#arma3_scripting

1 messages · Page 743 of 1

oblique summit
pale glacier
#

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?

brazen lagoon
#

its possible that if mid is halfway between min and max it's equivalent

#

but hard to say without knowing how its implemented

winter rose
brazen lagoon
#

👍

little raptor
brazen lagoon
#

@little raptor it makes sense I think he's just going about it wrong

pale glacier
#

Yeah I'm in the phase of learning with tons of trial and error..

winter rose
#

it is "human code" yes
I can read the intention, but it is of course wrong code-wise

brazen lagoon
#

yeah I think I get what you're doing. you're putting it in a trigger?

pale glacier
#

Yes

brazen lagoon
#

iirc the problem w/ doing it with a trigger is that it's only going to select units inside the trigger

little raptor
#

but anyway, in this case you just need to attach the trigger to bob

pale glacier
#

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

little raptor
brazen lagoon
#

I think I need more information here but couldn't you do sqf count (((position bob) nearEntities 50) select {side _x == west}) > 0?

little raptor
dapper cairn
#

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,""};
};
};

brazen lagoon
#

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

pale glacier
#

Thanks @brazen lagoon @little raptor I'll try

little raptor
brazen lagoon
#

not following

#

sec

#

OH

#

so you could do sqf ({side _x == west} count ((getPosATL bob) nearEntities 50)) > 0

tired delta
#

yes 😄

hasty current
#

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?

hasty current
#

Thank you!

oblique summit
#

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

round scroll
#

I guess publicVariable sends to all connected systems, publicVariableClient to a given client and, well, server to the server solely

oblique summit
# round scroll I guess `publicVariable` sends to all connected systems, `publicVariableClient` ...

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

languid tundra
#

publicVariable supports JIPs (ppl that disconnect and reconnect), so that's the way to go

little raptor
sonic sleet
#

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

little raptor
#

Bullets have different penetration values depending on the Object
no. that depends on the surface. not the object

oblique summit
little raptor
#

not the object

languid tundra
oblique summit
little raptor
#

but it has nothing to do with bullet penetration
it's a measure of its "health", so to speak

languid tundra
#

That would prevent polluting the missionNamespace

oblique summit
#

@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?

languid tundra
oblique summit
still forum
#

just do publicVariable

#

it takes care of sending to JIP by itself

oblique summit
# still forum just do publicVariable

@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.

still forum
#

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

oblique summit
still forum
#

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

oblique summit
#

ok

finite mica
#

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

finite mica
#

Everything I googled just kept bring up the virtual Arsenal

little raptor
#

"arma add ace arsenal" 🙄

finite mica
#

“How to add ace arsenal in Eden”
Is exactly what I have in my search bar

sonic sleet
little raptor
oblique summit
# still forum One example would be if you were trying to send events using publicVariableEvent...

@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?

sonic sleet
oblique summit
#

🤯

#

ok

fair lava
#

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?

still forum
#

yes, its called global variables

fair lava
#

oh the _ actually has an effect?

still forum
#

yes

fair lava
#

i figured that was just a naming scheme to avoid confusion

still forum
#

_ is local variable

fair lava
#

yeah i just read the variables page again, ty ^.^

sonic sleet
#

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,""];
sharp grotto
sonic sleet
#

huh got "NOID footstep_I.p3d"

sharp grotto
#

then define the type you are searching for

sonic sleet
#

Didnt think foot steps were objects lol

#

Ah I got it "All" Returns what I want. Cheers

fair lava
#

it works rooAwwClap

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;
    };
}];
true frigate
#

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 ^

winter rose
#
_group1 addWaypoint [getPosATL selectRandom [p1, p2], -1];
true frigate
#

And say if p1 was empty, would it automatically use p2?

winter rose
#

"empty"?

true frigate
#

as in

#

didnt have a player in the slot

#

I should have said

#

I'm defining these variables as players

#

My bad 😅

winter rose
#

oh
well no, it would trigger an error because then p1 is undefined

true frigate
#

Could I just replace 'getPosATL p1' with 'player'?

winter rose
#

nooo?

