#arma3_scripting

1 messages Β· Page 592 of 1

finite sail
#

right. beer me. its the only thing that makes sense now πŸ™‚

#

oh, i said that out loud, didnt i?

spice arch
#

cheers m8

finite sail
#

no problem

neon crane
#

@neon crane so you made a folder called scripts and added the unlock.sqf into 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 via View >> View Filke extensions in 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?

brave jungle
#

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

neon crane
#

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.

jagged halo
#

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?

exotic flax
#

either modify CfgFunctions of Liberation and add your functions to theirs, or disable their CfgFunctions and put all their functions in yours

jagged halo
#

how would i add it to cfgfunctions.hpp

exotic flax
#

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

jagged halo
#

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

exotic flax
#

make sure the path is correct, either relative to file or relative to mission root

jagged halo
#

Perhaps i have to change that part i added to check from mission root

#

because wont it be looking relative to kp\kpplm\etc

rustic plover
#

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

#

Ok. It's not "AmmoBox"

fair drum
#

is there a "fired upon" command?

#

or what would you do to check to see if a unit is fired upon?

plucky wave
#

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?

sonic slate
#

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

exotic tinsel
winter rose
#

either check the behaviour (switches to "COMBAT" when engaged), or (less precise and limited range) the FiredNear EH + checking shooter's side @fair drum

vague geode
#

Where do I need to put this in? The init.sqf? Or initServer.sqf?

    params ["_mapIsOpened", "_mapIsForced"];

    /* code to execute */

}];```
still forum
#

there is no map on server

vague geode
#

So it's the init.sqf then, right?

winter rose
#

@vague geode initPlayerLocal.sqf, or init.sqf yes

vague geode
#

Ok, thanks.

#

@winter rose Does it irrelevant which one I put it in or is there something I need to be aware of?

winter rose
#

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 {};

vague geode
#

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

winter rose
#

of course, because

there is no map on server

vague geode
#

@winter rose Wait, you meant it's ALSO run on the server, not exclusivly run there, right?

winter rose
#

init.sqf run things locally
and
is run by clients and server yes

vague geode
#

@winter rose Ah, ok. Thanks alot.

winter rose
hollow thistle
#

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.

vague geode
#

@hollow thistle That's great since isServer (or rather !isServer) is exactly what I used...

hollow thistle
#

for adding Map eh you should actually check if there's interface. no point in adding it somewhere where there's no interface.

winter rose
#

@hollow thistle true, hasInterface

long glacier
#

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

]
};```

cosmic lichen
#

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

long glacier
#

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

]```

still forum
#

compile format ['player addWeapon "%1"', _classname],
notlikemeow

#

you can pass parameters to the action function, please just use that

long glacier
#

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

]
};```

still forum
#
_text, 
{player addWeapon (_this select 3)}, 
_classname, 0.1, true, true, "", "(_target distance _this) < 3" 
long glacier
#

Ohh ok is this for better performance

still forum
#

MUCH better yes.

long glacier
#

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 πŸ‘

finite sail
#

mmmm

winter rose
#

@finite sail still no links without description πŸ‘€ #rules

finite sail
#

is mmmm not suffiicient? πŸ™‚

#

rules noted, wont happen again

topaz fiber
#

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

finite sail
#

@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];
};

topaz fiber
#

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

finite sail
#

πŸ™‚

topaz fiber
#

I just try to understand it.

brave jungle
#

Learn from existing ;)

#

Just no Frankensteining 🀣

topaz fiber
#

It should be in a .sqf and callled from the serverinit by execVM? That’s how I did it anyway.

finite sail
#

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

topaz fiber
#

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

tough abyss
#

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

topaz fiber
#

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. πŸ‘

tough abyss
#

keep in mind init.sqf will execute for every JIP

finite sail
#

yes, init.sqf has its place

topaz fiber
#

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?

finite sail
#

JIP is players who join after the mission has started

#

for flashpoint, its witchcraft

topaz fiber
#

I’ve not seen that wiki page. Really useful thanks.

tough abyss
#

Hey, I need to make players invincible while in a specific vehicle named "vic"

#

Does anyone know how to accomplish this?

