#arma3_scripting

1 messages · Page 649 of 1

past wagon
#

so now I have to redo it a bit

#

how do I make it add backpacks if they are just part of the array?

little raptor
#

backpacks are part of cfgVehicles

#

items are part of cfgMagazines

#

their configs are different

past wagon
#

ok

#

inconvenient but ok

little raptor
#

if it's a class in cfgVehicles, use the backpack version

#

otherwise use the item one

past wagon
#

ok

little raptor
past wagon
#

ok

little raptor
#

Works with items, weapons and magazines.

past wagon
#

but I want the backpacks to be integrated into the crates in the exact same way as the rest of the items. will using addBackPackCargo interfere with this?

#

wont I have to create a separate array like with the weapons and magazines?

past wagon
#

ok

#
private _itemArray = ["Binocular", "FirstAidKit", "Medikit", "muzzle_snds_L", "optic_Arco_blk_F", "optic_Aco", "optic_Hamr", "optic_ACO_grn", "optic_MRCO", "muzzle_snds_acp", "optic_Holosight_blk_F", "HandGrenade", "SmokeShell", "U_B_FullGhillie_ard", "V_TacVest_oli", "H_HelmetB", "H_HelmetB_camo", "B_AssaultPack_rgr", "B_Carryall_mcamo", "V_PlateCarrier1_rgr"];

_crates = allMissionObjects "Box_EAF_Equip_F";

{
_item = selectRandom _itemArray

_x addItemCargoGlobal [_item, 4]
} forEach _crates
#

ima just move this up here

little raptor
past wagon
#

ok

#
if _item isClass (configFile >> "cfgVehicles" >> _item);
#

@little raptor

#

is that a start?

little raptor
past wagon
#

better now?

#

@little raptor now do I add a then statement?

little raptor
past wagon
#

well

#

i just dont know what to do next

#

i did read the wiki

#

what is a Boolean

#

?

little raptor
#

you can click on it

#

and read it

past wagon
#

I read the whole thing

#

i am pretty sure that an if statement is a type of Boolean

#

and i put a boolean in the isClass statement

#

so everything should be good

#
if _item = isClass (configFile >> "cfgVehicles" >> _item);
little raptor
#

what about the syntax?

past wagon
#

is there a =?

little raptor
#

here's how EVERYTHING in SQF works:
operand1 operator operand2
(operator and command are almost synonymous)
some commands don't have the left hand operand (like selectRandom). these are called unary commands/operators.
some have neither (like time) these are called nullar commands/operators.
commands that have both operands are called binary operators.

each operand can either be a variable, or the return value from another operand.
if a command returns something, it can also be saved into a new variable using =:
variable = operand1 operator operand2

Syntax:
if condition
condition: Boolean expression.
if is a unary command
you provide a bool to its right
it can be the result from another command
for example:

Syntax:
Boolean = isClass config
Parameters:
config: Config
Return Value:
Boolean
isClass is also a unary command
it takes arguments to its right
it returns a boolean
so we pass its return value to our if:
if isClass (configFile >> "cfgVehicles" >> _item) then

past wagon
#

ok

#
if isClass (configFile >> "cfgVehicles" >> _item) then
#

so that is just saying, if _item is in the cfgVehicles class, then....

#

what next?

#

@little raptor

past wagon
#
private _itemArray = ["Binocular", "FirstAidKit", "Medikit", "muzzle_snds_L", "optic_Arco_blk_F", "optic_Aco", "optic_Hamr", "optic_ACO_grn", "optic_MRCO", "muzzle_snds_acp", "optic_Holosight_blk_F", "HandGrenade", "SmokeShell", "U_B_FullGhillie_ard", "V_TacVest_oli", "H_HelmetB", "H_HelmetB_camo", "B_AssaultPack_rgr", "B_Carryall_mcamo", "V_PlateCarrier1_rgr"];

_crates = allMissionObjects "Box_EAF_Equip_F";

{
_item = selectRandom _itemArray

if isClass (configFile >> "cfgVehicles" >> _item) then
  {
_x addBackpackCargoGlobal [_item, 1];
  }
else
    {

_x addItemCargoGlobal [_item, 1];
    }

} forEach _crates;
#

@little raptor is this what you were trying to get me to do?

#

I think I figured it out, ima try it

robust hollow
#

your if statement is missing the { and } 😬

little raptor
#

plus else

past wagon
#

@little raptor how does that look?

robust hollow
#

still not right. the line with foreach should be last

past wagon
#

@robust hollow better now?

robust hollow
#

yea

past wagon
#

how can I make that whole section repeat 4 times?

tough abyss
#

This has been an interesting read on how to teach Arma scripting. Maybe rewrite it as an article in BI forums introducing others to arrays and control structures?

exotic flax
#

try, fail, try again, see progress, continue trying till it finally works 🤣

tight jungle
#

so i have two triggers with a group of comanches inside them

the first one hides the comanches:

{_x hideObjectGlobal true} forEach thisList;
#

and the second one shows them:

#
{_x hideObjectGlobal false} forEach thisList;
#

wtf happened?

warm hedge
#

You meaning some parts of em still showing? That is just an issue that haven't solved for ages

tight jungle
#

huh thats weird

bronze lotus
#

Can default functions be overwritten?

#

Since I want to force the "bis_fnc_arsenal" function to use Ace Arsenal instead of Virtual Arsenal.

past wagon
#

@little raptor

tepid osprey
#

I have no starting script and Im totally lost on where to start and what to do with it

tepid osprey
#

im trying to make a version of this helmet with no light and another with the light on

#

how can I make it so these light tabs glow red

scarlet flume
#

how would i script a rush like mission ojectives, attackers vs defenders, attackers have to destroy two ojectives once they do that they have thier spawn point move up and the defenders spawn points move back, and enables the next set of objectives, attackers win if they take out all sets of of objectives and defenders win if they managed to drain attackers spawn tickets?

quartz coyote
#

Do you guys know if the Vanilla Scoreboard is scripted somewhere and accessible to us or is it on Engine side ?

quartz coyote
#

I mean the UI. That is just to interact with the scroes.
I need to check out how it's displayed in the code.

warm hedge
#

I don't think you have a way to access something related to it

robust hollow
#

yea looks to be engine side. the function for that display is empty

quartz coyote
#

Okay thanks

finite sail
#

@quartz coyote I've been thinking about a custom scoreboard - my UI designer tells me it can be done, but keeps disappearing

quartz coyote
robust hollow
#

what kind of issues?

finite sail
#

I should clarify... my UI designer chap keeps disappearing, not the scoreboard lol

finite sail
#

LOL at Dedmen's GIF

winter rose
still forum
#

thats what will happen when I do that

finite sail
#

hmm yes, flogging a dead horse is a great saying in english, but there are better GIFs for that

#

so I assumed that wasnt what ded meant

#

or is it that one team member gets dragged along by another ignoring injury?

#

either way, it made me chuckle... my kids liked it too

#

meanwhle... back at the ranch....

#

BIS_fnc_showRespawnMenuDisableItem

#

should I run this on client or server?

#

as it uses uiNamespace, I presume it has to be client side?

median abyss
#

How does the eden editor allow for vehicles being spawned as destroyed, without injuring anyone around, and not spawning flames? (while still being simulated)
Is there any way to achieve the same behavior through scripting?

grizzled lagoon
#

Hello i have question with fire, I create fire with createvehicle but the problem its cursortboject return nil if i point the fire and if i want delete this i can' t

little raptor
finite sail
#

also setdamage alternative syntax

warm hedge
#

Both are referring the same notlikemeow

finite sail
#

ah yes

median abyss
#

facepalm I had the useEffects flipped

sullen sigil
#

any lads or ladettes got a script that uses the ingame music stuff (accessible with jukebox from 3den enhanced etc) to play modded music through a radio, preferably with options?

#

tried say3d but cannot make it work for the life of me

#

music is already ingame with classnames, doesnt need adding to the mission or whatnot

#

if you could tag in reply that'd be grand as I have this server muted

winter rose
sullen sigil
#

that could be it, i'll try that after this lesson

#

will that play it originating from the object?

little raptor
#

no

sullen sigil
#

pee

#

needs to sound like its coming from the objec

#

t

winter rose
#

then say or say3D (same thing) but also a CfgSounds in description.ext
or playSound3D +attachTo and file name

little raptor
#

if the object is static, use playSound3D with the Music path

#

playSound3D+attachTo
works?

#

afaik it doesn't follow the object

winter rose
sullen sigil
#

oh so regardless i cant path it to whats in the mods it has to be in the description.ext?

winter rose
sullen sigil
#

so no choice but to go fiddling with mission files

#

which i dont like doing

#

eeeeh ill just play music through my phone that way it sounds like a radio too 😂😂

acoustic trellis
#

Does anyone know a script where it can disable radio communication between players? (TFAR radios)

still forum
#

just take away the radios from the players? what exactly you wanna do?

finite sail
#

play something from my wife's collection of shouty, angry, growled German heavy rock. That'll make them stop listening

acoustic trellis
#

@still forum i want to know a script where if avplayer on the other team destroys a communication tower then how do i disable the other teams tfar radios

little raptor
#

didn't tfar have a jamming feature?

acoustic trellis
#

Not sure how would i use that

winter rose
#

TFAR doc may have the info?

acoustic trellis
#

Is he/she in this discord?

little raptor
#