#

are p1, p2, p3 etc all players and do you want that waypoint on a random on all players?

true frigate
#

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 😄

winter rose
#

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
true frigate
#

Brilliant, you're always the genius Lou 😄

sonic sleet
#

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; 
true frigate
#

Got another one then, can I attach a waypoint to a player using script? Something like the DESTROY waypoint?

winter rose
#

yes

oblique summit
#

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"];

true frigate
#

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?

willow hound
winter rose
oblique summit
sonic sleet
#

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)}];"
oblique summit
winter rose
#

I have no idea how this is related

oblique summit
# winter rose 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...

winter rose
#

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

oblique summit
winter rose
#

yep

#

this is why it is the server that decides the number

oblique summit
winter rose
#

I provided the correct code

radiant yacht
#

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"

winter rose
#

(instead of ``, try

```cpp
```
)

winter rose
radiant yacht
#

maybe, but how does one break those up

winter rose
#

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

radiant yacht
winter rose
undone dew
#

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
winter rose
#

waitUntil the status is equal to "WANTED_STATE" yes

undone dew
#

my bad i edited it funny the first time

winter rose
#

while {!(_randomcarUnlocked)} do to be removed too

undone dew
#

but yeah thats coming back as task undefined

winter rose
#

all this is confusing, as you are reusing variables

#

@undone dew nowhere is _randomcarUnlocked declared in this script (before line 21)

undone dew
#

ohh

sonic sleet
#

Dumb question, how do I know when to use the Init.SQF compared to making another file?

winter rose
sonic sleet
#

So, theres no difference from the Init File and making another one?

#

Just Organization

hushed tendon
#

Yes there is

undone dew
hushed tendon
winter rose
dapper cairn
#

Question, how do yall put the scripts into the boxes like that

#

So they dont get messed up when typing them normally

sonic sleet
#

Type Tilde 3x (Left of One), Then type " sqf "
Code down herereeee
Then Tilde 3x again then hit enter

dapper cairn
#

okay thanks

winter rose
#

!code

wicked roostBOT
#
How to use SQF syntax highlighting in Discord

```sqf
// your code here
hint "good!";
```

// your code here
hint "good!";
winter rose
#

^.^

sonic sleet
#

^ Ah, the smart way

winter rose
#

a shortcut :p thank you for the detailed explanation!

sonic sleet
#

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)}];"
dapper cairn
#
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

hushed tendon
# sonic sleet Man I'm at a loss Trying to figure out how to get this code to come together. B...

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)
}];
sonic sleet
#

Would this cause lag having multiple people?

#

Also I selected 1 for the 2nd in the array as the first is always the Player

hushed tendon
#

So by object what objects are you looking to get armor values from?

sonic sleet
#

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

hushed tendon
#

Yeah so you only want to run that when you are actually hit

#

Running it more than that can cause lag especially for multiplayer

sonic sleet
#

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)
}];
hushed tendon
# sonic sleet so in other words This every 3 seconds ```sqf private _nearestObj = nearestOb...

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)
}];
buoyant elm
#

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.

fair drum
#

Help you tomorrow Jekyll. Sleep time now.

dapper cairn
#
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

little raptor
little raptor
buoyant elm
little raptor
#

Did you add some logging to see if it even detects your object at all?

buoyant elm
#

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

little raptor
#

Also for your selectRandom [1,1,1...], selectRandomWeighted is a thing you know...

buoyant elm
#

i know

#

i threw that in for testing it'll be changed out for somethnig else later

buoyant elm
#

enabled or disable,d same result

#

it's disabled because they're stuck inside an object, and they'll go flying otherwise

little raptor
#

Objects with disabled sim have a very slow sync rate in MP

buoyant elm
#

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;

little raptor
#

That won't work

#

Like I said disabled sim causes very slow sync rate

#

Sometimes 1 minute

buoyant elm
#

oof

little raptor
#

If they go flying you can just attach them

buoyant elm
#

either way, i can spawn these objects into the map from 3den and have a preset value, yet they don't keep that value

little raptor
#

¯\_(ツ)_/¯