winter rose
#
vic allowDamage false```@tough abyss, but be sure to check for locality (see the wiki)
tough abyss
#

No I meant the players inside must be invincible, not the vehicle itself

#

The passengers can not be damaged while inside

inland bay
#

what

#

stop please

#

Someone was @tting me

#

and I get warned for telling them to F off

tacit glen
#

@inland bay can u help me with a admin script not loading?

half hawk
#

yeah mikey

inland bay
#

Yeah sure thing

#

Im rather Excelled in that area

half hawk
#

yeah join TS

tacit glen
#

ugh stop stealing my men moe

crude needle
tacit glen
#

πŸ’―

tough abyss
#

Where do I put that @crude needle

fair drum
#

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?

tough abyss
#

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

fair drum
#

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

tough abyss
#

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

solar chasm
#

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?

copper raven
solar chasm
#

Doh. Thanks, was trying to find something under speed. =/

topaz fiber
#

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

copper raven
#

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.

topaz fiber
#

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?

copper raven
topaz fiber
#

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

copper raven
#

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.

topaz fiber
#

so the script should just be placed in the init.sqf instead of server.sqf?

copper raven
#

initPlayerLocal

topaz fiber
#

ok that makes sense. I'll give it a go. thanks πŸ‘

copper raven
#

MP EH is also not needed, change it to regular respawn

#

player addEventHandler ["Respawn", ...]

topaz fiber
#

so... its monitoring the player, when the player respawns the handler spawns the delete body function
thats how i read it

copper raven
#

Ye, and creates the particles, if you want particles to appear for other players, you need to remoteExec.

topaz fiber
#

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

topaz fiber
#

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

brave jungle
#

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 πŸ˜‰

topaz fiber
#

Thanks Curious, that helps a lot.... although eventHandler is both??

#

ahhhh, one is executed

#

i see

frigid lodge
#

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

winter rose
#

@frigid lodge ^

frigid lodge
#

🀣 I thought AmmoBoxInit would work but does it not add a scrollwheel option for other players?

winter rose
#

I believe you should add items before doing the preload/create dialog

#

(not experienced with Arsenal, just a guess)

frigid lodge
#

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 πŸ™‚

frigid lodge
#

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

valid bison
#

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 πŸ™‚

warm hedge
#

I don't think there's any, unfortunately

valid bison
#

All right, well, let's go with some "actionKeys" aha ^^ Thanks anyway πŸ™‚

exotic flax
#

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 πŸ˜‰

valid bison
#

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

tough abyss
#

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

exotic flax
#

AnimChanged is also running almost every second πŸ€” unless someone is afk...

tough abyss
#

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

jaunty zephyr
#

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)

astral dawn
#

But I don't really know if it returns an empty path or an incomplete path in that situation

jaunty zephyr
#

hmm that only works for agents, right? I dont actually use agents 😬

astral dawn
#

You should try anyway

#

I think we tried it on vehicles too

jaunty zephyr
#

oh wow I can actually attach that to normal units o.O

finite sail
#

nah, it works for everything

#

not limited to agents

jaunty zephyr
#

nice! the failing unit never ever triggers the "PathCalculated" event (expected, as it fails creating the path)

winter rose
#

someone should edit that page πŸ‘€

jaunty zephyr
#

and I can use that to find it

#

thx @astral dawn

finite sail
astral tendon
#

Is there any way to force the server to play in certain difficulty sething?

restive leaf
#

server.cfg combined with a custom Arma3Profile

astral tendon
#

How do I insert that into the mission file?

restive leaf
#

You don't

winter rose
#

"is there a way to force the server to play a certain mission in a certain difficulty setting"

astral tendon
#

Yes?

restive leaf
#

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

astral tendon
#

Then its impossible.

restive leaf
#

"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

finite sail
#

I think @astral tendon s question is "Can the mission maker force someone elses server to play in a given difficulty setting"

winter rose
#

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

topaz fiber
#

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

candid cape
#

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"

long glacier
#

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); }; };

long glacier
#

If it helps I have been playing around with get3DENLayerEntities but with no luck.

hallow mortar
#

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.

halcyon crypt
#

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)

hallow mortar
#

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.

halcyon crypt
#

yep

#

there are better functions for spawning groups though

hallow mortar
#

If this will spawn the group I want at the position I want, I don't need anything better

halcyon crypt
#

there isn't a better one anyway πŸ˜›

acoustic abyss
#

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?

exotic flax
#

You can assign any name to the orbat, or connect any player to any position in the orbat.

acoustic abyss
#

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

exotic flax
#

It's not possible to use code in CfgOrbat.

acoustic abyss
#

Thank you. Will play around with this.

glass zinc
#

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

tough abyss
#

Does anyone know where @life_server is downloaded when entering a server?

restive leaf
#

Oh, God no...

tough abyss
#

@restive leaf You tell me?

cunning crown
tough abyss
#

what server is it

cunning crown
#

[...] Arma 3 RPG [...]

tough abyss
#

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

topaz fiber
#

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

topaz fiber
#

I put it in a while run do script and it works perfectly. Is this best practice or is there a better way? Thanks.

austere pendant
#

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

copper raven
#

Clients won't know what Dialog1 is, i assume you have it defined serverside only

austere pendant
#

so i should change the name?

copper raven
#

define the function client side

austere pendant
#

?????

copper raven
austere pendant
#

i literally just learned how to do dialogue

copper raven
#

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;
};
austere pendant
#

wait i just have a init.sqf

austere pendant
#

is that what i did wrong?

copper raven
#

If you put it in init.sqf, your trigger is setup wrong then, i don't know much about them

austere pendant
#

so i change the init to a initplayer?

copper raven
#

Doesn't matter

austere pendant
#

wait what

copper raven
#

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

austere pendant
#

aight

exotic tinsel
#

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

austere pendant
#

halayooya i got dialoge to work

#

techincally sharp did but still

copper raven
#

I thought you already had it in one of the init scripts, missread what you wrote, but glad you got it working.

austere pendant
#

πŸ˜„

#

this scripting thing is damn hard

#

and im doing the basic of basic things

fervent kettle
#

quick question, is server.sqf a reserved file name like onPlayerRespawn.sqf?

topaz fiber
#

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

winter rose
#

@fervent kettle nope

fervent kettle
#

thanks, was looking for that site^^

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

topaz fiber
#

@winter rose ha, the only thing I had wrong was the => expression. I even put in correct the first time. Thanks for your help.

winter rose
#

yeah - <=/>= inforEqual, suporEqual

topaz fiber
#

erghh, ilove hate this scripting. it works but as soon as the tent is destroyed the distance condition stops it working at all 😦

winter rose
#

it… should not?

you can make the tent invincible, too (allowDamage) @topaz fiber

viral basin
#

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.

topaz fiber
#

@winter rose yeah, something was funky in the playerlocal and playerrespawn. now all sorted and working perfectly. thanks

winter rose
#

@viral basin ```sqf
[_unit, [_forEachIndex, _x]] remoteExecCall ["setObjectTexture"];