@acoustic trellis
you can look at this script:
https://forums.bohemia.net/forums/topic/203810-release-radio-jamming-script-for-task-force-radio/
see how they jam the radio

acoustic trellis
#

Thank you!!

still forum
little raptor
#

configFile >> "CfgVehicles" >> "B_Captain_Dwarden_F"

#

Had anyone seen this before?!

winter rose
#

yes.

little raptor
little raptor
#

Ok cool!

digital hollow
#

How do base game landmines proximity "fuse" detection work? Is it repeatedly checking nearestObjects?

still forum
#

Same way as object collision checking works

#

So no

#

Quadtree

#

Well nearestObjects is also quadtree but not like that

#

In short: Magic

digital hollow
#

I see. Is it better for a placeable vehicle-detector-object compared to alternatives like nearestObjects, and/or more reliable than EpeContact EH?

still forum
#

Yes, epe is physics only

#

I kinda want to make some trigger area thing that works like mines do.
And replace where people use triggers, for teleporters or bargates

polar saffron
#

How can I make a mission end with the death of my character?

reef grove
polar saffron
reef grove
#

oh i read it wrong I thought you wanted character to die when the mission ends, not make mission end when character dies

#

is it a SP or MP mission, if MP do you want to mission to end for everyone or just "end" for the player who died?

polar saffron
#

It is in sp, what I want it to do is when my character dies I skip a failed ending that I see

reef grove
#

something like this will prolly work

    "end1" call BIS_fnc_endMission;
}];
little raptor
#

but it's ridiculous

#

Imagine as soon as you die, you don't even see your character drop to the ground and

#

bam

#

Mission Failed

reef grove
#

could always just add a sleep for a few seconds

#

and some effects on screen

next kraken
#

i have to put an Pelter (Demining Robot) into my Hunter as cargo from mission start and later check if the robot is alive in the mission, is there any way to set a Variable for the backpack/mining roboter to check conditions for it?

willow hound
#

@next kraken Inventory items are no objects, so you can only try using the WeaponAssembled EH to detect when the player deploys the robot and then work from there.

young current
drifting sky
#

Is there a built in way to make a dictionary, (i.e., key, value pair) data structure? Look up key, to get value for that key.

willow hound
#

Hmmmm

#

There are rumors

robust hollow
#

only on the dev branch at the moment

willow hound
#

Whispering in the shadows
Some folk say HashMaps are coming

still forum
gaunt mortar
#

Small question about the UnitCapture/Play

I'm guessing it's still not supported in MP ^^ ? And if it doesn't, is there anything that's could do pretty much the same thing in MP ?

Thanks !

gaunt mortar
#

oh is it ?
Tbf last time i tried it was a while ago XD so it may work
I didn't tried recently c:

finite sail
#

my mum asked my 2 sons what they wanted to be when they grow up.. at the time, they were 8 and 9m and they said "We want to be youtubers!"

#

so I decided how hard it is to make content

#

*idecided to show them how hard it is to make content

#

and that was the result

little raptor
drifting sky
#

yeah, i guess that is a good enough solution

little raptor
finite sail
#

at 25 seconds, the runing man is dwarden and in the close up credits shot

little raptor
#

nope, it's not!

finite sail
#

im sure we used dwarden for this because hes gendarme in the game

#

and the tanoa 50 video needed a policeman

little raptor
#

yeah but that's not his face!

#

that's kerry

finite sail
#

let me see if i still have the mission file

winter rose
#

that's "Default Face", but the Editor unit might be a Dwarden

finite sail
#

ah

little raptor
#

yeah, the default face is Kerry isn't it?

finite sail
#

i dont know

winter rose
#

…no? at least, I don't think so

finite sail
#

i dont have the mission file any more 😦

little raptor
#

If you spawned the unit as player, his face has been replaced

#

That's just how the game works!

finite sail
#

yes, it was a player, my son played dwarden, i was the camera

little raptor
#

Yeah that's why! 😅

#

You got the wrong guy!

finite sail
#

thats why he blanked me when I showed him

#

"Thats not me, you arse!"

#

lol

#

it took a few days of annotating the original hawaii 5 0 theme, then shooting it, timing it, editing... all ine all, took about 40 hours

#

80 man hours becuase there was two of us

#

well.. 40 man and 40 8 year old child hours... but they've never said since, I'm going to make a career out of posting shit on youtube

#

so, job done

drifting sky
#

A2OA: Is it possible to get the position an AI unit thinks another unit is located?

verbal whale
#

guys quick question , i am trying to create marker using createMarker https://community.bistudio.com/wiki/createMarker function , i need to pass channel and creator as third and forth parameter but still getting error that it only accept two parameters , any one can help me with that ?

#

_marker = createMarker ["player marker ", player,1,player];

willow hound
#

You are probably not using A3 v2.01 yet.

verbal whale
#

i got it , is this version on the main branch or it is on the development branch as steam telling me i have the latest version

robust hollow
#

development. the main branch is version 2.00

#

2.02 coming soon ™️

verbal whale
#

ok got it thanks i will pull the dev to continue scripting 🙂

icy oasis
#

Hi all. new to the scripting thing.
So I've reffed a old script ( before 2.0) which I've figured out does not make use of "nil" which this old script does.
How can I correct this? ( since Im a proper noob. )
this addAction ["Download Files",{ [] execVM "download.sqf"}, nil, 2, true,true,"", "!_target getVariable ['inUse',false]"];

finite sail
#

why do you need to correct it, there's nothing wrong with it

queen cargo
#

better question is: where did you get the information from that something needs to be altered

exotic flax
icy oasis
#

ok well my googling turned that up. as said clueless. was getting a Boolean error. I could share here quick.

#

uploading mission

#

Thanks to anyone who is willing to help.

tidal swallow
#

Well apparently i fucked somthing up in init.sqf but I don't know what. It is not initializing, there is no debug error code, nothing. I check with notepad++ with sqf coloring, nothing strange.

Could someone please take a peak what I did wrong. It worked but when I tried to make it more organized everything went dark
https://pastebin.com/c2y0W2R1

little raptor
little raptor
next kraken
#

want to check if any civilian is killed by blufor on an MP server. what i tried, added EH in the initServer {if ((side _x) == civilian) then {this addeventhandler ["killed",{civ_casaulties = civ_casaulties + 1}]} forEach AllUnits}; and checked ingame via trigger civ_casaulties>0 but no reaction. any idea ?

little raptor
#

is civ_casaulties even defined?

next kraken
#

yea, publicVariable "civ_casaulties" in the serverinit

little raptor
#

use _x

#

also you might wanna use MPKilled instead of Killed in MP

tidal swallow
next kraken
#

{if ((side _x) == civilian) then {this addMPeventhandler ["killed",{civ_casaulties = civ_casaulties + 1}]} forEach AllUnits};

#

mhh thx no luck with that one

cosmic lichen
#

Why the extra { }?

#

There is also one missing.

#
{
  if ((side _x) == civilian) then
  {
    this addMPeventhandler ["killed",{civ_casaulties = civ_casaulties + 1}]
  } forEach AllUnits
};``` 
Now find the mistake
little raptor
#

the mistake was this
I already told you @next kraken

next kraken
#

im using poseidon, but i cant find the mistake, sorry Leopard20, used _x allready

#

if ((side _x) == civilian) then
{
_x addMPeventhandler ["killed",{civ_casaulties = civ_casaulties + 1}]
} forEach AllUnits;

little raptor
#

killed is not an MP eventhandler

next kraken
#

used killed no luck^^

#

MPkilled

#

if ((side _x) == civilian) then
{
_x addMPeventhandler ["MPkilled",{civ_casaulties = civ_casaulties + 1}]
} forEach AllUnits;

little raptor
#

where are you calling that?

next kraken
#

debug console, tried serverside local and global + initserver.sqf

little raptor
#

and where are you getting civ_casaulties?

next kraken
#

checking via trigger ingame

#

civ_casaulties>0 condition

little raptor
#

is your trigger server side? (which should be)

#

also, why publicVariable?

#

you only need it on the server

next kraken
#

trigger is serverside

icy oasis
little raptor
#
this addAction ["Download Files","download.sqf", nil, 2, true,true,"", "!(_target getVariable ['inUse',false])"];
#

as for why it doesn't work, check download.sqf

ripe sapphire
# next kraken trigger is serverside

Are you sure the trigger is not fired? Since trigger is server-side, the onAct will only execute on the server and you’ll have to remoteexec them to clients

#

You can also do this to check the actual value of it ```sqf
Hint str civ_casaulties

winter rose
#

(btw: casualties)

little raptor
#

no it's causalties 🙃

winter rose
#

causality*

#

not to be confused with correlation

ripe sapphire
ripe sapphire
#

Guys please explain?? Is this correct

Variable = 1  /// global variable
_variable= 1 /// local variable
private _variable = 1  /// private local variable
#

What is considered a local variable

copper raven
#

yes

ripe sapphire
#

So local variables are variables whose identifier has an underscore in front yeah?

analog walrus
#

Need help with importing a custom sound into a scenario. Arma seems like it can't find the custom sound file. I've added CfgSounds into description.ext, and my custom sounds are in a "sound" folder in the mission directory. Tried to play sound, getting a "Sound not found" error. Sound is also not present in Trigger:Effects sound list.

This is especially annoying since I literally copy pasted the examples from the Arma wiki to use as a template. It may be the pathing that's wrong, but I have no idea. Any help?

Description.ext file:

class CfgSounds
{
    sounds[] = {};
    class c4_beep
    {
        name = "c4_beep";
        sound[] = {"sound\c4_beep1.ogg", 1, 1};
        titles[] = {0.5, "*beep*"};
    };
};
ripe sapphire
#

Thanks guys 👍

ripe sapphire
analog walrus
willow hound
#

Have you reloaded the mission?

analog walrus
#

Yep

little raptor
analog walrus
#

Just did, still nothing

little raptor
#

what command do you use?

little raptor
analog walrus
#

It's a symptom of the issue, since I read that any sounds defined in CfgSounds should also appear in the Trigger:Effects list

little raptor
#

but not Description.ext

#

it means the ones defined in ConfigFile

#

not missionConfigFile

analog walrus
#

Understandable, but I'm using a playSound in an .sqf to play the sound in question

#

That's my main issue, since it outputs the "Sound not found" error

willow hound
#

Well, post the code

analog walrus
#

Literally just a

{playSound "c4_beep"} forEach allPlayers;
#

It's just for debug, since I can't even import the sounds properly meowtrash

ripe sapphire
#

Where do u put the c4_beep.ogg in the mssion folder?

ripe sapphire
analog walrus
#

missionnamehere.Altis -> sound -> c4_beep1.ogg

#

Also according to the CfgSounds examples on the wiki, it doesn't even have to be named "sound" specifically

ripe sapphire
#

Yea but thats what u put in your description.ext

#

Trying moving the file to the main directory, change the description.ext, go back to 3den then reload mission?

analog walrus
#

I guess it's worth a try

ripe sapphire
#

Post code?

#

I mean the description

analog walrus
#
class CfgSounds
{
    sounds[] = {};
    class c4_beep
    {
        name = "c4_beep";
        sound[] = {"c4_beep1.ogg", 1, 1};
        titles[] = {0.5, "*beep*"};
    };
};
ripe sapphire
#

Strange, i have pretty much the same thing just with different file name and it works

analog walrus
#

Very strange indeed, it's driving me nuts since nothing seems amiss

ripe sapphire
#

Have you make sure to exit the mission to 3den and reload instead of just restarting

analog walrus
#

Aye

ripe sapphire
#

This might seem funny but is the mission folder the correct one with the one you’re editing right now?

#

Can go file > show mission folder from 3den

#

Cause i once edited the scripts of a diff mission than the one im loading in game and wondered why nothing changed 🙃

analog walrus
#

Oh I wish that was the solution

#

But no, mission folder is correct

ripe sapphire
#

Try changing the classname to c4beep (remove underscore)

willow hound
#

Does everything else (e.g. CfgFunctions) from your Description.ext work?

winter rose
#

description.ext.txt 😬

analog walrus
#

But then again the respawn types are hella confusing, so I could very well be wrong

analog walrus
#

That was it

#

Thanks for all the help, but goddamn that just feels bitter

willow hound
#

Straight to jail

#

You can easily avoid stupid stuff like that by using something proper such as Visual Studio Code for your scripting krtecek

polar saffron
#

Hello, does anyone know how it is possible for each unit to have its own reference points, being already in a group?

willow hound
#

Reference points?

winter rose
unique sundial
#

Woah, I was looking everywhere to see if anyone complained about processDiaryLink not working on briefing screen, thought Im imagining things, this seems to confirm it

delicate lotus
#

Crazy that you found a message from me that old o.O

unique sundial
#

search function

delicate lotus
#

Good thing discord stores messages that old 😄

unique sundial
#

yeah, going to fix it

delicate lotus
#

Nice!

little raptor
dreamy kestrel
#

Q: is there a limit to how many class functions you can include? I am running into some odd issues that seem to indicate there is a hard limit to how much text can be included in a file. Maybe I can separate that out across several files. i.e.

class MYLIB {
#include "path\to\functions.hpp"
// ... rinse and repeat ad nauseum (?)
};

Which might define something like:

class init {
  class init_preInit {
    preInit = 1;
  };

  class init_myInitFunc {};
};

And so on.

hallow spear
#

how big is that file? sounds chunky. I have never had that issue, but perhaps have never reached your level

dreamy kestrel
#

I don't know, the parent file is only 60 lines, 26 includes. Each include defines its own member class, and can have anywhere from several, half a dozen, to dozen or so class/functions defined.

#

So it piles up, fast.

#

Wonder if I am hitting a barrier there.

#

If that's an accurate assumption on my part, then what are my contingencies. Introduce other parent classes. Could I even define a separate file, same parent class. I don't know, exactly.

robust hollow
#

what are the issues you are experiencing?

dreamy kestrel
#

The log is indicating no ;, stuff like that, but I know there is a semi colon there. It's as though the parser hit a barrier.

robust hollow
#

or you have an issue elsewhere

dreamy kestrel
#

Well, I thought that, but as I did what I thought were appropriate adjustments, the same issue would arise, in a different place.

robust hollow
#

so fix it in the new place?

dreamy kestrel
#

it's like playing wackamole.

#

for stuff that "worked" before

robust hollow
#

mod configs are huge so a bunch of function classes is relatively small. highly unlikely it is an include issue.

dreamy kestrel
#

is it common for compiled code to run behind that? i.e. I have something like class init_preInit {...}, right, which exposes a fn_init_preInit compiled function. A variable, compiled function like MYLIB_fnc_init_preInit lands in the namespace.

robust hollow
#

well... if you define a function in the function config then yes it will be compiled when you load in game. and if you set preinit=1 like you show above, then yes it will execute during preinit.

dreamy kestrel
#

Hmm... can I define multiple files adding various functionality to the same parent class MYLIB {...}? does that work?

robust hollow
#

yes

dreamy kestrel
#

Hmm, at the 'top' description.ext level, that ends up with,

class CfgFunctions {
  #include "MYLIB_functions.hpp"
};
robust hollow
#

ok?

dreamy kestrel
#

confused over it at the moment, head scratcher.

#

and in the problem area, I see the function in question, it did compile. but when I try to invoke it, nothing. not even an obvious log entry upon execution into the function.

robust hollow
#

how are you confirming it compiled?

dreamy kestrel
#

I drop the variable name in the debugger.

#

and I have content there, versus nothing or nil when it does not.

willow hound
#

What does the code look like?

dreamy kestrel
#

Can you include side types in parameters? This is the only exotic thing I am doing there to my knowledge. i.e.

params [
["_varName", "", [""]]
, ["_proxy", objNull, [objNull]]
, ["_side", MYLIB_preset_sideF, [west]]
];
robust hollow
#

yea. it takes any type

willow hound
#

Put something like systemChat "Function called"; above params and try if that shows when you call the function.

west portal
#

is it possible to get output of a script which can return nothing, and output predefined thing if it does such ?

willow hound
#

I don't understand...

dreamy kestrel
#

I get nothing, no systemChat even, like the execution never got there

west portal
#
[]spawn{
  _v1 = [] call {_r = 1};
  systemchat "t2";
  _v = [[1]];
  _v set [0,if isNil "_v1" then{[]}else{_v1}];
  systemchat str _v;
};
#

in debug console it breaks before systemchat "t2";

willow hound
#

It also breaks my mind

queen cargo
#

I am not fully aware of what you are trying to Archive

west portal
#

its for execution frame, so user wouldn't have to return something from the code he sends

queen cargo
#

What execution frame?