#

Try with simulation for now

#

See if it works

buoyant elm
#

i have, i put them on the groudn and left sim on, still doesn't update them

#

it's super frustrating

little raptor
#

Props have a slow sync rate too btw

#

But not that slow... think_turtle

buoyant elm
#

so slow that initial values never get sunc?

#

i think it's a dlc problem to be honest

little raptor
#

Dunno. Try attaching them to a unit object. See if they sync properly like that

buoyant elm
#

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?

little raptor
buoyant elm
#

ah, thank you

buoyant elm
#

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

tepid vigil
#

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.

copper raven
#

BeforeDestroy - Name of the script to run right before destroying the particle.

tepid vigil
#

so i guess the wiki needs some updating

little raptor
#

oh nvm that already does say path

little raptor
#

or is it _this?

little raptor
#

thanks. will fix

little crest
#

Any of you can help with this?

little raptor
#

if it doesn't help use getMissionPath

little crest
#

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"";";

little raptor
little crest
#

[this] execvm ""sonicboom\sonicboom.sqf""; This is what I wanna put in it.

little crest
#

Yeah, sorry.

little raptor
#

why do you use so many "? meowsweats

little crest
#

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 🤯

little raptor
#

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

little crest
#

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

little raptor
#

if you do you can see why that was wrong:

[this] execvm ""sonicboom\sonicboom.sqf"";
#

that part is not green anymore

#

on discord:

wicked roostBOT
#
How to use SQF syntax highlighting in Discord

```sqf
// your code here
hint "good!";
```

// your code here
hint "good!";
little raptor
#

but use something like notepad++ or vscode for coding, with SQF extensions

little crest
#

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?

little raptor
#

just add a sqf next to ``` to get syntax highlighting: ```sqf meowsweats

little crest
#

🤯

#

OH I see it now

little raptor
#

setVehicleInit
processInitCommands
clearVehicleInit
ummm, what?

#

where did you even get those?

#

they're not valid commands

little crest
#

Yeah a friend tried to help me with a couple of days ago 😂

cosmic lichen
#

They are disabled in arma 3

little crest
#

This is for A2

#

Sorry I should of specified 👀

cosmic lichen
#

So what isn't working?

little crest
#

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";
cosmic lichen
#

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.

little crest
#

Even I don't see it clientside, how would I get it to load?

cosmic lichen
#

Try without the isServer check

little crest
#

I just remove if (isServer) then ?

cosmic lichen
#

yes

little crest
#

Alrighty

#

Same thing 👀

little raptor
little crest
little raptor
#

}

little crest
#

Where am I placing that?

little raptor
# little crest 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.

little crest
#

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";
little raptor
#

second of all, _texture is not defined

little crest
#

How does one define it?

little raptor
#

same way you originally did

#
_texture = "Images\Camoflague\WL_HEX.paa"
little crest
#

Ah right

#

Well that still doesn't work 😂

little raptor
#

also you didn't end your line with ;

#

... 😮‍💨

little raptor
little crest
#
_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.

little raptor
#

does