viral basin
#

okay so server and hc also need this information and jip is not required?

winter rose
#

for JIP, ```sqf
// ["setObjectTexture", true];
["setObjectTexture", 0, true];

viral basin
#

are you sure? according to the wiki the second param is targets and the third one is jip

winter rose
#

woops
0, true

#

or 0, _unit
etc

viral basin
#

πŸ˜„ i give it a try then - so its just the case that the server also need this information?

winter rose
#

a server is not always a dedicated one

viral basin
#

in our case it is πŸ˜… sorry for the confusion

winter rose
#

you should ideally code your mission for everyone, someone can decide to host it or it to be hosted

topaz fiber
#

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

winter rose
#

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

topaz fiber
#

If !alive medicTent //add the action with the distance

#

Else //add the one without

plucky wave
#

Will Arma freak out if you have multiple statements on the same line? E.g.:

player playAction "putdown"; sleep 1; _civ playAction "putdown";

winter rose
#

nope

plucky wave
#

Cool, ta

stone totem
#

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

winter rose
#

@stone totem you want them to be already aboard the vehicle?

stone totem
#

yes

winter rose
stone totem
#

ah great

winter rose
#

(or specific moveInDriver, moveInCargo, etc)

stone totem
#

wow great! that helps. Thanks πŸ™‚

#

problem instant fixed πŸ™‚

winter rose
#

the wiki and this channel are here to help πŸ˜‰

stone totem
#

πŸ˜„

#

❀️

finite bone
#

Is there a way to reduce damage taken by a specific playable character or increase the health above the standard 100% ?

finite bone
#

thanks PES_ThumbsUp

fair drum
#

lou is on fire today

winter rose
uncut trout
#

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.

winter rose
#

disableAI "move", driver myPlane setDamage 1, while { true } do { myPlane setVelocity [0,0,0] }…plenty of ways! πŸ˜„

jaunty ermine
#

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

tough abyss
#

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 avoid while loops 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)

topaz fiber
#

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

uncut trout
#

@winter rose Thank you! I wasn’t sure what avenues to explore further! I’ll give these a try!

finite sail
#

@spice arch, ref convoys, you'v done well, that took me ages to bolt down

#

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.

fair drum
#

think the next game in the series will use the same script language? or will I have to learn something new again lol

tough abyss
#

if dayz is anything to go by it will be a C-derivative

#

C# probably

#

which would be wonderful, SQF sucks

fair drum
#

but will that be harder to learn for non-coders?

errant epoch
#

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.

fair drum
#

and python is one of the easier ones right?

#

cause I started learning that the other day

errant epoch
#

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.

copper raven
#

shouldn't compare static and dynamic languages, statically typed one will obviously be harder

brittle egret
#

Hey what is the script for a teleporter[fast travel pole]

warm hedge
#

No crossposting, do it only ONE topic

brittle egret
#

i m deleting from other channels this is the write channel, right?

fair drum
#

this is fine here

brittle egret
#

okkie so what is it?

fair drum
#

no one has it right at the tip of their fingers bro, especially at 4 AM

warm hedge
#

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

fair drum
#

actually I kinda forgot that most of the arma player base is european

warm hedge
#

I'm not an European tho

fair drum
#

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.

brittle egret
#

ASia right

winter rose
#

@fair drum I am pretty sure killing the pilot would work

#

or setting the fuel to 0 πŸ™‚

fair drum
#

lol I'm aware, but I was trying to apply it to other things since it wasn't my thread

brittle egret
#

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

fair drum
#

you're talking as if you were zeus right?

brittle egret
#

in editor

#

addaction["Teleport",{player setPos(getPos object)}]; i tried this but init error missing is showing

warm hedge
#

addAction to nothing will return error. You maybe want to put this before addAction

brittle egret
#

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

warm hedge
#

As long as addAction is added to every player

brittle egret
#

like?

warm hedge
#

What should i do if i want it to say Teleport to Range when i go near it
I don't get it?

brittle egret
#

when i go near it and scroll it shows teleport

warm hedge
#

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?

brittle egret
#

What if i want it to show Teleport To Range

warm hedge
#

Then "Teleport To Range" instead "Teleport"

brittle egret
#

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?
@warm hedge okie

#

Then "Teleport To Range" instead "Teleport"
@warm hedge You are the best!!

warm hedge
#

You don't need to ping me...

brittle egret
#

okk sorry

queen cargo
#

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

winter rose
#

L*fe server memory leaks incoming

ebon citrus
#

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

queen cargo
#

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

runic edge
#

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 ?

surreal peak
#

showing us zeus.sqf and cdg.sqf would probably help

#

also what do you mean by buggy?

still forum
#

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

runic edge
#

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

still forum
#

It s buggy because you dont have one loadout but a mix of both
Sounds like what I said

runic edge
#

No i thought it was equivalent dedmen I will try it

still forum
#

always read the wiki πŸ˜„

runic edge
#

What do you meant by a prefix

still forum
#

HH_ce
instead of just ce

#

some tag/prefix you put infront of every variable to make it unique to you

runic edge
#

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{};
still forum
#

that looks like you should just be using setUnitLoadout

#

if(true) exitWith{};
wtf is this? πŸ˜„

runic edge
#

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

warm hedge
#

Completely does nothing

surreal peak
#

exitWith exits the current scope. exitWith{} exits with no extra code, if(true) means that exitWith will always execute

still forum
#

you always exit the function, exactly one line before it would exit anyway

winter rose
#

so it saves perfoarrrmance?? πŸ˜„

runic edge
#

are you trolling lou ? or are you seriously contradicting polpox

winter rose
#

trolling; exiting the script by command just before the end of the script is more perf consuming

runic edge
#

i understand what dedmen said and i thing it does nothing

#

but me understanding code make me uncertain ^^

winter rose
#

it does create the if/exitWith structures, processes conditions, all this to just leave before the file ending
it is exactly pointless, yes πŸ™‚

runic edge
#

tyty

astral dawn
#

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

winter rose
#

multithreading plz πŸ˜„

still forum
#

SQF can multithread on linux

astral dawn
#

what?

still forum
#

πŸ˜„

winter rose
#

GIB

still forum
#

I mean, could

astral dawn
#

how is it possible?

still forum
#

you just run them in parallel Β―_(ツ)_/Β―

astral dawn
#

you must be joking

still forum
#

no

astral dawn
#

πŸ€”

still forum
#

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

winter rose
#
{
  _x setDamage 1;
}
parallelForEach _myArray;```
astral dawn
#