willow hound
#
if (_condition) exitWith { nil };
_otherResult
```Are you aiming for something like this?
queen cargo
#

It looks more like the Black magic that is the out or ref Parameter stuff apllied in sqf

#

The Script Btw errors because in sqf, Var = val is not leaving anything on the value stack, making the code return literally nothing

willow hound
dreamy kestrel
#

verified the inputs to the function are there and correct. but the execution never lands in the function body. i.e.

["MYLIB_eden_startbase",MYLIB_eden_startbase]
#

@willow hound yes, see ^^, verified in the debug console

#

heaven forbid could it even be a call stack being blown.

willow hound
#

So you can see the function in the functions viewer?

dreamy kestrel
#

I'll check that... @willow hound

#

yep 👍 it's there

#

also as the debugger shows, enter the variable name, tells you the diagnostics

willow hound
#

And call MYLIB_fnc_eden_startbase; does not show anything in system chat when systemChat is in the first line?

dreamy kestrel
#

troubleshooting both sides of the execution path. those are inputs to the function, so it ain't that being the issue.

willow hound
#

Functions from CfgFunctions are always TAG**_fnc_**functionName.

west portal
#

is it possible to get output of a script which can return nothing, and output predefined thing if it does such ?

func = {/*..*/ _this select 0 call (_this select 1); /*..*/};

_sc = {v = _this};

systemChat str ([1,_sc] call func);
#

if doesn't work, but works with _sc = {v = _this; 0}; . how to solve that ?

willow hound
#

What on earth are you doing

west portal
#

(to make it work in the both cases)

dreamy kestrel
#

@west portal not sure what you're accomplishing. I have a couple of functions, however, that return different shapes of results, depending on the input args. so, yes... entirely feasible.

willow hound
west portal
#

if the function is specified by user, it may not return anything . i just need a handling for this .

dreamy kestrel
#

right. would need to include _var = val; _var ... SQF is just particular like that.

willow hound
#

if the function is specified by user
What do you mean by that?

dreamy kestrel
#

@willow hound right, re: your assertion, yes. the function is there as we've established now, in a couple of ways. i.e. MYLIB_fnc_myFunc

west portal
dreamy kestrel
#

the inputs are healthy. verified those. the execution never lands in the function, however.

willow hound
west portal
#

the ILIAS_fnc_func processes script that he arguments . and return output of that script, which can be nil

willow hound
#

Does ILIAS_fnc_func do anything else?

west portal
#

y

#

obviously

#

but i can't find how to get the output of script, if that output can be nil

dreamy kestrel
#

First two lines in the script are literally,

systemChat "'MYLIB_fnc_eden_create' entered";
diag_log text "'MYLIB_fnc_eden_create' entered";

I see nothing appearing in the log.

#

@west portal

private _x = call {};
isNil "_x"
willow hound
dreamy kestrel
#

I'm tempted to just introduce a second function and start building it out slowly, see if/when it breaks.

queen cargo
willow hound
#

Doesn't that make _var nil?

queen cargo
#

no

#

the assignment does not return any value to the value stack, leaving nothing (literally)

#

not nil

#

nil would be an empty value

#

not no value

dreamy kestrel
#

it's the same thing. nil is implied.

_x = call {};
isNil "_x"

same as:

_x = call {nil};
isNil "_x"
willow hound
#

Well, but _var = nil; destroys the variable _var

#

So if _var = NOT EVEN NIL; then I would expect _var to not exist thereafter.

little raptor
#

this works with any code

queen cargo
little raptor
#

it does

#

try it

hollow thistle
#

yep it works.

queen cargo
little raptor
willow hound
#

An exception in SQF?

dreamy kestrel
#

yikes!

_a = 0;
_b = 1;
_x = call {_a = _b;};
isNil "_x"

not even nil ...

queen cargo
queen cargo
dreamy kestrel
#

tried it in the debugger. versus previous examples ^^ @little raptor

little raptor
#

and behold the magic

willow hound
dreamy kestrel
#

@little raptor simplify it. we're troubleshooting a "no return", not even nil question.

little raptor
#

and I did

dreamy kestrel
#

it's a peculiar gremlin

little raptor
#

it's called an apply workaround

dreamy kestrel
#

oh oh I see 👀

west portal
#

@little raptor thanks, this is exactly what i was looking for .

  _sc = {_r = 1};
  _v1 = ([nil] apply {[] call _sc}) select 0;
  systemchat "t3";
  _v = [[1]];
  _v set [0,_v1];
  systemchat str isNil {_v select 0};

"true"

  _sc = {_r = 1; 0};
  _v1 = ([nil] apply {[] call _sc}) select 0;
  systemchat "t3";
  _v = [[1]];
  _v set [0,_v1];
  systemchat str isNil {_v select 0};

"false"

dreamy kestrel
#

yep that returns

little raptor
dreamy kestrel
#

no worries

queen cargo
#

tbh ... just ignore it
if someone is actually doing that, it is a user-error
period

willow hound
#

Yes but I still want to understand what _var = NOT EVEN NIL; does to _var.

queen cargo
#

nothing

#

it just errors

west portal
#

then give a 'correct way'

willow hound
#

With or without error message?

west portal
#

@queen cargo

dreamy kestrel
#

appreciate the 🔉 board, folks. I have a couple of avenues I want to explore before throwing it all away for the day.

queen cargo
queen cargo
willow hound
#

Gotcha

queen cargo
west portal
#

@queen cargo he need to write SQF, SQF allow to return nothing . inability to handle such (allowed) return is SQF's issue. not user's

queen cargo
#

given that it is mandatory for parts in arma, this won't change
and given that the issue literally only appears if one assigns a value as last instruction, it can be safely ignored (as people then just could add a nil or 0 after that and SQF would no longer complain)

#

general rule of SQF: never end with an assignment

west portal
#

"append" return nothing, while "push" -- something, and among other, such rule would sound like "always return something" . and it appears all the time, if you don't remember and follow that 'workaround' rule .

queen cargo
#

Append Returns nil

#

Assignments return literal, LITERAL nothing

west portal
#

if that so, it anyway makes even worse, as the rule becomes less general and so even less meaningful and harder to remember

queen cargo
#

it is simple ...

#

just never do: variable = value anytime you end a codeblock

#

it does not matter for literally anything else

#

setVariable, fine

#

assign, too

#

using = last, nono

west portal
#

its not simple, because its junk . all you need to remember in programming language is basic syntax and some often commands .

dreamy kestrel
#

found the issue 🤯 getPosAGL ... should be getPos or maybe getPosATL

queen cargo
willow hound
west portal
#

you are defending it, im just answering .

#

the info is received already

dreamy kestrel
#

@willow hound I do not know, it is bizarre. I just started paring off lines to see what worked... process of elimination.

queen cargo
#

i am not, i am trying to tell you what you have to do and that the situation is deal with it ... and you cannot change that

#

i would love to be able to do _var = _foo = 123

#

but SQF is SQF, custom script language for a game and BI decided that the assignment pushes nothing to the value stack

dreamy kestrel
#

@queen cargo @west portal SQF is just not that sophisticated. it's pretty powerful though once you wrap your brain around the data flow, etc.

west portal
#

i realized when you said it the 1st time, but you kept adding things like "its easy" :)

queen cargo
dreamy kestrel
#

compared to visual data flow, like Prograph, but the principles are very similar.

west portal
#

not simple to remember though

queen cargo
dreamy kestrel
#

@west portal it's a never ending struggle. logs are your friend. I continually get smacked by dumb stuff. SQF being what it is.

queen cargo
#

use vscode with some sqf language server (plugin)
helps to eliminate 99% of the issues 😉

dreamy kestrel
#

@queen cargo so so... in its own way, I will give it that.

willow hound
#

The SQF LS reports too many problems krtecek

queen cargo
#

will continue working on SQF-VM language server once the pressure of university stuff settles

#

will get especially funny once #pragma support lands in arma and i can actually spend the time to rework the whole language server (type checked SQF ftw)

willow hound
#

SQF-VM LS reports too many problems and Armitxes' language support has not received an update in forever despite GitHub repo activity, this makes me very sad krtecek

queen cargo
#

ye... sqf-vm LS has issues
mostly because, as said, could not spend as much time as i would have anticipated with it yet

willow hound
#

I have faith in you 😋

queen cargo
#

i have hopes for some people in the community still to pick it up

#

like ... my time schedule is so filled to the rim

#

could not even do any work 2020 (since corona started) on arma.studio really

#

and that even already uses sqf-vm for debugging

willow hound
#

I considered it when you advertised for it, but I too have studies to complete, a happy little pet project to take care of and wiki articles to beautify, so I decided against figuring out VSC addon creation and looking into an already existing complex code base.

queen cargo
#

the codebase for the LS is trash 😄
somewhere there is a memory leak, the whole way i do it is also borked ... so many issues i would need to change

west grove
#

hm. i have made a new module with a variable size class AttributeValues { size3[] = {400,400,75}; }; can anyone tell me how i access these values in my script?

#

nevermind, i got it :>

#

_module getVariable "objectArea"

west portal
#

excuse my english, i only by now have correctly related/arranged all the messages X)

drifting sky
#

Wiki says of "getHideFrome" this: "Return Value:
Array - ASLToATL representation of the believed aimPos of the enemy object ". Does this mean the value returned is ASL or ATL?

dusky wolf
#

if (typeOf rhsusf_m1132_m2 in _vehicle) then { CODE } else { CODE };

#

I'm trying to get this to work to run a different script depending on the specific type of vehicle

#

Getting: Error Undefined variable in expression: rhsusf_m1132_m2

#

Is there are a way to do this where I simply have the classname and check if it is in the vaariable _vehicle?

exotic flax
#

rhsusf_m1132_m2 is just a class name, not an object variable name

dusky wolf
#

This is what _vehicle is passing 15ee5314080# 1170912: rhsusf_m1126_m2.p3d

exotic flax
#

isKindOf is probably what you're looking for

#

file names still have nothing to do with the classname

#

and that is an object...
so I guess you want ```sqf
if (_vehicle isKindOf "rhsusf_m1126_m2") then {

dusky wolf
#

Lemme give that a try. Thank you!

past wagon
#

Do i need a script to make a crate spawn with a parachute?

exotic flax
#

place this in the init field of the crate, and it will drop down (with parachute) from 200m

para1 = "steerable_parachute_f" createVehicle [0,0,0];
para1 setPos [getPos this select 0, getPos this select 1, 200]; 
this attachto [para1,[0,0,-1]];
#

3sec on Google

cerulean cloak
#

How would I change the name of a backpack drone after it's been assembled?

this addEventHandler ["WeaponAssembled", {
    params ["_unit", "_staticWeapon"]; 
    (group weapon) setgroupID ["Raven 1-1"];
}];

I've got the EH activating after being assembled but the group name's not changing.

drifting sky
#

can you use setvariable on a marker?

past wagon
#

@exotic flax if I want to change it from 200m to 500m would it look like this:

para1 = "steerable_parachute_f" createVehicle [0,0,0];
para1 setPos [getPos this select 0, getPos this select 1, 500]; 
this attachto [para1,[0,0,-1]];
#

that seems to work

#

however there is one issue

#

the crate has random spawn location in the initServer.sqf file

#

and when I use this in the init on the crate, it no longer spawns at one of the given options in the initServer.sqf file

#

also why does it have to be a steerable parachute? what about those round ones that supply drops come with?

buoyant hare
#

Is this the right forum to ask for scripting help? If not, could you point me in the right direction?

cosmic lichen
#

@buoyant hare If you read the last messages I think it looks like the right place, doesn't it?

topaz fiber
#

Morning all. Trying to find a list off roll classes for scripting. ‘If “sniper”, ‘if “engineer”.
That kind of thing. Could someone point me in the right direction?

true arrow
warm hedge
#
"getNumber (_x >> 'scope') == 2 and getText (_x >> 'role') == 'marksman'" configClasses (configFile >> "CfgVehicles") apply {configName _x}```->```["B_soldier_M_F","B_recon_M_F","B_spotter_F","B_sniper_F","I_G_Soldier_M_F","B_G_Soldier_M_F","O_G_Soldier_M_F","I_Soldier_M_F","I_Spotter_F","I_Sniper_F","O_soldier_M_F","O_spotter_F","O_sniper_F","O_recon_M_F","O_soldierU_M_F","B_ghillie_lsh_F","B_ghillie_sard_F","B_ghillie_ard_F","O_ghillie_lsh_F","O_ghillie_sard_F","O_ghillie_ard_F","I_ghillie_lsh_F","I_ghillie_sard_F","I_ghillie_ard_F","B_Sharpshooter_F","B_Recon_Sharpshooter_F","B_CTRG_Sharphooter_F","O_Sharpshooter_F","O_Urban_Sharpshooter_F","O_Pathfinder_F","I_G_Sharpshooter_F","B_G_Sharpshooter_F","O_G_Sharpshooter_F","B_T_soldier_M_F","B_T_Recon_M_F","B_T_Sniper_F","B_T_Spotter_F","B_T_ghillie_tna_F","O_T_Soldier_M_F","O_T_Recon_M_F","O_T_Sniper_F","O_T_Spotter_F","O_T_ghillie_tna_F","B_CTRG_Soldier_M_tna_F","O_V_Soldier_M_hex_F","O_V_Soldier_M_ghex_F","B_Patrol_Soldier_M_F","B_W_soldier_M_F","O_R_soldier_M_F","O_R_recon_M_F","I_E_soldier_M_F","O_R_Patrol_Soldier_M_F","O_R_Patrol_Soldier_M2_F"]```
finite sail
buoyant hare
#

Does anyone know the limitations of playSound3D in terms of audio length and file size?

winter rose
buoyant hare
#

@winter rose Ok. Because I'm having troubles looping a 3 min. long audio (700 kB) to a truck.
The truck just plays 2-3 seconds before going silent.

This is my code:

[] spawn {
    while {true} do {
    _this = truck;
    playSound3D [getMissionPath "media\lehjani.ogg", _this];
    sleep 195;
    };
};
winter rose
#

That's weird - maybe the file has an issue?
You can also use the following, given the sound is defined in CfgSounds:```sqf
truck say "myCfgSoundsDefinition";

#

(also, _this = truck? why not using truck directly)

buoyant hare
buoyant hare
topaz fiber
#

Thanks guys, but I think it’s specifically the unitTrait I’m after. So you would only allow a sniperSpecialist (I think it is) a sniper rifle

winter rose
winter rose
topaz fiber
#

Oh 🤦‍♂️

#

I’ll get my 🧥

finite sail
#

You can set a custom trait, but I don't think that helps

#

Tankbuster setUnitTrait ["Bellend", true, true]

still forum
still forum
still forum
queen cargo
#

The vehicles Init eg.

still forum
#

Gonna fix that too

queen cargo
#

so no more empty value stack after assign soon™️?

still forum
#

ye

whole light
#

Is there any way to interrogate and selectively delete from the USERNAME.vars.Arma3Profile file? When it gets to large sizes, it causes huge input lag in the editor. Until now I have been deleting the file to allow the creation of a fresh one, but this causes the loss of Arsenal loadouts and some other stuff I don't want to constantly lose.

warm hedge
#

It literally is profileNamespace, so you can set/getVariable

whole light
#

I would like a way to see everything that is stored in there, not just the variables I specifically save. It seems like a variety of data is saved there.

warm hedge
#
allVariables profileNamespace```
whole light
#

Thank you very much man, that's a huge help.

still forum
whole light
#

I have had cases where the editor becomes very sluggish. For example, clicking to switch from BLUFOR assets to OPFOR, Arma would freeze for 5 seconds or so. Any clicking action in the editor would cause the same delay, even with no mods installed (my friend had the same problem with a fresh install of Arma on a freshly formatted SSD, but using his old profile). Pressing ESC ingame, the menu would not pop up for several seconds. This "lag" disappears when I delete my Drongo.vars.Arma3Profile file. In some cases this file is over 400mb.

#

Some of my friends who have the same problem find it disappears when deleting their vars.Arma3Profile file. I suspect the bloating of this file may be connected to my Map Population mod.

#

But I'm not sure so I want to check as much as possible what is going on in the file.

willow hound
#

400 MB for a binarized file that should be used to store numbers, Strings and maybe arrays thereof? How often do you have to use and subsequently save profile namespace to get there? meowsweats

winter rose
#

yep; do not abuse of profileNamespace

#

mine is 400KB 😬

willow hound
#

Use it to store custom user settings, by all means, but for nothing else.

#

The user's keybind for your server's custom earplug script for example.

still forum
#

I need a FT ticket, and the .vars.Arma3Profile file (at best 7z compressed)

whole light
#

The Map Pop saves shortly after mission start to store an array of arrays of positions for each unique mission where is it enabled. However, I find if I exit out of such missions, the file expands each time, despite saving in the same variable name. This index array is usually fairly small, but vars file keeps increasing. I am trying to find out what exactly is causing this.

still forum
#

please give me ticket to fix the performance problem

#

you can check what causes the size by just debinarizing your vars file (its just a config.bin)

past mist
#

I'm creating a COF in the editor, I'm currently activating and deactivating the popup targets using an addaction. I create an "Activate" addaction that when called calls a function with a bool argument (true -> activate the pop up targets, false -> deactivate them).
Simple in theory, however, my function works only one way for some reasons. It activates the targets (and adds the action to disable them) but then it soen't execute the code to disable them.

the function code is as follows

params ["_target", "_caller", "_actionId", "_arguments"];
//true  -> Activate targets
//false -> Deactivate targets
if (_arguments) then {
    {_x animate ["terc", 0];} forEach UpClose;
    _target removeAction _actionId;
    upCloseAct = _target addAction ["Deactivate targets", "R3D_fnc_UpClose", false, 10, false, true];
} else {
    {_x animate ["terc", 1];} forEach UpClose;
    _target removeAction _actionId;
    upCloseAct = _target addAction ["Activate targets", "R3D_fnc_UpClose", true, 10, false, true];
};

It's like the else part of the code doesn't get executed. No errors in the RPT.

#

where UpClose is the array of targets

willow hound
willow hound
past mist
#

R3D_fnc_UpClose is that snippet of code itself

#

_this would pass the object (target as the wiki says) itself, but I need to pass a bool to that function

#

however the function itself gets called

whole light
whole light
willow hound
past mist
#

nevermind, I think I got the issue

#

yup, got it

#

the first addAction (and the only one that was working) was in the init field of the object I was attaching to

#

and that was with call R3D_fnc_UpClose

#

me after 3 hr straight at looking at the same code and wondering why it doesn't work didn't think about it.

finite sail
#

3hrs... those are rookie numbers

past mist
#

oh no...

#

Anyway.

If you set a variable in a trigger OnActivation code, can you access it in OnDeactivation?

next kraken
#

Question for Spectator Cam: I got that code working fine, if calling it from the debug console in MP. if i use it from a script, for example "onplayerkilled.sqf"it just shows the normal specator cam with third person and all options, not my customized one. ["Initialize",[player,[],true,false,false,true,false,false,true,true]] call BIS_fnc_EGSpectator;

distant oyster
past mist
#

Ok. Thanks!

exotic tinsel
#

is there something better than boundingBoxReal to get more accurate dimensions of an object?

finite sail
#

if its a building... the alternative syntax is pretty accurat

#

but some of the buildings have inexplicably large boxes

#

try the alt syntax using clipvisual

exotic tinsel
#

like a gun or small object. there are too many objects with massive boxes

finite sail
#

ooo, dunno, never done boundingboxes with things that small

scarlet flume
#

how to script two kill objectives to enable two more?

scarlet flume
#

heya leopard hows been, thanks for the other day

past wagon
#

how can I simply attach a parachute (not a steerable one) to a crate?

#

I dont need to do anything else, just attach it to a parachute

#

one of those big round ones that supply drops come in would be nice

winter rose
#

attachTo?

past wagon
#

okay

#
supplyDrop attachTo ["NonSteerable_Parachute_F" [0,0,0.5]];

can I use a string for "object2"?

#

"NonSteerable_Parachute_F"

little raptor
#

no

past wagon
#

ok

little raptor
#

you must create it first

past wagon
#

I dont currently have a "NonSteerable_Parachute_F" in the scenario

#

ok

tough abyss
#

Are there any RHS guys in here?

little raptor
#

you can go ahead and ask the question

#

maybe some non-RHS guy already knows the answer

tough abyss
#

This does not work at all

little raptor
#

and what are you doing with it (and how)?

tough abyss
#

Putting that in the init.sqf like it says too

#

RHSDecalsOff = true;

little raptor
#

SP?

tough abyss
#

Tried on both SP and local MP

past wagon
#
sleep 1;
private _parachute = "NonSteerable_Parachute_F" createVehicle getPos supplyDrop;
#

@little raptor I already have a script in the initServer.sqf file that randomizes the location of the crate

#

If I just attach the supply drop to the parachute, will that move the supply drop to the position of the parachute?

#

that is why I did getPos supplyDrop

#
supplyDrop attachTo [_parachute [0,0,0.5]];
little raptor
past wagon
#

ok

#

could I just do it the other way around then?

little raptor
#

what do you mean?

past wagon
#
private _parachute = "NonSteerable_Parachute_F" createVehicle [0,0,0]

_parachute attachTo [supplyDrop [0,0,0.5]];
little raptor
#

no

tough abyss
#

Putting that variable in Preinit fixes it

#

Got it

past wagon
#

attach the parachute to the supply drop instead of the supply drop to the parachute

#

I am guessing that object1 cant be an array?

little raptor
#

the wiki already tells you what it can be

#

if you don't see your type there, then it's not supported

past wagon
#

ok

#

so I need to create the parachute AFTER the supply drop's position has been randomly selected, at the location of the supply drop

#
sleep 1;
private _parachute = "NonSteerable_Parachute_F" createVehicle getPos supplyDrop;

supplyDrop attachTo [_parachute, [0,0,0.5]];
#

so the only problem with that code is that getPos doesnt work the way I want it to

winter rose
#

also, missing comma in attachTo

past wagon
winter rose
#

no, worse

past wagon
#

lol

#

better now?

winter rose
#

maybe

little raptor
#

long story short, don't use getPos

past wagon
#

yea

#

ok I read the page you linked

#

so how do I know which format I am using

#
private _supplyDropPos = getPosATL supplyDrop;
#

does that work ^

#

@little raptor

little raptor
#

you're still using getpos

past wagon
#

yes

#

but I thought that it would work the way I thought it would in this scenario

#

what else can I use?

past wagon
#

ok

little raptor
#

what I recommend is getPosWorld and setPosWorld
Don't just pass the position to createVehicle. Also set its position after the object is created

past wagon
#

ok

#

here is what I am confused about

#

all these different position formats

#

which one is the correct one to use?

#

what is the default one used in the editor?

little raptor
#

I don't know. It's probably AGL (or ATL)

past wagon
#

what is AGL?

#

i know it is Above Generic/Ground Level, but what does that mean?

#

wait

#

actually i think it IS AGL

#

yea

#

but then what is the difference between ATL and AGL?

#

in the editor when I set an object's Z to 0, it went at the bottom of the ocean

#

not the surface

#

so yea, I would think it is ATL/AGL but is there a difference between them?

#

i think i just had a conversation with myself ^

past wagon
#

ohh

#

ok

#

so AGL is ATL when over land, and when it is over the sea, it is just sea level + waves

little raptor
#

yes

past wagon
#

so it basically counts the water as "ground"

little raptor
#

yes

past wagon
#

so I dont think it matters whether I use AGL or ATL because all of these objects are over land anyway

#

how does that look?

#

@little raptor

little raptor
#

post the full code

past wagon
#

ok

#

one sec

#
private _supplyDropPos = getPosATL supplyDrop;

sleep 1;
private _parachute = "NonSteerable_Parachute_F" createVehicle _supplyDropPos;

supplyDrop attachTo [_parachute, [0,0,0.5]];
#

I know that _supplyDropPos cant be used as a position

#

but that is all I have right now

little raptor
#

it can

past wagon
#

oh

#

cool

#

position: Position - Desired placement position. If the exact position is occupied, nearest empty position is used.

#

it didnt say array, so I thought that meant it wouldnt work

little raptor
past wagon
#

oh yea

little raptor
#

position = array with three SCALAR elements [x, y, z]

past wagon
#

yea

#

so you think the code I posted will work?

little raptor
#

not really

#

If the exact position is occupied, nearest empty position is used.

past wagon
#

oh yea

#

so can I put it in a relative position?

#

like slightly higher on the Z axis?

little raptor
#
_randomPosATL = ...;// the random editor pos you selected
sleep 1;
isNil {//isNil is used to do all of this in 1 frame (to avoid objects colliding and exploding)
private _parachute = "NonSteerable_Parachute_F" createVehicle _randomPosATL;
//you don't need to set the supplyDrop position, since it's being attached; you only need to set the parachute's pos
_patachute setPosATL _randomPosATL;

supplyDrop attachTo [_parachute, [0,0,0.5]];
};
past wagon
#

wait

#
private _supplyDropPos = getPosATL supplyDrop;
_supplyDropPos vectorAdd [0,0,1];

sleep 1;
private _parachute = "NonSteerable_Parachute_F" createVehicle _supplyDropPos;

supplyDrop attachTo [_parachute, [0,0,0.5]];
#

would this work?

#

@little raptor

winter rose
# past wagon would this work?

try and thou shalt see!

you cannot add a comma or change arguments order then ask if it will work - you have to understand how it works

past wagon
#

I didnt know I did

#

what part is wrong?

winter rose
#

I did not read your code, I mean generally
Leopard20 is not your personal compiler, the game is 🙃
we cannot be behind your every step, but be assured that we will fly for help and explain if you don't understand a part

past wagon
#

yea, thanks

#

i guess I will just test stuff out before I ask for your guys' confirmation

#

so the script isnt working, but it also isnt giving me an error message

#

it just drops from the sky

little raptor
#

instead of just randomly writing stuff, you should look at the example I posted.
#arma3_scripting message
I've even added comments that explains everything

past wagon
#
_supplyDropPosition = selectRandom [[12679.601, 13332.028, 1000], [13875.363, 13456.195, 1000], [13193.535, 13493.376, 1000], [14068.655, 12965.528, 1000], [12531.175, 12785.974, 1000], [13619.896, 13188.942, 1000], [12383.82, 13265.418, 1000]];

isNil {
private _parachute = "B_Parachute_02_F" createVehicle _supplyDropPosition;
_parachute setPosATL _supplyDropPosition;

supplyDrop attachTo [_parachute, [0,0,0.5]];
};
little raptor
#

if that's all of your code, why do you use sleep?

past wagon
#

ummm

#

thats not all my code

#

well

#

yea i guess i can get rid of sleep now

blissful oyster
#

Hey there i need some help. So i'm working on a mission where you get the task to capture a Gorgon (gorgon1). In the trigger for the task completion i put as condition " (vehicle player) == gorgon1 " earlier i tried " player in gorgon1 ". It works perfectly fine in Singleplayer but not in Multiplayer.. any ideas?

little raptor
blissful oyster
#

alright that one works. thank you

little raptor
blissful oyster
#

yeah i know that (:

past wagon
#

its working!
@little raptor @winter rose

winter rose
#

\o/
GJ!

past wagon
#

my battle royale is finally finished

#

if anyone wants to look at the mission, I can send it to them

winter rose
past wagon
#

how do I publish it?

#

I just made this so me and my friends can play

#

but I might publish it

#

if its easy to do

next kraken
#

any idea why this one isnt working:

#

class CfgSounds { sounds[] = {radioambient29}; class radioambient29 { name = "radioambient29"; sound[] = {"\A3\Sounds_F\sfx\radio\ambient_radio29.wss", db+10, 0}; titles[] = {0,""}; }; };

winter rose
next kraken
#

playSound "radioambient29"

past wagon
#

ok

next kraken
#

returns NOID <no shape>

next kraken
#

thx, solved...!

winter rose
next kraken
#

wrong path @A3\Sounds_F\sfx\radio\ambient_radio29", 0.25, 1,100

#

needs @ !

winter rose
#

ah true, true!

past wagon
#

how can I make it so that civilian vs civilian is not deemed friendly fire

little raptor
#

or make civilians enemies to themselves
or use addRating to make the unit a Renegade

astral tendon
#

How to hide my sounds in the CfgSounds?
They are showing on triggers but I don't want they to be there, there is sounds in the game that do not show on triggers without but can be use in script

astral tendon
#

were it should be placed? here is a exemple

class CfgSounds
{
    sounds[] = {};
    //Words
    class AWACS_US_Home_Plate_at
    {
        // how the sound is referred to in the editor (e.g. trigger effects)
        name = "AWACS_US_Home_Plate_at";

        // filename, volume, pitch, distance (optional)
        sound[] = { "RTG_AWACS\RTG_AWACS_Sounds\dub\AWACS\eng\Home Plate at.ogg", 80, 1};
        
        // subtitle delay in seconds, subtitle text
        titles[] = { 0, "" };
    };
little raptor
#

inside the class obviously

astral tendon
#

which one?

little raptor
#

what do you think?

#

it marks the scope of the class

astral tendon
#

class CfgSounds?
because there is over 170 defined sounds and im lazy to put in everyone.

little raptor
#

well you did it wrong

exotic flax
#

thinks in macro's

little raptor
#

you should've used inheritance

exotic flax
little raptor
#

but you can still use find and replace

#

yeah

astral tendon
#

well rip.

little raptor
#

use regex find & replace

exotic flax
#

Which is why you test with one thing, make sure it works and only then start adding the masses

astral tendon
#

That was a verry late thing

little raptor
astral tendon
#

the find and replace seems to not work when I need with two lines does the spaces with tab

astral tendon
#

🙄

exotic flax
#

Even a simple find&replace should work...

#

At least when you don't use Notepad or Word

winter rose
#

Ctrl+H name = scope = 0;\n\nname =

little raptor
#

actually I think it should be 1

#

not sure

little raptor
winter rose
little raptor
#

yeah I was explaining to @astral tendon

astral tendon
little raptor
#

yes

#

use Extended if you want to use Lou's

astral tendon
#

now that worked, thanks.

astral tendon
little raptor
exotic flax
#

Most likely have people there who know more about it

fair drum
#

any way I can use soundNames for sounds in playsound3d? I'm not sure why it has you supply the full file name when every other sound command just uses the sound name from your config

little raptor
#

it's far superior

fair drum
little raptor
little raptor
fair drum
# little raptor or alternatively, you can still use `playSound3D` and get the music file from th...

i think i might have to create a sound source using say3d like you posted... I think something is up with the soundPosition param on playSound3d. It says optional and that the default is [0,0,0] but if you do the default, it will override the position. but if you do [], the command fails as well. so I can't use the farther parameters at all.

playSound3d [missionpath "blahblahblah.ogg", unit] //works at player
playSound3d [missionpath "blahblahblah.ogg", unit, false] //works at player
playSound3d [missionpath "blahblahblah.ogg", unit, false, [0,0,0]] //Sound fires at 0,0,0
playSound3d [missionpath "blahblahblah.ogg", unit, false, []] //errors
little raptor
#
playSound3d [missionpath "blahblahblah.ogg", unit, false, getPosASL unit,...]
fair drum
#

then whats the point of soundSource at all if you have to provide the positions later in it lol

little raptor
distant oyster
#

So about respawn: does someone know how to put the player into spectator and respawn at a certain point in time at a position selected by the player? I tried:

fair drum
#

for campaign making, whats the best way to organize folders of files such as music, sounds, etc that you want carried from mission to mission? right now I have them in each mission and I realize I'm wasting file size. Is there anything complicated with referencing outside of each mission folder to the general mission folder?

exotic flax
#

create an assets mod

#

because it's not possible to reference stuff from one mission in another

#

not sure how that works with campaigns though... or with the fancy method that Old Man uses

fair drum
#

well i mean if i had campaignFolder/sounds/ couldn't i reference that each missions' individual cfgSounds?

#

campaignFolder/sounds/
campaignFolder/missions/mission1.blah
campaignFolder/missions/mission2.blah

#

I can't reference out to the root campaign folder?

exotic flax
#

Other files may appear at the root of myCampaignDirectory for sharing resources between missions, or storing the campaign overview image for example. No files should appear in myCampaignDirectory\missions , only mission directories Mission names do not matter nor impact the missions flow. Zmission.VR will not load after Amission.VR for example. The order is, again, defined in the description.ext file.

#

documentation helps 😉

fair drum
#

linky for further reading?

exotic flax
#

should be on your list already when making a campaign derpWolf

fair drum
#

yeah i just finished my second mission and I'm like... okay, so how do i put them together now lol

warm hedge
#
  1. Check the pinned to format.
  2. Looks like the trigger is executed globally. Use isServer to make sure it's happening only once
warm hedge
#

...Why did you removed your post?

fair drum
#

what does The minimal distance projectile needs to be from target position to enter ballistic mode mean?

warm hedge
#

_minDistanceToTarget is what it does mean?

#

So yeah, minimal distance to something

fair drum
#

well i mean ballistic mode

warm hedge
#

Uh hmm. Never tried that function so

crude vigil
#

@fair drum Probably means that if the target is closer than minimum distance defined, the missile is not able to acquire target and manouver according to that?

fair drum
#

how do i reference files in a campaign's folder, outside of the mission folder? I want to create a pool of files that every mission can access so I save on space.

campaignfolder\missions\mission01.blah
campaignfolder\img\image1.blah

how do I reference that image to mission01?

torpid pewter
#

I've noticed that when a vehicle that has multiple color variants is spawned by script on a dedicated server it's always the same color, however on a local hosted multiplayer it properly spawns with random textures.

Is this intended behavior or is this a bug?

winter rose
torpid pewter
#

My understanding was that vehicle textures for vehicles with randomized textures have always appeared differently to each client. For example, to one player a hatchback might appear red and to another it might appear blue. Is that still the case or was that fixed?

warm hedge
#

I don't think so, I've experienced the same recently

finite sail
#

Its annoying

#

but wasn't it fixed? I'm sure Tom wrote that the disableradomizarionwas fixed

real tartan
#

any ideas for one-liner code?

private _id = _unit getVariable ["custom_variable", 0];
_unit setVariable ["custom_variable", (_id + 1)];
finite sail
#

That said, I never tested it because I have a vehicle init function that fixes it and does loads of other mission related stuff

cosmic lichen
#

Last time I tested it, it wasn't fixed.

finite sail
#

Tested it just now... unexpected results

#

disableRandomization[] = {} and spawned a load of C_Hatchback_01_F on the host

#

host saw different colours, client saw all white cars

cosmic lichen
#

Any experience with this ? this setVariable ["BIS_fnc_initVehicle_customization", false, false]; The biki says it would disable randomisation

#

But it doesn't work and I don't see how it should, looking at the function

finite sail
#

disablerandomisation {"Allvehicles"} host and clients saw all cars as white

#

never used it revo

#

i gave up with it and wrote my ow

#

own

cosmic lichen
#

Yeah, seems bugged all over the place

torpid pewter
#

I know when I placed a bunch of hatchbacks in the editor and loaded the mission on a dedicated server with 2 clients (all clients and dedicated on same pc) the hatchbacks had different camo but was synced between the clients.

finite sail
#

yes, sounds like what i saw just now

#

the hatchbacks you saw, were they all white?

#

mine were

torpid pewter
#

No they were all different colors, but the colors matched for both clients. So a green car on one client was green on the other.

#

But this only seems for editor placed vehicles.

finite sail
#

ok

#

i was spawning them in mission using createvehicle

torpid pewter
#

In game with the debug menu or from the editor?

finite sail
#

debug

#

in a running mission

#

either way, its not working as it should

cosmic lichen
#

Not even _vehicle setVariable ["BIS_enableRandomization", False];works for disabling randomisation

#

WTH

finite sail
#

its rubbish, mate

little raptor
cosmic lichen
#

We need a setGetVariable command 😮

exotic flax
#

so a setGetVariable, and a getSetVariable, and a mayOrMayNotSetGetVariable 🤣

#

don't see the benefit of a new command which just adds more confusion...

little raptor
#

I think R3vo's joking

cosmic lichen
#

I might be German, but yeah, sometimes I make a joke.

little raptor
#

But you can still use macros for "setGetVar":

#define setGetVar(x,y,z) (x setVariable [y, (x getVariable [y, 0]) + z])
```🙃
slim oyster
#

IOT disable the vanilla throw binding, does anyone have any insight on what the best practice would be? Removing the throw weapon? Having a CBA playerEvent handler for "weaponMode" and switching mode from there? I would prefer disabling the ability to throw rather than interrupting with a fired EH or something along those lines.

little raptor
#

not sure if it's possible (but it should be)

young current
#

That would disable all grenade throwing yes but not sure if ace systems also rely on it.

#

I'm quite curious on why it would need to be disabled.

hollow thistle
#

IIRC we script the projectile

slim oyster
#

Sure, i find the speed at which people can throw grenades is simply too quick

hollow thistle
#

but I'm not sure if removing Throw muzzle will not block you from selecting the nades.

young current
#

And depending on method of removal it might mess with AI

slim oyster
#

I would be handling this locally on players via an addon, all AI on HC and their grenades are all scripted

#

Projectile spawn

young current
#

Why not just change the reload speed?

oblique arrow
slim oyster
#

I am altering the ace throw

#

Afaik, the vanilla system is simply throw + animation

#

There is no "prep" animation

exotic flax
#

how about removing the "Throw" weapon from the unit config?

little raptor
#

That might make it incompatible with modded units

#

altho most of them inherit from default man class

exotic flax
#

any mod which doesn't inherit from default classes won't work with ACE either

distant oyster
# distant oyster So about respawn: does someone know how to put the player into spectator and res...

I was finally able to solve it after hours of frustration :) You can use these settings:

respawn = 3;
respawnTemplates[] = { "MenuPosition", "Spectator" };
``` and to get the full spectator you have to set some variables in the uiNamespace of the player:
```sqf
//--- Enable full spectator in respawn screen
{
    missionNamespace setVariable [_x, true];
} forEach [
    //"BIS_respSpecAi",
    //"BIS_respSpecAllowFreeCamera",
    //"BIS_respSpecAllow3PPCamera",
    //"BIS_respSpecShowFocus",
    //"BIS_respSpecShowCameraButtons",
    "BIS_respSpecShowControlsHelper",
    "BIS_respSpecShowHeader",
    "BIS_respSpecLists"
];
``` I will also add this to the BIKI :)
ripe sapphire
#

guys should i make all my sqf into functions?

#

do functions execute faster than execVM ing a sqf?

winter rose
#

execVM reads and parses the file everytime, so it is slower

ripe sapphire
#

oh i see

#

so if its only once theres no improvement at all

#

?

#

well its easier to remoteExec at least i guess

winter rose
#

yep, and safer

ripe sapphire
#

ok ill make them all functions lol

#

thanks lou

blissful oyster
#

Have a question to debriefing. So in a coop mission when all players died i want a custom debriefing screen. I tried to overwrite the "loser" ending with the code from the wki

class CfgDebriefing
{
class loser
{
title = "You all died!";
subtitle = "";
description = "Everyone is dead.";
pictureBackground = "";
picture = "KIA";
pictureColor[] = {0.6,0.1,0.2,1};
};
};

but it still shows the standard "all players died" screen

tender fossil
#

Is there a way to detect who's placing markers on map during the briefing screen? (NOTE: Arma 2!)

#

Also, are you aware of any cheats that require user to place a certain marker on map (you can DM me)

still forum
#

Arma 2 you can replace the UI dialog that opens when you place a marker

#

and add a eventhandler on the OK button

tender fossil
#

@still forum I think there is one in place already, but it doesn't work in the briefing screen

#

Found this

fnc_marker_keyUp_EH =
{
    private["_handled","_display","_dikCode","_control","_text"];
    _display = _this select 0;
    _dikCode = _this select 1;
    _out = false;

    if ((_dikCode == 28) || (_dikCode == 156)) then
    {
        _control = _display displayCtrl 101;
        _text = ctrlText _control;
        if (_text == "") then
        {
            _text = format ["%1", name player];
        }
        else
        {
            _text = format ["%1: %2", name player, _text];
        };
        _control ctrlSetText _text;        
        _display displayRemoveAllEventHandlers "keyUp";
        _display displayRemoveAllEventHandlers "keyDown";

    };

    _out;
};
#

It works when the mission is running but not before it

#
fnc_map_mouseButtonDblClick_EH =
{
    private
    ["_display"];

    disableUserInput true;
    (time + 2) spawn
    {
        disableSerialization;

        while {time < _this} do
        {
            _display = findDisplay 54;
            if (!isNull _display) exitWith
            {
                
                _display displayAddEventHandler ["keyUp", "_this call fnc_marker_keyUp_EH"];
                _display displayAddEventHandler ["keyDown", "_this call fnc_marker_keyDown_EH"];

            };
        };
        disableUserInput false;
    };
    true;
};

if (local player) then
{
    waitUntil {sleep 0.1; !isNull (findDisplay 12)};
    ((findDisplay 12) displayCtrl 51) ctrlAddEventHandler ["mouseButtonDblClick", "call fnc_map_mouseButtonDblClick_EH"];
};
#

Hmm, wait a minute

#
waitUntil {sleep 0.1; !isNull (findDisplay 12)};

^ Is this line to blame for it not working in the briefing screen?

edgy thunder
winter rose
edgy thunder
#

Holy moly im blind. Thank you!

winter rose
#

you can hover your cursor to have a description 😉 welcome!

agile pumice
#

Is there any reason that the below code would not work on multiplayer but work in the editor?

0 = player createDiarySubject ["Intel Packet","Intel Packet"]; 
0 = player createDiaryRecord ["Intel Packet",["CIA Hostage","Pictured on Left: MATTHEW STEWART:<br></br><br></br><img image='images\2.jpg' width='300' height='180'/>"],taskNull,"",true];
0 = player createDiarySubject ["Intel Packet","Intel Packet"]; 
0 = player createDiaryRecord ["Intel Packet",["HVTs","Pictured from Left to Right: KAREEM AL-BEN, MUFEED AL-KAMEL (KIA), LABEEP AL-BEN:<br></br><br></br><img image='images\hvt.jpg' width='300' height='180'/>"],taskNull,"",true];
winter rose
#

yes

winter rose
#

run this in initPlayerLocal.sqf, and remove these useless 0 = 🙂

agile pumice
#

yeah that's the advice I gave my buddy, he put the code in the Eden editor General tab > init box

winter rose
#

oh so this box is server-side only, good to know

agile pumice
#

the code was generated using Eden Enhanced's "Briefing Creator" tool

#

Its good to know that the box is server only

winter rose
#

the code is not wrong, since it works!
but you have to have it run locally yes

agile pumice
#

I thought it had something to do with the commands

winter rose
#

or remoteExec it, but meh

agile pumice
#

I try to keep that to a minimum

#

Thanks Lou, you've been helpful as always

winter rose
#

w/ pleasure!

frigid apex
#

Any idea why playsound3d audio has a distance delay like it should, but this delay is only experienced clientside? I will explain the situation, I have a custom target I've made with a Onhit Eventhandler to play a sound in 3d when hit. Shooting the target at like 1000 meters the audio has a nice delay to it before it reaches the player, but this only works if you shoot the target yourself. Having another player shoot it you will hear the sound right when the target is hit, while the shooter hears the delay.

little raptor
#

Seems like a locality bug, since the command is supposed to have global effect

dusky wolf
#

Tying to fix a stupid issue by I just can't figure it out. I'm trying to make a trigger that closes a door a little while after deactivation
Since sleep timers can't be used directly in triggers I made a simple little sleep script that I can pass an argument to for the time (hoping to use the for a few different triggers)

[5] execVM "scripts\sleep.sqf";
sleep.sqf
params ["_sleepTimer"];
sleep _sleepTimer```
#