player setObjectTexture [1, "Images\Camoflague\WL_HEX.paa"];
``` even work?
little crest
#

SorryI misread

#

Negative

little raptor
#

running from debug console

little crest
little raptor
#

or does A2 have none? meowsweats

little crest
#

I have debug up

little raptor
#

well then how do you expect it to work in init? meowsweats

#

first test them in debug console

little crest
#

I have like an admin tool thing

#

Can launch scripts

versed widget
#

has anyone tried to implement negative correlation coefficient in sqf ?

languid tundra
reef walrus
#

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

languid tundra
reef walrus
#

Good pointer, indeed! Same for Arsenal, I guess... merci!

#

Or the "type" config entry.

dapper cairn
#
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

faint oasis
#

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

oblique summit
#

Hi guys,

_number = parseText [1000, 9998] call BIS_fnc_randomInt;
publicVariable "_number";

Could way of conversion to String correct?

winter rose
oblique summit
winter rose
#

no. use str ()

little raptor
winter rose
#

and you still try to publicvar a local variable

oblique summit
#

😣

#

Is some complicated to understand by myself sometimes that kind of language by Arma 3, but I never will give up with this topic.

languid tundra
#

As I said yesterday, it's much cleaner to set the variable on your bomb, rather than defining a global variable 😉

faint oasis
languid tundra
#

I just copied his first line without looking at it closely 😅

faint oasis
#

oh ok but i checked and "parseText" is not exactly same of "Str" so thanks you

languid tundra
#

Also the parentheses are crucial

oblique summit
# faint oasis what is your problem exactly ?

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

languid tundra
#

his line would produce a script error

#

since it would parse the array before calling the function

faint oasis
faint oasis
oblique summit
languid tundra
#

The true problem with your code is that the first line is full of errors

#

parseText expects a string as input, not number

faint oasis
#

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 ?

oblique summit
# faint oasis oh ok i understand

@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.

faint oasis
#

wait

oblique summit
faint oasis
#

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"

oblique summit
faint oasis
#

ooh

#

but it's an error

faint oasis
#

it's BIS_fnc_randomNumber instead "BLN_fnc_randomNumber"

#

because you wrote BLN

oblique summit
#

yeah

faint oasis
#

so i thought it's a function created by you

oblique summit
# faint oasis because you wrote BLN
class BLN
{
    tag = "BLN";
    class clientes
    {
        file = "functions\clients";
        class briefing {};        //Briefing 
        class randomNumber {};    //Number random
        class cronometro {};      //Cronometer

    };
};
faint oasis
#

oh ok

#

so it's a function defined in the mission

#

then try to use

oblique summit
#

yeah

faint oasis
#
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"];
languid tundra
#

Actually,

#
this addAction ["<t color='#FF0000'>Get Number</t>","hint str bomb_code"];
oblique summit
#

All right, but you know that hint need that you parse the number to String

faint oasis
#

yeah

languid tundra
#

BLN_fnc_randomNumber is completely nonsensical

faint oasis
#

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

oblique summit
faint oasis
#

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

oblique summit
faint oasis
#

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

oblique summit
#

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

faint oasis
#

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";
oblique summit
#

ok, so what type of File I need make for a players that disconnected and reconnected again get the same code again?

faint oasis
#

you don't need anything

languid tundra
#

publicVariable "bomb_code"; already took care of that for the 100th time 😅

faint oasis
#

you just need to put the code above in your initserver

oblique summit
#

@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.

#

🤯

faint oasis
#

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"

languid tundra
faint oasis
#

publicVariable is to broadcast the variable over the network

oblique summit
#

@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?

faint oasis
#

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

languid tundra
#

Don't give him false ideas 🙈

#

It works

#

no loop needed

#

THE END

oblique summit
#

XD

faint oasis
oblique summit
#

@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

faint oasis
#

first thing we need to know

#

is where is your code ?

#

because it's important to know on which side your code is executed

oblique summit
#

@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

faint oasis
#

so if i understand when you call the function you have a count until 0 right ?

oblique summit
#

yes

faint oasis
#

so the second code is in which file ?

#

initServer ?

oblique summit
# faint oasis initServer ?

execute as a function and executed in the init in that moment, because I didn't understand well the same that point

faint oasis
#

ok

faint oasis
#

i will explain you the difference with pictures

#

you will understand how it work and what is the difference between

oblique summit
# faint oasis ok

the problem with this code were a player has disconnected when reconnected again the count reset to 2 hours again

faint oasis
oblique summit
ruby bronze
#

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

dapper cairn
#

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

fair drum
dapper cairn
#

didnt even see him answer me. notifications have been broke all day with discord going up and down

#

and was busy across town

dapper cairn
#

Thanks

dapper cairn
#
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?

open fractal
#

you can just spawn it with script

dapper cairn
#

Yeah I assumed so right when i asked that

little raptor
#

I said delete the sound object

#

delete that

dapper cairn
# little raptor Wat? I didn't say delete c1

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)

little raptor
dapper cairn
#

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

little raptor
#

No. The game creates a new object and that object plays the sound

dapper cairn
#

I see

little raptor
#

You can do something like:

mySoundSrc = c1 say3d...
#

And then delete mySoundSrc

dapper cairn
dapper cairn
#

for deleting it

little raptor
#

they're played from different objs?

dapper cairn
#

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

little raptor
#

how can more than one sound be played by one object? thonk
iirc say3D only allows 1 sound at a time

#

also confirmed by the wiki:

An object can only "say" one sound at a time.

dapper cairn
#
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

dapper cairn
#

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

little raptor
little raptor
winter rose
#

that, or for each "say" delete the previous source

little raptor
#

also say3D has local effect, so if you want this for MP, it won't work

dapper cairn
#

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

little raptor
#

it does work, as Lou already said

dapper cairn
#

yeah, i was typing that and reading something so didnt see Lou say that till i sent it

winter rose
#

I'm always ignored notlikemeowcry

dapper cairn
#

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

winter rose
#

you sir, are very nice and caring 🙇‍♂️

dapper cairn
#

Thank you Lou

cosmic lichen
#

I see CCR in that list. Good man!

plush belfry
#

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

little raptor
#

and make sure the environment is scheduled

royal ember
#

Any video anyone would suggest going through all the basics and all?

plush belfry
# little raptor call `BIS_fnc_typeText` instead of spawn

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);```
little raptor
plush belfry
little raptor
plush belfry
supple cove
#

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

