#arma3_scripting
1 messages Β· Page 592 of 1
cheers m8
no problem
@neon crane so you made a folder called
scriptsand added theunlock.sqfinto it. You made an init.sqf file and added the whitelisted steam IDs in the array, keeping the" "etc. You've made sure the path exists? You made sure the init.sqf file is a .sqf file and not a renamed .txt file? Make sure file extensions is on viaView >> View Filke extensionsin windows explorer
@brave jungle i did all that.
and of course the file extensions are enabled
So uhm. yeah. Most likely the script is dead or so.
Is there any good alternative someone has?
does it have ot be whitelisted?
Or
you can try using remoteExec
Because the effect of it is local
orrrrr
again
try instead of a init.sqf, an initplayerlocal.sqf
does it have ot be whitelisted?
@brave jungle yeah this unit is special. lmao
try instead of a init.sqf, an initplayerlocal.sqf
@brave jungle okay, i can try.
Hello, I'm having an isssue merging two scripts in a mission i'm working on. I'm trying to add sushi's breaching script to Liberation. The problem arises when i have to add this:
#define SAF_DEF
#include "sushi_scripts\core\init.cpp"
#include "sushi_scripts\breach\init.cpp"
#undef SAF_DEF
class CfgFunctions
{
class SAF {
#define SAF_FNCS
#include "sushi_scripts\core\init.cpp"
#include "sushi_scripts\breach\init.cpp"
#undef SAF_FNCS
};
};
To the description. Mainly due to the fact that it liberation already has a cfgfunctions defined in its description going to a cfgfunctions.hpp:
class CfgFunctions {
#include "CfgFunctions.hpp"
#include "KP\KPPLM\KPPLM_functions.hpp"
};
How would i resolve this?
either modify CfgFunctions of Liberation and add your functions to theirs, or disable their CfgFunctions and put all their functions in yours
how would i add it to cfgfunctions.hpp
add
class SAF {
#define SAF_FNCS
#include "\sushi_scripts\core\init.cpp"
#include "\sushi_scripts\breach\init.cpp"
#undef SAF_FNCS
};
to KP\KPPLM\KPPLM_functions.hpp
ok thank you very much
hmm now the game crashes and i get the error
include file sushi_scripts\core\init.cpp not found
But the file is there
make sure the path is correct, either relative to file or relative to mission root
Perhaps i have to change that part i added to check from mission root
because wont it be looking relative to kp\kpplm\etc
What wrong with it? I have box. This box have type "AmmoBox", I placed it from 3DEN and it must(?) be in allMissionObjects "AmmoBox" list, but it's not... It is in allMissionObjects "" list
Screenshot: https://i.imgur.com/ArvxEWV.png
Ok. It's not "AmmoBox"
is there a "fired upon" command?
or what would you do to check to see if a unit is fired upon?
Having issues executing a SQF script from config.cpp once its binarised into config.bin.. anyone have any pointers or troubleshooting tips to look out for?
Having issues with a .lip file generated with the BI tool
If I play the sound in mission without the lipfile, everything works as intended minus the lip movements
If I include the .lip file, the sound file is sped up significantly, and there is still no lip movement
@sonic slate think this topic for the #arma3_audio channel
either check the behaviour (switches to "COMBAT" when engaged), or (less precise and limited range) the FiredNear EH + checking shooter's side @fair drum
Where do I need to put this in? The init.sqf? Or initServer.sqf?
params ["_mapIsOpened", "_mapIsForced"];
/* code to execute */
}];```
there is no map on server
So it's the init.sqf then, right?
@vague geode initPlayerLocal.sqf, or init.sqf yes
Ok, thanks.
@winter rose Does it irrelevant which one I put it in or is there something I need to be aware of?
init.sqf is run on the server, so there will be one "useless" call
if you insist you can circumvent it by wrapping it with if (not isDedicated) then {};if (hasInterface) then {};
@winter rose Are you sure about that? I am asking because I put a findDisplay 12 displayCtrl 51 ctrlAddEventHandler ["Draw", { /*code*/ }]; into the init.sqf and it works perfectly (marking a carrier on the map) which it didn't when I only put it into a server run script...
of course, because
there is no map on server
@winter rose Wait, you meant it's ALSO run on the server, not exclusivly run there, right?
init.sqf run things locally
and
is run by clients and server yes
@winter rose Ah, ok. Thanks alot.
see the following for moarrr info @vague geode
https://community.bistudio.com/wiki/Initialization_Order
if (not isDedicated) {}; does not make much sense, it will run on headless clients.
which also does not have a map.
isDedicated should be rarely needed.
usually you need isServer or hasInterface checks.
@hollow thistle That's great since isServer (or rather !isServer) is exactly what I used...
for adding Map eh you should actually check if there's interface. no point in adding it somewhere where there's no interface.
@hollow thistle true, hasInterface
Afternoon all, anyone know how I can combine these easily? I thought it could be done with an else statement but then I would have to wrap it all and don't know what with? ```ActionScript
if (typeOf player == "I_Officer_F") then {
{
_x params ["_classname", "_text"];
this addAction [
_text,
compile format ['player addWeapon "%1"', _classname],
nil, 0.1, true, true, "", "(_target distance _this) < 3"
];
} forEach [
["arifle_Mk20_GL_plain_F","<t color='#ff0000'>Mk20 Carbine GL</t>"],
["arifle_TRG21_GL_F","<t color='#009933'>TRG 21 GL</t>"],
["arifle_SPAR_01_GL_khk_F","<t color='#009933'>SPAR Woodland GL</t>"],
["arifle_SPAR_01_GL_snd_F","<t color='#e6e600'>SPAR Sand GL</t>"],
["rhs_weap_m4a1_blockII_M203_d","<t color='#e6e600'>M4A1 Sand GL</t>"],
["rhs_weap_m4a1_blockII_M203_wd","<t color='#009933'>M4A1 Woodland GL"],
["hlc_rifle_ACR_GL_SBR_green","<t color='#009933'>ACR Woodland GL</t>"],
["hlc_rifle_ACR_GL_SBR_tan","<t color='#e6e600'>ACR Sand GL</t>"]
]
};
if (typeOf player == "I_Soldier_SL_F") then {
{
_x params ["_classname", "_text"];
this addAction [
_text,
compile format ['player addWeapon "%1"', _classname],
nil, 0.1, true, true, "", "(_target distance _this) < 3"
];
} forEach [
["arifle_Mk20_GL_plain_F","<t color='#ff0000'>Mk20 Carbine GL</t>"],
["arifle_TRG21_GL_F","<t color='#009933'>TRG 21 GL</t>"],
["arifle_SPAR_01_GL_khk_F","<t color='#009933'>SPAR Woodland GL</t>"],
["arifle_SPAR_01_GL_snd_F","<t color='#e6e600'>SPAR Sand GL</t>"],
["rhs_weap_m4a1_blockII_M203_d","<t color='#e6e600'>M4A1 Sand GL</t>"],
["rhs_weap_m4a1_blockII_M203_wd","<t color='#009933'>M4A1 Woodland GL"],
["hlc_rifle_ACR_GL_SBR_green","<t color='#009933'>ACR Woodland GL</t>"],
["hlc_rifle_ACR_GL_SBR_tan","<t color='#e6e600'>ACR Sand GL</t>"]
]
};```
use switch inside the forEach loop
and please use the radius parameter of addAction instead of the condition.
oh wait
Both classes get the same weapons right?
then you can just do sqf typeOf player in ["class1","class2"];
Yeah
I only want specific roles to be able to interact with the boxes for designed for their roles.
Like this? ```ActionScript
{
typeOf Player in ["I_Officer_F", "I_Soldier_SL_F"]
_x params ["_classname", "_text"];
this addAction [
_text,
compile format ['player addWeapon "%1"', _classname],
nil, 0.1, true, true, "", "(_target distance _this) < 3"
];
} forEach [
["arifle_Mk20_GL_plain_F","<t color='#ff0000'>Mk20 Carbine GL</t>"],
["arifle_TRG21_GL_F","<t color='#009933'>TRG 21 GL</t>"],
["arifle_SPAR_01_GL_khk_F","<t color='#009933'>SPAR Woodland GL</t>"],
["arifle_SPAR_01_GL_snd_F","<t color='#e6e600'>SPAR Sand GL</t>"],
["rhs_weap_m4a1_blockII_M203_d","<t color='#e6e600'>M4A1 Sand GL</t>"],
["rhs_weap_m4a1_blockII_M203_wd","<t color='#009933'>M4A1 Woodland GL"],
["hlc_rifle_ACR_GL_SBR_green","<t color='#009933'>ACR Woodland GL</t>"],
["hlc_rifle_ACR_GL_SBR_tan","<t color='#e6e600'>ACR Sand GL</t>"]
]```
compile format ['player addWeapon "%1"', _classname],
you can pass parameters to the action function, please just use that
ohh no I did this ```ActionScript
if (typeOf player in ["I_Officer_F", "I_Soldier_SL_F"]) then {
{
_x params ["_classname", "_text"];
this addAction [
_text,
compile format ['player addWeapon "%1"', _classname],
nil, 0.1, true, true, "", "(_target distance _this) < 3"
];
} forEach [
["arifle_Mk20_GL_plain_F","<t color='#ff0000'>Mk20 Carbine GL</t>"],
["arifle_TRG21_GL_F","<t color='#009933'>TRG 21 GL</t>"],
["arifle_SPAR_01_GL_khk_F","<t color='#009933'>SPAR Woodland GL</t>"],
["arifle_SPAR_01_GL_snd_F","<t color='#e6e600'>SPAR Sand GL</t>"],
["rhs_weap_m4a1_blockII_M203_d","<t color='#e6e600'>M4A1 Sand GL</t>"],
["rhs_weap_m4a1_blockII_M203_wd","<t color='#009933'>M4A1 Woodland GL"],
["hlc_rifle_ACR_GL_SBR_green","<t color='#009933'>ACR Woodland GL</t>"],
["hlc_rifle_ACR_GL_SBR_tan","<t color='#e6e600'>ACR Sand GL</t>"]
]
};```
_text,
{player addWeapon (_this select 3)},
_classname, 0.1, true, true, "", "(_target distance _this) < 3"
Ohh ok is this for better performance
MUCH better yes.
So this then ```ActionScript
if (typeOf player in ["I_Officer_F", "I_Soldier_SL_F"]) then {
{
_x params ["_classname", "_text"];
this addAction [
_text,
{player addWeapon (_this select 3)},
_classname, 0.1, true, true, "", "(_target distance _this) < 3"
];
} forEach [
["arifle_Mk20_GL_plain_F","<t color='#ff0000'>Mk20 Carbine GL</t>"],
["arifle_TRG21_GL_F","<t color='#009933'>TRG 21 GL</t>"],
["arifle_SPAR_01_GL_khk_F","<t color='#009933'>SPAR Woodland GL</t>"],
["arifle_SPAR_01_GL_snd_F","<t color='#e6e600'>SPAR Sand GL</t>"],
["rhs_weap_m4a1_blockII_M203_d","<t color='#e6e600'>M4A1 Sand GL</t>"],
["rhs_weap_m4a1_blockII_M203_wd","<t color='#009933'>M4A1 Woodland GL"],
["hlc_rifle_ACR_GL_SBR_green","<t color='#009933'>ACR Woodland GL</t>"],
["hlc_rifle_ACR_GL_SBR_tan","<t color='#e6e600'>ACR Sand GL</t>"]
]
};```
Thank you @cosmic lichen and @still forum π
mmmm
Hi, looking for help with a script to run on dedicated server to set a variable name to a respawned vic. currently it is set to 'strykerRespawn' for the purpose of strykerRespawnWest = [West,strykerRespawn,"STRYKER"] call BIS_fnc_addRespawnPosition;
but i need it to be the same when it respawns
looking along the lines of
strykerRespawn setVehicleVarName "strykerRespawn";
in the vehicle respawn module expression, but no joy
@topaz fiber razorclam, you mean you want the vehicle name to be publkic?
ie, known and named to server and all clients?
if so, I use this fnc
fnc_setVehicleName =
{
params ["_veh", "_name"];
missionNamespace setVariable [_name, _veh, true];
[_veh, _name] remoteExec ["setVehicleVarName", 0, true];
};
@finite sail thatβs perfect thanks. I found it after some googling. Iβm trying really hard to not google stuff and figure it out but maybe Iβm just a bit old π©
π
I just try to understand it.
It should be in a .sqf and callled from the serverinit by execVM? Thatβs how I did it anyway.
i use that as a function, complie it in description.exe
then call it
[_vehicletobenamed, "vecname"] call fnc_setvehiclename
that vehicle will then be know as vecname on server and all players
I put it in a functions.sqf and then execVM from the init. Then called from vic respwan expression
It works anyway. So Iβm pleased. Just have to debug why the timer isnβt working but think itβs a conflict with ALiVE
best practice is to put things in a function so they don't have to compile in real-time, but if you're not doing anything major it should be fine
also be careful about using init.sqf, it can cause a lot of weird locality issues in mp. don't use it if you don't know why you're using it
I went from making missions locally to a dedicated server. Nothing worked so had to basically learn scripting. Now my init.sqf is empty. Itβs all in serverinit
Some things still not working right though.
Ha, I donβt know why Iβm using most of it π€
Itβs really interesting though. Itβs great to get advice and help too so thanks. π
yes, init.sqf has its place
Iβm still figuring it all out. JIP is join in progress? This refers to players in the briefing screen before they spawn into the mission?
JIP is players who join after the mission has started
for flashpoint, its witchcraft
Iβve not seen that wiki page. Really useful thanks.
Hey, I need to make players invincible while in a specific vehicle named "vic"
Does anyone know how to accomplish this?
vic allowDamage false```@tough abyss, but be sure to check for locality (see the wiki)
No I meant the players inside must be invincible, not the vehicle itself
The passengers can not be damaged while inside
what
stop please
Someone was @tting me
and I get warned for telling them to F off
@inland bay can u help me with a admin script not loading?
yeah mikey
yeah join TS
ugh stop stealing my men moe
@tough abyss I'd recommend GetIn(man) and GetOut(man) event handlers.
https://community.bistudio.com/wiki/Arma_3:_Event_Handlers#GetInMan
e.g. something like:
player addEventHandler ["GetInMan", {
params ["_unit", "_role", "_vehicle", "_turret"];
if (_vehicle isEqualTo vic) then {
_unit allowDamage false;
};
}];
π―
Where do I put that @crude needle
okay so I have a lot of sideChat commands I need to do. I remember someone posting about putting it in a file then calling the specific class. could I get some reading material on how to do this correctly?
I remember someone posting about putting it in a file then calling the specific class
not sure what you mean, was he referring to using format?
or was he talking about just creating a function that contained all the sideChat commands
like creating a separate file with all the chat text in it, then having different classes defined for each one, then calling it in mission easily
yes that'd be done via function
many different ways to create a function, most reliable way imo is to make a dedicated directory for functions then reference them in description.ext. from that point you can call them from anything in the mission and they'll work,
else you may run into some strange issues
Frivolous idea... Would it be possible to script a trigger to boost a vehicle past its maximum speed (temporarily)? I can find functions that limit max speed, but not change it...
Or would this have to be worked into the configs of the vehicles in question and then accessed from the scenario?
Doh. Thanks, was trying to find something under speed. =/
morning,
I have a body cleanup function that works great local but not on dedi server
player addMPEventHandler ["MPRespawn", {_this spawn FNC_Del_Corpse;}];
in initserver
FNC_Del_Corpse = {_unit = _this select 1;
_pos = getPos _unit;_xpos = _pos select 0;_ypos = _pos select 1;
_zpos = _pos select 2;sleep 0.3;for "_i" from 0 to 3 do {_xvel = 0;_yvel = 0;_zvel = 0;_tnt = 0;
drop[["A3\Data_F\ParticleEffects\Universal\universal.p3d",16,7,48],"","Billboard",0,1 + random 0.5,[_xpos,_ypos,_zpos],
[_xvel,_yvel,_zvel],1,1.2,1.3,0,[2],[[0.55,0.5,0.45,0],[_tnt + 0.55,_tnt + 0.5,_tnt + 0.45,0.16],
[_tnt + 0.55,_tnt + 0.5,_tnt + 0.45, 0.12],[_tnt + 0.5,_tnt + 0.45,_tnt + 0.4,0.08],
[_tnt + 0.45,_tnt + 0.4,_tnt + 0.35,0.04],[_tnt + 0.4,_tnt + 0.35,_tnt + 0.3,0.01]],[0],0.1,0.1,"","",""];};
deleteVehicle _unit;};
is the function...... can someone tell me why is doesnt work on dedicated server? my head hurts
i tried - player addMPEvenHandler in the onPlayerRespawn.sqf but that stopped it working even locally
onPlayerRespawn.sqf wouldn't work as it fires locally on the player who respawned, while you're defining a function serverside on a dedicated server. player addMPEventHandler ["MPRespawn", {_this spawn FNC_Del_Corpse;}]; if you're calling this on a dedicated server, player obviously will not work.
Thanks, i appreciate you taking the time to respond. I wish it was obvious, then i wouldnt be here. π
wht is the alternative to player in the context of this call? i feel like i just delete player and leave the rest?
I don't really understand what you are trying to do, https://community.bistudio.com/wiki/drop has local effects, so creating the particle on a dedicated server makes 0 sense.
ok, the effects are a herring to be fair. they just make it look prettier when the body disappears. The function is to simply remove the body when the player respawns.
(the script is not my work)
but it works locally, not on server. that is what im trying to learn, why it acts differently
Move everything client side, if you want other players to see the particles, remoteExec it, server doesn't need to be involved here at all.
so the script should just be placed in the init.sqf instead of server.sqf?
initPlayerLocal
ok that makes sense. I'll give it a go. thanks π
MP EH is also not needed, change it to regular respawn
player addEventHandler ["Respawn", ...]
so... its monitoring the player, when the player respawns the handler spawns the delete body function
thats how i read it
Ye, and creates the particles, if you want particles to appear for other players, you need to remoteExec.
yeah, fk the particles for today π€£
i will just delete that part
hmmm, that's not working, again, worked ok local but not on the server
@copper raven when you said move everything local, you meant everything π
moved the function itself to to the initPlayerLocal.sqf and now it works perfectly....
You can work out if its gonna need to be local etc. by looking at the commands wiki page(s) and the top left it will say effect π
Thanks Curious, that helps a lot.... although eventHandler is both??
ahhhh, one is executed
i see
Hello, Is anyone able to help me understand what is wrong with this and why its not adding the things to the arsenal? I'm trying to avoid it being added to scroll wheel if that's possible. And just have it create the arsenal and add the vest backpacks and all that
https://sqfbin.com/equcumewizuzihiwopag
have you checked https://community.bistudio.com/wiki/BIS_fnc_arsenal , ya sneaky deleter π
@frigid lodge ^
π€£ I thought AmmoBoxInit would work but does it not add a scrollwheel option for other players?
I believe you should add items before doing the preload/create dialog
(not experienced with Arsenal, just a guess)
Ill give it a go, ill also try the AmmoBoxInit on multiplayer and see what happens, Ill report back with my findings, thanks for the assistance though @winter rose π
Ok so I managed to add all the items to the arsenal but now when it gets opened it resets and only adds what I'm wearing to the arsenal
Hello, I wanted to know if an event handler exists to detect when the player switches from primary to secondary weapon, etc.. ?
Thanks you in advance for your answer π
I don't think there's any, unfortunately
All right, well, let's go with some "actionKeys" aha ^^ Thanks anyway π
you probably would have to combine inventory EH's (open/close, take/put) with catching some key presses (direct weapon select and switch weapon)
although simply running a while which checks the current active weapon should do the job as well π
Yes I've already used these actions (open/close, take/put), but now I'm adding key actions to fill all that. Then I'd like to avoid a while, I do a HUD, and a while H24, it's not great ^^
there's no eventhandler dedicated to doing precisely what you want, but i think you can get away with using AnimChanged eh and then evaluating the current held weapon against whatever you want
since switching weapons always initiates an animation
please do not run a constant check to look at the primary weapon of a unit
AnimChanged is also running almost every second π€ unless someone is afk...
no it isn't
it only triggers whenever a new animation is started
which, yes, is quite frequent, but it's far better than doing a while loop that runs every frame
anyways, just double-checked it, doesn't seem to work
which is strange
but i want to see if i can get it to work now so, gib sec
hm, don't think you can do this with an eh but
yeah, not actually sure. gomen, i thought for sure changing weapons would be classified as an animation, not sure why it isn't
though i still maintain that you should avoid using a while loop as much as possible
hi folks! i'm getting an error in RPT that I interpret as a unit not being able to find a way to get from one point to another:
21:15:40 Out of path-planning region for C Alpha 1-2:1 at 3105.0,3658.0, node type Road
21:15:40 Error C Alpha 1-2:1: Invalid path from [3103.50, 13.18, 3658.50] to [3094.86, 13.63, 3661.11].
anyone know if I can catch that in a script (so I can handle it)
@jaunty zephyr you can try to use this event handler on your bot
https://community.bistudio.com/wiki/Arma_3:_Event_Handlers#PathCalculated
But I don't really know if it returns an empty path or an incomplete path in that situation
hmm that only works for agents, right? I dont actually use agents π¬
oh wow I can actually attach that to normal units o.O
nice! the failing unit never ever triggers the "PathCalculated" event (expected, as it fails creating the path)
someone should edit that page π
https://community.bistudio.com/wiki/calculatePath this page has more info
Is there any way to force the server to play in certain difficulty sething?
server.cfg combined with a custom Arma3Profile
See https://community.bistudio.com/wiki/server.armaprofile for documentation including an extensive example of an ARMA 3 profile file
How do I insert that into the mission file?
You don't
"is there a way to force the server to play a certain mission in a certain difficulty setting"
Yes?
You don't do it in the mission file... custom difficulty is defined in the profile and called from server.cfg, eg: class Missions { class Epoch { template = epoch.Altis; difficulty = "Custom"; }; };
Then its impossible.
"is there a way to force the server to play a certain mission in a certain difficulty setting" Yes, absolutely as detailed above... Not impossible, most of us do just that
I think @astral tendon s question is "Can the mission maker force someone elses server to play in a given difficulty setting"
"is there a way to force the server to play a certain mission in a certain difficulty setting"
yep, I believe this ^ is the real question
Bohemia has some missions (e.g the bootcamp campaign) forced to play in standard difficulty; I looked for a way to do this (even in SP) but could not find anything.
im strugling to figure out where things go;
i have a rally point able to be spawned which creates a marker. Im trying to figure out how to have the marker removed if the tent is destroyed. im sure my code is sound but maybe its in the wrong place
if ((damage medicTent) == 1) then {
deleteMarker "respawn_west1";
but i keep getting an error saying medictent is an unknown variable
Hi, I want a specific person to only be able to execute a script, how could I do that?
I know that is something like this
player getPlayerUID isEqualTo "765"
Hello all, I have this script working but the problem is it creates the markers on mission start but I would really like it to work in the editor so subsequent markers can be seen on top of the building markers it creates instead on them being underneath them. Any ideas? ActionScript if (isServer) then { [] spawn { _EdenObjectNum = 0; { _name = (["3DenObjectMarker",_EdenObjectNum] joinstring "_"); _bbr = boundingBoxReal _x; _p1 = _bbr select 0; _p2 = _bbr select 1; _maxWidth = abs ((_p2 select 0) - (_p1 select 0)); _maxLength = abs ((_p2 select 1) - (_p1 select 1)); _Direction = getDir _x; _centre = boundingCenter _x; createMarker [_name, _x]; _name setMarkerShape "RECTANGLE"; _name setMarkerBrush "SolidFull"; _name setMarkerSize [(_maxWidth / 2),(_maxLength / 2)]; _name setMarkerDir _Direction; _name setMarkerAlpha 1; _name setmarkerColor "ColorGrey"; _EdenObjectNum = _EdenObjectNum+1; } forEach ((getMissionLayerEntities "EdenMapObjects") select 0); }; };
If it helps I have been playing around with get3DENLayerEntities but with no luck.
I'm running this as an execVM'd server only script:
_group = [getMarkerPos "mkr_spawn1", west, "IRG_InfSquad"] call BIS_fnc_spawnGroup;
_wp = (_group addWaypoint [(getMarkerPos "mkr_obj"), 20]);
_wp setWaypointType "MOVE";
_group = [getMarkerPos "mkr_spawn2", west, "IRG_InfSquad"] call BIS_fnc_spawnGroup;
_wp = (_group addWaypoint [(getMarkerPos "mkr_obj"), 20]);
_wp setWaypointType "MOVE";
_group = [getMarkerPos "mkr_spawn3", west, "IRG_InfSquad"] call BIS_fnc_spawnGroup;
_wp = (_group addWaypoint [(getMarkerPos "mkr_obj"), 20]);
_wp setWaypointType "MOVE";
sleep 5;
// then repeat the same thing
Problem: absolutely nothing happens.
RPT reveals this:
23:01:26 A null object passed as a target to RemoteExec(Call) 'bis_fnc_objectvar'
but I don't know what's causing that, how to fix it, or if it's even caused by this script.
I know the script is running to begin with, since there's a notification at the start that appears correctly.
your 3rd parameter for BIS_fnc_spawnGroup isn't correct
Can be three different types: a list of character types (Array), an amount of characters to spawn (Number) or a CfgGroups entry (Config)
Oh, you have to write out the entire path to the cfgGroups entry even though it knows it's got to look in cfgGroups if it's not an array or number
awesome.
If this will spawn the group I want at the position I want, I don't need anything better
there isn't a better one anyway π
Hey everyone,
I have recently discovered the joys and frustrations of the ORBAT viewer. Had a question:
Is it possible to assign the player (name) as the commander of an ORBAT group/class?
The default one in the BIKI has "Armstrong", and allows generic names. But can other names be referenced?
Or can I somehow create an array of the playernames after role selection, and then refer to that in the description.ext?
You can assign any name to the orbat, or connect any player to any position in the orbat.
@exotic flax Well, great! Mmm, but what is the syntax to refer to a player's name? It doesn't look like name or getplayerUID give me a player's name for a character object. Also; can you simply run regular SQF inside the braces of a description.ext class ?
Just noticed https://community.bistudio.com/wiki/BIS_fnc_ORBATSetGroupParams, which should allow you to "override" the config on the fly, and therefore set a player name
It's not possible to use code in CfgOrbat.
Thank you. Will play around with this.
sometimes my event handler is not working
like i will join the mission and sometimes it wont detect the keypress
_name = name player;
//Set the needed global variable
TIME_TO_IDLE = (time + 120);
// Add keypress eventhandler
// Add keypress eventhandler and check for a player display
waituntil {sleep 0.3;!isnull (finddisplay 46)};
(findDisplay 46) displayAddEventHandler ["keyDown", "_this call fnc_key"];
// Detect keypress
fnc_key = if (isGameFocused) then {
{TIME_TO_IDLE = time + 120};
};
i check TIME_TO_IDLE in dev console and its not changing with the keypress
but i can join other times and it is detecting it
anyone know why this might be happening
mission does take a long time to load into
Does anyone know where @life_server is downloaded when entering a server?
Oh, God no...
@restive leaf You tell me?
Ask them directly, there is a link to the official Arma 3 RPG Discord in #channel_invites_list
what server is it
[...] Arma 3 RPG [...]
@topaz fiber
if ((damage medicTent) == 1) then {
deleteMarker "respawn_west1";```
why not use
if (!alive medicTent) then { deleteMarker "respawn_west1"};
also to answer your question of unknown variables it depends on many things, what is the context of this script? where is it located?
@tough abyss thanks for your response. The script is called from an addAction on a player. This builds the tent and creates a spawn marker on it
The script is in a Script folder in the mission folder.
The was I understand it is that to check for the destroyed tent there would have to be a kind of monitoring script on a loop?
I put it in a while run do script and it works perfectly. Is this best practice or is there a better way? Thanks.
hey guys i got a slight problem i have a dialoge set up
and remoteExec ["Dialog1",0,true]; in activation only server on
but that damned think wont trigger
Dialog1 = {
[
["yankee-1","all suspects KIA code 4", 0],
["Dispatch","Copy that Yankee-1 return to base", 6]
] spawn BIS_fnc_EXP_camp_playSubtitles;
};
when i activate the trigger nothing
Clients won't know what Dialog1 is, i assume you have it defined serverside only
so i should change the name?
define the function client side
?????
I put it in a while run do script and it works perfectly. Is this best practice or is there a better way?
@topaz fiber https://community.bistudio.com/wiki/Arma_3:_Event_Handlers#Killed
i literally just learned how to do dialogue
Put this in initPlayerLocal.sqf
Dialog1 = {
[
["yankee-1","all suspects KIA code 4", 0],
["Dispatch","Copy that Yankee-1 return to base", 6]
] spawn BIS_fnc_EXP_camp_playSubtitles;
};
wait i just have a init.sqf
is that what i did wrong?
If you put it in init.sqf, your trigger is setup wrong then, i don't know much about them
so i change the init to a initplayer?
Doesn't matter
wait what
You can put it in either file, it makes more sense to define it on client only as it plays subtitles or whatever it does
aight
@still forum is it possible to simulate the push to talk functionality? I have a dialog that i need players to be able to have open and use push to talk. i have my eventhandlers and action detection scripts in place. i just need to know how to activate/call function to turn on and off push to talk. is there something you can point me to that will enable me to find the answer.
I thought you already had it in one of the init scripts, missread what you wrote, but glad you got it working.
quick question, is server.sqf a reserved file name like onPlayerRespawn.sqf?
morning scripters
for the life of me i cant get this to work, always error saying missing this and that
player addAction ["<t color='#FF707E'>Deploy Rallypoint</t>", "Scripts\rallyPoint.sqf", [], 0, false, true, "", "{(vehicle player == player) and (player distance medicTent =< 10)}"];
anything obvious im missing? :thanks:
its the distance condition which is causing the error, without it it works just fine
@fervent kettle nope
you can check which files are here: https://community.bistudio.com/wiki/Event_Scripts
thanks, was looking for that site^^
player addAction [
"<t color='#FF707E'>Deploy Rallypoint</t>", // title
"Scripts\rallyPoint.sqf", //script
[], // arguments
0, // priority
false, // showWindow
true, // hideOnUse
"", // shortcut
"{(vehicle player == player) and (player distance medicTent =< 10)}" // condition
];
```your condition does **not** need { } around it - remove that and it should be fine @topaz fiber
and =< β <=
you could also simply use the "radius" parameter
@winter rose ha, the only thing I had wrong was the => expression. I even put in correct the first time. Thanks for your help.
yeah - <=/>= inforEqual, suporEqual
erghh, ilove hate this scripting. it works but as soon as the tent is destroyed the distance condition stops it working at all π¦
it⦠should not?
you can make the tent invincible, too (allowDamage) @topaz fiber
Hey i wrote a script which changes the texture of the player. i tried using setObjectTextureGlobal but it didn't work quite well - so i switched to the local version of this command and broadcasted it over the network using remoteExecCall.
[_unit,[_foreachIndex,_x]] remoteExecCall ["setObjectTexture",[-2,-HClient],_unit]
thats what i replaced, but it only affected my player locally - any other player online didn't see the texture changes. Is it buggy or did i do something wrong?
PS: HClient is a global variable containing the owner ID and _x contains the relative image path.
@winter rose yeah, something was funky in the playerlocal and playerrespawn. now all sorted and working perfectly. thanks
@viral basin ```sqf
[_unit, [_forEachIndex, _x]] remoteExecCall ["setObjectTexture"];
okay so server and hc also need this information and jip is not required?
for JIP, ```sqf
// ["setObjectTexture", true];
["setObjectTexture", 0, true];
are you sure? according to the wiki the second param is targets and the third one is jip
π i give it a try then - so its just the case that the server also need this information?
a server is not always a dedicated one
in our case it is π sorry for the confusion
you should ideally code your mission for everyone, someone can decide to host it or it to be hosted
@winter rose the addAction doesnβt work on a fresh spawn. It calls the script containing the medic tent (forgive my lack of understanding) but could it be because the addAction command contains reference to a variable (medicTent) that hasnβt been created yet. If I delete that line from the addAction in the playerlocal.init and respawnrespawn.init it works ok.
ah yes
wouldn't it be better to add the action to the tent itself?
that or check that said tent exists before adding the action
Will Arma freak out if you have multiple statements on the same line? E.g.:
player playAction "putdown"; sleep 1; _civ playAction "putdown";
nope
Cool, ta
Hey Folks,
I am relative new in editing and scripting and could need some help.
I created a teleport that moves the players to a diving submarine that they could mount. But tbh I would prefere to "teleport/mount" them directly into the submarine (SDV).
This is what I used for the teleport so far:
this addaction["Submarine-Delta",{player setPos[-1800.194,7848.792,-6];}];
I would love to try things a little and googled a lot to find something. So I realy dont expact finished codelines or something. But if someone could give me a hint which command I should look at in the scripting-wiki that would realy help me (if such a command exists).
@stone totem you want them to be already aboard the vehicle?
yes
you can look into moveInAny
https://community.bistudio.com/wiki/moveInAny
ah great
(or specific moveInDriver, moveInCargo, etc)
the wiki and this channel are here to help π
Is there a way to reduce damage taken by a specific playable character or increase the health above the standard 100% ?
thanks 
lou is on fire today
as in every day π
Would anyone be able to help me with the UnitPlay function? At the end of the recorded sequence, I have my aircraft landed on a position. I would like it to remain on that position after playback but instead it just immediately takes off. Disabling simulation keeps it in place, but it's not ideal as I want units to be able load up in it and then take off.
disableAI "move", driver myPlane setDamage 1, while { true } do { myPlane setVelocity [0,0,0] }β¦plenty of ways! π
Might be a bit niche but is there a way to disable certain tabs of the ACE arsenal, eg the GPS or the misc items tabs? I don't want players to be able to access anything in the tabs, but either accessing it will delete whatever they had in that slot in the case of the gps slot, or they will be able to access items and change how many they have when not wanted
I put it in a while run do script and it works perfectly. Is this best practice or is there a better way? Thanks.
@topaz fiber generally speaking you should avoidwhileloops as much as humanly possible, since they evaluate every frame (when conditions are met, obviously) and are generally pretty bad for performance. depends on what you're doing of course, if you're just running a small check you probably won't notice any performance difference though it's best to explore other options to do what you're trying to do
in any case, you should probably assign the medic tent an eventhandler for when it dies like so;
medicTent addEventHandler ["Killed", {
params ["_unit", "_killer", "_instigator", "_useEffects"];
if (!alive _unit) then {deleteMarker "respawn_west1"};
}];```
so your addaction would look something like
this addAction
[
"title", // title
{
params ["_target", "_caller", "_actionId", "_arguments"];
(_arguments select 0) addEventHandler ["Killed", {
params ["_unit", "_killer", "_instigator", "_useEffects"];
if (!alive _unit) then {deleteMarker "respawn_west1"};
]; // script
},
medicTent, // arguments
1.5, // priority
true, // showWindow
true, // hideOnUse
"", // shortcut
"true", // condition
15, // radius
false, // unconscious
"", // selection
"" // memoryPoint
];```
no need to have an entirely different script file for a small snippet of code like this
you may need to pass the medicTent variable (wherever that is) into the eh btw
if you do it'd look like uhhh
that (edited the code above)
@tough abyss dude, I really appreciate you taking the time to compile that. But Iβm sorry to say itβs over my head. Iβm just starting out and Iβm trying to dissect it. Iβm sure Iβll learn something from it.
The template for the addAction Iβve grabbed though. βΊοΈ
@winter rose Thank you! I wasnβt sure what avenues to explore further! Iβll give these a try!
@spice arch, ref convoys, you'v done well, that took me ages to bolt down
You might want to consider https://community.bistudio.com/wiki/setUnloadInCombat whiel you're there
if you don't allow unloadincombat, the AI tend to turn out which looks cool
but if you have them at careless, they don't do anything. what i do is when the driver becomes aware of blufor, set the gunner to weapons free
all this depends on if you are planning to have players engage the convoy. I do.
think the next game in the series will use the same script language? or will I have to learn something new again lol
if dayz is anything to go by it will be a C-derivative
C# probably
which would be wonderful, SQF sucks
but will that be harder to learn for non-coders?
C# is about as hard to learn as Python is. They're both object based coding languages and, if it were to be used, you would be able to look at code already written and start learning from there.
and python is one of the easier ones right?
cause I started learning that the other day
Python is very easy. I used to teach it to a Year 8 Class. (7th Grade for US)
C# is probably a little bit more difficult to start learning but it's a bit more intuitive.
shouldn't compare static and dynamic languages, statically typed one will obviously be harder
Hey what is the script for a teleporter[fast travel pole]
No crossposting, do it only ONE topic
i m deleting from other channels this is the write channel, right?
or should ask it in #arma3_editor
this is fine here
okkie so what is it?
no one has it right at the tip of their fingers bro, especially at 4 AM
a quick search gives this:
https://www.youtube.com/watch?v=P9qh0QMcGjA
setPos
especially at 4 AM
Hmm how dare you it's 5 PM here. This is pretty world-wide server so someone's up at anytime
actually I kinda forgot that most of the arma player base is european
I'm not an European tho
disableAI "move", driver myPlane setDamage 1, while { true } do { myPlane setVelocity [0,0,0] }β¦plenty of ways! π
@winter rose
I just tested disableAI "MOVE" with a pilot in a plane and it did not work. hinting the str of checkAIFeature also came back false so I know it was disabled. Plane still took off and could fly fine. Ejected the pilot, and he couldn't move once he was on the ground.
ASia right
@fair drum I am pretty sure killing the pilot would work
or setting the fuel to 0 π
lol I'm aware, but I was trying to apply it to other things since it wasn't my thread
@winter rose
I just tested
disableAI "MOVE"with a pilot in a plane and it did not work. hinting the str ofcheckAIFeaturealso came back false so I know it was disabled. Plane still took off and could fly fine. Ejected the pilot, and he couldn't move once he was on the ground.
@fair drum i tried it once if you do this to AI first then put him into the plane , it will stop the plane from taking off
you're talking as if you were zeus right?
in editor
addaction["Teleport",{player setPos(getPos object)}]; i tried this but init error missing is showing
addAction to nothing will return error. You maybe want to put this before addAction
it works with this!
will it work in dedicated server? @warm hedge
and What should i do if i want it to say Teleport to Range when i go near it
As long as addAction is added to every player
like?
What should i do if i want it to say Teleport to Range when i go near it
I don't get it?
when i go near it and scroll it shows teleport
addAction is effect local, the actions added by the command is local for everyone, so you need to do it for every players I guess. However you're doing in an object's initialization so don't need to think about it?
What if i want it to show Teleport To Range
addActionis effect local, the actions added by the command is local for everyone, so you need to do it for every players I guess. However you're doing in an object's initialization so don't need to think about it?
@warm hedge okie
Then
"Teleport To Range"instead"Teleport"
@warm hedge You are the best!!
You don't need to ping me...
okk sorry
SQF sucks
Nah, SQF is a great language. Only problem is that people expect stuff that simply cannot exist in SQF, because they did not understood how SQF actually works
if dayz is anything to go by it will be a C-derivative
DayZ uses Enscript
which is probably what will fuel arma 4 if it ever gets created
in my personal opinion, Enscript itself is harder then it needs to be ... but well ... bad luck or something among those lines i guess
L*fe server memory leaks incoming
People: Arma is badly optimized
Also same people: have gazillion while-loops in their scheduler setting time, weather and doing other stupid checks you couldve used a trigger or eventhandler for
Sqf is good enough
I agree with Enforce being too overkill for it's purpise
But it could be that it' just this iteration of the script
Sqf itself has seen changes along the years
L*fe server memory leaks incoming
and we talk about actual memory leaks introduced by scripts π€«
Sqf itself has seen changes along the years
Not really, just new operators
SQF itself stood the same way as ever (the runtime of it) with just a very few assembly instructions
Hello guys,
I'm trying to write a small script that will give a player given equipment by the variable name the character he's slotted in his.
For now, I have :
waitUntil {alive player};
{
if (isPlayer _x)
then {
if (!isNil "ce")
then {
_x execVM "loads\ce\zeus.sqf";
}
else {
_x execVM "loads\da\zeus.sqf";
};
};
} forEach [
god,
god1
];
{
if (isPlayer _x)
then {
if (!isNil "ce")
then {
_x execVM "loads\ce\cdg.sqf";
}
else {
_x execVM "loads\da\cdg.sqf";
};
};
} forEach [
sgCdg,
grCdg
];
It seems to be working fine for the first player but it's quite buggy for the others, what am I doing wrong ?
showing us zeus.sqf and cdg.sqf would probably help
also what do you mean by buggy?
You know isPlayer just says if its any player, not that its the local player? or not?
because isPlayer is not == player
so you might be setting the loadouts for others
!isNil "ce"
ALL global variables should have a prefix, your name is way too generic, it could conflict with the variables of some other script
Those are just loads that are other wise working send you this right away
It s buggy because you dont have one loadout but a mix of both
It s buggy because you dont have one loadout but a mix of both
Sounds like what I said
No i thought it was equivalent dedmen I will try it
What do you meant by a prefix
HH_ce
instead of just ce
some tag/prefix you put infront of every variable to make it unique to you
Ok will change it ! The point is that i sont try to call another thing ce by mistake and crash everything ?
@surreal peak here is cdg.sqf, zeus.sqf is quite similar
private _unit = player;
removeAllWeapons _unit;
removeAllItems _unit;
removeAllAssignedItems _unit;
removeUniform _unit;
removeVest _unit;
removeBackpack _unit;
removeHeadgear _unit;
removeGoggles _unit;
_unit addWeapon "R3F_Famas_felin";
_unit addPrimaryWeaponItem "R3F_EOTECH";
_unit addPrimaryWeaponItem "R3F_30Rnd_556x45_FAMAS";
_unit addWeapon "rhs_weap_M136";
_unit addWeapon "R3F_G17";
_unit addHandgunItem "R3F_17Rnd_9x19_G17";
_unit addWeapon "R3F_JIM_LR";
_unit forceAddUniform "R3F_uniform_urr";
for "_i" from 1 to 4 do {_unit addItemToUniform "ACE_tourniquet";};
for "_i" from 1 to 10 do {_unit addItemToUniform "ACE_elasticBandage";};
for "_i" from 1 to 4 do {_unit addItemToUniform "ACE_CableTie";};
_unit addItemToUniform "ACE_MapTools";
_unit addItemToUniform "ACE_Flashlight_MX991";
_unit addVest "R3F_veste_ce300";
for "_i" from 1 to 20 do {_unit addItemToVest "ACE_packingBandage";};
for "_i" from 1 to 5 do {_unit addItemToVest "ACE_morphine";};
for "_i" from 1 to 5 do {_unit addItemToVest "ACE_epinephrine";};
for "_i" from 1 to 2 do {_unit addItemToVest "R3F_17Rnd_9x19_G17";};
_unit addItemToVest "SmokeShellGreen";
for "_i" from 1 to 2 do {_unit addItemToVest "R3F_Grenade_df_mag";};
for "_i" from 1 to 2 do {_unit addItemToVest "R3F_FlashBang_mag";};
_unit addBackpack "FGN_AAF_FAST_M81";
for "_i" from 1 to 4 do {_unit addItemToBackpack "ACE_plasmaIV_500";};
for "_i" from 1 to 10 do {_unit addItemToBackpack "ACE_splint";};
_unit addItemToBackpack "ACE_EarPlugs";
for "_i" from 1 to 10 do {_unit addItemToBackpack "R3F_30Rnd_556x45_FAMAS";};
for "_i" from 1 to 4 do {_unit addItemToBackpack "SmokeShell";};
_unit addHeadgear "R3F_casque_felin";
_unit linkItem "ItemMap";
_unit linkItem "ItemCompass";
_unit linkItem "ItemWatch";
_unit linkItem "TFAR_anprc152";
_unit linkItem "R3F_ITEM_DAGR";
if(true) exitWith{};
that looks like you should just be using setUnitLoadout
if(true) exitWith{};
wtf is this? π
that looks like you should just be using setUnitLoadout
I'm looking at the wiki page now, i tried to do it with cdg and zeus.sqf because the files are ready
wtf is this? π
I was trying to make a script to addAction called XX on a pannel that gives you the load XX and i found a template for this on armaholic that had this line
isn't it usefull
Completely does nothing
exitWith exits the current scope. exitWith{} exits with no extra code, if(true) means that exitWith will always execute
you always exit the function, exactly one line before it would exit anyway
so it saves perfoarrrmance?? π
are you trolling lou ? or are you seriously contradicting polpox
trolling; exiting the script by command just before the end of the script is more perf consuming
i understand what dedmen said and i thing it does nothing
but me understanding code make me uncertain ^^
it does create the if/exitWith structures, processes conditions, all this to just leave before the file ending
it is exactly pointless, yes π
tyty
Sqf is good enough
It's never good enough and SQF has a lot to be improved in terms of its performance which is horrible
Performance limits the degree of kind of project you can implement with it
multithreading plz π
SQF can multithread on linux
what?
π
GIB
I mean, could
how is it possible?
you just run them in parallel Β―_(γ)_/Β―
you must be joking
no
π€
because linux is missing a optimization that windows has, but I'm fixing it up and enabling that on linux too, so then it again won't be able to run in seperate thread
{
_x setDamage 1;
}
parallelForEach _myArray;```
so it means two machines working in parallel or how? It must access the game in synchronous manner anyway.
You can't do that in parallel. You are modifying the world state
thats a seperate thing
are arrays thread-safe?
well it's the very thing preventing it ever from working in parallel π€·
You can run SQF itself in parallel, as long as you don't access the same things
No its not
Thread safety, is it not?
different things
SQF language, versus specific commands
SQF itself can run in parallel (on current linux) but you cannot modify world state or objects in parallel
but you can for example run complicated queries, do lineIntersects (with some limitations)
you can read world state (unless the read also causes a write), but not write
but on windows you can't do anything
well... I... don't know what to say Β―_(γ)_/Β― 
in my personal opinion, Enscript itself is harder then it needs to be ... but well ... bad luck or something among those lines i guess
It is like C# but made by BI, which makes sense if you want to move more game code into script world - which as I understand is the case for C# popularity in video games nowadays.
But I agree that those specifiers which do refcounting and such things are an overkill perhaps (there are 2 or 3 of them...?? don't remember), but I don't know the full picture of why it was needed, so π€·
Enscript is not "like C#"
it has C style syntax and manual memory management
aka: no GC
refcounting is a form of GC
aka: welcome the missions that crash due to out of memory after 2 mins
but I understand what form of GC you are talking about (the one present in C#)
aka: welcome the missions that crash due to out of memory after 2 mins
but but if variable(object) is unreferenced then it's deleted
with my understanding of enscript, refcounting requires autoptr
which makes this more like cpps shared_ptr
yes, there is some way to GC your memory
but that is more like "here are the tools, manage them yourself"
IIRC even without autoptr it still deletes it? I don't remember much honestly, the wiki page has several errors related to it :///
there is a garbage collector, but you have to declare its usage manually iirc
aka: welcome the missions that crash due to out of memory after 2 mins
Are you talking about Old Man? Because that happened.
nah
about less complicated scripts that do some fancy loops without ever deleting stuff
I for sure dislike the lack of pass-by-value custom objects in Enscript ... (like C# struct), but it can be worked around
im adding a toggle terrain and satellite views button to my map control and i need to get the orientation of the map so its the same when they toggle. i know how to set the zoom but i cant find a function for getting its orientation. can anyone help me with this one?
quick question about callExtension callbacks, on the wiki the c++ interface for the function is __declspec (dllexport) void __stdcall RVExtensionRegisterCallback(int(*callbackProc)(char const *name, char const *function, char const *data)); I am wondering what exactly is this part doing? int(*callbackProc)(char const *name, char const *function, char const *data), and what is the name for this style of syntax?
hey y'all, how do i get the respawn settings i have set in description.ext to override those chosen in the eden editor GUI? im having a lot of trouble moving forward with my stuff because of this
@ me with response
@final gale method pointer
@trail hinge language (edit the profanity out now)
and Description.ext already takes precedence over Eden Editor
rlly?
@queen cargo thanks!
i have a template set at Seagull but when my dude dies he just respawns as a dude and not a seagull
@winter rose
you didn't overwrite everything then (like respawn templates)
you can also just remove definitions from Eden
class Header
{
gameType = DM; // Game type
minPlayers = 2; // minimum number of players the mission supports
maxPlayers = 12; // maximum number of players the mission supports
};
respawnTemplatesCiv[] = {"Seagull"};
respawnOnStart = 1;
???
respawnOnStart is working fine, but Seagull is not
player plays as civ
actually wait imma try something
nope, changing to respawnTemplates[] didnt work
yeah i can confirm that its not overriding
can anyone else help me out w this?
@ me if anyone can
what happens when you just do respawnTemplates[] = { "Seagull" };
@trail hinge
if you spawn in as civ and it behaves as expected then your unit is not a civilian at the time of death
also
Respawn player when he joins the game. Available only for INSTANT and BASE respawn types.
respawnOnStart = -1; // Default: 0
-1 - Dont respawn on start. Don't run respawn script on start.
0 - Dont respawn on start. Run respawn script on start.
1 - Respawn on start. Run respawn script on start.```
you don't have a respawn defined as far as i can tell, so if you're testing in SP respawnOnStart isn't going to do anything. in SP default respawn template is 0 (none), which as stated by the wiki is not available for that respawn type
try launching a local multiplayer server from 3DEN and trying, because from there your default respawn template will be 1. or you can just add that entry in your description.ext
there's also no 'overriding' the 3DEN attributes, if there is a setting in the description.ext then the mission will take that setting regardless of what you have in 3den
So, -1 will spawn you on the units position you placed in editor, 0 will spawn you out in the middle of the water, and 1 will start you at the spawn selection screen?
and you'll also spawn in the middle of the water if no respawnOnStart is defined
Does anyone know how to use this command? Tried all day yesterday with all kinds of parameters and none made anything on the screen https://community.bistudio.com/wiki/drawEllipse
(in arma 2)
Drawline worked No problem...
give an example of what you did
All these kinds of variations
And nothing gave anything, I must be overlooking something
What is a reasonable size, came to mind that maybe 10 and 100 are so enormous that they go around the perimeters of the map or so microscopic they can't be seen π
@hasty violet no you cannot edit macros
where one could have this simply compile different code entirely within the file depending on what value showPlayerNames has, as defined in CBA Settings?
You can use different files for each possible setting.
You could build the piece of code to compile manually, using format and then grabbling all the small pieces together
like this
_myScript = preprocessFile "ImTheBase.sqf"; // You can't preproc from string, only from file, so you need to do that first
if (GVAR(showPlayerNames) == 3) then {
_myScript = _myScript + "
_onKeyPressAlphaMax = 2 + (GVAR(showNamesTime) - CBA_missionTime);
_enabledTagsNearby = _enabledTagsNearby || {_onKeyPressAlphaMax > 0}
";
};
if (GVAR(showPlayerNames) == 4) then {
_myScript = _myScript + "
_onKeyPressAlphaMax = 2 + (GVAR(showNamesTime) - CBA_missionTime);
_enabledTagsCursor = _onKeyPressAlphaMax > 0;
"
};
Whale_fnc_myFunction = compile _myScript
obviously the GVAR's won't work there, as I wrote you can only preproc from file
Can anyone recommend a good place to get started with coding? I feel like Iβve jumped in too deep and donβt want to get disheartened as everything I try to do on my own doesnβt work π€£
@topaz fiber
https://community.bistudio.com/wiki/Introduction_to_Arma_Scripting
and the links inside it π
Awesome thanks.
Although I fudge around copy and pasting other peopleβs code, I want to understand it.
So, -1 will spawn you on the units position you placed in editor, 0 will spawn you out in the middle of the water, and 1 will start you at the spawn selection screen?
and you'll also spawn in the middle of the water if no respawnOnStart is defined
@fair drum no, the only thing you're defining with respawnOnStart is whether or not you're running the respawn script and whether or not the respawn script actually runs when you join a mission or not. what onPlayerRespawn.sqf does is entirely up to you, as is the respawn type
Can anyone recommend a good place to get started with coding? I feel like Iβve jumped in too deep and donβt want to get disheartened as everything I try to do on my own doesnβt work π€£
@topaz fiber I feel the same... I just started 2 days ago
don't stress it, start slow and grow big (not to be used out of context\Β©)
the channel is here to help, the wiki too
I'm pretty happy that I managed to model and texture a thing and spawn it ingame π
Hi , I want to make an Add Action in an object of the map
but it only can see players in specific
How can I do it ?
It must be in Eden Editor , I can't put any SQF file
good thing you asked in #arma3_scripting then π
out of curiosity, why can't you put any SQF file?
I can't tell it lmao
we can't help illegal/hacking content Β―_(γ)_/Β―
Is not hacking lmao
oh, I take your word for it then.
Iβve been trying to spawn in a stupid Rallypoint that teleports the player between it and a base flag. Itβs enough to make me never want to write another line of code. My biggest problem is locality. I can get stuff to work locally but as soon as it goes to a dedicated sever it looses all functionality outside of the player that spawns it.
Plenty to read. Plenty to learn.
I also found VS which now makes me feel like a real programmer instead of just using notepad π€£
@topaz fiber even notepad++ can go quite a long way with that thanks to highlighting π i end up using it a fair bit beside VS to edit/view scripts not part of the VS-project im editing π
If i.e. im trying to edit a script i haven't added yet, i might open it in notepad++ beforehand, helps me keeping track of pieces of code i actually already use and code im just looking through/at π
Is It usefull to use VS
Does it show for example what parameters script commands need
Like with c# functions and such
It can in the example of SQF, there's a VS SQF library that helps out with that. although im not sure if all commands are in there
If it's just a single/small script i usually dont bother setting up a project for it, but if it's a scenario or collection of mods im trying to look through at once, i very well might.
it helps me out a fair bit in keeping track of existing variable-names π with just my chaotic self i make many, many more errors :p
I'll test if it suits my workflow :p
Iβm just making βhintsβ π€£
Can anyone spot an error?
{
sector = _x;
switch ((sector getVariable "BIS_WL_sectorSide")) do {
case WEST:
{
if (!((sector getVariable "name") == "Carrier Strike Group 14")) then {
{ sector setVariable ["FastTravelEnabled",true,true] } remoteExec ["bis_fnc_call", 0, true];
};
};
case EAST:
{
if (_x != BIS_WL_currentSector_WEST) then {
{ sector setVariable ["FastTravelEnabled",true,true] } remoteExec ["bis_fnc_call", 0, true];
};
};
default { { sector setVariable ["FastTravelEnabled",true,true] } remoteExec ["bis_fnc_call", 0, true]; };
};
} forEach BIS_WL_sectors;```
missing sqf syntax highlight
The indentation and brace layout are ugly
you have a one pair too many parenthesis on the switch
!(x == y) -> x != y
remoteExec call, not via bis_fnc_call, thats just unnecessary overhead
sector thats a global variable, you are missing a unique prefix/tag, also why are you using a global variable in a short loop that seems wrong.
remoteExec call setVariable? really? thats nonsense, you have the public flag set anyway, its already set everywhere.
You have JIP flag set on a remoteExec of a public setVariable? thats nonsense, the setVariable is already jip.
enough errors/mistakes/stupidnesses or do you need more?
@vague geode β and ```sqf
The sector thing is there because without it I always had an variable _x not defined error in the logs. The one pair too many parenthesis on the switch is true but removing them doesn't solve the problem. To be honest I have no clue why I did all that { /*code*/ } remoteExec ["bis_fnc_call", 0, true]; stuff but that isn't the problem either (tested it alone and it worked) although I am going to remove it.
So yeah, I kindda need more. π
The sector thing is there because without it I always had an variable _x not defined error in the logs.
Ah for
{ sector setVariable ["FastTravelEnabled",true,true] } remoteExec ["bis_fnc_call", 0, true];
Yeah no, thats not gonna work.
but that isn't the problem either
it is
sector variable in there is not what you want it to be
you never set that variable
So now it should work or are there any other errors/mistakes/stupidnesses left?
{
switch (_x getVariable "BIS_WL_sectorSide") do {
case WEST:
{
if ((_x getVariable "name" != "Carrier Strike Group 14") && (_x != BIS_WL_currentSector_EAST)) then {
_x setVariable ["FastTravelEnabled",true,true];
};
};
case EAST:
{
_x setVariable ["FastTravelEnabled",true,true];
};
default { _x setVariable ["FastTravelEnabled",true,true]; };
};
} forEach BIS_WL_sectors;```
looks better atlest
I think you sti...
&& (sector != BIS_WL_currentSector_EAST)
_x !=
and I think you want that same check, on case EAST: too right?
I missed that one sector. What do you mean with the same check on case EAST?
Previously you had if (_x != BIS_WL_currentSector_WEST) check on east, now you only do it on west
That's not necessary since the code only gets executed if (isNull BIS_WL_currentSector_WEST).
I have a similar code the other way around, when isNull BIS_WL_currentSector_EAST...
Basically the idea is to disable fast travel into a contested sector (even as defender) 60 seconds after it got targeted to prevent people from spawning in the back of the attackers if they have already cleared the city. The code here is meant to enable fasttravel again once the sector is either taken or sector voting was reseted.
Oh, yeah, I may have send the two different code blocks in here, once the one for if (isNull BIS_WL_currentSector_WEST) and once the one for if (isNull BIS_WL_currentSector_EAST). I am really sorry. I've only noticed it now...
What's the proper way to save something like a piece of code into a variable? I know the following works:
myCodeVariable = {... code...}
wasn't even done typing my example π
does that also work with quotes (strings) and []? those are always very iffy for me
yes
much appreciated
you need to give the house a variable name and then add that variable name to the forEach array
allMissionObjects "your classname"
I think
stuff to read
yeah. allMissionObjects
yes
allMissionObjects has a example on the wiki page
with a forEach
So I'm having an issue myself. I'm working on a cleanup function for my scripted mission and for some reason object deletion is not working. I'm doing a simple
{deleteVehicle _x} forEach _garbage;```
and `_garbage` is an array that looks something like this ```SQF
[O Group_1:1, O Group_1:2, O Group_1:3, O Group_1:4]``` and I just can't figure out what I'm doing wrong
you can't deleteVehicle groups. deleteVehicle takes objects
isn't O Group_1:1 a reference to an object? The 1st unit in Group_1?
I'm making the array trough nearestObjects or nearestEntities
I've tried _x setDamage 1 as well to see if that would kill them but nope.
hey everyone!
i have a question, i'm tired and feel like i'm going crazy. im trying to add custom event handlers, but it keeps throwing that it can't find the script when its supposed to trigger (so i know the eventhandlers run correctly up to actually calling the sqf
i've tried all permutations i could think of of the paths to sqf files, and nothing works. what am i doing wrong ?
{
Init = "_this execVM '\1rrf_fig_11_hitcount\fnc_1RRF_fig11_hc_init.sqf' ";
HandleDamage = "_this execVM '\1rrf_fig_11_hitcount\fnc_1RRF_fig11_hc_init.sqf' ";
};```
path must be wrong
also don't do execvm for an event handler unless you really need it or you understand what you are doing, it is just so weird
what's the best practice ?
okay, i was thinking i'd have to do that.
well you would generally (in most of the most cases) want event handler to be actually synchronous to the game world. Execvm asks game to execute your script some time later, perhaps at this frame, or at next one, or after a second
Oh. yeah, okay, not a good one to use then
yeah
every time, you load from the hard drive
thanks for the heads up
not ideal for performance
if you manage to put your code into the function library under name foo_fnc_bar, then the event handler code could be
"_this call foo_fnc_bar;"
perfect, cheers
i'm hoping the filepath not working is a weirdness of this specific use case, because i tried so many permutations lol
yes path inside addon is a π¦ ery π
Ace addon structure is nice and their macros are also nice to resolve path to file within pbo
Also, ensure that your pbo has a pbo prefix, without it handling paths is going to be inconvenient
ok, will do. thanks a lot ! i'll look into all that
hmm i'm trying to delete the destroyer from the jets dlc
[_object] call BIS_fnc_Destroyer01EdenDelete;
this actually works, except a middle part of the destroyer still remains
i also tried to fetch all parts via _object getVariable ["bis_carrierParts", []]; and then delete everything in a forEach, but that had the exact same effect
then the event handler code could be
"_this call foo_fnc_bar;"
maybe it can also be"foo_fnc_bar"directly - should save fromcalling (some perf saved) and still pass the arguments
I am not sure, it would mean that the game does
call compile "foo_fnc_bar"
call {foo_fnc_bar}
true
therefore, just call foo_fnc_bar could do
but will it pass _this to it?
Anyone ever scripted map tools without using Ace. Noob question. But it's something we've considered trying to add without using Ace.
Depends on what kind of map tools you're looking for
In my mind doing what you want without using a mod would require considerable scripting knowledge, going insofar as to likely having to create a GUI
and I know from experience that making GUIs in arma is akin to pulling teeth out of an angry lion
hi, i have a question
how to play this animation "Acts_NavigatingChopper_Loop" on the player ? because i can play this only on a bot
yes, call knows all the variables from the scope
yes that's right, forgot that
Depends on what kind of map tools you're looking for
@tough abyss thank you for your reply.
From what I understood, a guy in our server would like map tools to assist in getting the distance between two points on the map. For instance, when launching mortars. (We do not use Ace, using various scripts for some of the things that Ace can offer)
I find myself able to determine distance without any "map tools". But this player is constantly referencing map tools from Ace.
I won't deny that ACE map tools are extremely useful when it comes to ranging artillery, especially with no computers
That being said what you want to do is actually quite possible
OK. Great. Thank you.
one sec
Appreciate any help you give.
so you could do something like
//Prints a systemchat of the range and bearing to a given target when the map is clicked while alt is held.
[player] onMapSingleClick {
if (_alt) then {
_relativeDirection = [(_this select 0), _pos] call BIS_fnc_dirTo;
_relativeDistance = (_this select 0) distance _pos;
systemChat format ["The target is at bearing %1 and is %2 meters away.", _relativeDirection, _relativeDistance];
};
};```
@wanton vigil smack this in initPlayerLocal.sqf and you're good to go.
tested and it works
Wow. Great
though the bearing and distance it gives is very precise
Will handle that today. Very cool.
down to the thousandth place
so if you wanted it to be a bit more vague for realism's sake, you'd have to play with the value some
actually
here:
[player] onMapSingleClick {
if (_alt) then {
_relativeDirection = [(_this select 0), _pos] call BIS_fnc_dirTo;
_relativeDistance = (_this select 0) distance _pos;
_relativeDirection = round _relativeDirection;
_relativeDistance = round _relativeDistance;
systemChat format ["The target is at bearing %1 and is %2 meters away.", _relativeDirection, _relativeDistance];
};
};```
this will round the numbers up so you don't get so precise, it'll still be exact coordinates though it'll be easier to read without the unnecessary accuracy
hey, ive put some decals on a wall that is supposed to fall and when it does the decals doesnt go away so i was wondering what it would take to have those decals deleted as the wall falls. i have the trigger condition on !alive wall and tried to do the deleting but it didnt accept my noob code inputs
how are you spawning the decals
just kinda slapping them onto the wall in eden
are you using the vr objects
with a texture applied?
no..?

let me see your code
im literally a noob at code
ye and i'm not so i shall help 
to the point where it says that ";" is missing when its RIGHT. THERE!!!
learning arma 3's debug trickery will be an important step to take if you're srs about getting into SQF
but seriously show code
i would rather not
i've watched people with room temp IQs get a handle on SQF so i'm sure you can too π
well I mean there's not much I can do in that instance
im not looking to improve my code since the code i currently have is wrong to every turn
im looking for the correct way to do it, which involves coding so i skipped right to scripting instead of the editor chat
I mean... to be blunt, if you're just going to go around asking for others to write your code for you you won't get very far. If you're not willing to learn you may as well just do your best to find workarounds and perfect your skills in 3DEN working within its limitations. Β―_(γ)_/Β―
this will round the numbers up so you don't get so precise, it'll still be exact coordinates though it'll be easier to read without the unnecessary accuracy
@tough abyss
We are going to get this working tomorrow. To see if we can execute it properly. Thank you. I actually would prefer some kind of deviation in the script, whereby we are 20-40 meters off with a particular range.
sure, easy
and you're welcome
[player] onMapSingleClick {
if (_alt) then {
_relativeDirection = [(_this select 0), _pos] call BIS_fnc_dirTo;
_relativeDistance = (_this select 0) distance _pos;
_relativeDirection = round _relativeDirection;
_relativeDistance = round _relativeDistance;
_relativeDirection = _relativeDirection + ([2, 5] call BIS_fnc_randomInt);
_relativeDistance = _relativeDistance + ([20, 40] call BIS_fnc_randomInt);
systemChat format ["The target is at bearing %1 and is %2 meters away.", _relativeDirection, _relativeDistance];
};
};
@wanton vigil should work. not tested though
but this will deviate the heading by 2-5 degrees and the distance by 20-40 degrees
if you wanted to get REALLY into it you could randomly choose between + or -
but that'd increase deviation range
e.g -5 + random 10
[player] onMapSingleClick {
if (_alt) then {
_relativeDirection = [(_this select 0), _pos] call BIS_fnc_dirTo;
_relativeDistance = (_this select 0) distance _pos;
_relativeDirection = round _relativeDirection;
_relativeDistance = round _relativeDistance;
_randomOperator = selectRandom [+, -];
_relativeDirection = _relativeDirection _randomOperator ([2, 5] call BIS_fnc_randomInt);
_randomOperator = selectRandom [+, -];
_relativeDistance = _relativeDistance _randomOperator ([20, 40] call BIS_fnc_randomInt);
systemChat format ["The target is at bearing %1 and is %2 meters away.", _relativeDirection, _relativeDistance];
};
};
i have no idea if this will work
i've not tested it
but i don't see why it wouldn't
You cannot assign an operator
i've never tried using variables to represen- darn

what would be best practice in this case then?
e.g -5 + random 10
oh
yeah i guess that works best
dunno why i asked that, i've done that exact thing in the past π
in that case, ```sqf
[player] onMapSingleClick {
if (_alt) then {
_relativeDirection = [(_this select 0), _pos] call BIS_fnc_dirTo;
_relativeDistance = (_this select 0) distance _pos;
_relativeDirection = round _relativeDirection;
_relativeDistance = round _relativeDistance;
_relativeDirection = _relativeDirection + (-5 + random 10);
_relativeDistance = _relativeDistance + (-40 + random 80);
systemChat format ["The target is at bearing %1 and is %2 meters away.", _relativeDirection, _relativeDistance];
};
};
bluekavflag addAction ["Go to Kavala", {player setPos getMarkerPos selectRandom ["k","k_1","k_2","k_3","k_4"]} {hint "A player is entering the Kavala raid zone!"}]; Does anyone know how to execute both {player setPos getMarkerPos selectRandom ["k","k_1","k_2","k_3","k_4"]} and {hint "A player is entering the Kavala raid zone!"} when the action is interacted with?
bluekavflag addAction ["Go to Kavala",
{player setPos (getMarkerPos selectRandom ["k","k_1","k_2","k_3","k_4"]);
hint "A player is entering the Kavala raid zone!"},
//rest of your addaction
];```
you also had a syntax error
Thanks! Will try it out later
no problem
i'm trying to reference a code block inside my function through a ctrlEH but it doesn't seem to run the block ever.
https://github.com/56curious/VKN_Official_Mod/blob/master/VKN_Functions/Functions/fn_missionTemplateTool.sqf#L94
Is the code as you'd probs want the context.
Its from line 48 to 95.
I'm guessing its out of scope maybe?
Guess you're right
undefined variable
And I think you were told the same thing about a dozen times now :D
local variables don't carry over into eventhandlers
Well at least I guessed right so its slowing sinking in π€£
when using params, how can you skip an index? E.g. I only want to store index 1,2 & 5 to a variable name. Can I just use "" so it'll be something like:
_args params ["", ["_one", "", [""]], ["_two", "", [""]], "", "", ["_five", "", [""]];
@plucky wave yes exactly. ""
i think making it a function on a global variable would be the best solution @brave jungle
Thx Dedmen, again..
Hello Dedmen, I overhauled my initServer.sqf script following your advice to the best of my knowledge and abilities but now the whole thing doesn't seem to be working anymore at all. Could you help me to figure out how to make it work?
waitUntil { !isNil "BIS_WL_sectors" };
targetOvercast = random [1,0,1]; //random overcast value in a range from 0 (0% overcast, very likely) to 1 (100% overcast, very unlikely)
[targetOvercast] call BIS_fnc_setOvercast; //random overcast value set (forced weather change)
FastTravelTimeoutWEST = time; //point in time when fast travel to sector targeted by OPFOR should be disabled for BLUFOR
FastTravelTimeoutEAST = time; //point in time when fast travel to sector targeted by BLUFOR should be disabled for OPFOR
//...//
//...//
while { true } do
{
if (isNull BIS_WL_currentSector_WEST) then {
if (BIS_WL_selectionTime_WEST != -1) then { //has someone from BLUFOR already voted
if (FastTravelTimeoutEAST <= time) then { //has FastTravelTimeoutEAST already been set
missionNamespace setVariable ["FastTravelTimeoutEAST", time + (BIS_WL_selectionTimeout + 60)]; //FastTravelTimeoutEAST is set to 60 seconds after voting ended
};
{
switch (_x getVariable "BIS_WL_sectorSide") do {
case WEST:
{
if ((_x getVariable "name" != "Carrier Strike Group 14") && (_x != BIS_WL_currentSector_EAST)) then {
_x setVariable ["FastTravelEnabled",true,true];
};
};
case EAST:
{
_x setVariable ["FastTravelEnabled",true,true];
};
default { _x setVariable ["FastTravelEnabled",true,true]; };
};
} forEach BIS_WL_sectors; //enable fast travel for all sectors except "Carrier Strike Group 14" and the sector currently targeted by OPFOR
} else {
missionNamespace setVariable ["FastTravelTimeoutEAST", time]; //incase sector selecting was reset while voting was in process FastTravelTimeoutEAST gets reset
};
} else {
if (FastTravelTimeoutEAST <= time) then { //has the 60 second timeout for fast travel after sector selection passed
BIS_WL_currentSector_WEST setVariable ["FastTravelEnabled",false,true]; //disable fast travel for the sectro currently targeted by BLUFOR
};
};
/*...*/
/*...*/
if (isNull BIS_WL_currentSector_EAST) then {
if (BIS_WL_selectionTime_EAST != -1) then { //someone from OPFOR has voted
if (FastTravelTimeoutWEST <= time) then { //has FastTravelTimeoutWEST already been set
missionNamespace setVariable ["FastTravelTimeoutWEST", time + (BIS_WL_selectionTimeout + 60)];
};
{
switch (_x getVariable "BIS_WL_sectorSide") do {
case WEST:
{
if (_x getVariable "name" != "Carrier Strike Group 14") then {
_x setVariable ["FastTravelEnabled",true,true];
};
};
case EAST:
{
if (_x != BIS_WL_currentSector_WEST) then {
_x setVariable ["FastTravelEnabled",true,true];
};
};
default { _x setVariable ["FastTravelEnabled",true,true]; };
};
} forEach BIS_WL_sectors; //enable fast travel for all sectors except "Carrier Strike Group 14" and the sector currently targeted by BLUFOR
} else {
missionNamespace setVariable ["FastTravelTimeoutWEST", time]; //incase sector selecting was reset while voting was in process FastTravelTimeoutWEST gets reset
};
} else {
if (FastTravelTimeoutWEST <= time) then { //has the 60 second timeout for fast travel after sector selection passed
BIS_WL_currentSector_EAST setVariable ["FastTravelEnabled",false,true]; //disable fast travel for the sectro currently targeted by OPFOR
};
};
//...//
//...//
if(overcast == targetOvercast) then { //has the target overcast been reached
_changeTime = (60 + (random 120)) * 60; //random time over which overcast should change (between 1 and 3 hours)
missionNamespace setVariable ["targetOvercast", random [1,0,1]; //set new random overcast value
(_changeTime / timeMultiplier) setOvercast targetOvercast; //change overcast to target overcast value over set in-game time
};
sleep 1;
};
don't see why you need two seperte switch statements that do basically the same stuff π€
but now the whole thing doesn't seem to be working anymore at all.
Add logging and see what exactly doesn't work, and what still works
missionNamespace setVariable ["targetOvercast", random [1,0,1]]
why not just
targetOvercast = random [1,0,1];
missionNamespace setVariable ["targetOvercast", random [1,0,1]]
why not just
targetOvercast = random [1,0,1];
Didn't you tell me so? Maybe I misunderstood something there. But I tried it withtargetOvercast = random[1,0,1];as well and it didn't seem to work either.
PS: How do I add logging?
diag_log or systemChat @vague geode
@winter rose Ok, I'll try that.
@vague geode according to the wiki,
random [min, mid, max]
instead of [1,0,1] maybe use [0, 0.25, 1]
hey, is there a way to call the rolling arma 3 credits movie?
I have my own credits, but i'd just like to be display the default ones aswell
@ebon citrus https://community.bistudio.com/wiki/BIS_fnc_credits
in a rolling-fashion
@winter rose this one open up a window with the credits
but im looking for a movie-type
this ^ displays the default one
you can read its code (in the Functions Viewer) and adapt it with your data
ah yes, didn't notice these
but i want to display the default arma 3 credits
not my own credits

and the issue with this one is that it's interactable and pauses the mission on the background
nothing a setAccTime 1 can't fix (regarding the pausing)
i guess
but yep, I don't know a ready function (not meaning there isn't one - I don't know all of them to my shame)
but the point is that the credits would be rolling
like in the campaign missioins
like these
i was wondering if i'd have to go and dig up BIS files again
or was there a clear solution
if not, then i might aswell write a dynamic-text roll that goes through the entire credits myself
[] spawn {
disableSerialization;
// Create credits
(findDisplay 46) createDisplay "RscCredits";
[] call BIS_fnc_credits_movie;
};
```for the ones wondering - thanks to @ebon citrus
Theres a module for that @eager pier
Cant remember the exact name
should be something like cover map or cover area? might be completely wrong though
Just go down the list of modules in the editor and you'll find it

let's say I have coordinates [x1,y1] and I need to move 100 meters towards coordinates [x2,y2] and get a new set of coordinates where I end up....
what kind of math formula would do that
hmm try that @radiant nimbus ? (result not guaranteed ^^)```sqf
// _pos1 = start
// _pos2 = destination
private _normVector = _pos2 vectorDiff _pos1;
private _m100 = _normVector vectorMultiply 100;
private _pos100m = _pos1 vectorAdd _m100;
vectors... WITCHCRAFT!!
missionNameSpace setVariable ["ace_hearing_disableVolumeUpdate",true,[2]]; This doesn't seem to work when executed in a script on my server (both dedi and hosted), but when I click execute on server from the debug console, with the exact same code, it does work
I have no clue what's happening
thanks Lou, I'll give it a try
I'm really lost, I've tried about everything I can find rn. It's so strange the command doesn't seem to work when it runs in a function on a server, but does run when executed there manually
if it is run on the server, why not just var = value ?
Well, that network ID 2 is just an example, because I was testing it on a hosted server
It could contain client id's too
(btw, you don't especially need an array if it is for just one network id)
Yeah I know that, but was just to show that there should be more in there
2 should never be in there, unless hosted mp
But that's besides the point
[{ ace_hearing_disableVolumeUpdate = true }] remoteExec ["call", 42];
```? Β―\_(γ)_/Β―
also, debug question but "are you sure your code is run"
Well, the code before and after it is, so it's not running into errors
It shouldn't really
Thanks for the suggestion
A tricky question:
If I have a local object (which exists only on client's computer), and if I send handle to that object to server, and from server back to client, does that handle become objNull in the end or arma can resolve that and return the proper object?
(My guess: it will be null in the end)
I believe it would end up as objNull on the server yes.
I don't know how it works exactly - if object on the server isNull in the case above, is the data erased completely or does it still hold the actual object's ID but it knows that such ID is invalid on this machine
try and thou shalt see!
Hey could someone please help me out, been stumped for ages now... trying to make it so that when a wheel is damage, through gun shot or crashing etc the tyres are not damaged. This is what i've got so far:
this addEventHandler ["HandleDamage", {
_hitSelection = (_this select 1);
if ("wheel" in _hitSelection) then
{
this setHit["HitWheel", 0];
this setHitPointDamage["HitWheel", 0];
this setHitPointDamage["HitHull", 0];
this setHitPointDamage["HitLFWheel", 0];
hint format["%1", _hitSelection];
};
}];
It hits inside the 'if' statement, but it doesn't repair the vehicle :'(
are you sure you use the correct names?
Because setHit uses the named selections (from model) which can be found here: https://community.bistudio.com/wiki/ArmA:_Selection_Translations
And setHitPointDamage uses the names from the vehicle configs, which can be different as well
Hey, i've tried lots of things.. but i've found an alternative solution. Here's the solution to anyone that may be interested in doing this yourself :)
this addEventHandler ["HandleDamage", {
private _unit = _this select 0;
private _hitSelection = _this select 1;
private _projectileType = _this select 4;
if ("wheel" in _hitSelection) then {
_unit getHit _hitSelection;
if !(_projectileType isEqualTo "") then {_unit getHit _hitSelection;};
};
}];
The wheels are not damaged if shot. So "bullet proof".
this isnt defined in the first event handler.
assuming it was in an object init, this is a local variable so isn't available in the event handler's scope.
Hmm, out of curiosity i will fix that and give it a try @robust hollow , though i like my new solution for what i'm wanting :)
Military cargo platform, is there a script to keep the walls down?
Vanilla slingloading spawns rope attachment hooks on the cargo. They appear to behave like simple objects, but move with the cargo. Are they just being setPos'd every frame?
i dont know for sure, but i'd say its more likely they are attached to the cargo.
I ask because
One cannot attach actions to a simple object via addAction.
and I vaguely recall seeing remote heli/cargo flying with hooks lagging behind.
Hey everyone is there any script for jamming tfar beta?
yes
can you share mate?
// jam radios
player setVariable ["tf_sendingDistanceMultiplicator", 0.05,true];
player setVariable ["tf_receivingDistanceMultiplicator", 0.05, true];
player setVariable ["tf_transmittingDistanceMultiplicator", 0.05, true];
// un-jam radios
player setVariable ["tf_sendingDistanceMultiplicator", 1,true];
player setVariable ["tf_receivingDistanceMultiplicator", 1, true];
player setVariable ["tf_transmittingDistanceMultiplicator", 1, true];
thank you so much mate
@static fulcrum why are you redefining parameters already in eventhandler?
you already have all the params you need passed into the EH natively
params ["_unit", "_selection", "_damage", "_source", "_projectile", "_hitIndex", "_instigator", "_hitPoint"];```
can anyone break down this code for me?
[[<UAV>],{player disableUAVConnectability [_this select 0,TRUE];}] remoteExec ['call',-2,<UAV>];
especially where the select is pointing to
well, it translates to the following when executed on the target.
[<UAV>] call {player disableUAVConnectability [_this select 0,TRUE];}```
so `_this select 0` is referencing the uav in the arguments array
Hi all I was wondering if anyone could help me. I'm setting up a trigger for a teleport area so when 4 players are present it teleporting them all to the one area out of 4 possible ones. I'm getting generic error and I've tried a heap of different ways to fix it but I cannot for the life of me figure it out.
heres the trigger content
Activation = player
Activation type = present
Repeatable
Condition
{player in thisList} count [player] >0;
0 is for solo testing purposes for what i want ill set to >3 on the server for testing
Activation
_location = getPosASL selectRandom [R1,R2,R3,R4];
{player in thisList} setPosASL [_location];
Error im getting
'...om [R1,R2,R3,R4];
{player in thisList} |#|setPosASL [_location];}'
error generic error in expression
I could use some guidance in what I've done wrong or even if I'm going in the right direction
Generic error in expression is usually meaning you messed something up in regards to the command itself, check the formatting of setPosASL (obj setPosASL position). I think it might be the first part {player in thisList} but I'm not sure. Idk if that returns the object.
I don't work with triggers much but wouldn't it be (player in thisList) instead of curly brackets? Idk if it's different for triggers
Bracket type is prob the only thing that I didn't try I'll have a go at that and see if it works thanks
@onyx sun https://community.bistudio.com/wiki/in in value returns boolean, so you player in thisList will result in True or False
you probably want to use https://community.bistudio.com/wiki/forEach
Is it possible to put an external link into a diary record that can be opened by clicking on it (like for example a link to a Steam group)?
someone did that recently by hacking a bit
you would have to skim through the channel's messages though
@slim verge was the author, iirc?
When using allControls is there a way to filter the controls to only show buttons?
As it currently returns Control #101 etc. I could try and identify by the number, however this is going to be used on many diplays/dialogs so the numbers will likely be different
So, I have an issue where _bTimedout is being set to true after the sleep, even if XIM_bRecentCombat is set to true when it is running.
if (!(_oPlayer getVariable "XIM_bRecentCombat")) then
{
sleep 10; // sleep for 10 seconds
hint "no longer in combat";
_bTimedOut = true;
};```
This is contained within a waitUntil loop, so it is run multiple times. _bTimedOut is defined at the start of the loop as a private variable which is false by default
@cold pebble ```sqf
(allControls _myDisplay) select { ctrlType _x == 1 };
Effectively, what I want it to do is check if XIM_bRecentCombat is true every 10 seconds, and then set _bTimedOut to true if that is the case.
Ah fantastic, I was just looking for something like ctrlType π
I had just thought of a weird solution where I was gonna check buttonAction for each control, and if a return wasn't "" its a button
_bTimedout is being set to true after the sleep, even if XIM_bRecentCombat is set to true when it is running
@modern adder β¦I don't get your issue?
error is elsewhere, that code should work as you expect it to
The issue is that it should exit if XIM_bRecentCombat is set to true
The if statement requires it to be false
So if it is true, it should immediately exit
And not make _bTimedOut true
Hmm buttonAction returns "" even if onButtonClick is populated in config, guess it only plays with buttonSetAction
@modern adder ```sqf
_oPlayer getVariable ["XIM_bRecentCombat", false] // a default value, if not set
Ok, I'll try that
if you didn't set it, the returned value is nil
and if (nil) throws an error and executes the code (I guess).
Thing is
That variable is defined as false right before that if
I highly doubt that is the problem
@cold pebble if you want to do something like that, your best bet is adding the button click eh, and checking if eh id > 0, but honestly you should just use Lou's solution.
I am using (allControls _myDisplay) select { ctrlType _x == 1 }; to identify buttons
The XIM_bRecentCombat variable is set to true elsewhere is a different bit of code entirely
But now I want to manipulate what is already on the button
Which looks like a getText solution rn
params [
["_display",displayNull,[displayNull]]
];
{
if (ctrlType _x == 1) then {
private _var = getText(configFile >> (displayName here) >> "controls" >> (ctrlClassName _x) >> "onButtonClick");
systemChat str (_x);
};
} forEach (allControls _display);
Currently here, which is almost what I need, just trying to figure the best way to get the name of the display, rather then the return of Display #1600 etc
_className = findDisplay 12 getVariable ["BIS_fnc_initDisplay_configClass", ""]; // "RscDiary" you can set some variable like that for your own displays aswell, onLoad eh.
If you need config class of a game created Display, it is stored on display itself: sounds like its set without me doing any onLoad jazz
Lemme give it a go
See what I get
for BI displays yea, as they use their initDisplay funcs
Ahhh thats true
Hmm, as this is meant to be universal I couldn't be confident that people would setup that var correctly, but that may be the only way
Just wondering if I can use the IDD to get its name from config
hi, i have some problems with the Military cargo platform (CargoPlaftorm_01_green_F) when i let it spawn the walls are panels are up, is there a script to delete them or hide?
"getNumber(_x >> 'idd') == 1014" configClasses configFile;
Anyone who's interested, thats how I've got the name of the display
More specifically ```sqf
("getNumber(_x >> 'idd') == 1014" configClasses configFile) params ["_path"];
private _configString = str _path;
private _startIndex = (_configString find ".bin") + 5;
private _displayName = _configString select [_startIndex];
@modern adder
private _bTimedOut = false;
if (!(_oPlayer getVariable ["XIM_bRecentCombat", false])) then
{
sleep 10; // sleep for 10 seconds
hint "no longer in combat";
_bTimedOut = true;
};
should work.
Yeah I figured it out cheers
but i need help
maybe we can
oh
hi, i have some problems with the Military cargo platform (CargoPlaftorm_01_green_F) when i let it spawn the walls are panels are up, is there a script to delete them or hide?
missed it
the thing is, when i edit in eden the Military cargo platform and hide the walls, in game they appear
if you set them down in Eden, they should be down in-game
but it is doable by script, I don't know how though - I suppose animateSource
maybee thats the problem, i let them spawn like this: ["CargoPlaftorm_01_green_F", 0, [0,2,-7.1],
createVehicle?
what is that?
hmm
this seems to be some crCTI framework value or I don't know what else, and I can't really help about that
you can check available animation names with https://community.bistudio.com/wiki/animationNames @austere silo
thank you.
private _vehicle = "Land_RotorCoversBag_01_F" createVehicle position player;
// _vehicle is the (local) variable
// if you need to use it in -another- script, use a global variable (no underscore)
SHDW_MyCar = "Land_RotorCoversBag_01_F" createVehicle position player;
myRope = ropeCreate [SHDW_MyCar, [0,0,-2], bag1, [0,0,0], 10];
@cunning oriole β
and if you don't need a future reference to this object, no need to = - just use createVehicle without grabbing the return value π
@tough abyss Thanks for the info, still couldn't get that particular one to work anyhow
@surreal peak cheers for that i had another think about it and sort got it working with forEach however selectRandom is only ever taking the last option whenever i test solo locally perhaps a server environment would work different but yea
@cunning oriole I don't exactly get your "toObject" idea? What do you want to do with this vehicle - make it a prop?
I don't think a rope can take allowDamage, but you can try @cunning oriole
hey there i'm currently trying to close a dialog and immediately calling a function in which a new dialog will be created.
_toggleMode = {
params["_control"];
private _display = ctrlParent _control;
private _vehicle = _display getVariable ["Vehicle",objNull];
closeDialog 0;
[_vehicle] call VEH_REP_fnc_repairInit; //the new dialog will be created in this function
};
_changeButton ctrlAddEventHandler ["buttonDown",_toggleMode];
the problem now is that the current dialog won't be closed and is still active when the new dialog is created. at least findDisplay doesn't change to No Display.
Does anyone know what is going on here?
Nevermind, i fixed it using spawn instead of call...i guess the closeDialog will be executed in the same simulation cycle as the createDialog and then causes the problem.
So i have been working on this script, with help from you guys i have mostly got it to work, i am now just trying to delete the action on the base flag when the rally point is destroyed or moved. Im struggling with the action ID of the 'base flag' addaction.
any help would be appreciated
Woah
stop
put code in pastebin
myGlobalVariable = obj addAction *blah blah*
unit removeAction myGlobalVariable
If you're gonna add code please use `, see the pinned message
@topaz fiber use ```sqf for small code pieces, or sqfbin.com for bigger ones
@brave jungle thanks for pointing that out. To be fair I never read it. My bad. π
π
np
don't forget to remoteExec it if its MP
Effect is local https://community.bistudio.com/wiki/removeAction
Itβs been the remoteexec of the action in the first place thatβs been a brick wall for me. Had to googletube hard to figure it out.
Ah, well always welcome to ask here π
I found I was asking for so much help here I might as well of had someone write the script for me. π€£
A lot of what Iβve got is still nabbed from guides and forums. Iβm hoping I can understand it by adapting it to my needs an then figuring out why it works.
so i am trying to understand where is the "press space to initiate launch sequence" in the USS freedom config, i don't remember under what name are those things labeled, anyone have clues?
nice page, but i was looking for a more "learn how to find it" than the actual answer π
- go to wiki
- use search
π€£
'''sqf
[teleportToRallypoint = baseFlag, ["<t color='#00ff00'>Move to Rally Point</t>", "(_this select 1) setPos (getMarkerPos 'respawn_west1')", [], 1, false, true, "", "", 5]] remoteExec ["addAction", 0, true];
'''
oh, that didnt work like i expect
``` instead of '''
i cant even code that π€£
you're fired!
nono i mean, how to find it using arma and the tools in it, as I have to look into some mods to call functions later on
[teleportToRallypoint = baseFlag, ["<t color='#00ff00'>Move to Rally Point</t>", "(_this select 1) setPos (getMarkerPos 'respawn_west1')", [], 1, false, true, "", "", 5]] remoteExec ["addAction", 0, true];
clap
nono i mean, how to find it using arma and the tools in it, as I have to look into some mods to call functions later on
Functions Viewer? @flat elbow
baseFlag removeAction teleportToRallypoint;
this doesnt work as i expected
as in at all π€£
it cannot work
first because of bad syntax,
and second the id is created on the client, you can't get it from the server
@topaz fiber make a client-side script?
if you remoteExec, it means it's not
if the script is local, no need to remoteExec π
Put addAction on object, so it's available for everyone π€
then you made your code server-side
tell me: is this action to come and go? as in, appear, disappear, etc
yes
then maybe you want to addAction and set a condition to it - so you don't have to add/remove every time
https://community.bistudio.com/wiki/addAction
see 8th parameter
is the hole thing, its called by a specific role
yea i found it referenced in the PBO as [_plane,_dirCatapult] call BIS_fnc_AircraftCatapultLaunch;
funny enough i tried to place an airplane and call [this] call BIS_fnc_AircraftCatapultLaunch; but it gives a generic error in expression on line 100, i checked also with this iskindof "Plane" and it is so i'm puzzled
_this select 0: mode (Scalar) 0: plane/object
Guess it's not expecting a plane object, but something else
this is where _plane is defined: private _plane = cameraOn;
cameraon: Returns the vehicle to which the camera is attached.
the RPT have a more clear reason: 20:40:06 File A3\Functions_F_Jets\Functions\Aircraft\fn_AircraftCatapultLaunch.sqf [BIS_fnc_AircraftCatapultLaunch]..., line 86
20:40:06 Suspending not allowed in this context
call vs spawn
I don't have the code in front of me (I'm on phone), but wiki explains a lot...
yep
@flat elbow ```sqf
[this] SPAWN BIS_fnc_AircraftCatapultLaunch;
Although if wiki is incomplete feel free to share your info in #community_wiki π
Wiki is purrfuct!! >:u
the function was never meant to be used in multiplayer or on an AI
funny, because in the Showcase⦠it is used on an AI.
but yea you have to call it with spawn and probably also set the throttle as my AI just wanted to use his F22 as a submarine
https://community.bistudio.com/wiki/setAirplaneThrottle which only works on players
you are making assumptions before knowing how it works, don't put horses before the cart ^^
no I mean, the script itself should take care of this velocity thing
I think, at least
well but it doesn't, i can see the plane splashing in the water
that's why i wanted to set the throttle, as the wrapper of the action to the user do it
you make me start Arma to check
look into "Functions\AircraftCarrier\fn_carrier01CatapultActionAdd.sqf" line 144
ok so i think to make it not magically change speed i need to use https://community.bistudio.com/wiki/setVelocityTransformation
dab sweat
@flat elbow what exactly are you trying - making an AI take off with that?
yep, basically i want to accellerate it and make it gain altitude
vanilla airplane? from the vanilla aircraft carrier USS Freedom?
uhm no it's a RHS airplane from the uss freedom
ops
[superAIPlane] spawn BIS_fnc_AircraftCatapultLaunch; // works with the Black Wasp
i am used to the quality of RHS that even I forget they are a mod, deeply sorry
no "big" worries, but it's frustrating :p
above ^code will work, whether the plane is on a carrier or not
yea i am trying to wrap my head around the RHS one
do the RHS planes actually have the required configs to work with Carriers?
i don't think so, that's why i am using the setVelocityTransformation in addition
with little success I have to admit
just checked the RHSUSAF F22 and it is not compatible by default (unless there's some internal patch), which is probably easier to add than trying to rewrite the catapult system π
uhm if it's not compatible what do you mean by "easier to add"?
make a compat mod which extends the classes with the required configs
although, since RHS is already extending Plane_Base_F it should be there, can't look in-game at the moment
i think i can nail it with the setvelocitytransformation if only i understand how it works
this is why i should have progressed my 3D math skills
in short you could use the code from BIS_fnc_aircraftCatapultLaunch, change the variables which are normally taken from the config, and replace those with "static" numbers
because all it does it increase the velocity (movement into a certain direction), which should work(?)
yep it seems so but i guess they also missed the use of the setthrottle as there is:
if (_isAi) then
{
_plane engineOn true;
_plane setAirplaneThrottle 1;
};
it seems that this disableAI "MOVE"; does not actually prevent them from moving the aircraft, they keep disaligning :/
Has anyone had any experience with selectRandom? When I use it in my script it always chooses whatever is last in the array
show your code!
@onyx sun
selectRandom [0,1,2,3,4,5,6,7,8,9]; // 1 out of 10 chances
_RES1 = player setPos
[getPos R1 select 0, getPos R1 select 1, getPos R1 select 2]
forEach thisList;
_RES2 = player setPos
[getPos R2 select 0, getPos R2 select 1, getPos R2 select 2]
forEach thisList;
_RES3 = player setPos
[getPos R3 select 0, getPos R3 select 1, getPos R3 select 2]
forEach thisList;
_RES4 = player setPos
[getPos R4 select 0, getPos R4 select 1, getPos R4 select 2]
forEach thisList;
_RES5 = player setPos
[getPos R5 select 0, getPos R5 select 1, getPos R5 select 2]
forEach thisList;
selectRandom [_RES1, _RES2, _RES3, _RES4, _RES5];
Like its pretty simple so i don't understand why its not randomising
because that script is wrong in many many ways...
and if you would have displayErrors enabled, or checked your RPT files you would know it's borked
Its supposed to in in an activation area in a trigger. And i don't get any errors there when testing it im pretty sure I've got show errors on as when setting this up I've ran into heaps. Sorry I'm still wrapping my head around arma code
player setPos []is a command, and doesn't return anything[] forEach thisListis not possible... it expects a code block, not an arrayselectRandomgives a return value, and doesn't do stuff magicly
setPos:
Return Value: Nothing
so it's not possible to use_RES1 = player setPos [...], _RES1 will simply contain nothing...
forEach:
Example 1:
{ _x setDamage 1 } forEach units group player;
it requires Code (or a String when running SQS), which means something between{and}