Unfortunately it seems to simply be skipping over the sleep timer. It's not kicking back an error in the rpt, so I assume it's "working"

winter rose
#

unless there is something after that sleep

dusky wolf
#

Ok, so I just need to add an addition 'something' that basically does nothing

#

Just so it will actually wait before it continues on

winter rose
#

no

#

by using execVM, you are creating a new thread

agile pumice
#

I'm experiencing an issue with Virtual Arsenal messing with a PIP camera attached to a UAV drone that renders on a tv object. The feed works until the Arsenal is opened.

params ["_uav", "_tv"];

fn_createCam = {
    params ["_uav", "_tv"];

    /* create camera and stream to render surface */
    screentime_cam = "camera" camCreate [0,0,0];
    screentime_cam cameraEffect ["External", "Back", "uavrtt"];

    /* attach cam to gunner cam position */
    screentime_cam attachTo [_uav, [0,0,0], "PiP0_pos"]; 

    /* make it zoom in a little */
    screentime_cam camSetFov 0.1;

    /* switch cam to NVG */
    "uavrtt" setPiPEffect [2];

    /* adjust cam orientation */
    addMissionEventHandler ["Draw3D", {
        _dir = 
            (uav selectionPosition "laserstart") 
                vectorFromTo 
            (uav selectionPosition "commanderview");
        screentime_cam setVectorDirAndUp [
            _dir, 
            _dir vectorCrossProduct [-(_dir select 1), _dir select 0, 0]
        ];
    }];
    
    _tv setObjectTextureGlobal [0, "#(argb,512,512,1)r2t(uavrtt,1)"];
};