supple cove
#

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

little raptor
#

spawned in and have no init values
wat?

supple cove
#

I don't spawn the units inside the eden, something like Alive that has no init on the units

little raptor
#

so? what does it have to do with FiredMan EH?

#

you add that to players

supple cove
#

but its the reverse

#

If i add to the players it will be fired when the players shoot, no?

little raptor
#

yes. that's literally what you asked too

#

triggers only when someone fired their gun

#

give the players a chance to do stealth kills

supple cove
#

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

little raptor
supple cove
#

The enemies will be stored within list trigger yea? That's a good idea

eager prawn
#

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?

little raptor
hollow thistle
#

we have serialization/deserializaiton functions

#

which were written with persistence in mind.

undone dew
#

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

little raptor
eager prawn
hollow thistle
#

yes

little raptor
#

and similarly, create a function for deleting the action, and remoteExec that function when you want to delete the action

eager prawn
eager prawn
#

@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)```
eager prawn
#

actually I'm just going to use isInStableCondition, that's even better 😃

#

oo thanks!

hollow thistle
#

Public: Yes

#

we do not guarantee that internal functions will stay in same form and format.

torpid mica
#

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?

torpid mica
#

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.

mellow thunder
#

Removed , but will someone script me a dialog where the arma character tells Leopard to say please.

faint oasis
#

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 ?

faint oasis
#

because i tried to setmass before and setmass after but nothing worked. it work only in singleplayer but in multiplayer it doesn't work.

little raptor
faint oasis
eager prawn
# hollow thistle we have serialization/deserializaiton functions

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)

hollow thistle
#

Run the code unscheduled.

eager prawn
#

I'll try that rn

acoustic abyss
#

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?

eager prawn
# hollow thistle Run the code unscheduled.

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

past wagon
#

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

acoustic abyss
# acoustic abyss Does anyone have experience with both *setPosWorld* and *attachTo* ? I have a li...

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?

little raptor
acoustic abyss
little raptor
little raptor
#

That might be why they jump up and down

acoustic abyss
#

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?

past wagon
little raptor
#

But you just did that I guess...

acoustic abyss
little raptor
#

You can use setVelocityTransformation

#

But not the way unitCapture uses it

acoustic abyss
#

🙂 ?

little raptor
#

Did you read the unitCapture script?

#

Actually I meant unitPlay

acoustic abyss
#

The "Stairway to Heaven"? on setVelocityTransformation?

#

Oh let me read

#

You mean BIS_fnc_unitPlay?

little raptor
#

Yes

acoustic abyss
#

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.

open fractal
#

Is there a good way to get the time elapsed since script start?

#
_time = time - _startTime
acoustic abyss
#

And UnitCapture is recording the following info on every frame it runs:
capturedData = _capturedData + [[(_timeCur + _timeOffset), (getPosASL _unit), vectorDir _unit, vectorUp _unit, velocity _unit]];

open fractal
#

or should I Just stick with htis

little raptor
acoustic abyss
#

I tried running BIS_fnc_unitPlay on the light object, by the way. It seemed to disappear 😬

open fractal
#

do you happen to know why _time magic variable doesn't work in sqf? is it a resource thing?

little raptor
#

I think it's a debug variable, specific to cfgFunctions

#

Should've been explained on the wiki thonk

open fractal
#

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

acoustic abyss
#

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.

#

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?

acoustic abyss
half moon
#

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.

little raptor
#

Also no one ows you anything here so don't be like "give me answers now"

acoustic abyss
#

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.

fair lava
#

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

acoustic abyss
#

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.

acoustic abyss
#

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.

fair lava
#

ty

acoustic abyss
#

And that's why I responded back with your smiley.

little raptor
acoustic abyss
#

I hope you don't take it personal. It's more a reflection of my own inadequacy as a programmer hobbyist.

fair lava
#

ah so while {player getVariable ["BRAA_Running", false]} do

#

?

little raptor
#

Yes

fair lava
#

ty ty

little raptor
#

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

acoustic abyss
#

So #1: thank you.

acoustic abyss
little raptor
#

no just attachedObj setVelocity velocity myVehicle

#

since they're attached (rigid) they have the same velocity

#

as long as the object moves linearly... meowsweats

#

when it turns the velocities differ

acoustic abyss
#

Cool. Let me test this.

acoustic abyss
#

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?

little raptor
#

don't use onEachFrame

little raptor
acoustic abyss
little raptor
# acoustic abyss I could use a few reputation points on the BI forums =]. Again: you're getting f...

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]];
acoustic abyss
#

What's the first line for?

little raptor
#

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];
acoustic abyss
#

Syntax seems straightforward. I'll link the post somewhere later.

#

This has been super productive and helpful for me.

#

Have a good (lunch)?

faint oasis
#

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.

little raptor
somber radish
#

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;
somber radish
#

Aah

#

thnx!

little raptor
#

_PushPositions pushBackUnique _Positions select _I;
you're not obeying order of precedence here

somber radish
#

How would you do it?

little raptor
#

first of all:

_PushPositions pushBackUnique (_Positions select _I);

second of all,

to count _Positions
that's off by 1

#

third of all, use forEach

somber radish
#

It is wrapped inside a forEach loop

#

but yeah point taken

little raptor
#

not forEach

#

to count _Positions do

somber radish
#
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;
little raptor
#

that's what I mean

#

plus it's wrong rn

#

off by 1

faint oasis
little raptor
#

also you said you want it for MP

#

does it work in SP?

faint oasis
#

so yeah i want it for MP

little raptor
#

do you remoteExec it?

#

perhaps the vehicle changes locality when you attach it

faint oasis
#

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];
little raptor
#

you should've remoteExeced where _obj is local:

[_obj, _obj_mass] remoteExecCall ["setMass", _obj];
#

but if it doesn't work then idk

faint oasis
#

oh ok then i will try

little raptor
#

you were remoteExecing for everyone

#

that also includes locally

#

unless that breaks the game or something thonk

faint oasis
#

then it's probably a bug

#

i will try to spawn with a sleep to see if it work

faint oasis
#

@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.

brazen lagoon
#

@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)

brazen lagoon
#

@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

sharp grotto
#

maybe add a Killed or MPKilled EH to the mine (not sure if that is even possible, so just a brain fart)

brazen lagoon
#

yeah that's the problem I think I'm not sure you can..

brazen lagoon
#

@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

little raptor
#

also not sure if projectiles have inits

brazen lagoon
#

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

little raptor
#

fired? you mean handleDamage?

brazen lagoon
#

well if mines are projectiles/ammo then on detonation they would run the 'fired' event handler right?

little raptor
#

no

hollow thistle
#

no

little raptor
#

they just don't run any EHs

hollow thistle
#

they do

#

ammoHit

brazen lagoon
#

what is ammoHit

#

rather, when does that fire

hollow thistle
#

barely documented EH that runs when mine ammo explodes.

brazen lagoon
#

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

hollow thistle
#

no, it's config only IIRC.

brazen lagoon
#

meaning I would have to make an addon?

hollow thistle
#

Not sure if he have XEH support for it. I think not.

brazen lagoon
#

ok so best choice is probably just that UI event handler on defuse action

#

🤷‍♂️ oh well!

hollow thistle
#

I guess I could add ammoHit to XEH but with current release cycle you would see it in the next quarter pepe_laugh

brazen lagoon
#

hey, better nate than lever and all

eager prawn
#

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.

hollow thistle
#

it json

eager prawn
#

(The # signs are placeholders for :, which I do a stringReplace on, as SQL can't handle :

eager prawn
hollow thistle
#

then replace them back

#

and json parse with CBA fnc

eager prawn
#

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

hollow thistle
#

I don't see the issue.

eager prawn
hollow thistle
#

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.

eager prawn
#

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?

copper raven
#

the escaping is messed up in the string no?

#

that's why parseSimpleArray fails

hollow thistle
#

You're making no sense to me sorry.

#

If you will parse the json via CBA function it will be parsed into CBA Hash.

tepid vigil
#

Hey, I have a question regarding markers: ```sqf
_marker = createMarkerLocal ["Unit #1", _unit];
_marker setMarkerTypeLocal "hd_dot";
_marker setMarkerColor "ColorBlue";