so it means two machines working in parallel or how? It must access the game in synchronous manner anyway.

still forum
#

You can't do that in parallel. You are modifying the world state

#

thats a seperate thing

winter rose
#

are arrays thread-safe?

astral dawn
#

well it's the very thing preventing it ever from working in parallel 🀷

still forum
#

You can run SQF itself in parallel, as long as you don't access the same things

#

No its not

astral dawn
#

Thread safety, is it not?

still forum
#

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

astral dawn
#

well... I... don't know what to say Β―_(ツ)_/Β― notlikemeow

#

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 🀷

queen cargo
#

Enscript is not "like C#"
it has C style syntax and manual memory management

#

aka: no GC

astral dawn
#

refcounting is a form of GC

queen cargo
#

aka: welcome the missions that crash due to out of memory after 2 mins

astral dawn
#

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

queen cargo
#

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"

astral dawn
#

IIRC even without autoptr it still deletes it? I don't remember much honestly, the wiki page has several errors related to it :///

winter rose
#

there is a garbage collector, but you have to declare its usage manually iirc

still forum
#

aka: welcome the missions that crash due to out of memory after 2 mins
Are you talking about Old Man? Because that happened.

queen cargo
#

nah
about less complicated scripts that do some fancy loops without ever deleting stuff

astral dawn
#

