#arma3_scripting
1 messages · Page 75 of 1
Try to figure out why it gets reset in the first place? Some mods perhaps?
I was thinking of having a continuous loop (onEachFrame) to keep reseting the texture back to the rtt
There was a similar issue reported in the reddit few years ago: https://www.reddit.com/r/armadev/comments/chlpp8/live_drone_feed_displayed_to_screen_disappears/ could be of hel
That part you can probably use addUserActionEventHandler or other method to detect exiting Zeus.
yeahhhhhh i have no idea how to implement that, i've got no clue about scripting, sorry
Would EH be too taxing / unnecessary in this case?
It would be a lot less taxing on performance than perframe 😅 . may be more taxing on coder.
XD
i finally have a lead, open question, does cba invisible targets do anything differently in dedicated mp?
Uhhh??
whats up?
You pinged me
right so
its for this #arma3_scripting message
i could explain it again if you'd like
Maybe attach darter or drone to missile and target that
? what? no so the issue is im not firing at the missile im just firing in the general direction of it
and it worked with an invisible target
but then it just breaks in mp
and idk why
Dunno really ive never dealt with aa missiles. If u wanna go full out, you could make a mod that adds plane which is something small like pen model, attach it to missile and any aa would target it.
If you can attach anything to missile to begin with
technically a mod i have loaded already does that, im trying ti circumvent this issue btw with replacing the target with an f/a-181 so now the bastard cant miss
and im not trying ti shoot those missiles down just fyi
im just trying to getthem to fire succesdfully in that direction which they’re even failing to do
Dont think missile can be destroyed anyways.
Were you using invisible air target?
yes
it fucks up in mp doesnt it
Did you reveal position to all ai aa units?
do i have to…?
It certanly helps, so they instantly target it
how do i implement that, sorry?
https://community.bistudio.com/wiki/reveal
Execute that local to AA
so this is the full script
*/
//-------------------------------------------------------------- Params
_vic = _this select 0;
//---------------------------------------------------------------------
while {true} do {
sleep 1;
//---------------------------------------------------------- 1st Target
_vic doTarget t3;
sleep 2;
_vic fireAtTarget [t3];
//---------------------------------------------------------- 2nd Target
_vic doTarget t3;
sleep 2;
_vic fireAtTarget [t3];
//---------------------------------------------------------- 2nd Target
_vic doTarget t3;
sleep 2;
_vic fireAtTarget [t3];
//---------------------------------------------------------- 3rd Target
_vic doTarget t3;
sleep 2;
_vic fireAtTarget [t3];
//---------------------------------------------------------- 4th Target
sleep 1;
};
//---------------------------------------------------------- Script end```
so where would i put this?
Probs before dotarget
gotcha so it'd be,
_vic reveal t3;
_vic doTarget t3;
sleep 2;
_vic fireAtTarget [t3];```
like that?
forgot semi colon
Yeah. Plus ; after it
Also why are you always giving target t3? Even tho ur comments say target 1,2,3,4?
so the original script comes with 2 different targets, t2, t3, and so on thats because the author used all the scripts in 1 scenario, i didnt want that, so i just use t3
U can reveal target and do target only once, then just fireAtTarget
oh
btw, on this note, with the target being a 181, the missile is shot STRAIGHT UP into the sky, for the cba invisible target, nada
modded, from pooks sam pack
Also how do you exec above script?
I cant open it. Im on phone
so nikko's initial troubleshooting solution was move the sqf to a function, so it's remote execed
alright ill paste it
Just important part
// Trigger your SAM launch
[] spawn {
{
sleep (random 5);
[_x] remoteExec ["TNRGN_fnc_wr_vic_shoot",_x];
} forEach [s3001,s3002,s3006,s3004,s3005,s3003];
};
sleep 60;
whoops sorry
yep, thats it
@sage heath so an aa from opfor fire to blufor, laserTargetE maybe better, what is the line 7 to line 12 inside file fn_missileStrike.sqf purpose for? and t3 variable is confirm that exist and you may also need fetch the radar too
so 7-12 is the one that triggers this script here, which fires the SAM, i dont think the SAM can lock a laser target
also good point on the radar
Where is t3 created?
in eden
ima try recreate your scenario
well here's the issue in SP it works fine, in DEDICATED MP, its broken
nope!
well with the F/A 181 target, it turned off sim, hide model, although i could test it again without taht, issue is, other AA pieces fire on it IMMEDIATELY, for the cba invisible target, nothing
rpt got error about it?
no errors
if you wanna see more in detail how about a call and screenshare?>
That wouldnt help in my case.
rip
I think I'm just way over my head for what I wanted to do. I'm having doubts now haha.
based on what i observed that doTarget kind of useless, you can just do fireAtTarget
@sage heath
i get that, but then like would it necessarily fix the issue?
maybe was the mod cause it? i have try the arma anti air, works good at mp and dedicate mp
How would I go about adding a position to load a static weapon onto a vehicle that does not have one?
How'd I go about using EH to detect whenever any camera view is being switched? (Like entering and closing arsenal, zeus interface, etc). Is there any other method than EH for this?
There is no generic way to detect a camera has changed
CBA has something https://cbateam.github.io/CBA_A3/docs/files/events/fnc_addPlayerEventHandler-sqf.html featureCamera
do you mean adding a space for Vehicle-in-Vehicle transport? can't, pretty sure. just attachTo
Is there any example of this function? I can see the parametrs but without example difficult to translate.
There is the example?
_id = ["unit", {systemChat str _this}] call CBA_fnc_addPlayerEventHandler;```
wait nvm i got it confused
It is impossible to be GE
Thanks
Ok I've tried the CBA's addPlayerEventHandler and my script entirely breaks (no PiP is generated). Without it - PiP/render works but as soon as I enter/exit Zeus Interface, Arsenal or any other display/overlay the render breaks. Any help in this is appreciated.
_bb = "Land_BriefingRoomScreen_01_F" createVehicle [550.533, 4516.7, 0];
_bb setObjectMaterialGlobal [0, "\a3\data_f\default.rvmat"];
_bb setObjectTextureGlobal [0, "#(argb,512,512,1)r2t(uavrtt,1)"];
uav = createVehicle ["B_UAV_01_F", _bb modelToWorld [0,100,100], [], 0, "FLY"];
createVehicleCrew uav;
uav lockCameraTo [_bb, [0]];
uav flyInHeight 100;
_wp = group uav addWaypoint [position _bb, 0];
publicVariable "uav";
_wp setWaypointType "LOITER";
_wp setWaypointLoiterType "CIRCLE_L";
_wp setWaypointLoiterRadius 100;
{
cam = "camera" camCreate [0,0,0];
cam cameraEffect ["Internal", "Back", "uavrtt"];
cam attachTo [uav, [0,0,0], "PiP0_pos"];
cam camSetFov 0.1;
addMissionEventHandler ["Draw3D", {
_dir = (uav selectionPosition "PiP0_pos") vectorFromTo (uav selectionPosition "PiP0_dir");
cam setVectorDirAndUp [ _dir, _dir vectorCrossProduct [-(_dir select 1), _dir select 0, 0]];
}];
} remoteExec ["call", [0, -2] select isDedicated];
getObjectTextures your vehicle after you close zeus?
See what it returns
@still forum HitPart generates a lot of crap for the event handler arguments, I wonder how expensive it is really on the engine side? I'm planning on adding HitPart to all relevant in-game entities (units and vehicles, few hundred in real scenario), gonna try my best to have EH code as fast as possible but I wonder how much strain it is going to put on the engine or can I just ignore it? Not sure if I can measure it myself, thus the question
bit of a noob when it comes to scripting but I need some help with this one. i'm currently trying to setup a "Droid Spawner" for a star wars scenario. The mod I'm using has a vehicle that actually produces droids that I'm attempting to use however my problem is I have no idea how to tell it to preform the action on its action bar to spawn droids if BLUFOR enters the radius of a trigger. Ideally if someone would also know what I could add to tell it to stop spawning droids if a certain number of OPFOR is present in the area that would be wonderful but any help is appreciated :)
Same - ["#(argb,512,512,1)r2t(uavrtt,1)"]
is there an event handler that fires when a smoke grenade goes off? or is there a way to get the cords of where the smoke grenade goes off?
Something else is breaking then. Check if your Draw3D is working, if your cam is not deleted, etc.
Perhaps you need to do cameraEffect again
You can assign Fired event handler to a unit that throws the grenade, then calculate when smoke starts going with https://community.bistudio.com/wiki/CfgAmmo_Config_Reference#explosionTime
OMG Yes - A rerun of cameraEffect displays it again (until I open up an arsenal / enter / exit zeus interface at which point I must run it again)
but this issue is so mundane
No idea why it happens, I didn't work with zeus too much
There is probably an event handler that fires when you close it
Otherwise you can check some other way
from some googling looks like I could check the Fired event handler _ammo for "BlueSmokeShell"
This EH has all the info about fired weapon - weapon, muzzle, mode, ammo class, magazine class, pick whatever you want to check
(_this select 4) isKindOf "SmokeShell"
```Will check if fired projectile inherits from base smoke grenade (your `SmokeShellBlue` does)
Or if you do params like in example in https://community.bistudio.com/wiki/Arma_3:_Event_Handlers#Fired
_ammo isKindOf "SmokeShell"
player addEventHandler ["Fired",
{
private ["_throwable", "_shooter", "_smokepos"];
_throwable = _this select 6;
_shooter = _this select 0;
if (_throwable isKindOf "SmokeShell") then {
_smokepos = getPos _throwable;
// code
};
}];
This will be initial position of a smoke grenade, not when it goes off
He'll need something like:
if(_ammo isKindOf "SmokeShell") then {
private _goes_off_at = diag_tickTime + getNumber(configOf _projectile >> "explosionTime");
// New thread that waits until time comes and prints coordinate into chat
[_projectile, _goes_off_at] spawn {
params ["_projectile", "_goes_off_at"];
waitUntil{diag_tickTime >= _goes_off_at};
systemChat format ["Smoke started at %1", getPosATL _projectile];
};
};
inside Fired EH
ah
if(_ammo isKindOf "SmokeShell") then {
_projectile spawn {
private _goes_off_at = diag_tickTime + getNumber(configOf _this >> "explosionTime");
waitUntil{diag_tickTime >= _goes_off_at};
systemChat format ["Smoke started at %1", getPosATL _this];
};
};
```Same thing but a bit simplier
is there a way to have dynamic variable names?
kind of like an incrementing variable name?
Thanks both you and elpepe, I have an idea of what im doing with this now
Basically I want to do this but instead of creating a marker, im trying to create a vehicle each time the script is executed.
if (isNil "PEPE_markerIndex") then { PEPE_markerIndex = 0 };
_pepemarkerName = format ["PEPE_%1", PEPE_markerIndex];
PEPE_markerIndex = PEPE_markerIndex + 1;
_pepemarker = createMarker [_pepemarkerName, _logic];```
Put vehicles into array
private _vehicle = createVehicle ...
PEPE_vehiclesArray pushBack _vehicle;
Is there a reliable way to turn FireGeometry selection names (from HitPart EH) to HitPoints selection names that HandleDamage EH ends up getting?
I would've done similar check to what engine done by checking radius of every HitPoints point (precalculated ofc) but unfortunately selectionPosition doesn't have return mode to return all points, only first, average or bound box, neither of which tell the full picture
I guess I'll need to ask for AllPoints return more for selectionPosition?
HandleDamage has a selection return as well as a hitpoint return. Is that not the same as the HitPart selection return?
I think you could use the return from getAllHitPointsDamage to convert between them as well
No, HandleDamage uses Hit-points LOD selections, HitPart uses FireGeometry. getAllHitPointsDamage returns Hit-points selections too, only some of them.
Example, tank turret hit in HitPart: ["otocvez","hit_main_turret"], HandeDamage reports hit_main_turret_point selection, getAllHitPointsDamage has hit_main_turret_point for HitTurret too
I'm making a script that changes the faction of the demining drone the players faction when placed. Where do I start?
is there a way to determine on which object a player/vehicle stands? Can lineIntersectsWith be used for that purpose, just a line vertically down? I want to determine if something/someone is on an elevator on the Nimitz
I'm working on a mission where players can earn tiered upgrades to gear and weapons from a limited ACE arsenal depending on their performance in jobs I give them. Is there some kind of scipt I could use to add things to an ACE Limited arsenal based on selections like Gear; Tier 1-3, Weapons; Tier 1-3, NVGs; Tier 1-3, etc?
I know I can get a raw array for ACE arsenal by exporting it in editor.
as long as the elevator is a proper object, why not?
You need to wait until drone crew is initialised and then create another group for them
In WeaponAssembled EH
just wondering if there might be a better way
how come we don't have a worldWorldToModel command to convert positionASL to positionRelative?
will do once i'm home
to clarify on this in case anyone was eyeballing it, issue was fixed by just executing that code in init.sqf rather than initServer.sqf
Can anyone (tagging: @meager granite since I'm using his code as base) explain how a Nested onEachFrame gives significant performance compared to a single onEachFrame?
For example:
testcenter2 = getPosWorld player;
if (!isNil "testmap2") then { deleteVehicle testmap2 };
testmap2 = createVehicle ["Land_MapBoard_F", player modelToWorld [0.2, 3, 0], [], 0, "CAN_COLLIDE"];
testmap2 setDir (player getDir testmap2);
testmap2 enableSimulation false;
testmaptexture2 = "map" + (diag_frameno toFixed 0);
testmap2 setObjectTexture [0, format["#(rgb,2048,2048,1)ui('RscDisplayEmpty','%1')", testmaptexture2]];
testframe2 = diag_frameno + 5;
onEachFrame {
private _displays2 = [
findDisplay testmaptexture2
];
if ( _displays2 findIf { isNull _x } < 0 ) then {
testdisplays2 = _displays2;
{
private _map2 = _x ctrlCreate ["RscMapControl", -1];
_map2 ctrlMapSetPosition [0.2, 0.2, 0.6, 0.6];
_map2 ctrlMapAnimAdd [0, 0.03, testcenter2];
ctrlMapAnimCommit _map2;
_x setVariable ["map", _map2];
private _marker_color2 = (["ColorRed", "ColorGreen", "ColorBlue", "ColorYellow"] select (_forEachIndex % 4));
_map2 setVariable ["color", getArray(configFile >> "CfgMarkerColors" >> _marker_color2 >> "color")];
displayUpdate _x;
} forEach testdisplays2;
onEachFrame {
{
private _map2 = _x getVariable "map";
_map2 ctrlMapAnimAdd [0, 0.03, testcenter2];
ctrlMapAnimCommit _map2;
displayUpdate _x;
} forEach testdisplays2;
};
};
};``` This is more stable than
```sqf
testcenter = getPosWorld player;
if (!isNil "testmap") then { deleteVehicle testmap };
testmap = createVehicle ["Land_MapBoard_F", player modelToWorld [0.2, 3, 0], [], 0, "CAN_COLLIDE"];
testmap setDir (player getDir testmap);
testmap enableSimulation false;
testmaptexture = "map" + (diag_frameno toFixed 0);
testmap setObjectTexture [0, format["#(rgb,2048,2048,1)ui('RscDisplayEmpty','%1')", testmaptexture]];
testframe = diag_frameno + 5;
onEachFrame {
private _displays = [
findDisplay testmaptexture
];
if ( _displays findIf { isNull _x } < 0 ) then {
testdisplays = _displays;
{
private _map = _x ctrlCreate ["RscMapControl", -1];
_map ctrlMapSetPosition [0.2, 0.2, 0.6, 0.6];
_map ctrlMapAnimAdd [0, 0.1, testcenter];
ctrlMapAnimCommit _map;
_x setVariable ["map", _map];
private _marker_color = (["ColorRed", "ColorGreen", "ColorBlue", "ColorYellow"] select (_forEachIndex % 4));
_map setVariable ["color", getArray(configFile >> "CfgMarkerColors" >> _marker_color >> "color")];
displayUpdate _x;
} forEach testdisplays;
};
};```
How would I loop through an array and use all possible combinations of all its values? e.g
private _arr = [1,2,3,4,5];
{
systemChat str _x;
} forEachCombination _arr;
//Would output something like [1],[1,2],[1,2,3] through to [5],[5,1],[5,1,3] and so on```
completely stumped here
use case is to output all possible combinations of hiddenselections + textures into an array to make my life easier
Hey
Second onEachFrame replaces the first once, its single EH, I use it for debug stuff
First layer is used to wait until findDisplay testmaptexture2 is not null, then it initialises and replaced OEF with one that does map animation
So I got 4 sounds for flashbangs Indoor close, Indoor distant, Outdoor close, and Outdoor distant does my fnc_flashbangThrownFuze determine which audio gets played for the distances?
I don't think you want all possible combinations because you can't use texture that's for index 1 at index 0
Unless you use some tiled or flat texture
we cannot tell you what your function determines…?
Yeah standby i’ll send it in a second
ah ok that makes sense got it
I think you wanted to ask how would your function do that ^^
please use https://sqfbin.com/ for big code chunks 🙂
just profile creating an array with that many arguments, like [9,9,9,9,9], that's how expensive it is.
its down 😢
/*
* Author: commy2
* Waits for the flashbang grenade fuze to trigger and 'explode'
*
* Arguments:
* 0: projectile - Flashbang Grenade <OBJECT>
*
* Return Value:
* None
*
* Example:
* [theFlashbang] call ace_grenades_fnc_flashbangThrownFuze
*
* Public: No
*/
params ["_projectile"];
TRACE_1("params",_projectile);
if (alive _projectile) then {
playSound3D ["Bang_Sound\Sounds\grenade_flash_start_indoor_close_1.ogg", _projectile, false, getPosASL _projectile, 5, 1.2, 50];
playSound3D ["Bang_Sound\Sounds\grenade_flash_start_indoor_distant_1.ogg", _projectile, false, getPosASL _projectile, 5, 1.2, 400];
playSound3D ["Bang_Sound\Sounds\grenade_flash_start_outdoor_close_1.ogg", _projectile, false, getPosASL _projectile, 5, 1.2, 50];
playSound3D ["Bang_Sound\Sounds\grenade_flash_start_outdoor_distant_1.ogg", _projectile, false, getPosASL _projectile, 5, 1.2, 400];
["ace_flashbangExploded", [getPosASL _projectile]] call CBA_fnc_globalEvent;
};```
Here's what it says
This (maybe) plays 4 sounds, which are audiable at distance < 50m and only _distant is heard out to 400m. Both indoor and outdoor are played.
Yeah thing is how do I get it to know which sound to play outdoor and indoor yk
Nvm
It's soundshaders
Eh? It's for auto generating config file
{
class Toka_soundtweak_Flash_closeExp_SoundShader
{
range = 15;
rangeCurve[] = {{0,1},{5,0.75},{15,0}};
samples[] = {{"",1}};
volume = 1;
};
class Toka_soundtweak_Flash_midExp_SoundShader
{
range = 2200;
rangeCurve[] = {{0,1},{100,1},{500,0},{2200,0}};
samples[] = {{"",1}};
volume = 1;
};
class Toka_soundtweak_Flash_distExp_SoundShader
{
range = 2200;
rangeCurve[] = {{0,0},{100,0},{250,1},{2200,1}};
samples[] = {{"",1}};
volume = 1;
};
};```
What do I put in here to have indoor and outdoor
You might need to ask #arma3_config about that
I'm using CBA_fnc_parseJSON to parse a JSON (duh) and getVariable to retrieve certain fields. It seems that if the field doesn't exist then getVariable does nothing. Is there a way to check whether the field doesn't exist? isNil and isNull didn't work.
Here's the function if needed:
You could try intersect and if specify a range to be in which an 'indoor' area is considered or get pos of the projectile and check if its inside a building / house.
Here's a sample script that uses intersect and selects the door aimed by the player inside a building.```sqf
// Allow players to breach a 'locked' door in a building with a shotgun
player addEventHandler ["Fired", {
private ["_shooter", "_magazine"];
_shooter = _this select 0;
_magazine = _this select 5;
_houses = nearestObjects [_shooter, ["house"], 10];
if (count _houses > 0) then {
_house = _houses select 0;
// _shooter sideChat format ["Nearest House: %1", _houses];
private _intersects = [];
{
_intersects = ([cursorObject, _x] intersect [ASLToATL eyepos _shooter, (screentoworld [0.5,0.5])]);
if (count (_intersects select 0) > 0) exitwith {
_intersects
}
} forEach ["FIRE","GEOM","VIEW"];
// _shooter sideChat "Found Intersect";
if (count _intersects > 0) then {
_intersect = _intersects select 0 select 0;
_dist = _intersects select 0 select 1;
// _shooter sideChat "Checking _is_door";
_is_door = [false,true] select (["door",_intersect] call BIS_fnc_inString);
// _shooter sideChat "Checking _magazine";
if (_is_door && _dist < 3 && _magazine == "rhsusf_5Rnd_Slug") then {
// _shooter sideChat format ["Breaching Door: %1", _intersect];
_select_door = format ["%1_rot", _intersect];
// _shooter sideChat "Animating";
_house animate [_select_door, 1,false];
};
};
};
}];```
like this? https://feedback.bistudio.com/T172195
Hit points config links fg and HP pods selections, right?
Nope, very little hit points have like to their FG components, no idea how it works
class HitEngine2: HitEngine1
{
name = "engine_2_hit";
convexComponent = "engine_2_hit";
};
Not sure if this convexComponent is even from FG
Yes exactly, or should anyway
After studying how it all works, I come to conclusion that there should be something like HandleDamage but from shooter side
The goal I'm trying to achieve is to connect projectile hits to corresponding HandleDamage, mainly to get full info about the shooter, secondly to build detailed damage report.
So far from all my tests I was unable to reliably tell which FG component in HitPart does damage to which HP, there are tons of FG components and the only way to tell which HP vertices they contain would be to return these vertices
selectionPosition can only return first, average or bounding box of these HP vertices
Did some tests trying to come up with approximate FG->HP conversion but couldn't make it reliable
Made a ticket requesting AllPoints return mode: https://feedback.bistudio.com/T172188
If I could iterate through each vertex in each HP selection and see what FG they're inside, then I can tell which FG belongs to which HP
Hardcoding the conversion is not an option of course
Sorry everyone for requesting suggesting getPosWorld and setPosWorld back in the day (https://feedback.bistudio.com/T78632), instead of say getPosOrigin and setPosOrigin creating much confusion for modelToWorld/worldToModel and its variants commands like modelToWorldWorld.
Though modelToWorldWorld should've been called modelToWorldASL
Speaking of getPos* commands, had a need for getPosAGL to skip one command when doing ASLtoATL getPosASL because muh microseconds
why would this be undefined in initPlayerLocal.sqf ?
trying to do this addEventHandler
this is for entity init fields (and trigger fields?)
oh gotcha, that makes some sense. I assumed this would be the current client. Thank you
There's just no this in scripts
Are there ways to check if a object is either dynamically or globally simulated ?
https://community.bistudio.com/wiki/dynamicSimulationEnabled
You can check an object's current simulation state with simulationEnabled, but only its simulation state on the local machine. You can't tell if it's currently sim disabled on a different machine, unless of course you know its state has been globally set.
Thanks, didn't see that one on the wiki 
How do I generate a diaryRecord for all players using remoteExec?
I tried this but it doesnt seem to work:
{
["notes", "Notes"] remoteExec ['createDiarySubject', _x];
["notes", ["Factory Note 1", "Note text here "], taskNull, "", false]; remoteExec ['createDiaryRecord', _x]
} forEach units player;
I used this code in a "hold action" section of an object.
would it work if instead of looping through the player list I just ran the remoteExec with player as one of the arguments?
i like how the description of this chat is literally impossible to execute in sqf
change units player to call BIS_fnc_listPlayers
even if chat here was a valid command :P
also you have extra ; there
yeah i noticed
But is it a good practice?
*looping through all players with remoteExec
i would just run the whole thing on each client (without remexec) but IDK what you are trying to achieve?
I want one of many players to find a note, but the note contents are shared across all clients
i wouldnt say its bad unless you have to do it many times
Then its fine I guess
yeah
you can also give list of players straight to remoteExec (as targets) but IDK if that matters a lot (and not loop)
oh yeah targets works
Would I be able to;
[player, "notes", "Notes"] remoteExec ['createDiarySubject', BIS_fnc_listPlayers];
or give the players side as target (west or east or resistance)
you need call for BIS_fnc_listPlayers
and player doesnt exist in dedi server
ah, not even in the remoteExec context?
nope
["notes", "Notes"] remoteExec ['createDiarySubject', west];
["notes", ["Factory Note 1", "Note text here "], taskNull, "", false] remoteExec ['createDiaryRecord', west]
createDiaryRecord does need an object parameter though,
unit createDiaryRecord [params]
something like that , not sure though about the order in which those commands are executed though, could be an problem
"message" remoteExec ["hint", 0]; // sends a hint message to everyone, identical to "message" remoteExec ["hint"]
"message" remoteExec ["hint", -2]; // sends a hint message to everybody but the server
"message" remoteExec ["hint", myCar]; // sends a hint message where myCar is local
"message" remoteExec ["hint", -clientOwner]; // sends a hint message to everybody but the current machine
oh right then my code doesnt work
that's why I was looping through the playerlist at the beginning
right
yknow im gonna stick to the player list thing
private _playerList = call BIS_fnc_listPlayers;
{
[_x, "notes", "Notes"] remoteExec ['createDiarySubject'];
} forEach _playerList;
private _playerList = call BIS_fnc_listPlayers;
{
[_x, ["notes", "Notes"]] remoteExec ['createDiarySubject', _x];
} forEach _playerList;
target is a must?
i think its like that, this remexec stuff is bit complicated
default target is 0 which means it sends to all
"message" remoteExec ["hint", 0]; // sends a hint message to everyone, identical to "message" remoteExec ["hint"]
its essentially the same anyways
still worrying about the order of the commands
I would personally just create a function that adds the diaries and remoteExec that
Yes. But if you do that in forEach, every one remoteexec for everyone same code again and again.
So you need add target where current code will be executed.
You can also call your code.
Like example
[player, [primaryWeapon player, 1]] remoteExec ["setAmmo", MyGroup]; // WRONG: the local player object is used here!
{ player setAmmo [primaryWeapon player, 1]; } remoteExec ["call", MyGroup]; // CORRECT: the remote player object is used here
Or above (if you scroll up) was couple version how remoteexec call works
Wasnt player ignored in the dedicated server context?
And the call way is simply awesome, just what I needed as a workaround
I assume this is your way to say "yes, player is in dedi server aswell"?
player can be used in a mission that's hosted on a dedicated server.
It cannot be used in code that's executed on the DS machine itself, because there is no player on a DS.
In the second example, the code containing player is not being executed on the DS. It's being prepared as a Code data type, and sent, unprocessed, to the client which will execute it.
Any suggestions on how I can make an object that is a modded object preform an action that's unique to it in its action menu?
So we cant have multiple objects displaying map view from different positions that is also updated as the changes are happening? I tried to use this example to create two maps but as soon as the second one is executed, the first one stops updating its display. Any ideas how/why?
Wait actually I can by adding it to the displays - need to figure out how to add them in the array and finddisplay in runtime
as Sa-Matra said you can only have one onEachFrame at a time (only the last one executed will be the "active" one)
OneEachFrame, you might say
I am a dumbo and skipped the part about getVariable default value. You can do e.g. _x getVariable ["units", []] to return an empty array (which I needed) in case the variable is undefined.
isNil and isNull didn't work.
isNil {_x getVariable "units"}
isNull wouldn't work anyway
yeaaaah
figured it out 😛
though that getVariable would return something when the variable is not defined
guess not (by default)
if you mean the one with default value, yes
what's the UserActions condition? Is it standard addAction condition params or?
Please ping me, I have a large area that I like to clear the grass, is there a script that I can set onto a trigger or a marker. Drop the link if there's a YouTube video or Reddit post thank you
Starting a youtube series on coding - going to cover everything, and once the basics are down, walk through the whole completion of a public gamemode w/ extDB saving to MySQL ect - https://www.youtube.com/watch?v=Tq9zOTZgxBU&list=PLOax498Sls3qC_oqq0i7FTXuLiGBZokYc
@grizzled cliff It should be
if (script) then { systemChat "here"; };
relevant username
indeed
lack of boolean comparisons is annoying in the rare chance you need them
Is there a way to make ai not automatically decide where to move like with disableAI "PATH", yet still move when doMove is issued?
There are several different types of automatic movement. Was there anything specific that you wanted to block?
In fsm i use doMove on unit, since it needs to get within ~3m to attack. However natural response of ai is to run away (ai is unarmed) when enemy is detected. So it feels like im constantly fighting it.
It works if i set ai to careless but that brings other problems
Disabling FSM while you're using FSM seems like a bad idea
If it's a scripted FSM then it's still going to run.
It is a custom fsm so i guess ill give it a shot. But what exactly does disableAi "FSM" cover?
Just responses or also seeking etc?
I still want it to respond to given waypoints
Not sure, I've never read (or found) the native FSMs.
From what i understand they arent publicly avalible.
I did a test once where I had to make an AI run towards an enemy without stopping to shoot. I don't think I wrote down the method though.
Might have used careless + set movement speed.
but even careless will shoot sometimes.
autotarget as well maybe.
Yup, it works that way. But its target seeking ability seems to be quite inhibited.
Also it tends to stop midway, if distance is long enough to "think". (Thats the annoying part)
I was going to say you should specify that publicvariableclient can only be run from the server, but killzone kid said starting 1.43 it works client to client if you know the owner id of the target
^ and thank god for that
could probably still specify that owner has to be run from the server
lol, I was thinking the same thing, but I can live with it
could have the server set a variable on them when they connect of their clientID, but then you run into whether it's worth it to getVariable the clientID and then send them the publicvariableclient versus having a function you call on them to set your chosen variable
Fire particle damage is so stupid, staying 5 meters away from camp fire keeps damaging you (and firing tons of HandleDamage) and does 0 or almost 0 damage (5.62454e-010 and such)
I wonder how much processing goes into vehicle wreck fire trying to damage everything around them, would FPS improve if this damage check was removed
I also remember back in the day damage used to be local->global as in damage was X number of clients in the game, but I think that was fixed
Wondering if anyone can offer some help, currently using this CUP to Livonia building replacement in my custom Overthrow scenario, the problem being is that it does not account for houses that are already spawned and saved in by the scenario, so I'm getting multiple copies of houses spawned in on top of each other and it's causing conflicts. I've tried many different solutions to check whether there is already a house object spawned in within 5 meters and if so to not place a new one however any changes seem to break the script, not really experienced in scripting so any help would be appreciated.
https://github.com/lelop15/CUP-To-Contact
Try changing
if (isObjectHidden _x) then {continue};
```to
```sqf
if (isObjectHidden _x || getObjectType _x != 1) then {continue};
Just tested and still seems the problem is persisting, building replace script is creating a house object and overthrow is also loading in it's own object for player owned houses, not sure if it could be something to do with the load order of the scripts as well, cant really touch the OT spawned house as a lot of game elements are tied to the house object
I have no idea what is "Overthrow" or how it works, but yeah, forcing order of scripts could be the solution
Change
class postInit{postInit=1;};
```to
class postInit{};
call ctc_fnc_postInit;
```after your other stuff, whatever you run
Thanks will give it a go, yeah it's my own custom fork of the Overthrow scenario, I might have to check with their discord in case it could be something with the custom save/load system causing issues
so im tryna make something that sets a players setUnitFreefallHeight . My code is in an init event handler, which works but when the player respawns it resets, how do i fix that?
is there a better event to hook onto, or should i hook onto both init and respawn, im also not sure about locality and if i need to run this for everyone or just where the player is local
what is the easiest way to remove a specific object from an array that is having units added and removed from it at the same time?
i've got an array that detects players in a distance but once they leave that distance from a object i can not remove them from the script i want to apply as they are in a variable
from the wiki: "If no value is returned, the default damage processing will be done." https://community.bistudio.com/wiki/Arma_3:_Event_Handlers#HandleDamage
_array deleteAt (_array find player)
Change the init event to a respawn event. So that it sets it when the player respawns. You will need to run a remoteExec with JIP flag to apply it to every player. Or config it to run at init.
Alternatively just set the variable inside onPlayerRespawn.sqf event script for a mission side solution
Is is possible to execute Hold Fire (same command like in the vanilla command menu) via script? If I use any of the setCombatMode then the units either go back into formation or engage. But I only want to put them on hold fire.
SetCombatMode will switch them to hold fire, but if they are commanded by an AI and can see enemies they will switch back quickly.
Maybe add _x disableAI "COMBAT"
The problem with SetCombatMode is that it also triggers to go into formation or engage. But I only want the units to hold fire.
Sorry, its 'Autocombat', disable that AI feature.
Unfortunately, this does not seem to work for player's group AI outside a vehicle.
it simply prevents the current script from being saved in a savegame
if you only do no-save/MP, you're good
Trying to delete a vehicle if it exists on a helipad. Here's the method:
padObject = missionNamespace getVariable "pad_alpha";
_veh = (nearestObjects [padObject, ["AllVehicles"], 10]) select 0;
if (alive _veh) then {
deleteVehicle _veh;
sleep 0.3;
};
It works perfectly when there is something on the pad, but throws an undefined variable error when there isn't as the if statement doesn't catch this. I've tried alive, !isNull, and !isNil and none of them have caught it. Can anyone lend a hand?
If there are no vehicles, nearestObjects will return empty array.
[] select 0 => nil, so when i'll try to feed nil into some command (alive) it will throw the error.
Why delete only the first vehicle btw?
You need a count check to see if array is empty before getting its first vehicle.
private _vehs = nearestObjects [padObject, ["AllVehicles"], 10];
if(count _vehs > 0) then {
private _veh = _vehs select 0;
if (alive _veh) then {
deleteVehicle _veh;
sleep 0.3;
};
};
Also looks like you used !isNil wrong, proper check would've been:
if (!isNil "_veh" && {alive _veh}) then {
```but doing count check is more valid approach here than to select from an empty array.
ahh gotcha, thanks
never expecting more than one
while you're here, could you help with calling a function... if I add this through zeus it works but not through eden editor:
padObject = missionNamespace getVariable "pad_alpha";
pad = getPosATL padObject;
dir = getDir padObject;
removeVehicle = {
_vehs = nearestObjects [padObject, ["AllVehicles"], 10];
if (count _vehs > 0) then {
private _veh = _vehs select 0;
if (alive _veh) then {
deleteVehicle _veh;
sleep 0.3;
};
};
};
this addAction
[
"Spawn MH-6M",
{
call removeVehicle;
// code continues
padObject is not defined in that function
Otherwise this looks like it could work in Init field
padObject = missionNamespace getVariable "pad_alpha"; is a line before the function declaration
will edit for clarity
Where do you add this anyway? In Init fields?
yes
Your assignments will execute once on Init and that's it. If your "pad_alpha" was undefined, your padObject will remain nil forever
Even if you define "pad_alpha" later, assignment was done during initialisation
it only doesn't work when moved into a separate function
ah i think i'm understanding
Btw, unless you're swapping namespaces, you can just use pad_alpha instead of missionNamespace getVariable "pad_alpha"
_vehs = nearestObjects [pad_alpha, ["AllVehicles"], 10];
this script goes on several objects with different pad names, wanted an easy way to only have to change the name in one place
If you use same script on different objects, your global padObject variable will be overwritten with different pad_* variables
if I prefixed the variable with an underscore, it wasn't accessible from the action methods
what is correct?
Yeah because underscored names are local variables
Coming from other languages, the scoping on this is really bizarre
Overall, you're structuring it wrong and need to rethink how you define stuff
Its really simple, there are global variables and there are local variables that exist until {} scope ends.
Define one function somewhere (Like init.sqf):
removeVehicle = {
_padObject = missionNamespace getVariable _this;
_vehs = nearestObjects [_padObject , ["AllVehicles"], 10];
if (count _vehs > 0) then {
private _veh = _vehs select 0;
if (alive _veh) then {
deleteVehicle _veh;
sleep 0.3;
};
};
};
then add actions where you need them:
this addAction
[
"Spawn MH-6M",
{
"pad_alpha" call removeVehicle;
...
Could also use some better function naming because removeVehicle looks very close to a scripting command deleteVehicle, you can't redefine those
There is also this, a structured way to add functions: https://community.bistudio.com/wiki/CfgFunctions but you can disregard that and just dump it all into init.sqf
Beware though, vehicle Init fields are done before init.sqf so if you define some function in init.sqf and try to call it from Init field, it won't work.
All I need to do to make this functional is make these variables local while still being able to reference them within action methods:
padObject = missionNamespace getVariable "pad_alpha";
pad = getPosATL padObject;
dir = getDir padObject;
I don't mind having code that isn't terribly clean. Is it possible to do this?
Hello! I'm entirely new to ArmA mod making so keep that in mind. Is it possible to interact with any kind of filesystem library to write files? I'd like to record some actions my player does and outputs them to a cache or whatever file so that i can use it elsewhere.
Its not about clean, you don't understand scopes. If you'll have several Init fields doing something like:
padObject = missionNamespace getVariable "pad_alpha";
```and another
```sqf
padObject = missionNamespace getVariable "pad_beta";
```guess what happens, one writes to `padObject`, then another overwrites `padObject` again.
I understand that
Do you only have single padObject? I guess its "Vehicle name" is pad_alpha?
Only through extensions: https://community.bistudio.com/wiki/callExtension
Variable name
There are multiple with ascending names in the phonetic alphabet
Variable names are essentially game putting this entity into this variable name.
You can address this object with pad_alpha
so essentially i'd have to build a dll through some c/cpp coding?
to achieve what i want
Yup
Yes.
some exist already, but yeah the base game doesn't allow you that
so far!
I understand this, what I'm asking is is it possible to make the variable local while also being able to reference the variables inside the addAction methods. Referencing it's variable name pad_alpha throughout the code is not what I'm going for as I want this variable to only have to be replaced once in the code to change the name of the pad referenced. Does that make sense?
would that even be allowed on the workshop
Local to addAction code? When you execute an action, it creates a brand new scope with few predefined local variables. Init field is a separate scope, as soon as script defined there is complete, all your local variables are lost.
Init field:
_some_local_var = 123;
this addAction ["action", {
//this is a completely new scope, _some_local_var is not available here
}];
There are arguments to addAction though, but they're static, you can't change them after you added addAction
I understand this which is why I made the variables global without realising other scripts could access and overwrite it. Is there no middleground between these two types?
_some_local_var = 123;
this addAction ["action", {
diag_log (_this select 3); // 123
}, _some_local_var];
Are you trying to change what is pad_alpha during gameplay? As in it was one helipad but then later changed to another?
I am not
I'd like to be able to copy the code in the editor and paste it into different areas only having the change one string at the start to reference a pad name
would that be safe for workshop?
A proper way would be to have your code in the files and not Init fields
But here is how you could have it done your way:
_padObject = missionNamespace getVariable "pad_alpha";
_removeVehicleFunction = {
_vehs = nearestObjects [_this, ["AllVehicles"], 10];
if (count _vehs > 0) then {
private _veh = _vehs select 0;
if (alive _veh) then {
deleteVehicle _veh;
sleep 0.3;
};
};
};
this addAction
[
"Spawn MH-6M",
{
(_this select 3 select 0) call (_this select 3 select 1);
},
[_padObject, _removeVehicleFunction],
...
You have your function and pad object as local variables at top of the Init field, then add action and have your local variables stored as arguments for action function
You can customize your function in each Init field as well as what pad object is
But this is a really clunky way of doing it all
Trying with just on provided variable...
this addAction
[
"Spawn MH-6M",
{
_pad = getPosATL _this select 3;
// continues
},_padObject, 1.5, true, false, "", "true", 5
];
Should the line be _pad = getPosATL _this select 3 select 0; even when one variable is given?
(_this select 3 select 0) turns into _this inside (_this select 3 select 1) function
Oh wait I didn't read the rest of your post 
_pad = getPosATL(_this select 3);
unary commands (getPosATL ENTITY) are always called before binary commands (ARRAY select INDEX)
So game was trying to do getPosATL _this and _this is array of addAction crap
yes; though it is recommended you keep your source code exposed.
github or other methods
A guide to the grammar and syntax of ARMA 3 SQF.
Got it working, thanks a bunch
I know and normally I'd want to make it as clean as possible but I'm not feeling great and just want to get it working
You can just do:
_padObject = _this select 3;
_pad = getPosATL _padObject;
_dir = getDir _padObject;
```to avoid `select 3` every time
yep no worries on that
most of my work is open sourced
why do i keep getting this error everywhere?
"this declaration has no storage class or type specifier"
What do you mean? The red line?
i could remove the error squiggles but i'd still like to keep intellisense on
Unrelated “error”. No need to think
Probably just remove the highlighter or something. I'm not very familiar with VSCode (I assume)
ig it was my intellisense complaining because this file wasn't compilable
hmm
do I need to create a meta.cpp file or is it created automatically?
seems like scripted FSM danger is also disabled via disableAI "FSM".
On topic of FSMs
4 - DCExplosion, // explosion detected
is never a cause. no matter how close explosions are to ai
Are Public Variables JIP enabled?
Yes
Great thanks
Is there a way, by way of script, to set the name of a target as it would appear on a radar when marked?
I believe it references the target's type, so outside of making a whole modded vehicle with that name... :/
Shoot; Fair enough. My hope was that I could easily script something in to create a target
What effect are you trying to create?
There's been a few times I've wanted to rename assets. One scenario for example, if I wanted to have an 'prototype' vehicle, to be able to rebrand it as such
But I don't necessarily want to create a whole vehicle in an addon to do it for one mission
Hi, having a syntax problem and cant solve it. How can I use a variable for the text below?
private _MeterLoop = player distance (units group player select 1);
["<t color='#db1a1a' size='.4'>["%1", _MeterLoop]</t>",-1.17,1.05,4,0,0,789] spawn BIS_fnc_dynamicText;
Ah, yeah. Only thing I could think to work around with that is a 'on locking this object, player comments 'wow my radar reports X but it doesn't look like an X!'. Just gotta work with the systems you're given.
Fair enough. I didn't consider an event handler
I mean, it's still not quite the impact you want, but it's the best you can do 😛
Bluh, sorry, the text clipped half off the screen and on second review, it didn't work as expected.
private _MeterLoop = player distance (units group player select 1);
[format ["<t color='#db1a1a' size='.4'>%1</t>",_MeterLoop],-1.17,1.05,4,0,0,789] spawn BIS_fnc_dynamicText;
Something like this?
Brilliant, thanks a lot for your help!
Hello, I've seen a script on a server that allows the player to edit the inventory of all vehicles, that are in a certain area... So far, I haven't found that script... do you know where I can find that? Cheers
Is there a way to show multiple texts on screen? It seems that ```sqf
BIS_fnc_dynamicText
always overwrites the existing text, even if it is in a different corner of the screen.
You need to use a different resource layer.
how can I do that please?
Just pick a different number for the last parameter. If you want to avoid tripping over other mods then this function to allocate them:
https://community.bistudio.com/wiki/BIS_fnc_rscLayer
I am using the following code but it gives me syntax errors:
if (combatMode player == "BLUE") then {["<t color='#1a81db' size='.4'>Blue Mode</t>",-1.33,1.05,4,0,0,789] [1] spawn BIS_fnc_dynamicText;};
if (combatMode player == "GREEN") then {["<t color='#16c728' size='.4'>Green Mode</t>",-1.33,1.05,4,0,0,789] [2] spawn BIS_fnc_dynamicText;};
if (combatMode player == "YELLOW") then {["<t color='#dde33d' size='.4'>Yellow Mode</t>",-1.33,1.05,4,0,0,789] [3] spawn BIS_fnc_dynamicText;};
if (combatMode player == "RED") then {["<t color='#db1a1a' size='.4'>Red Mode</t>",-1.33,1.05,4,0,0,789] [4] spawn BIS_fnc_dynamicText;};
if (combatMode player == "WHITE") then {["<t color='#f5f7f6' size='.4'>White Mode</t>",-1.33,1.05,4,0,0,789] [5] spawn BIS_fnc_dynamicText;};
Where shall i put the layer?
blinks
["<t color='#1a81db' size='.4'>Blue Mode</t>",-1.33,1.05,4,0,0,789] <- The "789" here.
The extra [n] you put in is nonsense syntax.
Did you read this: https://community.bistudio.com/wiki/BIS_fnc_dynamicText
So 789 is the layer number?
Yes.
Got it, thank you!
what would be the easiest way of adding a button to the menu when you press escape?
the only resource I found on this is a library from 2013 and it's outdated, everything else is about creating actual UIs and not "appending" buttons
ctrlCreate with RscButton as ctrl type
I think rhs does it for their stuff, could check that out for reference
Is there a way to check if AI can reach certain position or not calculatePath returns positions array even tho AI could never reach that spot.
Example AI is on the ground and position it wants to reach is on the rooftop (no ladder/ramp avalible)
So what type of execution / locality does diag_frameNo use?
local to where it was executed.
It returns the number of the current frame (as in rendered frame) since the game was opened. It has no arguments, and only returns one number.
So...it can only return the value for the local machine.
yeah but that's a button in general
my goal here is to insert a button within these ones
well unfortunately i'd like to keep my addon dependency-less
I didn't say use CBA. I said check how they do it
So in ctrlSetPosition what do the x,y,w,h mean? Since its a 2D display box, you'd only require 2 coordinates right? Like aren't the width and height of the control already specified by x and y?
No, they aren't
More so in the wiki description:
For 3D control, param is relative [x, y, z]. where as in Syntax 3: controlName ctrlSetPosition [x, z, y]
from what i've seen they basically simulate the behavior of arma menu buttons
i can't find the function where those are created tho
yeah I guessed that's what it does too. in that case just forget about it. you'd cause a conflict with CBA.
just add the button somewhere else
i wouldn't be able to go through that jungle of sqfs anyway
i thought of adding that button at the top-middle of my screen but i'm not too sure how to make it appear only when the escape menu is opened
do i have to use findDisplay to check whether the escape menu is opened?
[missionNamespace, "OnGameInterrupt", {
params ["_disp"];
}] call BIS_fnc_addScriptedEventHandler;
i assume _disp is a boolean
or...
wait
it's a display
why would it matter?
to remove/close the button upon game unpausing
what menu?
you don't need to
when you unpause the game the display gets destroyed
and everything in it goes with it
so any UI elements created after the game gets interrupted are destroyed once the pause menu is closed?
or do we have to explicitly tell Arma that an UI is apart the pause menu
i have very little experience with UIs in general so excuse me for my pretty narrow knowledge
||and i also can't type today||
the pause menu is a "display"
a display is a "layer" containing "controls"
controls are "ui elements" as you put it
when you unpause the game the display is destroyed
so obviously everything in the layer is gone
thanks for the clarification
so i have to call ctrlCreate on the display
to create the button
thx for the help
Could anyone give me a hand on how to add an ace interaction? I've been reading the docs and this is as close as I have gotten but it's not appearing.
_action = ["SpawnVehicle","Spawn Vehicle","",{hint "Spawning vehicle...";},{true}] call ace_interact_menu_fnc_createAction;
[this, 0, ["ACE_MainActions"], _action] call ace_interact_menu_fnc_addActionToObject;
link to docs?
yes
did you try from debug console in the mission?
_this instead of this if you are adding it here.
dunno never used that
tried that too
Works fine for me
how big is your object?
maybe you're too far from the center?
that might be it
Ah you are using the Aircraft Factory - Its a big object
there's a parameter for distance but there are some other parameters I have not defined in between, how do I ignore those and only set the distance?
give them the default value all the way up to the distance one
the default values are not specified
or set them null maybe
tried setting to null and distance of 30, still can't find it
those that are any -> nil
those that are string -> ""
code -> {}
and set the pos to [0,0,0]
_action = ["SpawnVehicle","Spawn Vehicle","",{hint "Spawning vehicle...";},{true},{},nil,[0,0,0],20] call ace_interact_menu_fnc_createAction;
[_this, 0, ["ACE_MainActions"], _action] call ace_interact_menu_fnc_addActionToObject;
still unable to find it
even tried distance of 50
why not try on another object to make sure everything works before moving onto this one?
it maybe not be due to dist anyway
It works for other objects - The specific object hes trying to add it to is too big (like a building)
oh well
Recommend having an invisible object and then adding this function while within the Aircraft Factory building.
i have an easier problem, i hope: i'm using a trigger and this code to repair and refuel a vehicle
thislist spawn {
{_x Setdamage 0} Foreach _this;
{_x Setfuel 1} Foreach _this;
{_x setVehicleAmmo 1} Foreach _this;
};
I would also like to message the crew in the vehicle while this is happening, this is what I tried:
thislist spawn {
{
hint "Your message here" to _x;
} forEach crew _this;
};
But I am getting an error
That sounds like an idea, i'll try that ty
hint .. to is a very incorrect code I must say
["Your message here"] remoteExec ["hint", thislist select { isPlayer _x }];
```I guess
Alternatively you could use vehicleChat
this works perfectly, thanks
could you explain how it works if you have the time?
Basically, you are executing the hint function remotely (meaning, to all players (identified by isPlayer _x in your trigger area (identified by thisList )
ah got it, thanks
my brain is deep fried. will this properly set a public variable named "endCDC" to the boolean true?
missionNamespace setVariable ["endCDC", true, true];
And enforce that True upon JIP
so a question regarding CBA scripting: Im trying to use the waitAndExecute fnc to fire off a flashbang effect 5 secs after a submunition is deployed. Now when I use the following:
[{ systemChat str _this}, [_this], 5] call CBA_fnc_waitAndExecute;
works just fine and reads back the submunition correctly
however if I use:
[{ _this call ace_grenades_fnc_flashbangthrownfuze}, [_this], 5] call CBA_fnc_waitAndExecute;
nothing happens, has anyone tried anything like this? or have an idea where the error could be?
currently the SQF is tied too cfgFunctions which in turn is in a class EventHandlers init in the submunition ammo code
it should yes
yeah it seems to be working
rest of my stuff isn't tho :(
I have a holdaction that when it completes should do remoteExec ["AID_fnc_intel_securityDone", -2]
and that function shows up just fine in the functions viewer, so my cfgFunctions is working
but it's not actually doing it
even though the function is laughably simple
literally just 2 sideChats and that previous "set this variable to true, globally"
I don't get it
Maybe I need to call the function some different way?
.....wait
maybe it's because of the environment, brb.
Okay that was totally it
note for other morons testing shit on their own machine
if you set the remoteExec param to -2 to avoid it executing on the server when it's on dedi, it won't execute on your machine when you're testing it locally in "test multiplayer"
ta-daaa, don't code "for dedi only"
[0, -2] select isDedicated
pleased as punch with my growth as a scripter to look again at the wiki page and understand what I was doing wrong without someone telling me, tho!
wait, what would that look like with the whole context
just replace -2 with that extract
so ["AID_fnc_intel_securityDone", [0, -2] select isDedicated]?
if the function is extremely simple, go for 0
but yep
(if done on server ofc)
hmm it's a holdaction so I'm gonna write that method down for later but use 0 here
thanks, you're a saint
Speak freely, @stark fjord
Im having a weird issue with Init event handler and createSound
So this is how event handler is defined inside CfgVehicles
class EventHandlers
{
init = "[_this select 0] call MST_FNC_monster_init;";
deleted = "[_this select 0] call MST_FNC_monster_delete;";
killed = "[_this select 0] call MST_FNC_monster_delete;";
};```
MST_FNC_monster_init
```sqf
params["_monster"];
if (isServer) then
{
private _sound = createSoundSource ["SFX_monster_loop", position _monster, [], 0];
_sound attachTo [_monster, [0, 0, 0], "Head"];
_monster setVariable ["MST_Sound", _sound];
};```
MST_FNC_monster_delete
```sqf
params["_monster"];
if (isServer) then
{
private _sound = _monster getVariable ["MST_Sound", objNull];
if (!isNull _sound) then
{
deleteVehicle _sound;
};
};
Event handler fire OK, sound gets created and deleted ok.
So the funny thing and it only shows on dedicated server:
When i create monster for the first time, 1 sound is created and 1 sound is deleted when i kill/delete monster.
When i create monster 2nd time 2 sounds are created?!? but 1 sound is deleted,
Third time 3 sounds are created but 1 sound is deleted, and so on you get the idea.
More funny things, when i create same monster as diffrent side, lets say OPFOR after that,
again 1 sound is created and 1 sound is deleted...
Any thoughts and prayers on that?
I've spoken
how does it even know how many times it was created ....
Also monster_init also create some clientside effects with if (hasInterface) then { check, and that does not create multiples of...
do you miss some params to define _monster perhaps?
nono its there, sound does get created and plays just fine...
It just with if i spawn N monsters, it creates N*N sounds 😐
(thonks)
both the code and config seem ok
and it seems to work properly on hosted, so idk 😐
it only shows on dedicated which is wierd... i guess i can just
{
deleteVehicle _x;
} forEach allMissionObjects "#dynamicsound";``` as a workaround... but sound does get earrapingly loud at about 6th one spawned (and rest are dead/Deleted)
Does anyone know the best way to remoteExec bis_fnc_dynamictext? Should I just shove it into a custom function like I have all my other shit, and execute it?
yes
Okay to follow up on this, it only happens when unit is deleted, either via deleteVehicle or Zeus delete.
First time its deleted it works fine.
Then when i spawn it again Init and Delete event handlers fire twice on server, but only once on client as expected.
Third time its deleted both event handlers fire 3x and so on. always only on server.
It is also side related as if i spawn same unit but different side then it works normally again until i delete that unit.
Also if i use 1st syntax of createUnit on server, dynamic sound gets created on server, and is at valid position and attached, but it doesnt play a sound.
If its created on client it works fine.
alt syntax works fine in every case.
did you check if _sound returns null after deleting the first time?
im guessing each time you create a monster it has a unique id?
Do anyone knows a good script for periodically spawning groups of infantry and vehicles and make them move towards a point? (either preconfigured units or editor placed). I tried a couple scripts: DAC and JEBUS, but neither allows me to spawn units on demand, they only respawn units when they die. There's also DMP, which is great but it doesn't have anything to order units to move.
Sound gets deleted alright.
Issue is init event handler fires lets say 3 times. 3 sounds are created, only last one is stored in variable, that one gets deleted, other 2 stay.
like lou said the code you posted looks fine it comes down to how you call it and create the unit which we cant see
With createUnit. And code is called from cfgvehicle event handlers
As ive said, issue is init and delete evt handlers fire multiple times after unit is deleted, only on server.
@hallow mortar after copius amounts of...testing i finally figure out what's causing the issue with the S-300 if you remember
it's cba, i don't know why it's cba, i basically stripped down the mission and script to just the S-300 part, and launched the game with just pook sam pack, and cba_a3, and this issue occurs, and doesnt occur when CBA_a3 is not loaded!
so yeah
what now?
I have absolutely no idea
crap
nvm it isnt, i just tested with just the mod without cba and it still occurs, ik you cant do anything but i figured i'd let you know
@stark fjord strange that, out of curiosity have you run a debug like the below to make sure that _monster is unique and doesn't have a sound variable already? first time would return NONE i am curious about second time
params["_monster"];
if (isServer) then
{
private _sound = createSoundSource ["SFX_monster_loop", position _monster, [], 0];
_sound attachTo [_monster, [0, 0, 0], "Head"];
diag_log format["MST Sound Var | %1",_monster getVariable ["MST_Sound","NONE"]];
_monster setVariable ["MST_Sound", _sound];
};
Anyone ever see the "giar pre stack size violation" error before?
cant find anything about it on google
Fixed, was missing a semicolon
Yeah those are basically undetected script errors that break the interpreter.
Hmm that discussion gave me an idea,
If I wanted to use a killed event handler on all npc/vehicles with a timer to delete their bodies after say...30m
Would all those EH be somehow taxing to the server?
As opposed to the traditional garbage collection
The EH isn't very expensive.
Having 30 threads hanging around is a bit more interesting.
If you want to do something like that, I'd suggest an EntityKilled mission EH that tags bodies with time of death, paired with a single loop that checks that at a medium interval and acts if necessary
Engine garbage collection isn't that bad though, I wouldn't bother unless you really have specific logic in mind that it's important to make it use
Yeah that's a good idea.
Well it has a use case on our big operations in big towns where there are a lot of bodies and it won't clean it fast enough. But I could maybe just do a better job at setting it up so eh
Yup i did. Infact as a workaround to this issue i check if MST_Sound is set, and if it is, i dont execute code under isServer check.
Init still fires multiple times (on server) but only one sound is created this way.
Here is example of how my test init looks ```sqf
params ["_m"];
if (local _m) then
{
[str player + " Setting local stuff"] remoteExec ["systemChat", -2];
};
if (isServer) then
{
["SERVER Setting server stuff"] remoteExec ["systemChat", -2];
};
if (hasInterface) then
{
[str player + " Setting client stuff"] remoteExec ["systemChat", -2];
};```
Output i see after first entity spawn/delete when createUnit is ran as client>
<player object> Setting local stuff
<player object> Setting client stuff
SERVER Setting server stuff```
Looking good, now second spawn/delete >
<player object> Setting local stuff
<player object> Setting client stuff
SERVER Setting server stuff
SERVER Setting server stuff```
If i run createUnit as a server, output looks like this, first spawn/delete >
<player object> Setting client stuff
<null object> Setting local stuff
SERVER Setting server stuff```
Second spawn/delete>```
<player object> Setting client stuff
<null object> Setting local stuff
SERVER Setting server stuff
<null object> Setting local stuff
SERVER Setting server stuff```
Same on deleted eh.
My current workaround as ive mentioned is sqf if (isServer && isNull(_monster getVariable ["MST_Sound", objNull])) then { //do server stuff & create _sound _monster setVariable ["MST_Sound", _sound]; };
This works okay enough, still fires multiple times but at least it aint spammin sounds...
Also for reference this is how i create unit
private _grp = createGroup WEST;
M_TEST = _grp createUnit ["MST_B_Monster", [<position>], [], 0, "FORM"];
// If above is ran on server, #dynamicsound is created and attached but no sound plays, if ran on client it works fine
// OR
private _grp = createGroup WEST;
"MST_B_Monster" createUnit [[<position>], _grp];
// Above can be ran on server or client and #dynamicsound works fine
//Init and Delete EHs still fire multiple times after unit is created deleted on same side multiple times
https://github.com/acemod/ACE3/blob/master/addons/grenades/functions/fnc_flashbangThrownFuze.sqf#L21
it does a alive check, what happens when you do the alive check and log it.
Also "works just fine and reads back the submunition correctly" are you sure its correct, or do you think its correct?
You thinking it looks correct-ish doesn't mean its right. for example maybe array nested to deep, or the projectle is already dead at that point
how do I run a script from an addon when the client starts playing on a mission?
I've seen people creating custom start event handlers calling scripts starting with "XEH" but i'm pretty sure it only works with ace/cba
PostInit in cfgFunctions would do you. Or preInit if you dont care if objects are created yet.
like so? :
class CfgFunctions
{
class WTK_PostInit
{
postInit = 1;
};
};
i'm not sure how you call a script this way
Not quite.
class myFunction {postInit = 1;};
Instead of postInit = 1;
so i nest another class inside WTK_PostInit?
also, how do I tell arma what sqf script to run?
Yeah read that a bit. Its explained nicely in there
would that work?
class CfgFunctions
{
class WTK
{
tag = "WTK";
class AnyCategory
{
class post_init
{
file = "fnc_init.sqf";
postInit = 1;
};
class pre_init
{
file = "fnc_preinit.sqf";
preInit = 1;
};
};
};
};
here's my current setup: (cropped out fnc_preinit.sqf)
Zeus Curator question
You don't need tag = "WTK" if you're already defining the tag class as WTK
Also, just below classs WTK. Put file="\addon_prefix\path\function\folder";
Then prefix all function files with fn_ and they will be auto included
so it's either the tag or the "WTK" class right?
You can use both. But its redundant
You must have the tag class layer, it's part of the config structure. The specific tag attribute is only if you want the tag in the final function name to be different from the tag the game would use to autogenerate a file path; there's almost no reason to do this, definitely not in your case.
class CfgFunctions
{
class WTK {
file = "\main\functions"
class AnyCategory
{
class post_init
{
postInit = 1;
};
class pre_init
{
preInit = 1;
};
};
};
};
would this setup work?
i fixed the mistakes i've made
Eggzample
class CfgFunctions
{
class WTK
{
class MuhFineScriptz
{
file="<addon_prefix>\fn";
class init {postInit = 1;};
class preInit {preInit = 1;};
};
};
};
Files would be
config.cpp
fn\fn_init.sqf
fn\fn_preInit.sqf
so I nearly got that right
file = "Arma3ModTest\addons\main\functions"
would it be valid?
Also edited you dont need leading \
No. Unless you have Arma3ModTest\addons\main\functions\fn_init.sqf
that's my addon prefix
Folders INSIDE your mod
inside the main (addon) folder?
Arma3ModTest\addons\ is your prefix??
i don't get it, the path is relative to the path of the main addon (where config.cpp is located) or relative to the path of the mod itself (where mod.cpp and stuff are located)?
Config.cpp
ok so it should just be file = "functions"
where does the prefix come from, it shouldn't matter here?
And prefix would be whatever your .pbo is called once compiled, by default.
But should be set in $PBOPREFIX$
https://community.bistudio.com/wiki/PBOPREFIX
Eggzample
class CfgFunctions
{
class WTK
{
class MuhFineScriptz
{
class init {postInit = 1;};
class preInit {preInit = 1;};
};
};
};
Files would be
config.cpp
MuhFineScriptz\fn_init.sqf
MuhFineScriptz\fn_preInit.sqf
the pboprefix specifies where the main addon is
Arma3ModTest\addons\main
this is a correct pboprefix afaik
wait actually no
it's in any addon
why is the file="" gone
The path is not relative to config.cpp. When in mod config, the path is relative to the game root. The addon prefix must be specified.
Cause category represents folder name. Look below in under "files would be"
ah, i see
i guess it's easier if i just remove the file property and rename the category to functions
class CfgFunctions
{
class WTK {
class functions
{
class init { postInit = 1; };
class pre_init { preInit = 1; };
};
};
};
correct?
Ye. Try this. Also cfgfunctions is included in config.cpp?
this is how my config.cpp is structured
https://community.bistudio.com/wiki/Arma_3:_Functions_Library
if in config, <ROOT> means the game's root directory. The addon path needs to be set manually.
The function will be loaded:
from config:
<ROOT>\Category\fn_functionName.sqf
I finger it should run
if i throw a hint "test" in fn_init.sqf it will print that out when i start a mission?
just wanna make sure
Should.
You can add sleep to maybe delay it a bit, so it doesnt hint you somewhere where hint cant be displayed
.
I guess file is needed then
<ROOT> is a magic word or do i have to replace it?
i don't get it
That is a description of how the game detects file paths when no specific path is defined
Also just a theory. If my pboprefix contains only test_addon
Then use file="\test_addon\functions"; that would work right?
i think it's better to keep it consistent with the pboprefix
When you specify a path, it is treated as <root>\whatever\path\fn_functionName.sqf
What <root> is is determined by the game. As described, when in mod config, <root> is the main game root, and if you want to reference an add-on you have to specify it
When loaded, addons are essentially folders inside the main game root
@hallow mortar according to what you've quoted, <root> is where mod.cpp and meta.cpp are located so I have to explicity tell the game the directory, this way:
class CfgFunctions
{
class WTK {
class InitScripts
{
file = "Arma3ModTest\addons\main\functions";
class init { postInit = 1; };
class pre_init { preInit = 1; };
};
};
};
correct me if i'm wrong, the name of the category doesn't matter if a file path is provided
That is correct
really appreciate the help guys
Cause if we take example from
CfgWeapons, picture="\my_addon\myPicture.paa"
I might be bamboozled here but in cfgFunctions
file="\my_addon\functions" would work all the same. Without the need to prefix
"MyAddonFolder\addons\my_addon\functions"
Well, this is what their prefix actually is. If this is the file structure then this is where they need to tell the game to look.
The file path begins at the game root.
You can in theory direct the file path to a different addon, if you're some kind of maniac.
Ill check once im home... but i think that would work. If pboprefix was my_addon
Getting this error below. can anyone tell why it's throwing back the missing ()?
15:08:14 Error in expression < serverTime;
private _objects = (call 3P_fnc_getEditableObjects);
{
[_x, _obje>
15:08:14 Error position: <P_fnc_getEditableObjects);
{
[_x, _obje>
15:08:14 Error Missing )
Code:
private _objects = (call 3P_fnc_getEditableObjects);
{
[_x, _objects] call 3P_fnc_updateEditableObjects;
} forEach allCurators;
Geteditbale returns an array
Prolly cause ur function starts with number
Is that not allowed then
IIRC no, it is not allowed
ill take a look when i get home from work thank you
What you wrote is like if you wrote
(call 3 P_fnc_getEditableObjects)
because variable names cannot start with numbers, it thinks its a number, followed by a variable (or command) name without a space between.
how can I give custom properties to my button class?
here's what I have in my description.ext :
import RscButton;
class MyCustomButton: RscButton {
}
when I create the control with ctrlCreate it creates nothing
however, when i put the rscbutton class directly it works
show the ctrlCreate script line
i've also tried to put the CT_BUTTON custom class from the wiki but it won't work
import RscButton;
class MyCustomButton: RscButton {
SizeEx = GUI_TEXT_SIZE_SMALL;
colorBackground[] = {1,1,1,0};
colorBackgroundActive[] = {1,1,1,0};
colorBackgroundDisabled[] = {1,1,1,0};
colorFocused[] = {1,1,1,0};
colorShadow[] = {1,1,1,0};
borderSize = 0;
}
if its empty it probably cannot find it
private _buttonControl = _display ctrlCreate ["MyCustomButton", -1];
works with the base RscButton class
how about
private _buttonControl = _display ctrlCreate [missionConfigFile >> "MyCustomButton", -1];
And if you run missionConfigFile >> "MyCustomButton" in debug console does it find it
it outputs this
so i assume it does?
error type config entry, string expected
that looks good
"error type config entry, string expected"
wuht, the wiki page says config works
since 2.14.. oh.. welp
Well atleast we know the button is definitely in description.ext and found
question what map do you guys debug in? do you go to altis and see the mediterranian explore europe with livonia or go plain and use vr
i use stratis
quicker to load than altis
fair fair
do you have any idea as to why the button doesn't show up?
did you check the RPT log yet?
yes the config looks correct to me
why would it be necessary?
it doesn't throw any error
To.. check if it throws any error
there's a black box everytime there's an error so
hello, what is the door object of these houses? I want it to open at the door of the house with the animation, but I could not do it. Can anyone help?
ah
17:05:05 Starting mission:
17:05:05 Mission file: moddingtest
17:05:05 Mission world: Stratis
17:05:05 Mission directory: Z:\Documents\Arma 3 - Other Profiles\Wojtek\missions\moddingtest.Stratis\
it's clean, no errors
Open the debug console
Then run animationNames cursorObject while looking at the object
It will give you all animations you can use with the animate command
Use getText
Well you don't need to actually 
You were already doing this...
yeah i asked yesterday but i couldn't work on it because i was setting up a bunch of stuff for addons
now i'm into scripting
Did you log/systemChat the ctrl to see if it even gets created?
how can i log that
those datatypes can be stringified?
type control, string expected
Str it 
Just a quick question what _display are you using?
it's the main menu display
when you press escape
thus it exists
the issue is about the UI itself i think
Yeah im thinking it does, its just somewhere you cant see it
here's my description.ext again
import RscButton;
class MyCustomButton: RscButton {
SizeEx = GUI_TEXT_SIZE_SMALL;
colorBackground[] = {1,1,1,0};
colorBackgroundActive[] = {1,1,1,0};
colorBackgroundDisabled[] = {1,1,1,0};
colorFocused[] = {1,1,1,0};
colorShadow[] = {1,1,1,0};
borderSize = 0;
text = "this is some text";
}
i noticed you made the color alpha zero
Check in config viewer
aah
that's code i ripped from the wiki
RscButton
x = 0;
y = 0;
w = 0.095589;
h = 0.039216;```
Thats the example of text only youve ripped. Try setting all 0s to 1s
we all love being
'd
And maybe set sizeEx to GUI_TEXT_SIZE_MEDIUM for easier findability
Send a screenshot of the whole class in config viewer
Hi, can we change the side counter count with a script ? I mean this : http://i.imgur.com/xSJcoLr.jpg
Thats respawn tickets no?
no i don't think because it increase every time i kill someone
ok nvm i found it the command is called " scoreSide"
Hi, I am using Leopard20's Advanced Developer Tools in game to check scripts for syntax errors. The tools are awesome but is there also another way to check sqf scripts when the game is not running for syntax errors?
RscButton or MyCustomButton class?
i don't find mycustombutton
but here
It will be in mission config
Your button doesn't have text either
And its background is invisible so effectively it's completely invisible
does?
it's weird because it does
"this is some text";
Oh 
and text is a valid property of RscButton so
aeugh how do you check that
it's in splendid config viewer or somewhere else?
i don't find it as i said
gib moment, ill start the game
k, thanks for the efforts
here, close configfile by double clicking
the text still doesn't show up
hmm try setting x=0.5; y = 0.5;
i think sizeEx is the problem
failed preprocess i guess
try sizeEx = 0.05;
does it have to do with it being in description.ext?
ah you didnt put in the macro into description ext
no its ok there
import it?
wait did you set sizeEx in description or not?
or do i have to make a hpp file to deifne the macro
you can define macro in description
#define GUI_TEXT_SIZE_SMALL (GUI_GRID_H * 0.8)
#define GUI_TEXT_SIZE_MEDIUM (GUI_GRID_H * 1)
#define GUI_TEXT_SIZE_LARGE (GUI_GRID_H * 1.2)```
the text now shows up
didn't know hpp syntax worked there too
nice
.ext is basically cpp file
if i quickly google the poop out of it, this may come useful for macros definitions
https://github.com/commy2/Arma-3-Scripted-Lobby/blob/master/missions/LOBBY.VR/ExportedGUIBaseClasses.hpp
There may be a more official one somewhere but idk
thats prolly why your CT_Button example didnt work
Does anyone happen to know if its possible in CfgUserActions to have the onActivate return something to be used in onDeactivate
Hello, what is the command for change the direction of object in eden editor ?
Is this what you're looking for: https://community.bistudio.com/wiki/setDir
its dosen't work
you have to use global vars
Are there any docs that show the correct way to do that, I dont want to implement it incorrectly
It should, what exactly is happening
Or am I correct in thinking that any variable left without _ will be global
I don't think so no.
in general, when using a global variable make sure you use a unique tag to prevent collision with other global vars
Alright, thank you for the help
it will be yes
Visually the direction is good but in the coordinates of the object the direction is bad
Im not entirely sure what that means sorry
Do you mean the center of rotation is wrong or?
If so maybe try setDir then SetPos?
the object is placed with the right direction but when I look at the coordinates of the object it is wrong
yes i have try
Im not sure then, someone else may have better input than I
what exactly are you trying to do?
i try to generate object in eden éditor, with the position and direction.
i use that for spawn object ```sqf
{
private _t = _x select 1;
private _pos = [(_t select 0), (_t select 1), 0];
private _obj = create3DENEntity ["Object", (_x select 0), _pos];
_obj setpos _pos;
_obj setdir (_x select 2);
} forEach (...);```
can you give example of one entry in forEach array?
I guess I couldn't. Or is there something wrong that I'm not aware of?
yes : ```sqf
{
private _t = _x select 1;
private _pos = [(_t select 0), (_t select 1), 0];
private _obj = create3DENEntity ["Object", (_x select 0), _pos];
_obj setpos _pos;
_obj setdir (_x select 2);
} forEach ([["Land_pavement_narrow_f",[3729.06,3048.7,1.90735e-006],114.91]]);```
And issue is, that it does set the direction, but its not set in objects attributes?
yes
run the mission
and you're not using the code I said to use
{
private _t = _x select 1;
private _pos = [(_t select 0), (_t select 1), 0];
private _obj = create3DENEntity ["Object", (_x select 0), _pos];
_obj set3DENAttribute ["rotation", [0, 0, _x select 2]];
} forEach ([["Land_pavement_narrow_f",[1796.36,1766.35,0],114.91]]);```
Thanks GG
I sent a friend request, if you have time tomorrow, I will show you by broadcasting. I couldn't because I can't do it without seeing it again, sorry.
I want to add a "Killed" EH to a vehicle, if i understood correctly all players+server needs this EH in case they drive the vehicle, as it only fires where the object is local?
this also needs to work with JIP so i add it inside a remoteExec.
assuming i am correct with the above, how can I remove it from the JIP queue in case the vehicle is destroyed? or will it clean up automatically?
You might want to consider the mission event handler EntityKilled instead. It's less of a pain.
With JIP remoteExec you can set the JIP ID parameter to the object, and then it's automatically cleaned up when the object is deleted. However, you can only have one remoteExec with the same JIP ID.
Alternatively you can remove it from the JIP queue manually with remoteExec ["", _jipID]. Works from anywhere.
Another option is to use the Dammaged EH, which is for some reason global-argument unlike Killed.
do you know if a vehicle counts as "deleted" when it is destroyed? or is the wreck still the same object?
Nope, same object.
ok, might be easier with addMissionEventHandler then, do i only add that one server side and it will always trigger there? regardless of where the vehicle is local?
Yep.
does the EntityKilled trigger when everything is killed, or can I still attach it it a specific unit?
It's a mission event handler, so it detects events in the entire mission and is not object-specific. It will fire when any entity is killed. You can use additional filtering in its code to decide whether to proceed further - for example, using a typeOf or isKindOf check and exitWith.
Hello!
The following script is a section of exported file from arma 3 arsenal: ```sqf
comment "Remove existing items";
removeAllWeapons _voj;
removeAllItems _voj;
removeAllAssignedItems _voj;
removeUniform _voj;
removeVest _voj;
removeBackpack _voj;
removeHeadgear _voj;
removeGoggles _voj;
should work for me, i have a variable set on the vehicle anyways. Im guessing there is no real overhead performance wise to this vs adding it to the specific unit and making sure the JIP queue is updated?
you can add it back
@scenic shard Things don't die that often so I think it's fine. Ideally have an early-out for objects that don't have classnames, because you can get a bit of spam when bombs drop on towns.
Variable set on vehicle is fine too.
that's exactly what i need to avoid, let me explain, among other mods, we use on our server well known TFAR mod. Each player has to tune his radio to a given frequency in order to be able to talk to the rest of the team. At some locations on the map we have rearm points. Those are basically objects with an addAction on them and after triggering it a script loads a new full gear, just like they would load it from arsenal, but in this situation the radio gets deleted from the inventory and the same one immediately readded, in theory it's ok, but this process resets the radio frequency and they have to set it again after loading the gear.... and that's what most players usually forget to do, we can't hear the player in the radio, we're sending units to his rescue while he's allright and mad why we're not responding, i've been trying to teach those players that they have to set the frequency again but they just still keep forgetting it
you can save and restore the freqs used with TFAR's eventhandler "radiosReceived" or similar
then instead of removeAllAssignedItems remove them one by one except the radio
{
_unit unlinkItem _x;
} forEach (assignedItems _unit - [getUnitLoadout _unit param [9, []] param [2, ""]])
That's a good idea
In the next version we get getSlotItemName :P
and this is what i should place instead of removeAllAssigned items ?
yeah

yes
is this using some arma 2 stuff? didnt even know comment was still a command 
comment is just a useless command for putting comments in unpreprocessed code
you can just put a raw string there...why did they even make a command for it?! 
yeah i checked the wiki and it felt like either you or lou wrote it after looking at a performance test for it
both a warning and an information card on the same wiki page
thank you, i just tested it and it looks like it works 🙂
adjusted that page a bit to explain why that command even exists
what's the property that changes the CT_EDIT textbox border (that grey one)?
you have to add the no rectangles flag to its type
type = "2 + 0x200"
like this?
i think this is the flag you are talking about
#define ST_NO_RECT 0x200
it's a style 
style = ST_LEFT + ST_NO_RECT
well I said it wrong 😓
Hey
ive been stuck on this all day and there are no guides to tell me how
im trying to make a very simple mod that justs prints "entity spawned" whenever an entity is spanwed
but just cant figure it out
i cant find any good tutorials
can anyone link me a good tutorial?
is there a way of changing its color instead of removing it completely?
i'm a perfectionist when it comes to this kind of stuff
By zeus or script, or?
Script
Through initServer.sqf
Mission event handlers
just a thought, why dont you just print your message when you spawn it in there?
i like how the description of the chat is literally impossible to execute in sqf
It triggers me.
Error generic error in expression
I’m just using the scenario as a way to learn how to do it
I plan on doing a lot more
But gotta learn how to turn it into an addon first
@stark fjord
Can anyone link a tutorial?
I tried that but it doesn’t explain where to put the scripts like initServer.sqf and load them
No event scripts are used in addon. If you wanna put scenario into addon, then it will be still used in scenario folder.
best error message ever
Is there a script function to change a value in an existing (in config) muzzle class?
I don't think so
finding the error is like shooting an elephant with a .22 blindfolded xD
you cannot edit config properties with sqf
What I want is to script a hotkey to throw a grenade at half power. By changing as little as possible.
I see, thanks.
Change would not have to persist btw. It would be temporary to fire the muzzle, then revert.
But if it can’t be done like that I’m dropping the idea. Not going to create new muzzles and all the hassle.
you can check how ACE does it with their lob throw
Fired event handler will detect grenades, you can then immediately change the grenade's velocity
Anyone got a solid script to set player respawn with additional player spawns set to certian roles say d_flag_hangers was set to pilot role and d_flag_garage was set to crewman?
Anyone knows which config entry is correct?
soundIncommingMissiles
or
soundIncommingMissile
or
soundIncomingMissile
I see both
pls don't harm inncoent elephants
Just wondered if anyone has seen an error like the one below and if so what it means ...
x (268435456) out of range <0, 1024)
I assume it refers to a value such as unit number etc.
Maybe some more context?
Edited the question. This get's more confusing the longer I look at it.
When object is created in editor Init event handler fires, but deleted doesnt,
Is there any such event handler that would?
so i can delete particles if unit is deleted
hey guys, is it possible to make a tank full of players drive without input? want to make a cutscene similar to the Thunder Run mission from bf3. Playing on dedicated so Unitcapture won't work..any ideas?
Funnily Enough I'm doing a similar type scenario. Wouldn't mind some input on this as well 😅
I think the error is generated when trying to reference a unit - I'll get more information for you if I can.
was first who blamed the description
even provided better example which would compile (still ... t would have given an error msg due to the fact that it called a function which was never defined)
There's the onDeleteUnits 3den EH
looking for a zombies script to run in official pub zeus. seen someone use one sucessfully a month or so ago
Thanks, that could work
does unitplay not work on dedicated? i remember using it a few weeks ago on a dedicated mp server
this worked for me ```sqf
_unitCaptureData1 = //your unit data here;
[Heli_1, _unitCaptureData1] spawn BIS_fnc_unitPlay
Can somebody explain the usecase for that?
https://community.bistudio.com/wiki/createHashMapObject
Because currently it looks like a solution in search for a problem 
Another question: Why helicopter pilots may sometimes completely ignore given waypoints? They just hover in the air doing nothing. Just for fun I killed one of them and second pilot immediately took control and proceeded to the wp.
How to overcome this?
"Object oriented scripting"
Many people tried to implement solutions navigating around SQF's deficits. This is the solution to get rid of the deficits
I do understand what it does, I do not understand 'why'? What for? 
Could you give an example?
It looks something like Lua module
Code organization mostly
instead of
thingy call Ded_fnc_thingy_DoThing
and
thingy call Ded_fnc_thingy_DoOtherThing
you can write
thingy call ["DoThing"];
thingy call ["DoOtherThing"];
and instead of
if (thingy#0 == "TypeA")
thingy call Ded_fnc_thingy_A_DoThing;
else if (thingy#0 == "TypeB")
thingy call Ded_fnc_thingy_B_DoThing;
you can write
thingy call ["DoThing"];
Plus the ability to implement RAII type constructs with a destructor, makes lots of things simpler