eager prawn
eager prawn
hollow thistle
#

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.

little raptor
#

but not sure

sharp grotto
eager prawn
#

It breaks out after the first character of ACE_MEDICAL_STATE

hollow thistle
#

it's not arma/parseSimpleArray fault

#

it's extDB fault.

copper raven
hollow thistle
#

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

eager prawn
#

and yes 100% it is extDB fault

#

as awesome as extDB is lol

copper raven
#

iirc extdb has different options for handling quotes, maybe you should tinker with them

hollow thistle
#

then you need to "repair" the json by replacing # with : and ' with "

eager prawn
#

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

hollow thistle
#

""""

#

'"'

eager prawn
#

in debugconsole both of those return as """" but maybe that's just debugconsole wierdness

#

I will try it in the script now

hollow thistle
#

yes, because both are same string.

eager prawn
#

but am I interpreting it right, that it is a string of two quotes?

#

because I need a single quote for stringReplace

willow hound
eager prawn
#

copy salute

#

something causing it all to crash now so figuring that out first 😄

little raptor
willow hound
#

Cursed notlikemeow

little raptor
#

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)

copper raven
#

i just disable BE and launch two armas

eager prawn
#

Literally doing that rn

#

😄

crude vigil
little raptor
eager prawn
#

compared to Arma Arma