fn_destoryCam = {
    params ["_cam"];
    _cam cameraEffect ["terminate","back"];
    camDestroy _cam;
};

uav = _uav; //for the addMissionEventHandler ref
call fn_createCam;

/* Arsenal Fix */
while {alive _uav && alive _tv) do {
    waitUntil { !isnull ( uinamespace getvariable "RSCDisplayArsenal" ) };
    diag_log "arsenal open";
    [screentime_cam] call fn_destoryCam;
    waitUntil { isnull ( uinamespace getvariable "RSCDisplayArsenal" ) };
    diag_log "arsenal closed";
    [_uav,_tv] call fn_createCam;
};
#

tv setObjectTextureGlobal [0, "#(argb,512,512,1)r2t(uavrtt,1)"]; was locally executed after the arsenal was opened/closed and that didn't help to fix the issue

urban night
#

Is it possible to have a different callsign for a unit but let them stay in whatever group they are?
I want to have different callsigns for certain roles in our multiplayer squads

winter rose
#

and setNamesound for the word used to call them

dusky wolf
# winter rose well, it waits but it won't wait from _within_ the trigger; it creates a new thr...

Thanks that helped out and I got the trigger running with that.
Now I'm just trying to make a solution for a specific case that this doesn't account for. It a player enters the trigger, then leaves it, and another player (or the same) enters it the deactivation will trigger. I'm looking to put in a check for players in the trigger area after the sleep timer and either run if there are none or loop back to the sleep timer if there is a player