I for sure dislike the lack of pass-by-value custom objects in Enscript ... (like C# struct), but it can be worked around

exotic tinsel
#

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?

final gale
#

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?

trail hinge
#

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

queen cargo
#

@final gale method pointer

winter rose
#

@trail hinge language (edit the profanity out now)
and Description.ext already takes precedence over Eden Editor

trail hinge
#

rlly?

final gale
#

@queen cargo thanks!

trail hinge
#

i have a template set at Seagull but when my dude dies he just respawns as a dude and not a seagull

#

@winter rose

winter rose
#

you didn't overwrite everything then (like respawn templates)
you can also just remove definitions from Eden

trail hinge
#
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

tough abyss
#

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

fair drum
#

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

tough abyss
#

hi whale!

#

how are you? it's been a whi(a)le

radiant nimbus
#

(in arma 2)

#

Drawline worked No problem...

fair drum
#

give an example of what you did

radiant nimbus
#

All these kinds of variations

#

And nothing gave anything, I must be overlooking something

radiant nimbus
#

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 πŸ˜‚

still forum
#

@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

topaz fiber
#

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 🀣

winter rose
topaz fiber
#

Awesome thanks.

#

Although I fudge around copy and pasting other people’s code, I want to understand it.

tough abyss
#

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

radiant nimbus
#

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

winter rose
#

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

radiant nimbus
#

I'm pretty happy that I managed to model and texture a thing and spawn it ingame 😎

candid cape
#

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

winter rose
#

good thing you asked in #arma3_scripting then πŸ˜„
out of curiosity, why can't you put any SQF file?

candid cape
#

I can't tell it lmao

winter rose
#

we can't help illegal/hacking content Β―_(ツ)_/Β―

candid cape
#

Is not hacking lmao

winter rose
#

oh, I take your word for it then.

topaz fiber
#

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 🀣

west tree
#

@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 πŸ™‚

radiant nimbus
#

Is It usefull to use VS

#

Does it show for example what parameters script commands need

#

Like with c# functions and such

west tree
#

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

radiant nimbus
#

I'll test if it suits my workflow :p

topaz fiber
#

I’m just making β€œhints” 🀣

vague geode
#

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;```
still forum
#

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?

winter rose
#

@vague geode ↑ and ```sqf

vague geode
#

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. πŸ˜…

still forum
#

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

vague geode
#

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;```
still forum
#

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?

vague geode
#

I missed that one sector. What do you mean with the same check on case EAST?

still forum
#

Previously you had if (_x != BIS_WL_currentSector_WEST) check on east, now you only do it on west

vague geode
#

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

frozen canopy
#

What's the proper way to save something like a piece of code into a variable? I know the following works:

still forum
#

myCodeVariable = {... code...}

frozen canopy
#

wasn't even done typing my example πŸ˜›

#

does that also work with quotes (strings) and []? those are always very iffy for me

still forum
#

yes

frozen canopy
#

much appreciated

copper raven
#

πŸ€”

#

sure, but put the classname in quotes

still forum
#

explain what you want to do

#

iterate through all buildings of that classname?

quaint ivy
#

you need to give the house a variable name and then add that variable name to the forEach array

still forum
#

allMissionObjects "your classname"
I think

#

stuff to read

#

yeah. allMissionObjects

#

yes

#

allMissionObjects has a example on the wiki page

#

with a forEach

quaint ivy
#

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
still forum
#

you can't deleteVehicle groups. deleteVehicle takes objects

quaint ivy
#

isn't O Group_1:1 a reference to an object? The 1st unit in Group_1?

still forum
#

Ah πŸ€”

#

confusing names ┬─┬ γƒŽ( γ‚œ-γ‚œγƒŽ)

quaint ivy
#

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.

winter flicker
#

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' ";
        };```
astral dawn
#

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

winter flicker
#

what's the best practice ?

winter rose
#

use CfgFunctions to load your function in memory

#

once*

winter flicker
#

okay, i was thinking i'd have to do that.

astral dawn
#

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

winter flicker
#

Oh. yeah, okay, not a good one to use then

astral dawn
#

yeah

winter rose
#

every time, you load from the hard drive

winter flicker
#

thanks for the heads up

winter rose
#

not ideal for performance

winter flicker
#

defo

#

so i should use call fnc_name;

#

once i've added it through CfgFunctions

astral dawn
#

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

winter flicker
#

perfect, cheers

#

i'm hoping the filepath not working is a weirdness of this specific use case, because i tried so many permutations lol

astral dawn
#

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

winter flicker
#

ok, will do. thanks a lot ! i'll look into all that

west grove
#

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

winter rose
#

then the event handler code could be
"_this call foo_fnc_bar;"
maybe it can also be "foo_fnc_bar" directly - should save from calling (some perf saved) and still pass the arguments

astral dawn
#

I am not sure, it would mean that the game does
call compile "foo_fnc_bar"

call {foo_fnc_bar}

winter rose
#

true
therefore, just call foo_fnc_bar could do

astral dawn
#

but will it pass _this to it?

winter rose
#

yes, call knows all the variables from the scope

wanton vigil
#

Anyone ever scripted map tools without using Ace. Noob question. But it's something we've considered trying to add without using Ace.

tough abyss
#

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

faint oasis
#

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

astral dawn
#

yes, call knows all the variables from the scope
yes that's right, forgot that

wanton vigil
#

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.

tough abyss
#

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

wanton vigil
#

OK. Great. Thank you.

tough abyss
#

one sec

wanton vigil
#

Appreciate any help you give.

tough abyss
#

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

wanton vigil
#

Wow. Great

tough abyss
#

though the bearing and distance it gives is very precise

wanton vigil
#

Will handle that today. Very cool.

tough abyss
#

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

wanton vigil
#

Understood.

#

Very cool.

tough abyss
#

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 wave

#

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

tough abyss
#

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. Β―_(ツ)_/Β―

wanton vigil
#

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.

tough abyss
#

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

winter rose
#

e.g -5 + random 10

tough abyss
#
[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

winter rose
#

You cannot assign an operator

tough abyss
#

i've never tried using variables to represen- darn

#

what would be best practice in this case then?

winter rose
#

e.g -5 + random 10

tough abyss
#

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

broken forge
#

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?

tough abyss
#
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

broken forge
#

Thanks! Will try it out later

tough abyss
#

no problem

brave jungle
warm hedge
#

Guess you're right

still forum
#

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

brave jungle
#

Well at least I guessed right so its slowing sinking in 🀣

plucky wave
#

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

still forum
#

@plucky wave yes exactly. ""

#

i think making it a function on a global variable would be the best solution @brave jungle

plucky wave
#

Thx Dedmen, again..

vague geode
#

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;
};
still forum
#

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

vague geode
#

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 with targetOvercast = random[1,0,1]; as well and it didn't seem to work either.
PS: How do I add logging?

winter rose
#

diag_log or systemChat @vague geode

vague geode
#

@winter rose Ok, I'll try that.

winter rose
#

@vague geode according to the wiki,

random [min, mid, max]

instead of [1,0,1] maybe use [0, 0.25, 1]

ebon citrus
#

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

winter rose
ebon citrus
#

in a rolling-fashion

#

@winter rose this one open up a window with the credits

#

but im looking for a movie-type

winter rose
#

this ^ displays the default one
you can read its code (in the Functions Viewer) and adapt it with your data

ebon citrus
#

in my own research

#

i know

winter rose
#

ah yes, didn't notice these

ebon citrus
#

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

winter rose
#

nothing a setAccTime 1 can't fix (regarding the pausing)

ebon citrus
#

i guess

winter rose
#

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)

