#arma3_scripting
1 messages · Page 743 of 1
Hello!
I want to run some command when a (any) Blufor unit is close to other unit (with variable name) by using the Distance command
I tried this in the trigger condition -
((side _x == Blufor) distance (bob)) < 50
Doesn't work..help please?
its possible that if mid is halfway between min and max it's equivalent
but hard to say without knowing how its implemented
see the image on the page, it is a pseudo-Gaussian distribution
👍
why would it work? you're just trying random stuff...
side _x == blufor -> bool
bob -> object
bool distance object? wat?
@little raptor it makes sense I think he's just going about it wrong
Yeah I'm in the phase of learning with tons of trial and error..
it is "human code" yes
I can read the intention, but it is of course wrong code-wise
yeah I think I get what you're doing. you're putting it in a trigger?
Yes
iirc the problem w/ doing it with a trigger is that it's only going to select units inside the trigger
you don't need trial and error. you need to learn the syntax
but anyway, in this case you just need to attach the trigger to bob
And How I determine only blufor side that getting close to him if I set him trigger owner?
It's a randomize mission so no specific place OR using only one trigger
I have no idea what you're saying
if it's just one object, you can just attach that trigger to your object. and set its activation type to blufor present
I think I need more information here but couldn't you do sqf count (((position bob) nearEntities 50) select {side _x == west}) > 0?
- position?

- you can count an array directly
I'm trying to add music to a mission in a few vehicles, currently I'm testing it on a radio and it works but I was wondering if I wanted to add lets say 2 more songs and we'll call them FYM and JMT how would I need to change what I have? I'm assuming I would need a new add action and say3D for each song? would I also duplicate what I have for everything from the class and after in the description.ext?
radio name c1
Init
c1 addAction [ "Turn music on" , {
c1 say3D [ "GYS", 50, 1];
} ];
description.ext
class CfgSounds
{
sounds[] = {};
class GYS
{
name = "GYS";
sound[] = {"\sounds\GYS.ogg", 300, 1};
titles[] = {0,""};
};
};
i know i know dont use position but im lazy and the differences here dont really matter for on foot comparing w/ on foot/vehicles
also what do you mean by count an array directly
Thanks @brazen lagoon @little raptor I'll try
{} count array
not following
sec
OH
so you could do sqf ({side _x == west} count ((getPosATL bob) nearEntities 50)) > 0
Works, thanks a lot!
yes 😄
Is there any way to check if a script is being run in the Eden Editor?
I have a unit randomization script in one of my units' init handler that works exactly as I wanted, but I only want it to be run on mission start, not while in the editor, as it causes issues if that happens. What checks can I run to achieve that?
if (is3DEN) exitWith {};
Thank you!
Guys, what's the different between publicVariable, publicVariableClient and publicVariableServer? the concept of this I cannot understand very good.
because I understand how I can use publicVariable, but I don't know is when apply the other ones u.u
I guess publicVariable sends to all connected systems, publicVariableClient to a given client and, well, server to the server solely
Ok. Example, I want generate a code number to deactivated a bomb, I use the code _number = [1000,9999] call BIS_fnc_randomInt; to generated it a number by multiplayer, all of members of the party needs has the same number that system had generated, because I'll make 4 different areas where you could found this number, but only once site of that four places you could found it, I need that variable do not change if one of the members has disconnected and connected again, you know why, I need that member that reconnected has that number generated before, so when the party found it that number and found the artefact to deactivated the bomb that number generated once you can to use to disable that bomb, but the question is: Do I need to use publicVariable for this? or what of those types I need it to used it?
My question is because I want to develop the code ad efficient as possible
publicVariable supports JIPs (ppl that disconnect and reconnect), so that's the way to go
but you have to generate the number on the server only
Hello,
Is there anyway to measure/get a Objects Armor value?
Like a rock or a Building.
Bullets have different penetration values depending on the Object. Curious to see if I can get that Value per Object
Bullets have different penetration values depending on the Object
no. that depends on the surface. not the object
I want to generate the number that the party will use it to deactivated the bomb after, so I want the number generated still persistence during all the game regardless one of the members disconnected and reconnected again.
not the object
He mean generate the variable on the server and then use publicVariable
ok, is the best way so.
you can get the overall object armor from the config
but it has nothing to do with bullet penetration
it's a measure of its "health", so to speak
Actually, you could set the variable on the bomb object with setVariable and set the global flag to true
That would prevent polluting the missionNamespace
All right.
@languid tundra you can tell in what scenario I should to use publicVariableServer? one short example? is only to have a better idea about using that type of code?
You can send a variable specifically to the server only with publicVariableServer .
publicVariableClient, in the other hand, is for sending a variable from the server to a specific client.
so, If I send the variable as publicVariableServer keep the variable persistent in the server regardless one of the member disconnected and reconnected again? So, Do I use in the JIP publicVariableClient to send again that parameter to this client specifically?
@still forum @languid tundra I understand what you are saying with publicVariable, but what I want is to try to clarify in which scenario I would have to use publicVariableServer, and publicVariableClient, so as not to be using publicVariable inefficiently, in the whole script being ignorant in relation.
If you only want a variable sent to a single machine
and not added to JIP queue
So for basic scripts, never
You remind me of someone