dusky wolf
#
_handle = [] spawn {
    while {getPos (_this select 0) inArea gateTrigger} do {
sleep 5;
gate animateSource ['Door_1_sound_source', 0]}
};``` 
I've gotten this far but I'm thinking while isn't quite what I'm looking for
little raptor
agile pumice
#

Am I not already doing that?

little raptor
#

before that

agile pumice
#

the terminate is called in fn_destroy which is called before screentime_cam cameraEffect ["External", "Back", "uavrtt"];

little raptor
#

you only do it when you destroy the camera

agile pumice
#

so between ```sqf
screentime_cam = "camera" camCreate [0,0,0];
screentime_cam cameraEffect ["External", "Back", "uavrtt"];

#

seems redundant?

little raptor
#

you should do it after the camera is created

agile pumice
#

okay I'll try

#

I'll report back with findings

little raptor
agile pumice
#

having the last param be the same should be better right?

#
    screentime_cam cameraEffect ["terminate", "Back", "uavrtt"];
    screentime_cam cameraEffect ["External", "Back", "uavrtt"];
little raptor
#

I don't remember how the syntax went

#

check it on the wiki

little raptor
tender fossil
#

Should I take the sleep 0.1 pff?

warm hedge
#

Not sure the context. Is it call'ed?

#

@tender fossil ^

#

I suspect it's an error because you're trying to do waitUntil and sleep in an Unscheduled Environment

tender fossil
#

@warm hedge It's executed in scheduled environment and it works after the (de?)briefing when the mission starts

patent goblet