ebon citrus
#

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

winter rose
#
[] spawn {
    disableSerialization;
    // Create credits
    (findDisplay 46) createDisplay "RscCredits";
    [] call BIS_fnc_credits_movie;
    };
```for the ones wondering - thanks to @ebon citrus
oblique arrow
#

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

radiant nimbus
#

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

finite sail
winter rose
#

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;

finite sail
#

vectors... WITCHCRAFT!!

narrow pollen
#

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

radiant nimbus
#

thanks Lou, I'll give it a try

narrow pollen
#

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

winter rose
#

if it is run on the server, why not just var = value ?

narrow pollen
#

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

winter rose
#

(btw, you don't especially need an array if it is for just one network id)

narrow pollen
#

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

winter rose
#
[{ ace_hearing_disableVolumeUpdate = true }] remoteExec ["call", 42];
```? Β―\_(ツ)_/Β―
#

also, debug question but "are you sure your code is run"

narrow pollen
#

Well, the code before and after it is, so it's not running into errors

#

It shouldn't really

#

Thanks for the suggestion

astral dawn
#

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)

winter rose
#

I believe it would end up as objNull on the server yes.

astral dawn
#

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

winter rose
#

try and thou shalt see!

static fulcrum
#

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 :'(

exotic flax
#

are you sure you use the correct names?