sharp grotto
#

6,84 GB only yea

little raptor
copper raven
#

localhost 2302?

#

or just LAN

eager prawn
#

@hollow thistle it workkkkked 🎉

little raptor
#

lan

eager prawn
#

in debug console at least 😄

spark sun
#

Everybody already have an arma server

#

just execute arma3server.exe

little raptor
crude vigil
#

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

little raptor
#

oh it worked this time

#

weird thonk

languid tundra
#

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 😉

lilac heath
#

Hi, there is any way to write some text into a .txt or .sqf file?

eager prawn
#

@hollow thistle so uh, fun thing. I did all the conversion to get it put into the database, but parseSimpleArray still escapes early

little raptor
#

in plain SQF no

#

with extensions yes

lilac heath
#

ok, and in some .txt?

eager prawn
#

Just returns this [1,[[]]]

little raptor
#

it doesn't matter what file you write to. SQF can't write to external files

lilac heath
#

a ok, sorry XD

#

ok so I should search for a dll extensión or make my own right?

little raptor
#

there are some you can use

#

but out of curiosity why do you even need that?

lilac heath
#

To store some resume data form our missions, to check it later.

half moon
#

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"

little raptor
lilac heath
#

I have been thinking about diag_log. But I would like something beter

eager prawn
#

parseSimpleArray _dumbStringArray = [1,[[]]]```

😭
little raptor
#

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++

lilac heath
#

ok, thx very much I will take a look into it

little raptor
#

so you said you needed the array after [1,

#

right?

eager prawn
little raptor
#

didn't you say you want to parse it later with CBA?

eager prawn
#

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

little raptor
#

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

eager prawn
#

I'll try it rn

little raptor
#
_dumbArray regexFind ["(?<=\[\[).*?(?=\]\])", 0]
eager prawn
#

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

little raptor
#

didn't you want to parse it with CBA?

#

apparently CBA has a json parser already no?

eager prawn
#

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 🙂

little raptor
distant oyster
#

Oh that has been a while since then, now we have regexReplace 😄 also was just accidently typing meowtrash

unreal heath
#

Adding Full Virtual Arsenal through addAction through remoteExec doesn't work on public scriptable servers for some reason

eager prawn
#

@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.

half moon
little raptor
#

Don't public variable something from inside global event handlers

little raptor
#

similar to handleDamage

#

Tho not 100% sure

prime tundra
#

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?

ruby bronze
#

Guys what is the best practice to add diary subjects / diary records that persist after the player dies or JIPs? I'm going crazy

ruby bronze
#

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?
prime tundra
dapper cairn
#

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?

fair drum
fair drum
dapper cairn
fair drum
#

then yes it will stick

ruby bronze
dapper cairn
#

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)

fair drum
ruby bronze
#

Did you recreate it on a dedicated server and did you try respawning?

fair drum
#

you did not mention a dedicated. standby

ruby bronze
#

Sorry

fair drum
#

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

ruby bronze
#

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

prime tundra
#

ahh i guess unitcapture cant be in multiplayer without running into issues. welp there’s goes my idea of a convoy ambush

open fractal
#

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

sacred slate
#

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

fair drum
#

simply send variables to new things via arguments and params

sacred slate
#

so it would be better to send a non global variable to a other file, instead of using a global one?

fair drum
#

correct

#
private _variable1 = 1;
private _variable2 = 2;

[_variable1, _variable2] call fn_myNewFunction;

//fn_myNewFunction
params ["_var1", "_var2"];
_var1 + _var2 //returns 3
sacred slate
#

ill save that thx. but that goes over my needs so far 😄

warm hedge
#

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

sacred slate
#

ah

#

yeah, performance is my main focus

#

i like to squeeze out as much frames as possible lol

warm hedge
#

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

dapper cairn
#
[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

fair drum
dapper cairn
#

multi

fair drum
#

nothing you posted above will work for that

dapper cairn
#

yeah, just realized

#

when you asked me

#

fuuuuuck

#

think im just gonna plop it down with zues because this is driving me nuts

fair drum
#

lol give me the class names of the vehicles you want to spawn

#

its not that hard,

warm hedge
#

Computer/Desktop/Compositions "hellmt.sqf" This won't work... I mean, at all

dapper cairn
#

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

fair drum
#

so you want it to fade out, delete the vehicle, create and move a new vehicle to that position, then fade back in?

dapper cairn
#

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

sacred slate
#

you cannot do absolute path without "file patching", and you cannot do multiplayer with "file patching"

dapper cairn
#

yeah i know, like i siad, 2am and no sleep. didnt even think about it till was asked if its for multi

fair drum
#
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];
    };
};
dapper cairn
#

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

fair drum
#

then after you create the vehicle, you use attachTo or attachToRelative

#

with the things you want to mount on it

dapper cairn
#

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

prime tundra
half moon
half moon
#

The script does remove itself with _thisEventHandler plus does hideobjectglobal on the object

tidal ferry
#

Hey, do AI attack enemy units if they are sim-disabled?

little raptor
tidal ferry
#

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?

little raptor
#

iirc it will attack it yes

#

you can test that in like 10 seconds in Eden meowsweats

tidal ferry
#

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

austere granite
#

Been a long time since I used CBA... but can you not use use addPerFrameHandler during preinit?