One example would be if you were trying to send events using publicVariableEventHandler, thats how it was done in Arma 2.
But we have remoteExec now so that old stuff is not relevant anymore
ok
Can someone tell me the bit of code to make things arsenals in eden?
I have the virtual one but I can’t find one for ace
a simple googling would give you this:
https://ace3mod.com/wiki/framework/arsenal-framework.html#21-adding-ace-arsenal-to-a-box
Everything I googled just kept bring up the virtual Arsenal
"arma add ace arsenal" 🙄
“How to add ace arsenal in Eden”
Is exactly what I have in my search bar
How could I find this Config? Im trying to make it so, if a player is in a bunker or house they gain a fraction of its Health. So i'll need a way to reference it
getNumber (configOf _obj >> "armor")
@languid tundra @still forum I came up with a better idea so you can understand me. I want to develop a timer, which starts running from two minutes down, when it reaches zero the game ends, but apart from this I want that time to be visible to the players and if any of them disconnects and reconnects you can see the current time, but don't begins from start again. In this case, Do I need use publicVariable as well?
Amazing thank you!
yes
I'm trying to make a map tool that measures the distance between two points, idea being you press a key, click somewhere, click somewhere else, tells you the distance and bearing.
I'm using addMissionEventHandler ["MapSingleClick" which works but i'm not able to use variables outside the scope of the EH inside the EH, is there some kind of client side variable storage or something to get around this?
yes, its called global variables
oh the _ actually has an effect?
yes
i figured that was just a naming scheme to avoid confusion
_ is local variable
yeah i just read the variables page again, ty ^.^
Not sure how to get this to work.
Looking for the nearestobject near the player. Everytime I use it. It comes back as the Player.
nearestObject [player,""];
try this for example
nearestObjects [player, [], 50] select 1;
huh got "NOID footstep_I.p3d"
Didnt think foot steps were objects lol
Ah I got it "All" Returns what I want. Cheers
it works 
Pos1 = nil;
MarkerIndex = 0;
addMissionEventHandler ["MapSingleClick", {
private _pos = _this#1;
if (isNil "Pos1") then
{
Pos1 = _pos;
hint "Pos 1 Set";
} else
{
_bearing = [Pos1, _pos] call BIS_fnc_dirTo;
_distance = [((Pos1 distance2D _pos)/1000) , 1] call BIS_fnc_cutDecimals;
_text = format ["%1° %2km", round _bearing, _distance];
MarkerIndex = MarkerIndex + 2;
[MarkerIndex, Pos1, _pos, _text] spawn {
params ["_index", "_pos1", "_pos2", "_text"];
_line = createMarkerLocal [format ["BRAA%1", _index], _pos1];
_line setMarkerShapeLocal "polyline";
_line setMarkerPolylineLocal [_pos1#0, _pos1#1, _pos2#0, _pos2#1];
_line SetMarkerColorLocal "ColorBlack";
_dot = createMarkerLocal [format ["BRAADOT%1", _index+1], _pos2];
_dot setMarkerShapeLocal "ICON";
_dot setMarkerTypeLocal "hd_dot";
_dot setMarkerTextLocal _text;
sleep 1.5;
deleteMarkerLocal _line;
deleteMarkerLocal _dot;
};
Pos1 = nil;
};
}];
Is there a way of setting a waypoint to have 2 different possible variables?
Say for instance
_group1 addWaypoint [(getPosATL p1 or p2),0];
That obviously isnt the correct syntax ^
selectRandom? 😉
_group1 addWaypoint [getPosATL selectRandom [p1, p2], -1];
And say if p1 was empty, would it automatically use p2?
"empty"?
as in
didnt have a player in the slot
I should have said
I'm defining these variables as players
My bad 😅
oh
well no, it would trigger an error because then p1 is undefined
Could I just replace 'getPosATL p1' with 'player'?
nooo?
are p1, p2, p3 etc all players and do you want that waypoint on a random on all players?
Sorry let me try and explain it further, p1 and p2 are slots that only a certain person can take, however, sometimes they can pick the wrong one and if I set it to be p1 and they pick the slot with p2 it breaks the script.
I don't know why its set up like this I don't make the rules 😄
if it's only these two, use this
call {
if (not isNil "p1") exitWith { _group1 addWaypoint [getPosATL p1, -1]; };
if (not isNil "p2") exitWith { _group1 addWaypoint [getPosATL p2, -1]; };
};
```if neither p1 or p2 exist, no waypoint is added
Brilliant, you're always the genius Lou 😄
anyway to get this to give "All" But not players? I tried this but sadly didnt work
nearestObjects [player, ["All",!="player"], 1,true] select 1;
Got another one then, can I attach a waypoint to a player using script? Something like the DESTROY waypoint?
yes
see https://community.bistudio.com/wiki/Category:Command_Group:_Waypoints @true frigate
you have waypointAttachVehicle, and setWaypointType
What's Bad in this Code?
init.sqf
_code = [1000,9999] call BIS_fnc_randomInt;
publicVariable str _code;
[_code] call BLN_fnc_randomNumber;
BLN_fnc_randomNumber
_numberA = _this select 0;
publicVariable str _numberA;
if (_numberA == nil) then
{
hint "this number doesn't exist";
} else
{
hint "this number Exist";
}
That code don't want show me nothing in the hint when use
this addAction ["<t color='#FF0000'>Get Number</t>","call BLN_fnc_randomNumber"];
I've tried this at the moment
EnemyPlane = createVehicle [_plane, _spawn, [], 0, "FLY"];
EPCREW = createVehicleCrew EnemyPlane;
EPCREW setBehaviour "COMBAT";
epwp = call {
if (not isNil "P1") exitWith { EPCREW addWaypoint [getPosATL P1, -1]; };
if (not isNil "P2") exitWith { EPCREW addWaypoint [getPosATL P2, -1]; };
epwp setWaypointType "DESTROY";
epwp waypointAttachVehicle FP1;
};
But it doesn't seem to attach it, am I setting it up wrong?
Multiplayer or singleplayer?
_code = [1000,9999] call BIS_fnc_randomInt;
publicVariable str _code;
```you are public variabling the number as string
it should be
```sqf
ZOT_Code = [1000,9999] call BIS_fnc_randomInt;
publicVariable "ZOT_Code";
MP
I'm Very new to coding, I'm confused on what files I need and where to put everything.
Long story short I'm trying to make it so when a Player is behind an Object. I.e Sandbag. They get reduced dmg based on a value of the Object near them
I've got the Values working. Just have zero idea on how/where to plug this in.
Calculates Armor bases on nearby Object.
private _nearestObj =
nearestObjects [player, ["All","Man"], 1,true] select 1;
private _objArmor =
getNumber (configOf _nearestObj >> "armor");
private _armorBonus =
_objArmor/((_objArmor/10)+100);
Code I found to Reduce Damage Taken with the "_armorBonus" Plugged in
"this addEventHandler [""HandleDamage"",{damage (_this select 0)+((_this select 2)/_armorBonus)}];"
But when I want to call this addAction ["<t color='#FF0000'>Get Number</t>","call BLN_fnc_randomNumber"] in a object don't want show me nothing in the hint
I have no idea how this is related
In the Init.sqf
_code = [1000,9999] call BIS_fnc_randomInt;
publicVariable "_code";
[_code] call BLN_fnc_randomNumber;
In the function: BLN_fnc_randomNumber
_numberA = _this select 0;
publicVariable "_numberA";
if (_numberA == nil) then
{
hint "this number doesn't exist";
} else
{
hint "this number Exist";
}
In a object: this addAction ["<t color='#FF0000'>Get Number</t>","call BLN_fnc_randomNumber"]; but when I try to get the code and show in the hint nothing happen...
you cannot publicVariable a local (_var) variable
use isNil, not == nil
if your code is in init.sqf, it runs on every client
the code in the addAction does not provide any argument to BLN_fnc_randomNumber
SO:
initServer.sqf
ZOT_Code = [1000,9999] call BIS_fnc_randomInt;
publicVariable "ZOT_Code";
then on clients: simply use ZOT_Code
ok, I'm looking for is that at the beginning of the game could create it a random code, and when the player reaches a specific object he gets that code and it is shown on the screen, but that code cannot change, in case that player disconnected from the server and reconnected again with the game still in progress this would still using the same code.
But I'm buiding the correct code?
I provided the correct code
class CfgSounds { sounds[] = {}; class music1 { name = "music1"; sound[] = {"\sounds\astronaut.wav", 300, 1}; titles[] = {0,""}; }; class music2 { name = "music2"; sound[] = {"\sounds\us.wav", 300, 1}; titles[] = {0,""}; }; };
i'm getting an error that something a "member is already defined"
(instead of ``, try
```cpp
```
)
you may have two CfgSounds blocks
maybe, but how does one break those up
I mean, if you have only this in your description.ext, you won't get an error
if you have two CfgSounds blocks (not the sounds defined inside, the whole block), merge them
and the "something" in "member is already defined" might be useful, too
this is all i have in my description.ext
huh… no
please use https://sqfbin.com thanks
fuck k
didn't know that existed
https://sqfbin.com/wosadiliyulidiluxegi
So i'm trying to script a task that that waits for a player to use an action on a car to unlock it, and then set the objective to complete, but i'm having trouble getting the while do loop at the end to work. it keeps saying that "task" is undefined, how should I fix this?
specifically ```sqf
while {!(_randomcarUnlocked)} do
{
_randomcarUnlocked = ["task"] call BIS_fnc_taskState;
waitUntil {_randomcarUnlocked == "SUCCEEDED"};
["task","Succeeded"] call BIS_fnc_taskSetState;
};
isn't working even though the BIS_fnc_taskCreate function is used right above the loop
waitUntil the status is equal to "WANTED_STATE" yes
my bad i edited it funny the first time
while {!(_randomcarUnlocked)} do to be removed too
but yeah thats coming back as task undefined
all this is confusing, as you are reusing variables
@undone dew nowhere is _randomcarUnlocked declared in this script (before line 21)
ohh
Dumb question, how do I know when to use the Init.SQF compared to making another file?
…when you need another file?
So, theres no difference from the Init File and making another one?
Just Organization
Yes there is
(that solved the undefined issue, thanks for the help)
Init.sqf runs when a player joins and InitServer.sqf runs at the start of the server. Each predefined file name has its own use. If you need your own file just use some RandomName.sqf
yep
(and what code you want to run where of course - but it does not matter in a singleplayer mission)
Ahh Perfect thanks
Question, how do yall put the scripts into the boxes like that
So they dont get messed up when typing them normally
Type Tilde 3x (Left of One), Then type " sqf "
Code down herereeee
Then Tilde 3x again then hit enter
okay thanks
!code
```sqf
// your code here
hint "good!";
```
↓
// your code here
hint "good!";
^.^
^ Ah, the smart way
a shortcut :p thank you for the detailed explanation!
lol np
Man I'm at a loss
Trying to figure out how to get this code to come together.
Basically when next to an object you get a fraction of its Armor.
Determines the Object/armor value
private _nearestObj =
nearestObjects [player, ["All","Man"], 1,true] select 1;
private _objArmor =
getNumber (configOf _nearestObj >> "armor");
private _armorBonus =
_objArmor/((_objArmor/10)+100);
Reduces Incoming Damage by a set amount
this addEventHandler
[""HandleDamage"",{damage (_this select 0)+((_this select 2)/_armorBonus)}];"
thank you
c1 addAction [ "Turn music on" , {
c1 say3D [ "GYS", 50, 1];
} ];
c1 addAction [ "RTJ" , {
c1 say3D [ "RTJ", 50, 1];
} ];
So I got the music to work. What would I do for stopping the music?
also wondering if theres a way I can make it so the songs can only play one or the other
and not over eachother
I believe this should work. You need to run the nearestObjects within the EH.
this addEventHandler
["HandleDamage",{
private _nearestObj =
nearestObjects [(_this select 0), ["All","Man"], 1,true] select 0; //Switched to select 0 bc the first element of an array is 0
private _objArmor =
getNumber (configOf _nearestObj >> "armor");
private _armorBonus =
_objArmor/((_objArmor/10)+100);
damage (_this select 0)+((_this select 2)/_armorBonus)
}];
Would this cause lag having multiple people?
Also I selected 1 for the 2nd in the array as the first is always the Player
So by object what objects are you looking to get armor values from?
Houses, Walls, Sandbags, Basically anything that has an armor value
The goal is a Player can walk up to a sandbag, get cover and take less damage. Or walk into a bunker and take vastly less damage
The ArmorBonus thing works just need to plug it into the Damage reduction code and get it to constantly run
I'm just beyond new at coding and have just been fiddling my way through and confused at the whole, combine everything and get it to work part lol
Yeah so you only want to run that when you are actually hit
Running it more than that can cause lag especially for multiplayer
Well I figured I should run the _armourBonus calc every 3 seconds or so, and that way the math isnt done every shot.
so in other words
This every 3 seconds
private _nearestObj =
nearestObjects [player, ["All","Man"], 1,true] select 1;
private _objArmor =
getNumber (configOf _nearestObj >> "armor");
private _armorBonus =
_objArmor/((_objArmor/10)+100);
This every shot
this addEventHandler
["HandleDamage",{
damage (_this select 0)+((_this select 2)/_armorBonus)
}];
This will work I believe but it's not tested, lmk if you have an issue
InitPlayerLocal.sqf Will add the EH to a player when they join
params ["_player", "_didJIP"];
tag_CoverWaitTime=3; //-- Will only check cover every X seconds
_player addEventHandler ["HandleDamage",{
params ["_unit", "_selection", "_damage", "_source", "_projectile", "_hitIndex", "_instigator", "_hitPoint"];
_time = _unit getVariable ["tag_LastCheckedForCover",0]; //-- Returns 0 for time if variable has not been set
if(_time+tag_CoverWaitTime<diag_tickTime)then{
private _nearestObj = nearestObject [position _unit, "building"];
private _objArmor = getNumber (configOf _nearestObj >> "armor");
private _armorBonus = _objArmor/((_objArmor/10)+100);
_unit setVariable ["tag_LastCoverArmorBonus",_armorBonus]; //-- Remembers the last cover bonus
_unit setVariable ["tag_LastCheckedForCover",diag_tickTime]; //-- Remembers last time it checked for cover
};
_armorBonus = _unit getVariable ["tag_LastCoverArmorBonus",0];
damage (_this select 0)+((_this select 2)/_armorBonus)
}];
I've got a problem with the "Land_PortableServer_01_olive_F" object from the Contact DLC, i'm trying to use them in a mission and have their lights and how far pulled out they are change after an explosion. The problem i'm finding is that once i put the map on the dedicated server, they no longer animate. no matter if i run the command clientside or serverside, nothing happens, yet these same commands work fine in SP. Here is what I have: ```sqf
// Land_PortableServer_01_olive_F
// Dynamic Simulation: false
// Simulation: false
// Simple Object: false
// Enable Damage: false
//standing next to a bunch of them placed in-world
// works in SP does not work in MP on dedicated
{
if (typeOf _x == "Land_PortableServer_01_olive_F") then {
diag_log "Changing Land_PortableServer_01_olive_F";
_x animateSource ["Lights_Off_Source", selectRandom [1,1,1,1,1,1,1,1,1,1,0], true];
_x animateSource ["Server_Move_Source", (random 0.7), true];
};
} forEach (nearestObjects [player, [], 20]);
// for use in the 3Den editor with a selection -- works fine
{
_x animateSource ["Lights_Off_Source", selectRandom [1,1,1,1,1,1,1,1,1,1,0], true];
_x animateSource ["Server_Move_Source", (random 0.7), true];
} foreach get3DENSelected "object";
do some objects just stop working when put in a dedicated environment? I've noticed it on one other type of object, the rugged portable cabinets from the same dlc have the same issue. You can set their drawers as open in the editor and see it in SP, but moving to MP and they no longer work.
Help you tomorrow Jekyll. Sleep time now.
c1 addAction [ "Play: Got Your Six" , {
c1 say3D [ "GYS", 25, 1];
} ];
c1 addAction [ "Play: Run Through The Jungle" , {
c1 say3D [ "RTJ", 25, 1];
} ];
c1 addAction [ "Play: Gunman" , {
c1 say3D [ "GM", 25, 1];
} ];
c1 addAction [ "Play: Till I Collapse" , {
c1 say3D [ "TIC", 25, 1];
} ];
c1 addAction [ "Play: House of the Rising Sun" , {
c1 say3D [ "HRS", 25, 1];
} ];
So using the above code I'm setting a few vehicles and a radio to be able to play music. Is there a string I can add so it'll stop a song when a different one is selected or a action to stop all music on that source
You have to assign the sound object to a variable when you do say3d and delete that object when you want it to stop
Because player is not defined on dedicated server (it's a null object)
that's only for the example, on the server i'm using a map object with a named variable as the reference point
Did you add some logging to see if it even detects your object at all?
it does, i receive "Changing Land_PortableServer_01_olive_F" in the logs for each object i've got there
i can even run the code from a debug console on the dedi and it does nothing
Also for your selectRandom [1,1,1...], selectRandomWeighted is a thing you know...
Simulation = false?
Wat?
enabled or disable,d same result
it's disabled because they're stuck inside an object, and they'll go flying otherwise
Objects with disabled sim have a very slow sync rate in MP
i also tried this with no success: ```sqf
_x enableSimulation true;
_x animateSource ["Lights_Off_Source", 0, true];
_x animateSource ["Server_Move_Source", 0, true];
_x enableSimulation false;
That won't work
Like I said disabled sim causes very slow sync rate
Sometimes 1 minute
oof
If they go flying you can just attach them
either way, i can spawn these objects into the map from 3den and have a preset value, yet they don't keep that value
i have, i put them on the groudn and left sim on, still doesn't update them
it's super frustrating
Dunno. Try attaching them to a unit object. See if they sync properly like that
there's other objects from that dlc with similar behaviour
perhaps i can plop a unit nearby and try attaching it, doubtful though sicne i've tried them with every on/off
is there a quick way to get relative attachTo posititions?
BIS_fnc_attachToRelative
ah, thank you
fyi, attachTo made no difference, tried a bunch of combinations between simulation, dynamic sim, and even damage between the object attached to, and the objects themselves
In an ParticleArray, is it possible to execute code with onTimer or beforeDestroy instead of just executing a script? The biki says that beforeDestroy should be able to, but I can't get it to work.
i'm pretty sure it takes script path
BeforeDestroy - Name of the script to run right before destroying the particle.
aha but here it says code https://community.bistudio.com/wiki/ParticleArray#:~:text=17-,beforeDestroy,-Script 
yep, and using code instead of a path prints a message something along the lines of "script not found"
so i guess the wiki needs some updating
onTimer too right?
oh nvm that already does say path
could you check if this is actually defined in the script? there's a bit of discrepancy between the two scripts:
onTimer > private _particlePosition = _this;
beforeDestroy > private _particlePosition = this;

or is it _this?
_this is defined, this isn't
thanks. will fix
remove the \ at the start of the texture path
if it doesn't help use getMissionPath
I'll give it a try now, thanks ❤️
Also since you're here can I be a pest and ask for help with the vehicle respawn script for a2
I want the sonicboom script to be going with it, but it never lets me complete the ini of the vehicle.
Let me get you an example
Here is my current ini of a vehicle [this, 2, 2, 0, FALSE, FALSE, ""mrk = [this, """"Marker_TYBOMB2""""] execVM """"marker.sqf"""";""] execVM ""Scripts\vehicle.sqf""; mrk = [this, ""Marker_TYBOMB2""] execVM ""marker.sqf"";";
where did you even get the script? armaholic is down 
[this] execvm ""sonicboom\sonicboom.sqf""; This is what I wanna put in it.
by "ini" you mean init?
Yeah, sorry.
this is just broken. use syntax highlighting ...
[this, 2, 2, 0, FALSE, FALSE, ""mrk = [this, """"Marker_TYBOMB2""""] execVM """"marker.sqf"""";""] execVM ""Scripts\vehicle.sqf""; mrk = [this, ""Marker_TYBOMB2""] execVM ""marker.sqf"";";
why do you use so many "? 
I don't know 😂 I'm not good at scripting, I was just throwing thing's at it, until it worked.
Scripting boggles my mind 🤯
I really can't make sense of what you're trying to put here
if it's just a bunch of execVMs, you need 1 pair of " for that
that makes a string:
[this] execvm "sonicboom\sonicboom.sqf";
like I said, use syntax highlighting
So the vehicle respawn script, I want it to run with the Sonic Boom script. But whatever way I try throw it in, it comes back with an error.
I just want to combine the two
if you do you can see why that was wrong:
[this] execvm ""sonicboom\sonicboom.sqf"";
that part is not green anymore
on discord:
```sqf
// your code here
hint "good!";
```
↓
// your code here
hint "good!";
but use something like notepad++ or vscode for coding, with SQF extensions
But I tried the camo script and no avail
_texture = "Images\Camoflague\WL_HEX.paa";
_code2 = format ["if (isServer) then { _object setObjectTexture [1, %1]; hint 'Loaded';",_texture];
sleep 0.1;
player setVehicleInit _code2;
sleep 0.1;
processInitCommands;
sleep 0.1;
clearVehicleInit player;
hint "Texture Loaded";```
This is what you meant?
just add a sqf next to ``` to get syntax highlighting: ```sqf 
setVehicleInit
processInitCommands
clearVehicleInit
ummm, what?
where did you even get those?
they're not valid commands
Yeah a friend tried to help me with a couple of days ago 😂
They are disabled in arma 3
So what isn't working?
I want this to load a texture on to a vehicle from a callout in ArmA 2, I'm getting the "Texture Loaded" hint but no texture loads.
/********************************
LOAD THE TEXTURE (WL_HEX.paa)
/*******************************/
//_object setObjectTexture [0, "\Images\Camoflague\WL_HEX.paa"];
_texture = "\Images\Camoflague\WL_HEX.paa";
_code2 = format ["if (isServer) then { _object setObjectTexture [1, %1]; hint 'Loaded';",_texture];
sleep 0.1;
player setVehicleInit _code2;
sleep 0.1;
processInitCommands;
sleep 0.1;
clearVehicleInit player;
hint "Texture Loaded";
It might have to do with isServer
You are executing a local command only on the server. That's why other players never see the texture.
Even I don't see it clientside, how would I get it to load?
Try without the isServer check
I just remove if (isServer) then ?
yes
your if wasnt closed anyway...
?
}
Where am I placing that?
well as R3vo said you should remove the if anyway.
but this is what I mean:
"if (isServer) then { _object setObjectTexture [1, %1]; hint 'Loaded'}"
but now that you should remove it it simply becomes:
"_object setObjectTexture [1, %1]; hint 'Loaded'"
also _object is not defined
use this instead.
As is like this, nothing loads not even the hint.
/********************************
LOAD THE TEXTURE (WL_HEX.paa)
/*******************************/
//_object setObjectTexture [0, "\Images\Camoflague\WL_HEX.paa"];
getMissionPath "Images\Camoflague\WL_HEX.paa"
_code2 = format ["this setObjectTexture [1, %1]; hint 'Loaded'",_texture];
sleep 0.1;
player setVehicleInit _code2;
sleep 0.1;
processInitCommands;
sleep 0.1;
clearVehicleInit player;
hint "Texture Loaded";
well first of all, getMissionPath doesn't exist in A2
second of all, _texture is not defined
How does one define it?
well I don't know what those command you use are or what they do, so... 
they don't exist in A3 for a good reason
_texture = "\Images\Camoflague\WL_HEX.paa";
_code2 = format ["this setObjectTexture [1, %1]; hint 'Loaded'",_texture];
sleep 0.1;
player setVehicleInit _code2;
sleep 0.1;
processInitCommands;
sleep 0.1;
clearVehicleInit player;
hint "Texture Loaded";
Well this is what I have so far
I've tried without the \ before the directory to still no avail.
where are you even running this?
does
player setObjectTexture [1, "Images\Camoflague\WL_HEX.paa"];
``` even work?
running from debug console
or does A2 have none? 
I have debug up
has anyone tried to implement negative correlation coefficient in sqf ?
wat?
Probably not, but if you are interested in implementing one, CBA would be a good place to contribute to. I've added standard deviation there in the past, for instance.
Hola beautiful people,
I'm having an issue that turns out to be surprisingly difficult to solve (for me).
I'm trying to figure out whether a (n item) className corresponds to a vest, uniform or backpack. Maybe I'm just tired, but I can't find any clear indicator inside the configs that would tell me for sure "yup, that's a vest" or "yup, that's an uniform".
Could anyone please point me in the right direction? 😄
Never mind, the value I'm looking for is allowedSlots:D
Oh no, it's not. Damn. Just indicates where you can PUT the item. Hm
Looking at the implementation of the curator inventory attribute window would be a good start 😉
Good pointer, indeed! Same for Arsenal, I guess... merci!
Or the "type" config entry.
c1 addAction [ "Play: Got Your Six" , {
c1 say3D [ "GYS", 25, 1];
} ];
c1 addAction [ "Play: Run Through The Jungle" , {
c1 say3D [ "RTJ", 25, 1];
} ];
c1 addAction [ "Play: Gunman" , {
c1 say3D [ "GM", 25, 1];
} ];
c1 addAction [ "Play: Till I Collapse" , {
c1 say3D [ "TIC", 25, 1];
} ];
c1 addAction [ "Play: House of the Rising Sun" , {
c1 say3D [ "HRS", 25, 1];
} ];
So currently C1 is the radio but if more than one song is selected the music will lap over eachother. Is there a addAction I can add to it to stop music
hi, can i attachto like
myobject attachTo [myvehicle];
but keep the vector dir and the vector up ? because when i get the vector dir and vector up before it doesn't work
As it happens, I did a patch for that for ZEN a couple of months ago:
https://github.com/zen-mod/ZEN/commit/cf26b06ad0dfc8acc1cf11eee8262bc4f49f06a1#diff-5646245085623398eef22ceddf0bfbe109daec5aa9a92a86c39ef099ff280c14
thx i will try then
Hi guys,
_number = parseText [1000, 9998] call BIS_fnc_randomInt;
publicVariable "_number";
Could way of conversion to String correct?
See the answer to this message
yeah, but is another question, is about the conversion from integer to String, is using parseText is the better way or not.
no. use str ()
what you wrote has incorrect order of precedence
and you still try to publicvar a local variable
Yeah, I'm trying to understand correctly the way to using it. I'm sorry if it causes discomfort u.u
😣
Is some complicated to understand by myself sometimes that kind of language by Arma 3, but I never will give up with this topic.
what is your problem exactly ?
_number = parseText [1000, 9998] call BIS_fnc_randomInt;
_bombObject setVariable ["number", _number, true];
As I said yesterday, it's much cleaner to set the variable on your bomb, rather than defining a global variable 😉
why you don't use str instead of parseText
_number = str ([1000, 9998] call BIS_fnc_randomInt);
_bombObject setVariable ["number", _number, true];
I just copied his first line without looking at it closely 😅
oh ok but i checked and "parseText" is not exactly same of "Str" so thanks you
Also the parentheses are crucial
well, I don't know if is something that I build bad, but I trying to develop a function where get a code generated randomly, that code needs to be persist in all the game, regardless you disconnected and connected again, right, so I'm in Eden 3d, testing the solution that @winter rose given to me before right? but the problem now is, when I try pass as argument that code generated to the function, nothing happen using the server local of eden I don't know if that is the real problem or not, that just done when I use the formula directly in Eden but nothing happen using the function
his line would produce a script error
since it would parse the array before calling the function
and thanks you about the "vectordir and vector up" because i learn a new function "vectorWorldToModel"
when you mean a "code" it's a code for what exactly ? you mean a random number ?
Example, The mission start, at the beginning a code is generated automatically for being found it in one of 4 places and when one of 4 designed member in multiplayer. after they find that code, that code needs use it to deactivated a bomb, but in case that one of those player has disconnected and reconnected again that number would persist in this player without changes.
The true flag does exactly that for setVariable. It is JIP compatible like publicVariable
The true problem with your code is that the first line is full of errors
parseText expects a string as input, not number
oh ok i understand
so if you want to get a random code
execute a setvariable on the server
in this variable
store the bomb code
and when you want to desactivate this bomb send a request to the server
you can use the setvariable ["myvariable", content, ispublic]
replace is public by "true"
and the variable will be broadcasted over the network
can i know which system you built to "desactivate" the bomb ?
@faint oasis
@winter rose told me make a initServer.sqf and place the code there at the begins:
_code = [1000,9999] call BIS_fnc_randomInt;
publicVariable str _code;
and I made that, then I developed a function called BLN_fnc_randomNumber:
private _numberA = _this select 0;
_numberB = _numberA;
publicVariable "_numberB";
hint format _numberB;
In the eden Editor I placed a object called Files and in there you should to see the code in a hint, when you press get code developed:
this addAction ["<t color='#FF0000'>Get Number</t>","[_code]call BLN_fnc_randomNumber"];
But nothing happened, that was the way that I made it.
wait
Where I need put that code?
this function
BLN_fnc_randomNumber is in the initserver ?
where is defined this function : "BLN_fnc_randomNumber"
the variable called : "_code" is just available in the "initServer"
no, I want the function execute when I calling for it using addAction
exactly
yeah
so i thought it's a function created by you
class BLN
{
tag = "BLN";
class clientes
{
file = "functions\clients";
class briefing {}; //Briefing
class randomNumber {}; //Number random
class cronometro {}; //Cronometer
};
};
yeah
bomb_code = [1000,9999] call BIS_fnc_randomInt;
publicVariable "bomb_code";
and execute like
this addAction ["<t color='#FF0000'>Get Number</t>","[bomb_code] call BLN_fnc_randomNumber"];
Actually,
this addAction ["<t color='#FF0000'>Get Number</t>","hint str bomb_code"];
All right, but you know that hint need that you parse the number to String
yeah
BLN_fnc_randomNumber is completely nonsensical
yeah it's true
actually this function return something (i think) but is not used
so it's completely useless
actually i haven't really read you code
um.. you says is unnecessary to use a function to execute this?
i have a question
you want to do what exactly ?
you want an action to get the defuser code ?
i say that because "get the code" and "disable the bomb" is different
so if you want to get the code then @languid tundra already answered
yes, but that be persistent, even a player disconnected and reconnected again still being the same number.
then
place this into your initServer
bomb_code = [1000,9999] call BIS_fnc_randomInt;
publicVariable "bomb_code";
and @languid tundra said it's "JIP" compatible. JIP mean "Join in progress" so it's sended to players joining
because it's the code is executed on the server then the code will stay the same
initPlayerLocal.sqf
_unit = _this select 0;
_isJIP = _this select 1;
if (!_isJIP) then
{
//[_unit] call BLN_fnc_playerFireEnemy;
}else
{
//[_unit] call BLN_fnc_playerFireEnemy;
publicVariable "bomb_code";
}
is the way correct?
@languid tundra @faint oasis
so
you code isn't correct
because this is executed when a player join the server
actually you are trying to "publicvariable" a non existent variable
so your code can't work
you don't need to use an "initPlayerLocal"
just use the "InitServer" with this code
bomb_code = [1000,9999] call BIS_fnc_randomInt;
publicVariable "bomb_code";
ok, so what type of File I need make for a players that disconnected and reconnected again get the same code again?
you don't need anything
publicVariable "bomb_code"; already took care of that for the 100th time 😅
you just need to put the code above in your initserver
@faint oasis @languid tundra Oh, but I ever think that were nessary to develop initPlayerLocal.sqf to get any publicVarable again if one of the members has disconnected and reconnected again.
🤯
don't worry it's very simple
the playerlocal is a code that is executed when a player join
but the code executed is on the "player computer"
That's incorrect. publicVarable acts as a setter, not getter and there is no need for a getter. It's done automatically.
publicVariable is to broadcast the variable over the network
@languid tundra @faint oasis So, let me now recap again, if I put the publicVariable in initServer.sqf, regardless the player in MP disconnected or reconnected again that code executed once at the beginning will be persistent in all play until ends right? So I don't need to make a file called initLocalPlayer.sqf as a JIP to put again that publicVariable to the client machine again when this reconnected again right?
exactly
you just need to put the publicvariable in the initServer
if you want to be sure your variable is broadcast
you can make a loop but it's not needed
XD
xD
@faint oasis @languid tundra is the same with this cronometer right? in this case is in a fuction that I made that time, I was made that code in 2018, but I didn't conitnue this, because I have a lot of problem with this with a competition in LATAM:
private _FinishTime = true;
checkrun = true;
//////Is for the script is execute once
_publicTime = _this select 0;
publicTimerON = true;
//////////////////////
publicTimerOver = false;
stopTime = false;
while {publicTimerON && _publicTime > 10 && !stopTime} do
{ //while being more than 10 seg
_publicTime = _publicTime -1;
sleep 1;
_timestamp = _publicTime/3600;
if (stopTime) exitWith
{
while {true} do
{
["<t font = 'PuristaMedium'><t size = '1'><t color = '#00ffd8'>" + timedisplay + "</t>",-1,0.10,10,0,0,789] spawn BIS_fnc_dynamicText;
sleep 10;
};
};
timedisplay = [_timestamp, "HH:MM:SS"] call BIS_fnc_timeToString;
publicVariable "timedisplay";
["<t font = 'PuristaMedium'><t size = '1'>" + timedisplay + "</t>",1,-0.15,1,0] spawn BIS_fnc_dynamicText;
};
//Last 10 seg in red with a sound
while {publicTimerON && _publicTime <= 10 && _publicTime > 1 && !stopTime} do
{ //while being less or equal to 10 and more than 1
_publicTime = _publicTime -1;
sleep 1;
_timestamp = _publicTime/3600;
if (stopTime) exitWith
{
while {true} do {
["<t font = 'PuristaMedium'><t size = '1'><t color = '#00ffd8'>" + timedisplay + "</t>",-1,0.10,10,0,0,789] spawn BIS_fnc_dynamicText;
sleep 10;
};
};
timedisplay = [_timestamp, "HH:MM:SS"] call BIS_fnc_timeToString;
publicVariable "timedisplay";
["<t font = 'PuristaMedium'><t size = '1'><t color = '#FF0000'>" + timedisplay + "</t>",-1,-1,1,0] spawn BIS_fnc_dynamicText;
playSound "time";
};
while {publicTimerON && _publicTime >= 0 && !stopTime} do { //if is less to 1 and equal or more than 0
_publicTime = _publicTime -1;
sleep 1;
_timestamp = _publicTime/3600;
_end = [_timestamp, "HH:MM:SS"] call BIS_fnc_timeToString;
publicVariable "_end";
["<t font = 'PuristaMedium'><t size = '1'><t color = '#FF0000'>" + "00:00:00" + "</t>",-1,0.10,10,1,0,789] spawn BIS_fnc_dynamicText;
};
checkrun = false;
if (_publicTime <= 0) exitWith { //if the time become to 0 then load the final of the mission.
publicTimerOver = true;
publicVariable "publicTimerOver";
//call to counter finish
//[2] call contadorFAM;
};
The problem was the same thing, the publicVariable
first thing we need to know
is where is your code ?
because it's important to know on which side your code is executed
@faint oasis for this function you need as param a number. Example, [7200] call FAM_fnc_cronometer; where 7200 = 2 hours to complete a mission
so if i understand when you call the function you have a count until 0 right ?
yes
execute as a function and executed in the init in that moment, because I didn't understand well the same that point
ok
can you enable MP please ?
i will explain you the difference with pictures
you will understand how it work and what is the difference between
the problem with this code were a player has disconnected when reconnected again the count reset to 2 hours again
enable MP please if it's not a problem for you
oka
Hey guys, can someone give me a hand with this?
player createDiaryRecord ["Comms",["Radio",
"<br/><execute expression='if ( [""PRIVATE"",""CORPORAL"",""SERGEANT"",""LIEUTENANT"",""CAPTAIN"",""MAJOR"",""COLONEL""] find (rank player) > 2) then {player addItem ""ACRE_PRC152"";};'>Take PRC152</execute>"]];
I'm not sure why this is giving me 'Error invalid number in expression'
The goal is to check the rank of the player, and if it's high enough, they can take the radio, otherwise it fails.
I would have checked roleDescription instead but for some reason this seemed easier
Actually yeah, even better, if someone could help change this in a way that would allow players with Pilot, Copilot, SL, or PLT for their roleDescription to take the radio that would be great too
Is there a better way to add music to a vehicle without using 3dsound? Especially one where you can only do one song at a time
did you not understand leo's instructions on your last post?
didnt even see him answer me. notifications have been broke all day with discord going up and down
and was busy across town
Thanks
cs addAction [ "Stop Music" , {
deleteVehicle c1
} ];
cs addAction [ "Play: Got Your Six" , {
c1 say3D [ "GYS", 25, 1];
} ];
cs addAction [ "Play: Run Through The Jungle" , {
c1 say3D [ "RTJ", 25, 1];
} ];
cs addAction [ "Play: Gunman" , {
c1 say3D [ "GM", 25, 1];
} ];
cs addAction [ "Play: Till I Collapse" , {
c1 say3D [ "TIC", 25, 1];
} ];
cs addAction [ "Play: House of the Rising Sun" , {
c1 say3D [ "HRS", 25, 1];
} ];
Okay. So I get the music to stop by deleting c1 which I have assigned to a cone for now. I'm guessing theres no way to respawn that Cone without zeus having to be the one to place it back manually and rename it manually?
createvehicle
you can just spawn it with script
Yeah I assumed so right when i asked that
Wat? I didn't say delete c1
I said delete the sound object
https://community.bistudio.com/wiki/say3D
When you run say3D it returns a sound object to you
delete that
I named the sound object (cone) C1 and put the addAction on cs which would be the vehicles. So attach a cone to the vehicles and be able to select the song from the vehicle(cs) and itll play through the cone(c1)
then when activating(stop music) itll delete the cone(c1)
As I just wrote that's not what you should do
is the sound object NOT what the music is playing through? Please keep in mind I am very new to scripting so sorry if im coming off as a moron
No. The game creates a new object and that object plays the sound
I see
Thank you so much
if more than one song is played at a time do i need more mySoundSrc's? such as mySoundSrc_2,mySoundSrc_3, (etc)
for deleting it
they're played from different objs?
no, same obj, but i tested it and hitting "Stop music" works on a single one but not when more than one are going at a time
how can more than one sound be played by one object? 
iirc say3D only allows 1 sound at a time
also confirmed by the wiki:
An object can only "say" one sound at a time.
c2 addAction [ "Stop Music" , {
deleteVehicle mySoundSrc,mySoundSrc_1
} ];
c2 addAction [ "Play: Got Your Six" , {
mySoundSrc = c2 say3D [ "GYS", 25, 1];
} ];
c2 addAction [ "Play: Run Through The Jungle" , {
mySoundSrc = c2 say3D [ "RTJ", 25, 1];
} ];
c2 addAction [ "Play: Gunman" , {
mySoundSrc = c2 say3D [ "GM", 25, 1];
} ];
c2 addAction [ "Play: Till I Collapse" , {
mySoundSrc = c2 say3D [ "TIC", 25, 1];
} ];
c2 addAction [ "Play: House of the Rising Sun" , {
mySoundSrc = c2 say3D [ "HRS", 25, 1];
} ];
This is on c2(Truck)
class CfgSounds
{
sounds[] = {};
class GYS
{
name = "GYS";
sound[] = {"\sounds\GYS.ogg", 300, 1};
titles[] = {0,""};
=
sounds[] = {};
class RTJ
{
name = "RTJ";
sound[] = {"\sounds\RTJ.ogg", 300, 1};
titles[] = {0,""};
=
sounds[] = {};
class GM
{
name = "GM";
sound[] = {"\sounds\GM.ogg", 300, 1};
titles[] = {0,""};
=
sounds[] = {};
class HRS
{
name = "HRS";
sound[] = {"\sounds\HRS.ogg", 100, 1};
titles[] = {0,""};
=
sounds[] = {};
class TIC
{
name = "TIC";
sound[] = {"\sounds\TIC.ogg", 300, 1};
titles[] = {0,""};
};
};
This is in the description.ext
sounds are queued yes
idk, more than one is able to be played at a time and they overlap but only one is stopped when told to stop
from the same vehicle
then store all sources in an array
mySoundSrc = [];
c2 addAction ["Stop Music", {
{
deleteVehicle _x;
} forEach mySoundSrc;
}];
c2 addAction ["Play: Got Your Six", {
mySoundSrc pushBack (c2 say3D ["GYS", 25, 1]);
}];
that, or for each "say" delete the previous source
also say3D has local effect, so if you want this for MP, it won't work
yeah i was thinking could set it so it does the
deleteVehicle mySoundSrc
Then like a second later plays the music
if that would work
it does work, as Lou already said
yeah, i was typing that and reading something so didnt see Lou say that till i sent it
I'm always ignored 
nah, I listen, I'm just a little slow
okay, i think i got it...
Yes. I got it. Thank yall
c2 addAction [ "Stop Music" , {
deleteVehicle mySoundSrc
} ];
c2 addAction [ "Play: Got Your Six" , {
deleteVehicle mySoundSrc; sleep 0.5; mySoundSrc = c2 say3D [ "GYS", 25, 1];
} ];
c2 addAction [ "Play: Run Through The Jungle" , {
deleteVehicle mySoundSrc; sleep 0.5; mySoundSrc = c2 say3D [ "RTJ", 25, 1];
} ];
c2 addAction [ "Play: Gunman" , {
deleteVehicle mySoundSrc; sleep 0.5; mySoundSrc = c2 say3D [ "GM", 25, 1];
} ];
c2 addAction [ "Play: Till I Collapse" , {
deleteVehicle mySoundSrc; sleep 0.5; mySoundSrc = c2 say3D [ "TIC", 25, 1];
} ];
c2 addAction [ "Play: House of the Rising Sun" , {
deleteVehicle mySoundSrc; sleep 0.5; mySoundSrc = c2 say3D [ "HRS", 25, 1];
} ];
incase anyone cares to use it for whatever
you sir, are very nice and caring 🙇♂️
Thank you Lou
I see CCR in that list. Good man!
Hey I am trying to make a black screen intro where the player teleports to another location after interacting with an action during the black screen. However, during the fadeout of the text, the screen suddenly goes from black to showing everything normally. The text is still there, fading out, but I go from black background to the game world showing in a flash. Any Ideas?
[
[["Altis Airfield , NATO Military Base","<t align = 'center' shadow = '1' size = '0.7'>%1</t><br/>"]]
] spawn BIS_fnc_typeText;
titleFadeOut 1;```
This is the script I am using
call BIS_fnc_typeText instead of spawn
and make sure the environment is scheduled
Any video anyone would suggest going through all the basics and all?
Still not working unfortunately, its in a sqf file, here's the full code
sleep 3;
cutText ["","BLACK FADED", 999];
sleep 5;
[
[["Altis Airfield , NATO Military Base","<t align = 'center' shadow = '1' size = '0.7'>%1</t><br/>"]]
] call BIS_fnc_typeText;
titleFadeOut 1;
sleep 3;
player setPos (getPos markerman);```
titleFadeOut
what are you fading out here?!
player setPos (getPos markerman);
... 😮💨
https://community.bistudio.com/wiki/getPos
Here's the thing, none of the cutText scripts seem to be working for me, went to the Wiki and looked up cutText there, tried all the example scripts in the console and triggers, still no results. It's just a flash of black and then nothing...
you have to use cutFadeOut, not titleFadeOut
Ahh okay, thanks for the help
I wonder if there's something alike the detectedBy but that triggers only when someone fired their gun, someone from a specific side within an area, like how the detectedBy works.
I was thinking on playing with both detectedby trigger and the knowsAbout value, but the magic value that make them shoot is... magic i guess
I want to give the players a chance to do stealth kills before the enemies are all alerted and pew pew
FiredMan event handler
The problem is, the units are spawned in and have no init values
I was thinking on something more like the FiredNear EH but within an area
spawned in and have no init values
wat?
I don't spawn the units inside the eden, something like Alive that has no init on the units
but its the reverse
If i add to the players it will be fired when the players shoot, no?
yes. that's literally what you asked too
triggers only when someone fired their gun
give the players a chance to do stealth kills
I was refering to enemy AI, thus give the players a chance to do stealth kills, sorry if it seemed otherwise
The problem is the detectedBy trigger will be called too quickly, something more playable is once the enemy shoots
well one thing you can do is use the detectedBy to add the EHs to the enemies
The enemies will be stored within list trigger yea? That's a good idea
Anyone familiar with ACE Medical scripting?
My unit has a persistency system (SQL database, we store things like loadouts, etc to it) and persist it across reconnects/restarts, particularly useful if a player crashes mid-mission or we want to save and pick up the mission another day.
There's a loophole with the current implementation where the player can take a ton of damage, log off and rejoin, and then they're fully healed. I'd like to be able to persist the ACE Medical state of the player by saving the state via some function, and reapplying that state.
Looking at the ACE source code, it seems like for every little bit of ACE (blood, pain, injury per body part) there is a separate function to retrieve it. Does anyone know if there's a better helper function to retrieve their overall ACE medical state without having to go through each minute detail?
there was an ACE full heal function or something that stores all variables
we have serialization/deserializaiton functions
which were written with persistence in mind.
hey guys, this should be an easy one but I haven't found a solution yet. I'm using https://community.bistudio.com/wiki/BIS_fnc_holdActionAdd to add an action to an object, it says it returns a Number for the Action ID. How do I get this Action ID number to use with https://community.bistudio.com/wiki/BIS_fnc_holdActionRemove so that the action gets removed for all players in a MP environment when one of the players uses the action? For example:
[
_myLaptop, // Object the action is attached to
"Hack Laptop", // Title of the action
"\a3\ui_f\data\IGUI\Cfg\holdactions\holdAction_connect_ca.paa", // Idle icon shown on screen
"\a3\ui_f\data\IGUI\Cfg\holdactions\holdAction_connect_ca.paa", // Progress icon shown on screen
"_this distance _target < 3", // Condition for the action to be shown
"_caller distance _target < 3", // Condition for the action to progress
{}, // Code executed when action starts
{}, // Code executed on every progress tick
{ [ _target,ACTIONID ] call BIS_fnc_holdActionRemove; }, // Code executed on completion
{}, // Code executed on interrupted
[], // Arguments passed to the scripts as _this select 3
12, // Action duration in seconds
0, // Priority
true, // Remove on completion
false // Show in unconscious state
] remoteExec ["BIS_fnc_holdActionAdd", 0, _myLaptop]; // MP compatible implementation
Thx as always, you guys are awesome
setVariable on the object (locally)
so just use the serialize function to save to a string, and then use the deserialize function with that string to reapply the state?
yes
instead of this, make a function yourself that does two things
- adds the action
- uses setVariable to store the ID
then remoteExec this function instead
and similarly, create a function for deleting the action, and remoteExec that function when you want to delete the action
godsend, thanks
tyvm
@hollow thistle any easy way to check conscious state without parsing the serialized data?
I'm doing this -
> IF (Player is unconscious) -> "Kill player" (clear medical state, clear persistent position if it exists)
> ELSE IF (Player is conscious) -> "Heal player" (clear medical state, leave persistent position untouched)```
if you can use them, prefer to use functions marked as public
Public: Yes
we do not guarantee that internal functions will stay in same form and format.
I have a problem with some of my code which uses the Ace Rearm Framework. Can somebody help me there?
trg_1_1 setTriggerStatements["this", "[Munitionsauffueller_1, 666] call ace_rearm_fnc_setSupplyCount;",
"ammo_left = [Munitionsauffueller_1] call ace_rearm_fnc_getSupplyCount; hint str ammo_left;"];
the problem is that i always get -1 as "ammo_left" and i don´t know if it comes from the get or the set command or even both... Does somebody know a solution?
seems like the "ace_rearm_fnc_getSupplyCount" is brocken just tried it on an ammotruck with 250 ammo and it also returned -1. If somebody got more Info or an solution for this problem I would really appreciate it.
Removed , but will someone script me a dialog where the arma character tells Leopard to say please.
hi, actually i'm trying to change the mass of an object lifted by a ropeCreate and i saw i need to setMass after the ropeCreate but how can i setMass when the rope is destroyed ?
because i tried to setmass before and setmass after but nothing worked. it work only in singleplayer but in multiplayer it doesn't work.
it has nothing to do with this channel. remove it
hi, do you have an idea for my problem ?
Hey, when I try to call the serialize function and store to a variable, it throws this error:
>
21:16:55 Error position: <_value] call CBA_fnc_encodeJSON]
>
21:16:55 Error Undefined variable in expression: _value
21:16:55 File /x/cba/addons/hashes/fnc_encodeJSON.sqf..., line 91```
This is how I'm calling it _medicalState = [_player] call ace_medical_fnc_serializeState;
Is there anything special I have to do to store json as a variable?
Works fine without saving to a variable (output via debug console)
I'll try that rn
Does anyone have experience with both setPosWorld and attachTo ? I have a light attached to a flying vehicle that's executing a unitcapture. The light is lagging behind the plane. The error is exactly as shown in this article gif: https://community.bistudio.com/wiki/Simulation_vs_Render_Time_Scope
But I am a little confused on how to use the commands in: https://community.bistudio.com/wiki/Category:Command_Group:_Render_Time_Scope . All the commands in the renderTimeScope column seem to be "getters". How do you set an object position in renderTimeScope?
So it does work unscheduled, but it's not compatible with the MySQL setup I'm trying to put it into 😆 rip.
All the SQL inputs have to be separated by colons, which means when it's seeing it as 22 inputs instead of 2 inputs because the serialized string uses : as well.
Config Invalid Number Number of Inputs Got 22 Expected 2
{"ace_medical_openwounds": [], "ace_medical_bloodpressure": [80, 120], "ace_medical_ivbags": null, "ace_medical_inpain": false, "ace_medical_medications": [], "ace_medical_tourniquets": [0, 0, 0, 0, 0, 0], "ace_medical_heartrate": 80, "ace_medical_pain": 0, "ace_medical_bloodvolume": 6, "ace_medical_stitchedwounds": [], "ace_medical_fractures": [0, 0, 0, 0, 0, 0], "ace_medical_triagelevel": 0, "ace_medical_bodypartdamage": [0, 0, 0, 0, 0, 0], "ace_medical_hemorrhage": 0, "ace_medical_occludedmedications": null, "ace_medical_triagecard": [], "ace_medical_bandagedwounds": [], "ace_medical_peripheralresistance": 100, "ace_medical_painsuppress": 0, "ace_medical_statemachinestate": "Default"}:76561198085725205
guess I could do a string replace
is there a command to get the map name of the mission?
I want my script to be usable on different maps, and I want it to run differently depending on which map it is
You could play around with https://community.bistudio.com/wiki/getMissionPath
So, just to expand: I've dug around on the forums. There's several threads on this, the most informative coming from 2014: https://forums.bohemia.net/forums/topic/175094-attached-lights-bouncing-around/
It's very CPU intensive. But I'm lighting the interior of a plane that will be deleted after 40 seconds into the mission, so the performance hit should be limited.
Before my beginner coding skills spend hours on figuring blind ends: is it easier to have the lightobject use setVelocityTransformation and follow the plane's unitCapture? Or update its position each frame via modelToWorld as it is attached?
thanks
worldName
There's no need for setters
Okay. It's true; this is new for me. Can you please point me in the right direction for getting my light object to follow the path of the vehicle it is attached to?
How about a dialog that gives you one of these instead? 🖕
I think they have a low sync rate
That might be why they jump up and down
What exactly do you mean with low sync rate? The simulation and render time difference? Or network related?
And can I manually improve the sync rate with a temporary, very expensive function?
damn that's crazy
Network
I think attaching the object to one with high sync rate can do it
But you just did that I guess...
I started with attachTo. Interestingly, this bug occurs in Singleplayer (as well). All I have to do is have the vehicle follow a "unitCapture" script. The effect is exactly like https://community.bistudio.com/wiki/Simulation_vs_Render_Time_Scope . So I have been looking up in that direction.
Yeah unitCapture isn't good
You can use setVelocityTransformation
But not the way unitCapture uses it
🙂 ?
The "Stairway to Heaven"? on setVelocityTransformation?
Oh let me read
You mean BIS_fnc_unitPlay?
Yes
So I'm reading it in the Function Viewer. If I understand it, this line: addMissionEventHandler ["EachFrame", format ["'%1' call bis_fnc_unitPlay;", _dataVar]];
Is how they get each step to execute per frame.
Is there a good way to get the time elapsed since script start?
_time = time - _startTime
And UnitCapture is recording the following info on every frame it runs:
capturedData = _capturedData + [[(_timeCur + _timeOffset), (getPosASL _unit), vectorDir _unit, vectorUp _unit, velocity _unit]];
or should I Just stick with htis
That or use diag_tickTime
I tried running BIS_fnc_unitPlay on the light object, by the way. It seemed to disappear 😬
do you happen to know why _time magic variable doesn't work in sqf? is it a resource thing?
I think it's a debug variable, specific to cfgFunctions
Should've been explained on the wiki 
SQS ONLY. The time elapsed since the script started running.
OK
I think I've gone back to that page at least three times and went "oh cool" and then was disappointed that I have to write more than 5 characters to do that
You have to give it a path
Not sure I get it. I used the same data on the light object as the plane. Plane flew; light object disappeared (as far as I can tell).
It could be that it was, for example, pointing in the wrong direction.
But I'm not even sure I want to know how I would correct that in the data, if that were the case.
Ah. I've replicated it with a VR object. The object is offset ahead of the plane. See screenshot: #screenshots_arma message
So what I now have is recorded UnitPlay data, that needs to be changed in offset (position) and orientation (vector), for every frame that it has been recorded.
I think I'm going to have to learn another programming language (and vector math) to be able to do that.
Is there a way of recording 2 simultaneous UnitPlays: one for the vehicle, another for the attached object?
Why? Just attach them 
OK now it's my turn to use the exasperated smiley: 
I have mentioned it twice already now that my problem occurs exactly when I use attachTo. The forum posts that I refer to also mention this. So how do I get my attached light to keep up with my plane, without lag?
Can anyone tell me whether it is possible to set the desired azimuth and direction for an AI arty unit, like a player does if he's in a mortar f.e?
The idea is to have a system where you'd have to calculate the azimuth/direction but have AI units perform the fire missions
I'm very uncertain if that's theoretically possible.
Well then your question just makes no sense
If the attached object has a movement problem how do you expect the recorded move to solve it for you?
Also no one ows you anything here so don't be like "give me answers now"
Oh dear. I sometimes get a little excited. Let me be diplomatic-
I am afraid that we're talking past each other here. Our conversation has been going on for several hours, with long pauses, so maybe that's inevitable.
Can I run getVariable inside the eval block of a while loop? i.e:
while {player getVariable "BRAA_Running"} do {};
and is this a bad idea
In this situation, I am clearly the learner, and you (and most everybody else) are the teachers.
It wasn't my intention to put pressure on you to give answers. Or to make it personal. My previous response had more to do with a sense of the conversation going in a circle.
I was attempting to explain the problems and the troubleshooting to show my working. Long winded, perhaps.
Yes
You were commenting on one of my (quite desperate, I'll admit) brainstorm ideas on solutions, after several back and forths over the day. But not the original problem.
ty
And that's why I responded back with your smiley.
But use the variant with default value
I hope you don't take it personal. It's more a reflection of my own inadequacy as a programmer hobbyist.
Yes
ty ty
so about this problem:
if unitCapture works smoothly on the vehicle (not the attached one), and you're okay with it, there's one thing you can do
first get the relative position of the attached object when the vehicle is stationary:
attachedObjPos = _vehicle worldToModel ASLtoAGL getPosWorld _obj;
then use that in an each frame loop:
onEachFrame {
attachedObj setPosWorld (myVehicle modelToWorldVisualWorld attachedObjPos)
}
also in MP you might have to add a setVelocity to that to make sure syncing works as expected
tho your object might not support setVelocity which could make things difficult in MP
So #1: thank you.
What would the setVelocity be? The first "frame" of the unitCapture recording?
no just attachedObj setVelocity velocity myVehicle
since they're attached (rigid) they have the same velocity
as long as the object moves linearly... 
when it turns the velocities differ
Cool. Let me test this.
Yes. That worked perfectly (on my singleplayer setup).
So I found, no joke, about 6 different threads asking this question. Should I just "necro" one with your solution and tag you in it?
well that was just for testing btw
don't use onEachFrame
if you want to it's fine. or you can put the links here and I'll post it there myself.
I could use a few reputation points on the BI forums =]. Again: you're getting full credit.
well anyway use something like this:
if (missionNamespace getVariable ["my_attach_EH", -1] >= 0) exitWith {}; //prevent duplication
my_attach_EH = addMissionEventHandler ["EachFrame", {
_thisArgs params ["_vehicle", "_obj", "_relPos"];
_obj setPosWorld (_vehicle modelToWorldVisualWorld _relPos);
_obj setVelocity velocity _vehicle; //note: this is wrong when the vehicle turns
}, [_vehicle, _obj, _relPos]];
What's the first line for?
preventing duplicate EHs
but that only allows 1 EH
there's another way to write the EH code that allows multiple objs
params ["_vehicle", "_obj", "_relPos"];
if (isNil "my_attachedObjs") then {my_attachedObjs = []};
my_attachedObjs pushBack [_vehicle, _obj, _relPos];
if (missionNamespace getVariable ["my_attach_EH", -1] >= 0) exitWith {}; //prevent duplication
my_attach_EH = addMissionEventHandler ["EachFrame", {
{
_x params ["_vehicle", "_obj", "_relPos"];
_obj setPosWorld (_vehicle modelToWorldVisualWorld _relPos);
_obj setVelocity velocity _vehicle; //note: this is wrong when the vehicle turns
} forEach my_attachedObjs;
}];
now you can use this function instead
can support multiple objects
just call it as:
[_vehicle, _attachedObj, _relPos] call that_function
it's kind of similar to doing:
_attachedObj attachTo [_vehicle, _relPos];
Syntax seems straightforward. I'll link the post somewhere later.
This has been super productive and helpful for me.
Have a good (lunch)?
hi, someone know how can i use ropeDestroy with setmass to the object where the ropes are destroyed ? because when i use ropeCreate and setmass, i need to execute the setmass after the ropeCreate but this doesn't work for the ropeDestroy so someone can help me please ? it's in Multiplayer.
what's the problem? I don't see why you need setMass for ropeDestroy
Anyone got a clue what recursive array means?
Error code:
11:24:24 Recursive array
11:24:24 Error in expression <to count _Positions do
{
_PushPositions pushBackUnique _Positions select _I;
};
>
11:24:24 Error position: <pushBackUnique _Positions select _I;
putting an array into itself
_PushPositions pushBackUnique _Positions select _I;
you're not obeying order of precedence here
How would you do it?
first of all:
_PushPositions pushBackUnique (_Positions select _I);
second of all,
to count _Positions
that's off by 1
third of all, use forEach
I see a for loop
not forEach
to count _Positions do
Private _PushPositions = [];
{
if(count _PushPositions > 30)exitWith{};
if(_x GetVariable "Evading")
then{
Private _CloseCenter = (_x GetVariable "centro");
if((_Center distance2d _CloseCenter) < 100)
then{
Private _Positions = (_x GetVariable "PushPositions");
if(count _Positions > 0)
then {
for "_I" from 0 to count _Positions do
{
private _Pos = _Positions select _I;
_PushPositions pushBackUnique _Pos;
};
};
};
};
}ForEach _Friends;
use another forEach for that other loop too
that's what I mean
plus it's wrong rn
off by 1
hi, actually i want to lift an object but too heavy so i setmass before and i want to reset the mass after but when i setmass after it doesn't work
did you check to make sure the problem is not setting incorrect mass?
if setMass works before setmass it should work after too 
also you said you want it for MP
does it work in SP?
i tried and it work in SP
so yeah i want it for MP
according to wiki setMass takes local arg
do you remoteExec it?
perhaps the vehicle changes locality when you attach it
i already tried to remoteexec the setmass before create the rope and not worked but i haven't tried to remote exec the setmass after
so i will try
@little raptor i tried to remoteexeccall but not worked.
[_obj, _obj_mass] remoteExecCall ["setMass", 0];
you should've remoteExeced where _obj is local:
[_obj, _obj_mass] remoteExecCall ["setMass", _obj];
but if it doesn't work then idk
oh ok then i will try
no need
you were remoteExecing for everyone
that also includes locally
unless that breaks the game or something 
yeah i thought that too
then it's probably a bug
i will try to spawn with a sleep to see if it work
@little raptor i have tried the "global exec" and it worked. I just need to wait a little bit because the change is not immediate. so thanks you.
@little raptor there's no event handlers for mines being destroyed or defused, right? How would you do a mechanic where you do something on mine defusal?
my initial thought was just to poll on allMines changing (but this sucks)
@sharp grotto meaning have this EH watch for mine defusal?
err
watch for the defusal action
yes that would work for actually doing the defusal
but i was hoping to also watch for an explosion
that is, if you destroy a mine by shooting it and it doesn't kill anyone, that should count as well
maybe add a Killed or MPKilled EH to the mine (not sure if that is even possible, so just a brain fart)
yeah that's the problem I think I'm not sure you can..
nope
@little raptor could you do something like use the cba extended event handlers to override mine classname inits, and then in the function you run on them attach a killed event handler?
would that work do you think?
or err. not mine classnames. the thing they inherit from. I think they all inherit from Mine
killed EH just don't work on them
also not sure if projectiles have inits
ah right. so you'd have to add a fired handler maybe and check if they do any damage, perhaps. and if they don't then consider that a mine clear
or just do what rabito suggested and fire on the action being activated... that's probably good enough
fired? you mean handleDamage?
well if mines are projectiles/ammo then on detonation they would run the 'fired' event handler right?
no
no
they just don't run any EHs
barely documented EH that runs when mine ammo explodes.
that's exactly what I want
wow, that's just not even on the wiki
so could I attach the ammoHit EH to the mine object on spawn?
using cba extended event handlers, I mean
no, it's config only IIRC.
meaning I would have to make an addon?
Not sure if he have XEH support for it. I think not.
ok so best choice is probably just that UI event handler on defuse action
🤷♂️ oh well!
I guess I could add ammoHit to XEH but with current release cycle you would see it in the next quarter 
hey, better nate than lever and all
Anyone have any ideas how I could parse this result (string) to an array so that I could access the ACE values?
I'm working with SQL (using extDB3) to add some ACE medical persistency to my units servers. I've been able to serialize the ACE health status of players and store it in my database, and I can read it into the server as well, but I cannot get it in a usable format.
extDB3 SQL returns it in this format
"[1,[[""ACE_MEDICAL_STATE""]]]"
where ACE_MEDICAL_STATE is actually equal to a super complex string, so it actually looks like this:
"[1,[[""{""ace_medical_openwounds""# [], ""ace_medical_bloodpressure""# [80, 120], ""ace_medical_ivbags""# null, ""ace_medical_inpain""# false, ""ace_medical_medications""# [], ""ace_medical_tourniquets""# [0, 0, 0, 0, 0, 0], ""ace_medical_heartrate""# 80, ""ace_medical_pain""# 0, ""ace_medical_bloodvolume""# 6, ""ace_medical_stitchedwounds""# [], ""ace_medical_fractures""# [0, 0, 0, 0, 0, 0], ""ace_medical_triagelevel""# 0, ""ace_medical_bodypartdamage""# [0, 0, 0, 0, 0, 0], ""ace_medical_hemorrhage""# 0, ""ace_medical_occludedmedications""# null, ""ace_medical_triagecard""# [], ""ace_medical_bandagedwounds""# [], ""ace_medical_peripheralresistance""# 100, ""ace_medical_painsuppress""# 0, ""ace_medical_statemachinestate""# ""Default""}""]]]"
I need to get just thata data in ACE_MEDICAL_STATE, but I can't parse this string to an array in order to get to it. If I run parseSimpleArray on it, I'll get returned [1,[["{"]]], which is literally only the first character of the entirety of ACE_MEDICAL_STATE.
it json
(The # signs are placeholders for :, which I do a stringReplace on, as SQL can't handle :
parseSimpleArray? 
can't do it in JSON format as I need to stringReplace the colons into it
I don't think that'll handle the initial "[1,[[""
since that's not part of the ACE json, but part of the SQL call
I don't see the issue.
parseSimpleArray returns after the first character unfortuantely
You get JSON string from ACE Medical state serialization function
when putting it into DB you replace : with #
when you're getting it out of the db you do the oposite and run CBA_fnc_parseJSON on it.
but then how do I get rid of the chunk of it?
i.e, how would I get the ACE_MEDICAL_STATE portion of the json out of the json? I'm not super familiar with working with json in Arma, is there a way to parse out part of the json?
You're making no sense to me sorry.
If you will parse the json via CBA function it will be parsed into CBA Hash.
Hey, I have a question regarding markers: ```sqf
_marker = createMarkerLocal ["Unit #1", _unit];
_marker setMarkerTypeLocal "hd_dot";
_marker setMarkerColor "ColorBlue";
but it's not all JSON is the problem
how would I change that though?
https://community.bistudio.com/wiki/createMarker
createMarkerLocal is local like the name indicates ^^
I think I understand your issue now, the extension returns a string that needs to be parsed with simpleArray but it does not escape the data properly.
actually I think it might broadcast
but not sure
true
"Local markers have their own set of local commands "xxMarkerxxLocal" to work with. If you use global marker commands on a local marker, the local marker will become global."
I think this is accurate, yes.
-> SQL call returns "[1,[[""ACE_MEDICAL_STATE""]]]", where ACE_MEDICAL_STATE is the serialized ACE medical status with : swapped out for #.
I need to then somehow break ACE_MEDICAL_STATE out of this return, but parseSimpleArray escapes too early.
It breaks out after the first character of ACE_MEDICAL_STATE
it does 😄
replace the " with ' while saving the data to DB
_str = "[1,[[""{'ace_medical_openwounds'# [], 'ace_medical_bloodpressure'# [80, 120], 'ace_medical_ivbags'# null, 'ace_medical_inpain'# false, 'ace_medical_medications'# [], 'ace_medical_tourniquets'# [0, 0, 0, 0, 0, 0], 'ace_medical_heartrate'# 80, 'ace_medical_pain'# 0, 'ace_medical_bloodvolume'# 6, 'ace_medical_stitchedwounds'# [], 'ace_medical_fractures'# [0, 0, 0, 0, 0, 0], 'ace_medical_triagelevel'# 0, 'ace_medical_bodypartdamage'# [0, 0, 0, 0, 0, 0], 'ace_medical_hemorrhage'# 0, 'ace_medical_occludedmedications'# null, 'ace_medical_triagecard'# [], 'ace_medical_bandagedwounds'# [], 'ace_medical_peripheralresistance'# 100, 'ace_medical_painsuppress'# 0, 'ace_medical_statemachinestate'# 'Default'}""]]]";
parseSimpleArray _str
this parses just fine
I will try that right now 🙂
and yes 100% it is extDB fault
as awesome as extDB is lol
iirc extdb has different options for handling quotes, maybe you should tinker with them
then you need to "repair" the json by replacing # with : and ' with "
as long as my stringReplace can replace " without getting screwy lol
'alas, it could not
Any ideas for putting a " into a string in Arma so that I can replace it?
""" obviously doesn't work 😆
doublequotes = quotes in Arma according to wiki
nope
in debugconsole both of those return as """" but maybe that's just debugconsole wierdness
I will try it in the script now
yes, because both are same string.
but am I interpreting it right, that it is a string of two quotes?
because I need a single quote for stringReplace
No, "" is the escaped version of " inside strings:
systemChat "abc ""abc"" abc"; //abc "abc" abc
systemChat 'abc "abc" abc'; //Same thing
systemChat 'abc ''abc'' abc'; //abc "abc" abc
also same thing 😛
Cursed 
anyway, I was gonna ask a question for a change. not fully related to this channel tho
does anyone know how to set up a LAN server to test my script functionality in MP?
I mean server + 1 client (on the same PC)
i just disable BE and launch two armas
Install Arma3Server from workshop, launch it with a bat file, and start Arma. You can run both simultaenously.
Literally doing that rn
😄
apparently for some people, that doesnt work actually. Well too bad for them 
isn't that a whole other Arma? 
I don't have that much space if so
Arma3Server is only 6gb
compared to Arma Arma
6,84 GB only yea
I tried but couldn't find myself in the server browser
@hollow thistle it workkkkked 🎉
lan
in debug console at least 😄
btw does it matter if the profile is the same?
no, afaik.
it just gives a warning for ur profilenamespace( sets 2nd instance as read only iirc)
so unless you got something to do with profilenamespace, it should be good
I guess Leopard20 already did it, but for anyone that wants to join with multiple instances, you also need loopback = true; in the server's config 😉
Hi, there is any way to write some text into a .txt or .sqf file?
@hollow thistle so uh, fun thing. I did all the conversion to get it put into the database, but parseSimpleArray still escapes early
ok, and in some .txt?
Just returns this [1,[[]]]
wdym?
it doesn't matter what file you write to. SQF can't write to external files
To store some resume data form our missions, to check it later.
I have a counter added to an MP "MPHit" eventhandler. On dedi, it usually works fine, but sometimes (maybe like 5-10% of the time) it gives double the score the one causing the hit. Any clues on this? Is it race conditions? Is it basic "score1 = score1 + 1; publicVariable "score1"
why not do diag_log?
I have been thinking about diag_log. But I would like something beter
parseSimpleArray _dumbStringArray = [1,[[]]]```
😭
you can check out this for example:
https://github.com/X39/extFileIO
there was another one too but I don't remember its name
you can also use intercept, but you'd have to write the code yourself in C++
ok, thx very much I will take a look into it
so what were you trying to do again?
so you said you needed the array after [1,
right?
basically. I specifically need everything in the {} of the ACE string
just do a simple find and select then
didn't you say you want to parse it later with CBA?
a who what now?
find only works if I know what the string is ahead of time though, right?
or does it do regex?
the whole "dumbStringArray" is actually a string
array packed within a string
if it always starts with [[ you can do this:
_rev = reverse _dumbArray;
_startIdx = (_dumbArray find "[[") + 2;
_endIdx = count _rev - ((_rev find "]]]") + 3);
_bla = _dumbArray select [_startIdx, _endIdx - _startIdx];
_bla is what you wanted
which you pass to CBA or whatever
I'll try it rn
you can also use regex yes
_dumbArray regexFind ["(?<=\[\[).*?(?=\]\])", 0]
That looks like it may have worked 😄
in debug console at least
going to add in the stringReplace now and see if I can get the whole thing to run proper
why?
didn't you want to parse it with CBA?
apparently CBA has a json parser already no?
there are characters extDB didn't handle
specifically colons
that I had to string replace when I saved it to the DB
so now I have to reverse on the way out
there speaks the string replacing guy
@distant oyster
Most of my stuff actually uses your stringReplace function 🙂
you can use the regex version which is shorter (and maybe faster):
_bla = _dumbArray regexFind ["(?<=\[\[).*(?=\]\]\])", 0] select 0 select 0 select 0;
Oh that has been a while since then, now we have regexReplace 😄 also was just accidently typing 
Adding Full Virtual Arsenal through addAction through remoteExec doesn't work on public scriptable servers for some reason
@hollow thistle @little raptor thanks to you guys for all your help! Happy to say that all of my servers now have 100% persistent ACE medical! 😄 My unit's gonna love it, we always aim for persistent missions and I've been working on fleshing out more of our persistency system.
Any clues on this, or script irregularities in general? I just had a CTF-script that should have the flag marker move with the player when flag is taken. This too worked only 60-70% of the time..
Yes. It could be a race condition
Don't public variable something from inside global event handlers
Also iirc hit EH can trigger multiple times
similar to handleDamage
Tho not 100% sure
so i’m wanting to create a convoy. i know there used to be a script that would remember your flying path. i can’t remember the name of that or is there something better?
Guys what is the best practice to add diary subjects / diary records that persist after the player dies or JIPs? I'm going crazy
you mean unitcapture?
what are you currently doing?
Trying to add a few diary subjects (new pages). I have them in .sqfs, and I have tried
[] execVM "briefing\briefing_comms.sqf";
in the init.sqf, the initPlayerLocal.sqf and I even tried it in initServer.sqf and none of those worked after respawn/JIP.
I even tried ```sqf
if (hasInterface) then {
0 = [] execVM "briefing\briefing_comms.sqf";
};
And that didn't work either. I think I tried that in all 3 inits also. Worth noting, the pages I'm making, including the one in the above example, all show up upon start. But after dying and respawning, or leaving and rejoining, the pages are gone.
What is the best practice for this?
yea that
Is it possible to have a vehicle(c2) get deleted then put a vehicle(c8) in its place? And if c8 is a composition will the things attached to c8 be placed how theyre supposed to be?
post whats in your comms sqf to sqfbin.com and paste it here
yes, and depends what you are doing to attach them
Currently the composition I am looking to use is using
call{[this, hemtt_1] call Bis_fnc_attachToRelative;}
To attach items to it
then yes it will stick
_index = player createDiarySubject ["Comms","Comms"];
player createDiaryRecord ["Comms",["Channels",
"<br/>
Channels<br/>
1 - Alpha<br/>
2 - Bravo<br/>
3 - Charlie<br/>
4 - Command<br/>
5 - Support<br/>
6 - Armor<br/>
7 - Air<br/>
8 - MG<br/>
9 - AT"]];
Im assuming the script will be along the lines of
[1, "BLACK", 5, 1] spawn BIS_fnc_fadeEffect;
deleteVehicle c2;
Then the summon line but I dont know how I would go about summoning it. Would I have it on the map then basically a script when this triggers would spawn it in a spot? (probably outside so Arma doesnt happen)
recreated, and I don't get the same result as you. mine are persistent. there is something additional you are doing that is causing an issue somewhere
Did you recreate it on a dedicated server and did you try respawning?
you did not mention a dedicated. standby
Sorry
there is no reason for the diary to be lost on death. whats your modlist?
a work around for you would simply be a onPlayerRespawn with a check to see if the diary exists, if it does, skip the script so you don't add a bunch of them
Only thing I can think of in the list that would be affecting it is the TMF framework addon, which includes a spectator mode and a respawn-from-spectator function
I'll check out the onPlayerRespawn solution. Thanks for your help
ahh i guess unitcapture cant be in multiplayer without running into issues. welp there’s goes my idea of a convoy ambush
unitplay doesn't work in multiplayer?
I've had it work fine as long as you only call the function on the server
if you call it globally the result is jank
i have not much clue about scripting. is there any reason to avoid global variables?
i have split some code to different files, just cause its more easy to handle
avoid globals as much as you can
simply send variables to new things via arguments and params
so it would be better to send a non global variable to a other file, instead of using a global one?
correct
private _variable1 = 1;
private _variable2 = 2;
[_variable1, _variable2] call fn_myNewFunction;
//fn_myNewFunction
params ["_var1", "_var2"];
_var1 + _var2 //returns 3
ill save that thx. but that goes over my needs so far 😄
Local variable will go to the void once the script ends unlike Global ones. So, you know what, it's better for RAM
Well, “better” means not really
ah
yeah, performance is my main focus
i like to squeeze out as much frames as possible lol
I don't believe eating RAM will make the performance slower, but yeah, in the terms of such technical things, better to use Local
Also, it's safe to say Local ones are safer to use because unlike Global ones will never be overwritten by other projects like third-party Mods
Unlikely to happen, but better to avoid
so i have a composition named hellmt.sqf in Computer/Desktop/Compositions
0 = [10908,7846,0, 0.5,359.79,291.846, call (compile (Computer/Desktop/Compositions "hellmt.sqf"))] call BIS_fnc_ObjectsMapper;
Is this what I would need to paste into the trigger to spawn the hellmt? Just trying to follow what I found here https://forums.bohemia.net/forums/topic/163625-dynamic-object-compositions-doc/?tab=comments#comment-2575685
[1, "BLACK", 5, 1] spawn BIS_fnc_fadeEffect;
deleteVehicle c2;
This is what I have in the trigger right now
Fades then deletes the vehicle, then I want it to spawn the hellmt
single player or multiplayer
multi
nothing you posted above will work for that
yeah, just realized
when you asked me
fuuuuuck
think im just gonna plop it down with zues because this is driving me nuts
Computer/Desktop/Compositions "hellmt.sqf" This won't work... I mean, at all
trying to use the HEMTT Flatbed
And yeah Pol i realized that when Hypo asked. 2am and running on no sleep so didnt even think
B_Truck_01_flatbed_F
so you want it to fade out, delete the vehicle, create and move a new vehicle to that position, then fade back in?
Yeah
which im still messing with the Fade script
Still very new to scripting so taking what I can find and touching it till I figure out what things do
you cannot do absolute path without "file patching", and you cannot do multiplayer with "file patching"
yeah i know, like i siad, 2am and no sleep. didnt even think about it till was asked if its for multi
if (isServer) then {
[] spawn {
[0, "BLACK", 5, 1] remoteExec ["BIS_fnc_fadeEffect", allPlayers];
sleep 6;
private _pos = getPosATL c2;
private _dir = getDir c2;
deleteVehicle c2;
private _newVehicle = createVehicle ["B_Truck_01_flatbed_F", [0,0,0], [], 0, "NONE"];
_newVehicle setDir _dir;
_newVehicle setPosATL _pos;
sleep 1;
[1, "BLACK", 5, 1] remoteExec ["BIS_fnc_fadeEffect", allPlayers];
};
};
I'm guessing theres not really a way to do this for a composition that uses the hemmt flatbed? Sorry, thats what I meant i was trying to do. like... could... i hide the model and have the truck and stuff attached all appear how they are supposed to be after the initial vehicle is deleted? if that makes sense
then after you create the vehicle, you use attachTo or attachToRelative
with the things you want to mount on it
hmm okay, thats what i was afraid of because the vehicle that is being deleted is the same style vehicle that is being spawned but "touched up" with armor plating and guns and whatnot. hmm... maybe while they are faded to black I can do it with zues
from searching up unitcapture people said it’s buggy so that’s what i figured
My next idea was to use a normal "HIT" eventhandler. I had a remoteexec for systemchat inside the script sqf that the global eventhandler executed, and it showed X times the chat message as how many players were connected.
Hmm.. Need to look into this.
The script does remove itself with _thisEventHandler plus does hideobjectglobal on the object
Hey, do AI attack enemy units if they are sim-disabled?
they don't even move...
I mean like
Say I have two units, one east and one west
The west unit is sim disabled
Will the eastern unit attack it or ignore it?
I know XD
I already tested it and they didn't
But I just wanted to double check my work since it's an important part of the mission I'm making
Haven't tested it on dedicated yet
Been a long time since I used CBA... but can you not use use addPerFrameHandler during preinit?