static fulcrum
#

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

robust hollow
#

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.

static fulcrum
#

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

austere silo
#

Military cargo platform, is there a script to keep the walls down?

digital hollow
#

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?

robust hollow
#

i dont know for sure, but i'd say its more likely they are attached to the cargo.

digital hollow
#

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.

clever tree
#

Hey everyone is there any script for jamming tfar beta?

exotic flax
#

yes

clever tree
#

can you share mate?

exotic flax
#
// 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];
clever tree
#

thank you so much mate

tough abyss
#

@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"];```
fair drum
#

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

robust hollow
#

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
onyx sun
#

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

uncut rapids
#

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

onyx sun
#

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

surreal peak
vague geode
#

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

winter rose
#

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?

cold pebble
#

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

modern adder
#

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

winter rose
#

@cold pebble ```sqf
(allControls _myDisplay) select { ctrlType _x == 1 };

modern adder
#

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.

cold pebble
#

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

winter rose
#

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

copper raven
#

error is elsewhere, that code should work as you expect it to

modern adder
#

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

cold pebble
#

Hmm buttonAction returns "" even if onButtonClick is populated in config, guess it only plays with buttonSetAction

winter rose
#

@modern adder ```sqf
_oPlayer getVariable ["XIM_bRecentCombat", false] // a default value, if not set

modern adder
#

Ok, I'll try that

winter rose
#

if you didn't set it, the returned value is nil
and if (nil) throws an error and executes the code (I guess).

modern adder
#

Thing is

#

That variable is defined as false right before that if

#

I highly doubt that is the problem

copper raven
#

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

cold pebble
#

I am using (allControls _myDisplay) select { ctrlType _x == 1 }; to identify buttons

modern adder
#

The XIM_bRecentCombat variable is set to true elsewhere is a different bit of code entirely

cold pebble
#

But now I want to manipulate what is already on the button

modern adder
#

But it's definitely true

#

I can tell in the console

cold pebble
#

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

copper raven
#

_className = findDisplay 12 getVariable ["BIS_fnc_initDisplay_configClass", ""]; // "RscDiary" you can set some variable like that for your own displays aswell, onLoad eh.

cold pebble
#

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

copper raven
#

for BI displays yea, as they use their initDisplay funcs

cold pebble
#

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

austere silo
#

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?

cold pebble
#

"getNumber(_x >> 'idd') == 1014" configClasses configFile;
Anyone who's interested, thats how I've got the name of the display

cold pebble
#

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

winter rose
#

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

modern adder
#

Yeah I figured it out cheers

austere silo
#

but i need help

winter rose
#

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

austere silo
#

the thing is, when i edit in eden the Military cargo platform and hide the walls, in game they appear

winter rose
#

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

austere silo
#

maybee thats the problem, i let them spawn like this: ["CargoPlaftorm_01_green_F", 0, [0,2,-7.1],

winter rose
#

createVehicle?

austere silo
#

structDefs set

#

i have

winter rose
#

what is that?

austere silo
#

hmm

winter rose
#

this seems to be some crCTI framework value or I don't know what else, and I can't really help about that

austere silo
#

ok np

#

i will try with animateSource

winter rose
austere silo
#

thank you.

winter rose
#
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 πŸ˜‰

static fulcrum
#

@tough abyss Thanks for the info, still couldn't get that particular one to work anyhow

onyx sun
#

@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

winter rose
#

@cunning oriole I don't exactly get your "toObject" idea? What do you want to do with this vehicle - make it a prop?

winter rose
#

I don't think a rope can take allowDamage, but you can try @cunning oriole

viral basin
#

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?

viral basin
#

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.

topaz fiber
#

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

brave jungle
#

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

winter rose
#

@topaz fiber use ```sqf for small code pieces, or sqfbin.com for bigger ones

topaz fiber
#

@brave jungle thanks for pointing that out. To be fair I never read it. My bad. πŸ‘

brave jungle
#

πŸ˜„

#

np

#

don't forget to remoteExec it if its MP

topaz fiber
#

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.

brave jungle
#

Ah, well always welcome to ask here πŸ˜‰

topaz fiber
#

I found I was asking for so much help here I might as well of had someone write the script for me. 🀣

brave jungle
#

haha

#

you'll learn πŸ˜‰

topaz fiber
#

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.

flat elbow
#

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?

winter rose
flat elbow
#

nice page, but i was looking for a more "learn how to find it" than the actual answer πŸ˜›

exotic flax
#
  1. go to wiki
  2. use search
    🀣
topaz fiber
#

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

exotic flax
#

``` instead of '''

topaz fiber
#

i cant even code that 🀣

winter rose
#

you're fired!

flat elbow
#

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

topaz fiber
#
[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

winter rose
#

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

topaz fiber
#
baseFlag removeAction teleportToRallypoint;
#

this doesnt work as i expected

#

as in at all 🀣

winter rose
#

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?

topaz fiber
#

tbh thats what i thought i had done.....

#

the script is called by the player

winter rose
#

if you remoteExec, it means it's not

#

if the script is local, no need to remoteExec πŸ˜‰

topaz fiber
#

but the addaction needs to be seen by everyone

#

and then removed for everyone

exotic flax
#

Put addAction on object, so it's available for everyone πŸ€”

winter rose
#

then you made your code server-side
tell me: is this action to come and go? as in, appear, disappear, etc

topaz fiber
#

yes

winter rose
#

then maybe you want to addAction and set a condition to it - so you don't have to add/remove every time

topaz fiber
winter rose
topaz fiber
#

is the hole thing, its called by a specific role

flat elbow
#

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

exotic flax
#

_this select 0: mode (Scalar) 0: plane/object

#

Guess it's not expecting a plane object, but something else

flat elbow
#

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

winter rose
#

call vs spawn

exotic flax
#

I don't have the code in front of me (I'm on phone), but wiki explains a lot...

flat elbow
#

yep

winter rose
#

@flat elbow ```sqf
[this] SPAWN BIS_fnc_AircraftCatapultLaunch;

exotic flax
#

Although if wiki is incomplete feel free to share your info in #community_wiki πŸ˜‰

winter rose
#

Wiki is purrfuct!! >:u

flat elbow
#

the function was never meant to be used in multiplayer or on an AI

winter rose
#

funny, because in the Showcase… it is used on an AI.

flat elbow
#

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

winter rose
#

you are making assumptions before knowing how it works, don't put horses before the cart ^^

flat elbow
#

i resorted in setting the velocity instead

#

i wonder if that's what you meant lou?

winter rose
#

no I mean, the script itself should take care of this velocity thing

#

I think, at least

flat elbow
#

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

winter rose
#

you make me start Arma to check

flat elbow
#

look into "Functions\AircraftCarrier\fn_carrier01CatapultActionAdd.sqf" line 144

#

dab sweat

winter rose
#

@flat elbow what exactly are you trying - making an AI take off with that?

flat elbow
#

yep, basically i want to accellerate it and make it gain altitude

winter rose
#

vanilla airplane? from the vanilla aircraft carrier USS Freedom?

flat elbow
#

uhm no it's a RHS airplane from the uss freedom

winter rose
#

heh

#

pleeease, mods are a big change, at least give notice of their usage! πŸ”¨

flat elbow
#

ops

winter rose
#
[superAIPlane] spawn BIS_fnc_AircraftCatapultLaunch; // works with the Black Wasp
flat elbow
#

i am used to the quality of RHS that even I forget they are a mod, deeply sorry

winter rose
#

no "big" worries, but it's frustrating :p

#

above ^code will work, whether the plane is on a carrier or not

flat elbow
#

yea i am trying to wrap my head around the RHS one

exotic flax
#

do the RHS planes actually have the required configs to work with Carriers?

flat elbow
#

i don't think so, that's why i am using the setVelocityTransformation in addition

#

with little success I have to admit

exotic flax
#

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 πŸ˜‰

flat elbow
#

uhm if it's not compatible what do you mean by "easier to add"?

exotic flax
#

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

flat elbow
#

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

exotic flax
#

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(?)

flat elbow
#

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;
    };
flat elbow
#

it seems that this disableAI "MOVE"; does not actually prevent them from moving the aircraft, they keep disaligning :/

onyx sun
#

Has anyone had any experience with selectRandom? When I use it in my script it always chooses whatever is last in the array

winter rose
#

show your code!

#

@onyx sun

#
selectRandom [0,1,2,3,4,5,6,7,8,9]; // 1 out of 10 chances
onyx sun
#
_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

exotic flax
#

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

onyx sun
#

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

exotic flax
#
  1. player setPos [] is a command, and doesn't return anything
  2. [] forEach thisList is not possible... it expects a code block, not an array
  3. selectRandom gives a return value, and doesn't do stuff magicly
exotic flax
#

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 }