#arma3_scripting

1 messages ยท Page 393 of 1

still forum
#

engaged looks like engagged

little eagle
#

Only to weird people.

austere granite
#

if you wanna reload configs without restariing the game you'll need to use arma3_diag.exe of the dev branch

cosmic kettle
#

Well in their defense, not everyone is used to this @still forum . playing the devils advocate here but just saying. not everyone here means the ones that legit have questions just not good at asking them.

little eagle
#

Repeating your question in all channels is just rude.

jade abyss
#

and leads up to multiple Convos in multiple channels

still forum
#

Or you just use script commands to write the config values live.

cosmic kettle
#

That is true, but some of the answers here have been just... shocking sometimes. One needs a thickkkkkkkk skin.

still forum
jade abyss
#

What means "shocking"?

cosmic kettle
#

Laws are laws, never drove too fast? but that's offtopic rly ^^

still forum
#

If you break them you'll get trolled by everyone till a mod comes along and bans you.

jade abyss
#

Laws are laws, never drove too fast?Until police catches you and gives you a fine. "a fine" in here = making fun/trolling you ๐Ÿ˜‰

cosmic kettle
#

Well lets say some of us are lke waiters, see them smile? they just started. See them bark? yeah those are ogs...

#

I mean I get where it comes from, i lol'd at what passes by sometimes.

ivory nova
#

Is there a way to pushback multiple ints to an array without the extra []?

little eagle
#

That guy didn't answer back anyway. Probably spammed even more places and got his answer somewhere else.

cosmic kettle
#

append? @ivory nova

ivory nova
#

well i'll be

jade abyss
#

You know, sometimes you just got ppl who try to learn something... but most of the time you got ppl like... erm... no, no names... who just ask stuff, you answer them and give them a solution, they ignore your answer and ask the same question a day later again. And then again. and again .... and again

ivory nova
#

@cosmic kettle thanks man, had that wiki open too lol

cosmic kettle
#

No problem round.

ivory nova
#

@jade abyss I will never forget you helping me with my heli smoke trails script, +1 thanks from me

cosmic kettle
#

@jade abyss yes, and those people will always exist. The hardest part about being the good guy is the shit you see.

jade abyss
#

i did? Can't remember tbh ^^ @ivory nova

cosmic kettle
#

^lmeo he said exactly that when I thanked him... memleak?

ivory nova
#

Was at least a year ago (: Not reason to remember hehe

jade abyss
#

Ah, okay =}

still forum
#

The brains of everyone in here are overflowing with bad scripts. No one remembers anything anymore

limpid pewter
#

I'm on Dscha 'list', im sure you remember me

jade abyss
#

I know you Pic, but... erm...

#

there are just way too many ppl in here ๐Ÿ˜„

limpid pewter
#

ye

cosmic kettle
#

dsha make me trailer truck pl0x ๐Ÿค”

jade abyss
#

(and my memory of people sucks anyway)

#

already did @cosmic kettle ๐Ÿ˜„

still forum
#

My brain only remembers _QS_worldName = worldName;

jade abyss
#

lol

#

yeah

ivory nova
still forum
#

lul

cosmic kettle
#

searches with google
still no clue
leaves joke be

little eagle
#

Dscha is famous.

still forum
#

@cosmic kettle my code snippet?

cosmic kettle
#

ye ^^

little eagle
#

Why would you ever link this again?

still forum
#

Be careful. Might crash your browser

jade abyss
#
commy2 - Today at 1:33 PM
Dscha is famous.```
awwwwww โค
cosmic kettle
#

nooo please don't

lone glade
#

to bamboozle us

cosmic kettle
#

i thought that was hidden

jade abyss
little eagle
#

I guess I was wrong. The scheduler can make everything run.

cosmic kettle
#

@jade abyss I was joking around, know you need the handbrake to go ๐Ÿ˜‰

jade abyss
#

and some other stuff ๐Ÿ˜„

cosmic kettle
#

and it is the best version I found really

jade abyss
#

the one from... erm... "name" was also not bad.... erm... Australian truck thingy (but had the same Probl with the UberHandbreak)

cosmic kettle
#

Well say whatever you want, #arma3_scripting is my favourite channel. Spent months on this discord, 90% here lol
and yeah i looked at name but they weren't public right?

little eagle
#

The real Arma game is actually the scripting jigsaw puzzle.

limpid pewter
#

^

jade abyss
#

And i think it's the channel where offtopic gets a little bit tolerated (till a certain point) ๐Ÿ˜„

cosmic kettle
#

Mods don't come here. 't is a haunted place filled with dangers of the deep.

little eagle
#

Because mods can't tell the diff between unintelligible off topic and unintelligible scripting lingo.

jade abyss
#

lol (both)

cosmic kettle
#

just add if (script == true OR 1==1 && 2==2) from time to time

jade abyss
#

explosion 3... 2... 1...
SCRIPT == TRUE ! NO ! FFS! BLABLA!

cosmic kettle
#

I was fishing commys... ๐Ÿ˜†

#

Some real work here. Is there a way of generating a list of muzzles, without knowing any weapons?

#

like get all muzzles on the server.

#

Credits: serena BI forum.

{
  private _wpn = _x;
  private _asi = 2;
  private _asn = ["MuzzleSlot", "CowsSlot", "PointerSlot", "UnderBarrelSlot"] select _asi;
  private _cfa = configfile >> "CfgWeapons" >> _wpn >> "WeaponSlotsInfo" >> _asn >> "compatibleItems";
  private _res = nil;

  if (isClass _cfa) then {
      _res = configProperties [_cfa, "isNumber _x"] select {getNumber _x > 0} apply {configName _x};
  } else {
      if (isArray _cfa) then {
          _res = getArray _cfa;
      };
  };
  {
    if !(_x in _hint) then {
      _LISTOFMUZZLES append _x;
    };
  } forEach _res;
}forEach _weaponList;
#

^still needs a weaponclass

little eagle
#

List of all muzzle attachments used in a mission?

cosmic kettle
#

Yeah

#

the goal is to spawn one randomly

#

I managed to 'harvest' some lists, manually

#

using the above code. but kept itching in the back of my head.

limpid pewter
#

configfile >> "MuzzleSlot"

#

Maybe

#

Its works for sights for me

cosmic kettle
#

Am confused

#

thought that was a subclass of cfgWeapons

limpid pewter
#
_weaponList = getArray (configFile >> "MuzzleSlot");
cosmic kettle
#

Lol thanks, will try

little eagle
#
private _allMuzzleItems = []; 
 
{ 
    { 
        _allMuzzleItems pushBackUnique (_x select 1); 
    } forEach weaponsItems _x 
} forEach allUnits; 
 
_allMuzzleItems - [""]
limpid pewter
#

Maybe, haven't tested it. But in my current mission i am using ```sqf
_sights = getArray (configfile >> "CowsSlot" >> "compatibleItems");

cosmic kettle
#

Commy why allUnits? Will be testing both pieces thx guys

little eagle
#

Do you want all muzzles used in the mission or all compatible muzzles?

#

Or just all muzzle attachments in general?

cosmic kettle
#

To rephrase; on first missionload I will spawn crates containing weapons/items/etc. I would like the spawnscript to select from a (preferred dynamic as in per server diff.) list of all possible weapons/atttachments on the server and spawn in the boxes.

jade abyss
#

the goal is to spawn one randomly
Sounded like using a list of all available

#

So you got a list and then select from there?

little eagle
#

So you want all muzzle attachments in the game.

jade abyss
#

available on that Server (Addons)

little eagle
#

Sure.

cosmic kettle
#

yeah, ATM I have to harvest each list and feed that to my spawnscript.

#
if ((_present getVariable "ARM_Events_Present_texture") in ["camo1","camo2","camo3"]) then {
  for "_x" from 0 to floor(_baseValue/10) do {
    private _weapons = [
      // shortened
    ];

    private _muzzles = [
        // shortened
    ];

    private _scopes = [
      // shortened
    ];

  /*
    private _backpacks = [
      // shortened
    ];
  */
    private _className = switch (floor random 3) do {
      case 0: {
        _muzzles select (floor random count(_muzzles))
      };
      case 1:{
        _scopes select (floor random count(_scopes))
      };
      case 2:{
        _weapons select (floor random count(_weapons))
      };
    };
    _present addItemCargo [_className, 1];
  };
}
jade abyss
#

So long story short:
You want a crate, that spawns in randomly selected MuzzleThingys, wich are available on the Server. Right?

cosmic kettle
#

above code says it all I guess, but yeah ๐Ÿ˜ƒ

#

and atm I feed in those lists

#

I would rather it be dynamic, so that on any server it'll work with what it has.

still forum
#

Why are you guys having such a hard time understanding the question ๐Ÿ˜„

cosmic kettle
#

I'm awful at phrasing sometimes.

little eagle
#
private _allMuzzleAttachments = "true" configClasses (configFile >> "CfgWeapons") apply {
    configName _x
} select {
    _x call BIS_fnc_itemType select 1 == "AccessoryMuzzle"
};
 
_allMuzzleAttachments
#

This?

still forum
#

I have an idea. Gimme a.............. Yes.. That.

cosmic kettle
#

lmao

#

I wonder, you guys have a cheatsheet or is that just brain?

little eagle
#

Memory. Google. And the wiki.

jade abyss
#

had the same thing in my hand^^

#

_ClassList = "true" configClasses (configFile >> "CfgVehicles"); <- from my files

#

(yeah, i know Vehicles, needed to be adjusted, blaaaaa. Just pasted in what i just found)

still forum
#

You can also read type directly from the config class.
CfgWeapons >> class >> "ItemInfo" >> "type"
301 is muzzle

little eagle
cosmic kettle
#

Okay, I gave them all a try, ofc (and ty) commy's piece works

little eagle
#

tbh, just use BIS_fnc_itemType

cosmic kettle
#

but intriguingly, Moldisocks piece works ... sometimes.

jade abyss
#
_ClassList = "true" configClasses (configFile >> "CfgWeapons");  
{
    if((getNumber "CfgWeapons" >> _x >> "ItemInfo" >> "type") == 301)then{addToYourArray};
}forEach _ClassList;```
Try that also
cosmic kettle
#
_sights = getArray (configfile >> "CowsSlot" >> "compatibleItems");
diag_log _sights;

returns array of scopeclasses

_muzzles = getArray (configfile >> "MuzzleSlot" >> "compatibleItems");
diag_log _muzzles;

returns [];

jade abyss
#

ah, scopes

still forum
#

That is certainly faster than commy's method. But.. I think that might throw RPT errors if ItemInfo is missing.
In ACE Arsenal we have a isClass check for that

little eagle
#

Just use BIS_fnc_itemType and store the result in a global.

cosmic kettle
#

@limpid pewter fyi , might learn a thing or two here.
I'm just wondering, why the diff between those two scripts?

still forum
#

They can't work.

#

configFile >> "MuzzleSlot" doesn't exist

cosmic kettle
#

first one does

limpid pewter
#

Because configu viewer says so, idk hahaha. I'm amatuer. Dude these guys know what they're talking about.

cosmic kettle
#

It was my initial reaction

still forum
#

MuzzleSlot doesn't work

cosmic kettle
#

Don't worry @limpid pewter just trying out what you gave me, because I had a feeling it wasn't uniform.

still forum
#

it's just a base class that's left there that weapons can inherit from

cosmic kettle
#

Okay

#

so the only really

limpid pewter
#

Makes sense

cosmic kettle
#

there we both learned ๐Ÿ˜ƒ

jade abyss
#

@cosmic kettle

_array = [];
_ClassList = "true" configClasses (configFile >> "CfgWeapons");  
{
    _Type = getNumber "CfgWeapons" >> _x >> "ItemInfo" >> "type";    //Get Typenumber
    _Scope = getNumber "CfgWeapons" >> _x >> "scope";    //Check the accessibility
    
    if(_Scope == 2)then
    {
        if(_Type == 301)then{_array pushback (configName _x);};
    };
}forEach _ClassList;```
Try that (written as easy as possible to understand)
limpid pewter
#

No more smiley

still forum
#

๐Ÿ˜„

#

@jade abyss isClass check on the ItemInfo and you're golden

cosmic kettle
#

@jade abyss I try out all code one gives me, even if it is to compare.

still forum
#

@limpid pewter More smiley! ๐Ÿ˜„ ๐Ÿ˜„ ๐Ÿ˜„

jade abyss
#

isClass? For what? hm

limpid pewter
#

-_-

still forum
#

Because ItemInfo doesn't necessarly have to exist

cosmic kettle
#

to check if class or array?

still forum
#

and if it doesn't it could throw error

jade abyss
#

oh, okay

still forum
#

To check if ItemInfo even exists.

#

Reading stuff out of a non-existent thingy == not gud

cosmic kettle
#

if isNil "_thingy" lmao

#

another thing I learned just by looking at someone get slaughtered here

little eagle
#

There's no problem with it afaik.
null >> "something"
is just null.
The only problem is, when you try to access an entry, e.g. string, as class with this.

still forum
#

Does that throw errors to RPT or do only accesses from engine throw errors?

little eagle
#

No error, just null.

#

getText null -> "" etc.

#

Only using double meme arrow >> errors when used on entries, not classes.

jade abyss
#
_array = [];
_ClassList = "true" configClasses (configFile >> "CfgWeapons");  
{
    if(isClass ("CfgWeapons" >> _x >> "ItemInfo"))then    //does ItemInfo exist?
    {
        _Type = getNumber "CfgWeapons" >> _x >> "ItemInfo" >> "type";    //Get Typenumber
        _Scope = getNumber "CfgWeapons" >> _x >> "scope";    //Check the accessibility
        
        if(_Scope == 2)then
        {
            if(_Type == 301)then{_array pushback (configName _x);};
        };
    };
}forEach _ClassList;```
Better? ๐Ÿ˜‰ @still forum
little eagle
#

Why so much code when I posted the solution already with 3 lines ๐Ÿ˜ฆ

still forum
#

Almost perfect ๐Ÿ˜„

#

No!

#

doesn't work ๐Ÿ˜‰

cosmic kettle
#

Hmm weird, why does your code @little eagle return more than the snippet I found.

still forum
#

Find the error

jade abyss
#

understandable and "easy" to redo @little eagle
+You didn't checked for scope for example

little eagle
#

Well, does it return more because the other thing is missing some?

jade abyss
#

Scope = 0 can lead to error messages or giving you a baseclass (without Model/proper config)

cosmic kettle
#

Oh you're right Commy, you just check it all, I had to feed it weaponclasses.

little eagle
#

That's what you wanted tho.

#

I asked thrice ๐Ÿ˜ฆ

cosmic kettle
#

it is, 100%

#

Oh don't worry I just for the sakes of it try stuff

jade abyss
#

So you want unusable Muzzles in your crate? ^^

cosmic kettle
#

lol yes preferred

jade abyss
#

dafork

#

O.O

#

๐Ÿค”

cosmic kettle
#

you ask the question

#

lolol

limpid pewter
#

Text comms suck

little eagle
#

Are you sure BIS_fnc_itemType method would list private classnames?

jade abyss
#

Sometimes, yeah @limpid pewter

cosmic kettle
#

when saying private here we mean scope=0?

little eagle
#

Yes.

#

0 private, 1 protected, 2 public

jade abyss
#

@still forum "Find the error" was the meant for me?

still forum
#

yes

jade abyss
#

wuuuut

little eagle
#
private _allMuzzleAttachments = "getNumber (_x >> 'scope') > 0" configClasses (configFile >> "CfgWeapons") apply {
    configName _x
} select {
    _x call BIS_fnc_itemType select 1 == "AccessoryMuzzle"
};
 
_allMuzzleAttachments
still forum
#

your script doesn't work because you forgot something

jade abyss
#

i haven't had cofeve yet, leave me alone

cosmic kettle
#

๐Ÿ˜„

jade abyss
#

Line? ๐Ÿค”

cosmic kettle
#

yes please

jade abyss
#

oh shaddap

#

^^

still forum
#

the getNumber's

#

right after the getNumber you forgot something

jade abyss
#

()?

#

Did that throw out an error?

little eagle
#

BIS

#

fnc

#

itemType

still forum
#

๐Ÿ˜„

#

You need a config to look up a config value.

jade abyss
#

ah fk, damnit

#

yeah^^

#
_array = [];
_ClassList = "true" configClasses (configFile >> "CfgWeapons");  
{
    if(isClass (configFile >> "CfgWeapons" >> _x >> "ItemInfo"))then    //does ItemInfo exist?
    {
        _Type = getNumber (configFile >> "CfgWeapons" >> _x >> "ItemInfo" >> "type");    //Get Typenumber
        _Scope = getNumber (configFile >> "CfgWeapons" >> _x >> "scope");    //Check the accessibility
        
        if(_Scope == 2)then
        {
            if(_Type == 301)then{_array pushback (configName _x);};
        };
    };
}forEach _ClassList;```
And yes, i ignore the bis_fnc ones @little eagle
still forum
#

Now fix performance and private variables ๐Ÿ˜„ :U

cosmic kettle
#

๐Ÿ˜ข

#

I click execute my screan turn blue

#

plis help

austere granite
#

not putting spaces in control structures triggers me

#

}forEach REEEE

#

if(isClass REEEEEEEEEEE

cosmic kettle
#

Same here, but not to a point where it triggers really.

jade abyss
#

mimimi @austere granite

little eagle
#

BIS

#

fnc

#

item

#

type

cosmic kettle
#

No lie though @jade abyss it eh broke

jade abyss
#

Yeah, prolly.

cosmic kettle
#

lmao commy

jade abyss
#

Commy going mental in a moment

cosmic kettle
#

what is this thing commy keeps shouting

little eagle
#

You're the one thinking about something that was solved 10 minutes ago in 1 minute.

jade abyss
#

<- eating atm

limpid pewter
#

@still forum "Now fix performance and private variables ๐Ÿ˜„ :U"
I have been meaning to ask you , why is it best to do sqf private _myVar = something; rather than just ```sqf
_myVar = something;

cosmic kettle
#

first. @limpid pewter

jade abyss
#

But Commy... it's a bis_fnc

still forum
#

@cosmic kettle Why ๐Ÿ˜„

#

Because you protect yourself from overwriting other variables that are in a scope higher up by accident

jade abyss
#
_array = [];
_ClassList = "true" configClasses (configFile >> "CfgWeapons");  
{
    if(isClass (configFile >> "CfgWeapons" >> _x >> "ItemInfo"))then    //does ItemInfo exist?
    {
        _CfgName = (configName _x);
        _Type = getNumber (configFile >> "CfgWeapons" >> _CfgName >> "ItemInfo" >> "type");    //Get Typenumber
        _Scope = getNumber (configFile >> "CfgWeapons" >> _CfgName >> "scope");    //Check the accessibility
        
        if(_Scope == 2)then
        {
            if(_Type == 301)then{_array pushback _CfgName;};
        };
    };
}forEach _ClassList;```
@cosmic kettle
cosmic kettle
#

Come on ded I was citing what you tought me it only took like 10 mins longer.

limpid pewter
#

ok, so unless you think you will be at risk of naming the private vars the same in other scopes, then it isn't an issue? @still forum

still forum
#

Also setting private variables is faster.
Because if you don't private the engine has to check all scopes above it if the variable already exists.

limpid pewter
#

^

still forum
#

It's just good practice and it doesn't hurt

limpid pewter
#

that is the answer is was looking for

#

That makes sense to use private then

jade abyss
#
private _array = [];
private _ClassList = "true" configClasses (configFile >> "CfgWeapons");  
{
    private _CfgName = (configName _x);
    if(isClass (configFile >> "CfgWeapons" >> _CfgName >> "ItemInfo"))then    //does ItemInfo exist?
    {
        private _Type = getNumber (configFile >> "CfgWeapons" >> _CfgName >> "ItemInfo" >> "type");    //Get Typenumber
        private _Scope = getNumber (configFile >> "CfgWeapons" >> _CfgName >> "scope");    //Check the accessibility
        
        if(_Scope == 2)then
        {
            if(_Type == 301)then{_array pushback _CfgName;};
        };
    };
}forEach _ClassList;```
#

incl. privates

still forum
#

If you don't have any upper scopes you don't have a real benefit. But it also doesn't make anything worse

limpid pewter
#

ok, awesome

#

might start doing that now

jade abyss
#

I bet @little eagle gone mental already and screams around why we don't use the bis fnc ๐Ÿ˜‚

cosmic kettle
#

@jade abyss you should really let it go lmao still errors ๐Ÿ˜‚

jade abyss
#

no

cosmic kettle
#

Commy went for a nice and calm walk outside

jade abyss
#

Where is error?

#

Yo mom has an error

still forum
#

But remember not to use private ["_var","_var2"]. That one has overhead. And actually quite a lot

jade abyss
#

Was it that much?

limpid pewter
#

@cosmic kettle May i ask why you have presents in the background of that screenshot? you making a christmas mission?

cosmic kettle
still forum
#

@jade abyss Infinitly much

limpid pewter
#

@still forum If you mean for defining local vars for parsed parameters, then ok. I usually use params ["_var1","_var2"]; anyway

cosmic kettle
#

@limpid pewter exactly, check out #arma3_model around yesterday 2PM ๐Ÿ˜‰

jade abyss
#

@cosmic kettle Copy the code from above again. I added configName 1 line too late

cosmic kettle
#

params [.... is ok, private [..... just isn't imo?

still forum
#

I often see people use

private ["_var"];
_var = 1;

instead of private _var = 1;
Which destroys all performance benefits that private variables have

little eagle
#

I'm in a different chat waiting for you guys to realize that I was right again.

still forum
#

params and private ARRAY do different things.

jade abyss
#

@still forum tbh, thats how it was made before ๐Ÿ˜„

still forum
#

params has a reason to exist. private ARRAY not really

jade abyss
#

lol Commy

limpid pewter
#

yeah ok, i understand what params does, just making sure i understand what private does

still forum
#

no @jade abyss You could always local _var = 1;

cosmic kettle
#

Waw Dsha your code it work so well and soooo compact.

jade abyss
#

๐Ÿ–•

little eagle
#

Add 5 more lines and it even works!

jade abyss
#

not my concern

little eagle
#

Haha.

jade abyss
#

omnomnom, back to food

#

AND WHERE IS MY GODDAMN COFEVE

#

nvm, found energy

cosmic kettle
#

Executes Dscha code:

["acc_flashlight","acc_flashlight_smg_01","acc_flashlight_pistol","acc_pointer_IR"]

happy

limpid pewter
#

i thought you wanted muzzle attachments

cosmic kettle
#

Dsha it broke

#

lmao

jade abyss
#

301, thats what @still forum said

limpid pewter
#

try 101

#

"You can also read type directly from the config class.
CfgWeapons >> class >> "ItemInfo" >> "type"
301 is muzzle
[201,301,101,302] optic,side,muzzle,bipod"

cosmic kettle
#

Just joking, It's the concept I'm testing @limpid pewter . As Commy said, easier and compacter code to be found way up there ^

jade abyss
#

Yep, 101 then

cosmic kettle
jade abyss
#

Anyway, you can have a list for all of those now^^

still forum
#

oh lol

limpid pewter
#

Did you just upload a screenshot to prove a point, rather than just quoting

still forum
#

oops ๐Ÿ˜„

jade abyss
#

๐Ÿ˜„

little eagle
jade abyss
#

Yep @limpid pewter

limpid pewter
#

-_-

jade abyss
#

*too many macros*
*OVERLOAD*

limpid pewter
#

reason i said try 101 was :
"[201,301,101,302] optic,side,muzzle,bipod"

#

from commy's post

still forum
#

Dedmen cannot count commata

jade abyss
#

It's monday, so all fine

#

wait, fk... it's tuesday

#

no excuse then

still forum
#

lul

cosmic kettle
#

was gonna say

jade abyss
#

๐Ÿ˜‰

limpid pewter
#

tis wednesday for me

little eagle
cosmic kettle
#

im deutschland... fill in

jade abyss
#

*system shutdown*

still forum
#

I wanna model something. Gimme something easy that I could 3D model and put in Arma

#

The CBA logo with roadway lods so you can climb on it? ๐Ÿ˜„

cosmic kettle
#

A statue of Dwarden

little eagle
#

The CBA logo with roadway lods so you can climb on it? ๐Ÿ˜„
YES

still forum
#

Off to work!

daring pawn
#

Can it be a weapon that shoots out bugs instead?

jade abyss
#

*14:17:11 Error Type Number,Not a Number, expected Number*

still forum
#

Game crashing bugs?

little eagle
#

Give it 4k textures, so we can put it in 3.6 and make 90% of the mods filesize this one model.

cosmic kettle
#

best errors @jade abyss

daring pawn
#

Like explosive bug rounds

#

or tracer bugs

jade abyss
#

Yep, Stickie

still forum
#

Oh gosh I have a better Idea :3 I'll do that first and then the model

daring pawn
#

๐Ÿ˜› ahah

#

What if it was a Plane that dropped bugs?

cosmic kettle
#

i have a good idea

#

a plane flies over the island and drops players

#

that'll be 10โ‚ฌ

daring pawn
#

#350?

limpid pewter
#

not another battle royale

still forum
#

How do I generate a NaN in SQF again?

little eagle
#

log -1

cosmic kettle
#

^when you know you've gone too far

little eagle
#

It's
i*pi/ln(10)
with programs that actually can do math.

limpid pewter
#

Did all of your guys start programming with other langauges like C,java and python, then come across and learn this? As a hobby

little eagle
#

sqf first 3 years ago.

jade abyss
#

SQS > SQF > damaged for life

cosmic kettle
#

Not me, I did web before don't shoot me

limpid pewter
#

huh, so is this you only langauge?

jade abyss
#

Nah, a bit C# also

cosmic kettle
#

web > SQF > C#

limpid pewter
#

@cosmic kettle haha, i started with arduino

#

kk

little eagle
#

Rudimentary I know a bit of C++, but not really.

cosmic kettle
#

Dedmaen dreams in C

still forum
#

DUDE

#

DEDMEN!

#

Grrrr

#

Awooooo Woof

jade abyss
#

Dadmen

#

damn furry

still forum
#

And no. I don't. I dream C++

little eagle
#

DEDMEN!

still forum
#

It is terrible when I wake up still sleepy and think about that I first have to initialize the class before I can disable the alarm clock

jade abyss
#

daaaaadddmmaaaaannnnn *sing*

limpid pewter
#

ok, just wanted to know if i was the only one who had no prior professional experience coding before doing SQF

cosmic kettle
#

noob spams question
pow
spam in chat
thump
dedmeeeen

still forum
#

Literally almost every morning my brain is in "writing code" mode. It's so weird.. After that I always think: WTF?

cosmic kettle
#

@limpid pewter I personally think A3 is great just for that. You learn to 'play' with code.

#

Before arma, I played games.

limpid pewter
#

Yeah definitely, but i am now trying to start developing an app at the same time, and all of the debugging techniques you learn in arma (systemChat, hint, diag_log) all are comepletley different, relearn everything -_-

lone glade
#

I personally think A3 is great just for that
It's pretty terrible actually

cosmic kettle
#

hence personally being the keyword

still forum
#

Well.. You can also use a real debugger in SQF.. That isn't really different from other languages then

limpid pewter
#

Yeah, i just meant generally, i have had to re-learn alot of stuff, sytax and structure wise

cosmic kettle
#

@limpid pewter you learn the principles, learning new languages is ike throwing the skillset away and rediscovering that same skillset in the new language. after that phase, you're good to go.

still forum
jade abyss
#

I personally think A3 is great just for that. You learn to 'play' with code.
Yep, but don't dive in too depp or you kill your thinking, when you start with another language ๐Ÿ˜„

cosmic kettle
#

wait wat, are you actually ...?

limpid pewter
#

@still forum What is this... Arma studio. I have been just using notepad++ and more recently Posiden tools

cosmic kettle
#

Oh moldi, don't be like me and waste years of your time

#

Checkout atom and the sqf lintchecker + ACE3's syntax

still forum
#

It's a Complete IDE with a real script Debugger that has breakpoints and all that magic. Integrated Linter and stuff.
People weren't interested in it so it was put on halt.

limpid pewter
#

"put on halt" So is it still working? can i use it now?

cosmic kettle
#

What are you talking about not interested? I learned about linters for A3 like 3 months back and wished I had searched sooner ever since.

still forum
#

The debugger part broke in.. 1.76 I think. When BI made a hotfix and "fixed" something that wasn't even the issue and broke the debugger.

limpid pewter
#

Bugger ๐Ÿ˜›

still forum
#

Would be about a day of work to get it fixed.. But not really worth the time if just two people would use it

limpid pewter
#

Well a full featured IDE sounds like a great tool. Better than notepad

#

Count me interested XD

still forum
#

There are two devs on that. I have work and school. Other dev is studying at university. There is better stuff to invest free time into that more people will have a use for

#

Like.. Write scripts in Intercept and just use any C++ debugger

cosmic kettle
#

Seriously though, moldi, use Atom and get a lintchecker.

limpid pewter
#

Yeah cool

cosmic kettle
#

Will save you loads of headaches in the meantime.

limpid pewter
#

will check it out, but i have gotten used to sublime text atm

still forum
cosmic kettle
#

maybe it wants a number 1 = "hello"

still forum
#

I don't know what that second Generic error thingy is...

#

Okey enough of funnying around. Let's get dis CBA thingy going

astral tendon
#

```RiverRaidMusicLoop = addMusicEventHandler ["MusicStop", {"RiverRaidLoop" remoteExec ["playmusic"];}];````
this handle is being called by the server but it seens like if the host is alt+tabed it does not work for clients

#

is there a wasy to call this handle local to all players connected?

still forum
#

If you are tabbed out there is no music. So I guess that could make sense

#

You can't call a Handle.

astral tendon
#

so its only works local?

cosmic kettle
#

you could launch it from host and handle locally

astral tendon
#

how?

cosmic kettle
#

it depends on what you want, but I have no experience with musicEVHers so can't help you with that.

limpid pewter
#

Why not use remoteExec to spawn on all clients a function that only does this : ```sqf
RiverRaidMusicLoop = addMusicEventHandler ["MusicStop", {[RiverRaidLoop] spawn playmusic;}];

astral tendon
#

i dont think that will fix it

limpid pewter
#

if the EH is on the client not the server, then when the server (you) alt-tabs, the client's EH is still running as usual. All i am saying is that you want the EH on the client, but as Stickle said, idk too much about music EHs at all, but if it works similarly to other EHs, then this is what i would suggest

still forum
#

@little eagle Want the bricks to be open on the underside?

little eagle
#

Like real legos.

limpid pewter
#

don't tell me your actually modeling lego -_-

still forum
#

I already used the original measurements but it's not open on the bottom. I'll add the opening then

#

I am ๐Ÿ˜„

limpid pewter
#

Why not a lego gun, just to make it fit in arma better

#

or tank

warm gorge
#

Anyone have any idea what could be going wrong with this vehicle unflip script? Ever since the latest Arma update, if often causes the vehicle to dissapear according to player reports.

#
private _pos = ASLToATL (getPosASL _vehicle);
_pos set [2,(_pos select 2) + 0.5];

_vehicle setPosATL _pos;

if(local _vehicle)then {
    _vehicle setVectorUp [0,0,1];
} else {
    [_vehicle,[0,0,1]] remoteExecCall ["DS_fnc_setVectorUp",_vehicle];
};
little eagle
#

Error is probably somewhere else.

#

Dunno why it would disappear, but pretty sure this would make it catapult into the air when used on steep terrain. Half of it would be stuck in the ground.

little oxide
#

use surface normal instead ?

tough abyss
#

Prob best todo all the getpos / setpos / setvectorup commands were vehicle is local shrugs
Never encountered vehicle disappear, but i normally transfer ownership to server first & get server to setpos / setvectorup. Makes it easier to create some BE filters, if you don't allow client to setpos on vehicles

little eagle
#
[_vehicle, {
    _pos = getPosASL _this;
    _this setPosASL _pos;
    _this setVectorUp surfaceNormal _pos;
}] remoteExec ["call", _vehicle];
#

idk

limpid pewter
#

Question: Do i need the extra parenthese around (_aflag_distance - 400)^2 ? ```sqf
1.18343195266272*((_aFlag_distance - 400)^2) + 1.2;

little eagle
#

Unless you want 160000, you need the parenthesis in math, sqf, and any other sane language.

limpid pewter
#

i want 1512100

#

XD

#

i was meaning to multiply the expression (_aflag_distance - 400)^2, do i need to put brackets arou nd it like this : ((_aflag_distance - 400)^2)?

little eagle
#

No.

#

Jesus.

#

You can use the debug console, you know?

austere granite
#

#WATCHFIELDS

limpid pewter
#

actually yeh, oops

#

better

little eagle
#

Do you know what the debug console is?

limpid pewter
#

Yes.

little eagle
#

Why not ask the debug console then? It makes no mistakes unlike we humans.

limpid pewter
#

Just not thinking straigth, 3 in the morning, should be asleep. Thought it would be easier to ask on here. I apologise

cosmic kettle
#

@little eagle The script you privided earlier (3 lines version ^^),for some reason, doesn't return backpacks, rifles, glasses and magazines, even though they are listed on BIS_fnc_itemType wiki.

little eagle
#

It's supposed to report muzzle attachments?!

cosmic kettle
#

I know, but I modified it:

params [
  ["_type","",[""]]
];

private _allClasses = "getNumber (_x >> 'scope') > 0" configClasses (configFile >> "CfgWeapons") apply {
    configName _x
} select {
    _x call BIS_fnc_itemType select 1 == _type
};

_allClasses
little eagle
cosmic kettle
#

I can get that I might need to use CfgMagazines for mags, but Rifles should work?

#

I did, once you posted the link earlier. Rifle is listed.

little eagle
#

"AssaultRifle"

#

Not all weapons are addable to soldiers. E.g. tank gun weapons.

cosmic kettle
#
Weapon / VehicleWeapon
            AssaultRifle
            BombLauncher
            Cannon
            GrenadeLauncher
            Handgun
            Launcher
            MachineGun
            Magazine
            MissileLauncher
            Mortar
            RocketLauncher
            Shotgun
            Throw
            **Rifle** ?
            SubmachineGun
            SniperRifle
little eagle
#

Well, what does "Rifle" report?

cosmic kettle
#

[], is it that it's never used maybe?

little eagle
#

And why don't you use "AssaultRifle" if that works?

#

never used maybe?
Seems to be.

cosmic kettle
#

I just base this on the thought they might be different, which indeed they are it seems.

#

Just because there are so many mods on this one I assumed it was. my mistake.

little eagle
#

Who knows. Maybe a typo on the wiki.

cosmic kettle
#

It's why I'm pointing it out, in the hopes more experienced folks will maybe notice errors in my way or the wiki

little eagle
#

As for backpacks, you have to change CfgWeapons to CfgVehicles.
And for goggles, you have to change CfgWeapons to CfgGlasses.

cosmic kettle
#

That's what I mean, I assumed those changes were neccesary, but Rifle is really the odd one out. Guess no rifles here shrugs

little eagle
#

It's AssaultRifle, to differentiate it from SniperRifle and MachineGun.

#

And SubmachineGun.

#

Shotgun never ๐Ÿ˜ฆ

cosmic kettle
#

Oh by the way, is it wrong to only load them once, store them somewhere and pick from that pool afterwards?

#

As in, arrays can get big.

little eagle
#

Global variables.

cosmic kettle
#

Exactly, so that's what I'll do

little eagle
#

Good. That is why it doesn't matter that it uses a bis function. No one cares about a second more as mission load, and this is way less.

cosmic kettle
#

Oh btw; I was thinking of making a modification to it to check if a client has the appropriate DLC, is there a BIS function i don't know about that could help me?

#

I admit I lack the latest one, but I assume peeps might lack more.

little eagle
#
private _fnc_getDlc = {
    params ["_classname"];

    private _dlc = getText (configFile >> "CfgWeapons" >> _classname >> "dlc");

    if (_dlc isEqualTo "") exitWith {-1};
    getNumber (configFile >> "CfgMods" >> _dlc >> "appId") // return
};
cosmic kettle
#

yeah ^^ sorry

subtle ore
#

isnt that broken on dedi?

little eagle
#

getPersonUsedDLCs is

subtle ore
#

:/

candid jay
#

To be more specific, if I add a setWaypointStatements on the server side on a group, where will it run?

#

I'd imagine on every single machine (since waypoints are global) but I'd like to be sure

real tartan
#

I have list of classes ["I_soldier_F", "rhsgref_cdf_ngd_crew", "rhs_vdv_arifleman"] and I need to sort them by side. Any ideas ? For vanilla classes I can use prefix I_, B_, O_, but how to sort modded classes ?

blissful wind
#

yes it works @candid jay

candid jay
#

it works = runs on every machine?

blissful wind
#

yes

candid jay
#

ok thanks

blissful wind
#

when you create then it also creates them for every machine and everyone will see their actions

candid jay
#

ok great

cosmic kettle
#

@real tartan I would iterate through classes, get the class side, store in array that holds but that type and afterwards make an array and append each previous array in the order you want.

real tartan
#

@cosmic kettle how to get the class side ?

cosmic kettle
#
getNumber(configfile >> "CfgVehicles" >> _className >> "side")


private _return = getNumber(configfile >> "CfgVehicles" >> "I_soldier_F" >> "side");
hint str _return; //2
real tartan
#

nice, thx

pure bluff
#

@little eagle Hey I tried the commy_fnc_firemissile.sqf script, but I get an error when clicking OK after adding it to the init of the soldier

little eagle
#

What error.

pure bluff
#

I'm trying to recreate it

astral tendon
#
if (isNull delet_1) exitWith {
hint "1";
if (alive player) then{
sleep 3;
playSound ["CmdA423", true];
sleep 17;
playSound ["Play400", true];
sleep 3;
playSound ["CmdA424", true];
sleep 4;
playSound ["Play401", true];
};
waitUntil {
 if (!(player in heliDelet)) exitWith {
if (alive player) then{
hint "2";
playSound ["Play404", true];};
sleep 5;

if (count (((player nearEntities ["man", 20]) select {side group _x isEqualTo west}) - [team_1, team_3]) >= 2) then {
hint "3";
(((player nearEntities ["man", 20]) select {side group _x isEqualTo west}) -[team_1, team_3] select 1) say3D ["10MC536", 100];
} else {
hint "4";
Player say3D ["10MC536", 100]
};

 true};
 };
true};
}; ```
For some reason my script file is stoping here for JIPs, why he cant check the "(isNull delet_1)"?
subtle ore
#

Roque.

pure bluff
#

generic error in expression

little eagle
#

Line ?

pure bluff
#

I think

#

commy_fnc_fireMissile = {

subtle ore
#

Before you even start, why do you have the entire thing encapsulated in waitUntil? ExitWith? Sleep? Suspension in unscheduled? The hell?

pure bluff
#

but it just flashed and was gone, not getting it to display again

subtle ore
#

I get you have the true returns at the bottom, but what is all the rest here?

little eagle
pure bluff
#

Unguided

little eagle
#

So the one I linked.

astral tendon
#

to avoid play the sound if the player has now yet spawned or play some sounds out of context

little eagle
#

You put that into the init.sqf file.

#

There'll be no error.

subtle ore
#

@astral tendon Why not just add a condition? WaitUntil is a one shot event

pure bluff
#

I removed the first line, then I didn't get the error

astral tendon
#

is supouse to be one shot event

little eagle
#

Don't just remove random lines.

pure bluff
#

but it is // so it is only tekst for the user? (I'm very very noob)

subtle ore
#
0 spawn
{
   while{true} do
    {
        if(timeisright) exitWith
        {
        
        };
    };
};
little eagle
#

What did you do with the script?

#

The // is fine.

subtle ore
#

// is just a comment. Ignored by the compiler

little eagle
#

^

astral tendon
#

also, this is to avoid the sounds to play all at the same time when the JIP join in the server

pure bluff
#

I only removed the comment, just the "// init.sqf"

#

then it worked

little eagle
#

If it works that's good I guess.

subtle ore
#

@astral tendon Do you understand why this happens? Because the unit init is considered eevery time a player joins

astral tendon
#

exacly

little eagle
#

if (didJIP) exitWith {}

subtle ore
#

So don't execute in the unit init!

astral tendon
#

is not the unit ints

subtle ore
#

You wouldn't have jip problens in the first place

astral tendon
#

is in the initPlayerLocal.sqf

#

Dub = execVM "Dub.sqf";

subtle ore
#

playSound should have entirely local effects

pure bluff
#

I added the whole script again and got the following error:
'call{|#|// init.sqf
commy_fnc_fireMissile = {
...'
Error invalid number in expression

astral tendon
#

the problem is i dont see that hint i put to help me check it

subtle ore
#

Ah, it's playSound3d

#

Why is this playsound3d in the initPlayerLocal if you don't want others to hear it?

#

You need to spawn this to begin with

#

No reason not to

astral tendon
#
Sleep 2; //delay to avoid JIP isues
//Game started
hint "o aquivo carregou"; /// <<<< this one actually works
waitUntil {
if (isNull delet_1) exitWith {
hint "1"; /// <<<stops here
if (alive player) then{
sleep 3;
playSound ["CmdA423", true];```
#

this is the begining of my file

subtle ore
#

Spawn the wait until

astral tendon
#

do i have to do it with all the others waitUntil inside the file?

#

because, as i know if i put too much spawns its gonna cause perfomace isues

subtle ore
#

Yes, you never use suspension without spawning it

#

You have a clusterfuck here, way too many suspensions in script to be doing something simple

#

Suspension: sleep. waitUntil, etc

little eagle
#

Scheduled hell.

astral tendon
#

so, why that only happens to JIPs? since it works if the client joins the game with the host

subtle ore
#

initPlayerLocal runs local to the player that is joining.

lone glade
#

also, you should NEVER suspend init scripts

subtle ore
#

^

astral tendon
#

that is not inside the initPlayerLocal , is on a separated file

#

Dub = execVM "Dub.sqf";

#

this is in the initPlayerLocal

subtle ore
#

Why do you need to execVM this?

astral tendon
#

this is how i find around the internet how to do a script file

subtle ore
#

You can look a little harder and find something like:

call compile preProcessFile "script.sqf";
#

Or register it under cfgFunctions in your description.ext

inner swallow
#

why not execVM?

#

you can sleep in a script that's run with execVM

subtle ore
#
class CfgFunctions 
{
    class midnight
    {
        class cool_tag
        {
            class aFnc{};
        };
    };
};
#

@inner swallow In this case there is no need as far as i know: the script handler isn't being used

inner swallow
#

i mean you don't need to use it...

subtle ore
#

Yes, but what's the advantages? None, unless you use a script handler, but you could always just use spawn for that

inner swallow
#

well...advantage is that it's quick and simple

subtle ore
#

Quick and simple don't equate to effective

inner swallow
#

they do, depending on one's definition of "effective"

#

look at it this way, what are the disadvantages?

#

and then what are the disadvantages in this context?

subtle ore
#

Well, if you truly want to use execVM. Have at it

#

But i'd rather have control wether it's scheduled or unscheduled

lone glade
#

I wonder what is the intended use case for execVM

#

(now that we have sqf)

subtle ore
#

I've never seen any

#

I also don't like that i always returns a script handle

#

Unless there is some other syntax that returns last? I don't see any

inner swallow
#

execVM is scheduled

still forum
#

execVM is a SQF thing

#

execVM is just a shorthand for spawn compile preprocessfilelinenumbers

tough abyss
#

I think one advantage is if there is an error in file with execVM it doesn't prevent rest of your script from running. pretty sure anyways

subtle ore
#

@inner swallow Yes, but what if i don't want it to be scheduled is what i am saying

worldly locust
#

I'm having some trouble with the following code. ```_crew2 = creategroup WEST;
_airframe2 = [getMarkerPos "mkr_SpawnApache", 90, "UK3CB_BAF_APACHE_AH1_MTP", _crew2] call BIS_fnc_spawnVehicle;

_wp21 = _crew2 addWaypoint [(getpos heliApache), 0];
_wp21 setWaypointType "GETOUT";
_wp21 setWaypointSpeed "NORMAL";

_wp22 = _crew2 addWaypoint [(getmarkerpos "mkr_SpawnDespawn"), 0];
_wp22 setWaypointType "MOVE";
_wp22 setWaypointSpeed "NORMAL";
_wp22 setWaypointBehaviour "SAFE";
_wp22 setWaypointStatements ["true", "hint 'crew 2';{deleteVehicle _x;} forEach units _crew2; deletegroup _crew2;"];``` The hint shows, but the crew aren't removed. Any ideas why?

still forum
#

_crew2 variable is undefined.

inner swallow
#

then that's your specific use case midnight

worldly locust
#

_crew2 is defined otherwise the waypoints wouldn't work no?

subtle ore
#

A lot of people understand it to be the only method of exeuction: which becomes a problem sometimes

lone glade
#

where does the love from execVM and init fields come from?

#

or using spawn at every sauce

still forum
#

No. _crew2 is not defined in the script with the hint

#

"hint 'crew 2';{deleteVehicle _x;} forEach units _crew2; deletegroup _crew2;"
That is your script. You never define _crew2

subtle ore
#

@lone glade I honestly have no clue, maybe it's just easier for beginners?

astral tendon
#

I still did not got a straight anser to this, but how many spawns we can use before it became a problem?

worldly locust
#

OK. So it must be entirely blind luck that the units are created, the waypoints assigned and they actually follow it then.

still forum
#

No

#

In the waypoint script the variables are properly defined. That's a different script.

#

You have 3 scripts in there
First:

_crew2 = creategroup WEST;
_airframe2 = [getMarkerPos "mkr_SpawnApache", 90, "UK3CB_BAF_APACHE_AH1_MTP", _crew2] call BIS_fnc_spawnVehicle;
 
_wp21 = _crew2 addWaypoint [(getpos heliApache), 0];
_wp21 setWaypointType "GETOUT";
_wp21 setWaypointSpeed "NORMAL";
 
_wp22 = _crew2 addWaypoint [(getmarkerpos "mkr_SpawnDespawn"), 0];
_wp22 setWaypointType "MOVE";
_wp22 setWaypointSpeed "NORMAL";
_wp22 setWaypointBehaviour "SAFE";
_wp22 setWaypointStatements ["true", "hint 'crew 2';{deleteVehicle _x;} forEach units _crew2; deletegroup _crew2;"];

Second
true
Third
hint 'crew 2';{deleteVehicle _x;} forEach units _crew2; deletegroup _crew2;

#

Variables don't magically carry over to scripts that don't know anything about eachother

worldly locust
#

It's all in the same script?

still forum
#

no

#

That's what I'm trying to tell you

worldly locust
#

Clearly you know the answer so can you not just tell me so I actually learn something? I don't follow what your trying to say

subtle ore
#

He's not misleading you, the script variables do not carry over

worldly locust
#

I'm not suggesting he is.

subtle ore
#

Make the variable public if you want to use it across scripts, or pass the variable into the exeuction of another script

worldly locust
#

I just don't understand what he is trying to tell me

#

How is it "different scripts"? It's the same fecking file.

still forum
#

Variables only carry over to scripts that you call directly.
You are not calling these

#

Variables go out of scope when you script ends

#

Here you just add a eventhandler. Meaning you add the eventhandler (the script is not being executed) your script then ends and your variables go out of scope and get deleted.
And minutes/hours/days later the eventhandler string get's compiled and executed by the engine. It has no Idea where that script came from or what variables were there when it was added as a eventhandler

#

Variables only carry over when you call a script. Not when you create a new script instance. Spawn/ExecVM/Eventhandlers and other stuff create new script instances

dusk sage
#

But i'd rather have control wether it's scheduled or unscheduled

still forum
#

Considering the "same file" argument.

script1 = {<code>};
script2 = {<code>};
script3 = {<code>};

Do you also consider these 3 scripts to all be the same script? No. Ofcause not. Because they aren't.
Your eventhandler code is the same. You have multiple scripts inside one file. Doesn't mean they are all the same script

jade abyss
#

Variables go out of scope when you script ends <-- !! *local variables

dusk sage
#

And using either spawn or call from initplayerlocal would still give you a scheduled environment

#

So it really doesn't matter

subtle ore
#

@dusk sage execVM was the discussion point

#

execVM sends the code to the scheduler

worldly locust
#

@still forum ah. Right. The light bulb is on. Thanks. I get it now.

lone glade
#

not if you're smart and use cba_fnc_directCall after a canSuspend check taps forehead

dusk sage
#

The code is already scheduled, it's irrelevant, it's a battle of compiling vs not

subtle ore
#

@lone glade ๐Ÿ–•

#

@dusk sage What are you on about?

lone glade
#

drugs it seems

worldly locust
#

So my answer is to make crew2=_crew2 and change the waypoint statement to reflect that?

dusk sage
#

Using call from initPlayerLocal, or spawn for that matter, won't help you pick the context it runs it, it'll be scheduled regardless

#

Unless you use something such as isNil, yada

lone glade
#

canSuspend check + cba_fnc_directCall = unscheduled in all cases

dusk sage
#

We aren't discussing isNil

lone glade
#

๐Ÿคฆ

subtle ore
#

@dusk sage why the hell would you put code directly in initPlayerLocal?

dusk sage
#

I'm not, I'm merely reading the conversation above

#

Why would you put code there? Because you want to

#

A bizarre question

subtle ore
#

Ugh, "because you want to". Doesn't mean it's okay

#

It's unreadable

lone glade
#

this function is guaranteed to ran in unscheduled

dusk sage
#

My point was, the argument for execVM/spawn, and call, inside initPlayerLocal, is irrelevant for the scope of contexts

#

It's the same regardless

lone glade
#

wat

subtle ore
#

Err.

lone glade
#

are you trolling?

dusk sage
#

No

subtle ore
#

BoGuu, is there something i am missing here?

#

Suspension from a script executed via call in initPlayerLocal will not work

still forum
#

@sand axledog [3CB]#2890 Yes. But be careful if you run that script multiple times your global var will get overwritten

subtle ore
#

Damn discord ๐Ÿคฆ

still forum
#

And I can't even work around the Discord bug and mention correctly because he doesn't have a avatar

indigo snow
#

@worldly locust (read ^)

subtle ore
#

For as many bugs as they squash, that's one that has been around for a while

astral tendon
#

well, still nothing

#
///Play all in game dub here
Sleep 2; //delay to avoid JIP isues
//Game started
waitUntil {alive player};
hint "o aquivo carregou"; /// <<<< this one actually works
waitUntil {isNull delet_1};
hint "1"; /// <<< JIP still stops here
if (alive player) then{
sleep 3;
playSound ["CmdA423", true];
sleep 17;
playSound ["Play400", true];
sleep 3;
playSound ["CmdA424", true];
sleep 4;
playSound ["Play401", true];
};````
#

And i changed to ```[] spawn compile preprocessfilelinenumbers "Dub.sqf";

subtle ore
#

๐Ÿคฆ

astral tendon
#

the problem still for jips

subtle ore
#

Gah...

astral tendon
#

Well, back to triggers.

subtle ore
#

Yeah no

#

Giving up easily and falling back to what you know doesn't help you learn

#

Spawn any code that is suspended

worldly locust
#

Thanks. @still forum . I couldn't post for "10 mins.." ๐Ÿคฆ

#

The script is only going to run once on the server so no worries about over writing the values. I will make the local variables public.

#

Unless there is a way of accessing a group from a waypoint it belongs to.

jovial ivy
#

Wait whats the issue? @astral tendon

astral tendon
#

@jovial ivy JIP players stop the script at waitUntil {isNull delet_1};

subtle ore
#

I wonder why

astral tendon
#

even tough that is already true

dusk sage
#

BoGuu, is there something i am missing here?
Yes, you are, the fact this
Suspension from a script executed via call in initPlayerLocal will not work
Is false

#

You're going from a scheduled environment (where canSuspend is true), to another scheduled environment, where canSuspend is ditto

#

And that statements like this:

Spawn any code that is suspended

Are bad advice

jovial ivy
#

@astral tendon Is something resetting that by chance? Maybe when the player joins it is setting it as null or something.

little eagle
#

And that statements like this:

Spawn any code

Are bad advice tbqh

dusk sage
#

Winter scheduler war is coming

queen cargo
#

Depends tbh

#

Spawn any code could be too much

#

However, could be exactly what is needed

astral tendon
#

@jovial ivy i dont think so, that unit was deleted once the players get on the helicopter

#

alive and triggeractivated also did not worked

dusk sage
#

@subtle ore Read up ^, incase you miss it

astral tendon
#

before i was using triggers in my last mission to spawn the voice acting, but people keep saying thats wrong so i decided to do the "right" way

modern sorrel
#

ohyh

rotund cypress
#

Hey guys, is there anything that should be known of animations syncing across network? I have experienced some animations sync fine over network, i.e. show for all in MP, and some does not which requires it to be remotely executed.

subtle ore
#

@dusk sage
A) I never said to spawn each code.
B) Suspensions like that should be scheduled.

#

@rotund cypress any anim players like switchMove and playMovd have local effects. So as far as i know you're going to want to remoteExec that

rotund cypress
#

Turns out playmove is actually global

#

Am already remote execing switchmove stuff though

subtle ore
#

Hm, well there you go.

#

@dusk sage Especially since it doesn't require time accuracy

dusk sage
#
A) I never said to spawn each code.

I just quoted what you wrote.

B) Suspensions like that should be scheduled.

Which it is (initPlayerLocal)

#

But ultimately, the thing I was attempting to get across, was that Suspension from a script executed via call in initPlayerLocal will not work, is wrong, and not how things work at all

subtle ore
#

@dusk sage We're saying the same thing ffs

dusk sage
#

No, we're not

#

Because I wouldn't write

Suspension from a script executed via call in initPlayerLocal will not work

Because it's wrong

modern sorrel
#
A called function may only use suspension (sleep, uiSleep, waitUntil) if it originates in a scheduled environment. If the called function originates in a non-scheduled environment it will return a generic error. 
little eagle
#

Getting 2015 vibes here. I thought everyone figured this out by now.

subtle ore
#

Whatever works.
Note that while the environment isย Scheduledย (canSuspendย returns true), the engine seems to wait until the script is done executing, essentially behaving similarly to anย Unscheduled environmentย - infinite loops will freeze the game, uiSleep may pause the game for up to ~20secs (postInit), et does this still apply?

#

Event scripts

still forum
#

That applies to atleast postInit

#

It doesn't freeze the game. But it has loading screen till the last script is done

shut flower
#

is this the weekly spawn discussion again?

tough abyss
#

I suppose.

#

And letโ€™s start the daily intercept discussion

#

๐Ÿคฃ

shut flower
#

please no

still forum
#

Intercept cool. Done.

#

Which helped me make ACE tripod better :3

shut flower
#

best place for intercept discussions is probably intercept slack

tough abyss
#

Thereโ€™s a slack for it?

shut flower
#

yip

tough abyss
#

Where does one find this

shut flower
#

there is a slack badge right at the top

south rivet
robust hollow
#

is the script in the root of ur mission or is it in a folder somewhere?

#

#include "..\scripts\moderation\UID.sqf" suggests its ina folder so put the full filepath to the script in ur execVM

south rivet
#

They are in the same folder, so it should work. But i'll try

robust hollow
#

no it shouldnt work, the UI is included into the description.ext before loading as the missionConfigFile

south rivet
#

I think that is actually the problem yea

#

Yup

#

I don't know how I didn't think of that. I had the same issue with cfgfunctions

limpid pewter
#

Can anyone tell me why this: ```sqf
drawIcon3D [(MISSION_ROOT + "resources\pictures\AFlag.paa"),icon_aflag_color,[14216,18291.8,15.064],icon_aflag_width,icon_aflag_height,0,"A Flag",0,1.2,"PuristaMedium","center",true];

#

Screenshot of this

robust hollow
#

1.2 is massive

#

try 0.04 (the value before the font)

limpid pewter
#

ok.Didn't realise the scale was different to say.. structured text sizes

#

Thanks, will try

daring pawn
#
switch (_houses) do {
    case ((_houses > 0) && (_houses < 5)): {
        for "_count" from 1 to 2 do {
            [getMarkerPos _mkr,"Infantry"] call EO_CreateGroup;
            systemChat format ["%1 is spawning %2",_mkr,_count];
        };
    };
    case ((_houses > 5) && (_houses < 10)): {};
    default {systemChat "Default"};
};

This is always returning default even if _houses is equal to 3 for example

limpid pewter
#

That worked Conner, thanks again

robust hollow
#

@daring pawn switch true do

daring pawn
#

Not sure I follow fully, I think I know what I fucked

limpid pewter
#
switch (true) do {
    case ((_houses > 0) && (_houses < 5)): {
        for "_count" from 1 to 2 do {
            [getMarkerPos _mkr,"Infantry"] call EO_CreateGroup;
            systemChat format ["%1 is spawning %2",_mkr,_count];
        };
    };
    case ((_houses > 5) && (_houses < 10)): {};
    default {systemChat "Default"};
};
``` ?
robust hollow
#

yea

#

what u had was basically saying if (_houses isEqualTo ((_houses > 0) && (_houses < 5)) which it never would be cause _houses is a number and the second part is a bool

daring pawn
#

Hmmm right. Well it is indeed working now. It appears I had a misunderstanding of the operation of switch

#

cheers

cosmic kettle
#

sorry, saw i included switch

limpid pewter
#

oh snap...

#

So is it working now?

daring pawn
#

Yea changed _houses to true in the switch

limpid pewter
#

Cool

cosmic kettle
#

lol

limpid pewter
#

Who here knows a fair bit about drawIcon3D? I would like to pick your brain for a bit

#

I have issues with scaling the 3D icon with regards to the distance the player is from the icon

cosmic kettle
#

@limpid pewter No experience, but what do you mean by this? I'd say vary the width & height params based on player distance.

limpid pewter
#

Yeah, i am doing taht already with a while lopp atm, just using a linear expression to work out size between 1.2 and 3 (maybe these sizes are wrong scale) : ```sqf
while {updateIconSize} do {
//A flag

_aFlag_distance = player distance [14216,18291.8,10.064];
if ((icon_aflag_height > 1.2) && (icon_aflag_width > 1.2) && (_aFlag_distance < 1000)) then {

    icon_aflag_width = -0.0018181818181818*_aFlag_distance + 3.004615384615385;
    icon_aflag_height = -0.0018181818181818*_aFlag_distance + 3.004615384615385;
};

};

cosmic kettle
#

You read the note right?

Use onEachFrame or addMissionEventHandler "Draw3D"
#

I mean, it works with normal values?

limpid pewter
#

Yeah, to i have this sqf addMissionEventHandler ["Draw3D", { drawIcon3D [(MISSION_ROOT + "resources\pictures\AFlag.paa"),icon_aflag_color,[14216,18291.8,15.064],icon_aflag_width,icon_aflag_height,0,"A Flag",0,0.04,"PuristaMedium","center",true]; }; To initialise the drawIcon3D stuff

#

Yeah everythin is fine, just needs polishing. When im say 400 m away from icon, the size is fairly large relative to screen, but at 10 meters it gets smaller

cosmic kettle
#

Well, for the distances 2 - 100 the number it returns varies between 2.8 and 3.1, is this the behaviour you want?

limpid pewter
#

Somewhat, i want the returned var to be closer to 3 as you get close to the marker, and as you get away, get closer to 1.2

#

So essentially, i need the marker to be big when i'm close, and small when far

cosmic kettle
#

I'd say you need to define yourself what those measures of close and far are and scale accordingly. The difference between 2 and 100m. is but .3, I doubt that is enough.

limpid pewter
#

Dw if too hard, i shall figure something out

#

yeah so close = 10m, far equals 1000m (as per the linear expression)

#

And the returned value should be close = 3 and far = 1.2

cosmic kettle
#

What you have now does exactly the opposite.

limpid pewter
#

Really?

cosmic kettle
#

No, sorry my bad, it does exaclty that.

limpid pewter
#

yee idk. The game seems to already do a simialr thing when the scale is left at 1. But it does it backwards (big far away and small up close), i need to counteract this is what i'm thinking. But anyway, thanks for help. I will just need to fiddle around with it

real tartan
#

If anyone wondering how to get SIDE from CLASS, here it is: _side = [east, west, independent, civilian] select ( getNumber ( configfile >> "CfgVehicles" >> _class >> "side" ) );

limpid pewter
#

ok cool, good to know

meager heart
cosmic kettle
#

Also @real tartan the provided code will only work for CfgVehicles, so no weapons/backpacks/goggles

spice crypt
#

can anyone clarify when using attachTo, attach objectA to objectB whether objectA should still have collision enabled?

i am attaching a 'praetorian 1c' to a 'brick' (to keep it secured in the one place), but in doing so objectA seems to lose it's collision aspect with vehicles. a player on foot walking towards objectA the collision is present, but driving a vehicle in to it, i go straight through objectA.

limpid pewter
#

Sorry, not too familar with attachTo command.

spice crypt
#

@limpid pewter i just did a quick test and...

getNumber (configfile >> "CfgMagazines" >> "NLAW_F" >> "type")

returns 768, therefore your conditional check of...

if (_type isEqualTo 768) then { <something here> };

will work. and use 'isEqualTo' instead of '=='

#

oh you deleted the question. 0.o

limpid pewter
#

Yeah, just did same. Mainly just trying to get my head around how to go about determining the type of a magazine, or that is: what weapon the magazine goes in.

#

Thanks btw soulkobk

spice crypt
#

np.

#

you could to a config search for weapons with specific scope that contain that magazine? cfgWeapons and getNumber 'scope' with getArray 'magazines'.

limpid pewter
#

yeah i guess, but was hopeing for a more elegant solution. But nvm ,i shall work something out. Thanks again

spice crypt
#

gl with it.

cosmic kettle
lone glade
#

^ just be aware that the capitalization of the returned strings is seemingly random

#

so tolower the array and tolower what you wanna compare it to

limpid pewter
#

Ok thanks for the warning

little eagle
#

Nothing apply {toLower _x}; can't fix.

limpid pewter
#

๐Ÿ˜ƒ

rotund cypress
#

Has anyone here experienced target computer freezing and Arma having to be restarted after you have remotely executed a script directly on that player object?

limpid pewter
#

Not really, but with that script you're executing on the player's machine, does it have any loops, waitUntils, etc..?

#

If short, just post the script up here, it would be useful

rotund cypress
#

@limpid pewter unfortunately I can not post the script, its also way to long. It is unscheduled, so no waituntils, and no loops; however it creates a new thread with loops in it.

#

remoteexecution -> unscheduled -> makes new thread

limpid pewter
#

by make new thread you mean you spawned a new function, rather than calling one yus? (just trying to ruleout the basic stuff)

cedar kindle
#

sounds like an issue in the script.

#

you can use pastebin for long scripts

limpid pewter
#

^

rotund cypress
#

@limpid pewter Yes spawning a function. It goes from remoteExecCall to then create a suspendable thread in that script.

#

Problem is, when I use diag_log it doesnt even reach the first one - only code being before the first diag_log is scriptName and scopeName

barren magnet
#

Uuurg diag log the source of all evil

#

points on A3Log

rotund cypress
#

Ehm, what?

barren magnet
#

Arma rpt log is spammed since update 1.78

rotund cypress
#

Yes

barren magnet
#

You can't read shit

rotund cypress
#

Now that you are here Arkensor, I might ask you; have you ever had this problem?

barren magnet
#

I would say yes even before you ask

#

But go ahead

rotund cypress
#

I'm lost ๐Ÿ˜‚

#

Did you read above? @barren magnet

barren magnet
#

Oh

#

No I did not but it does not sound correct for me

#

No matter what happens or what you execute the main thread will kill the script execution after the 0.3 time window

rotund cypress
#

I also must add: remoteExec does nothing, but does not freeze target, only remoteExecCall freezes target.

#

0.3 ms you mean?

barren magnet
#

I do not see how the execution could lock itself and block the UI thread

#

Yes

rotund cypress
#

Well it's Arma

#

ยฏ_(ใƒ„)_/ยฏ

barren magnet
#

As I said I would doubt it's normal ๐ŸŒˆ

#

Go ahead and remove the payload you execute

#

Put in something non fishy

rotund cypress
#

I also must add - when I host the mission locally - i.e. through host server it works.

barren magnet
#

Even a single diag log might be ok

rotund cypress
#

Even when its remoteExecCall

barren magnet
#

Rip arma then

rotund cypress
#

Fucking arma.....

barren magnet
#

I would post a meme in public but I would be banned for it most likely

#

So Look into your pm

rotund cypress
#

Will do - please send.

cedar kindle
#

unless you post the script sending the code and the code running no one can help sorry

rotund cypress
#

I've sent it to 4 respected SQF developers already, no one seems to know what the problem is so I doubt anyone here will be able too.

little eagle
#

T-thanks.

astral tendon
#

`does the JIP do not get the variable names?

peak plover
#

Sqf developers < sqf hobbyist

cedar kindle
#

lol

ivory nova
#

i have a brown belt in sqf

peak plover
#

I only just got my first sqf, he is nasty

tender root
#

Anyone got an idea how to get the current zeroing of a player, which is in a FFV turret of a vehicle ?

#

currentZeroing player just returns 0

#

Thanks in advance ๐Ÿ˜ƒ

little eagle
#

Tried
currentZeroing cameraOn
?

tender root
#

Good idea

#

but no D:

#

doesn't work

little eagle
#

Are you remote controlling a unit or is that your avatar?

tender root
#

my avatar

little eagle
#

Then it's probably broken and there is nothing you can do.

tender root
#

๐Ÿ˜ง

#

๐Ÿ˜ญ anyways thanks for the help

little eagle
#

If you're by chance running ACE, you might be able to parse the controls text. The display is (uiNamespace getVariable ["ACE_dlgSoldier", displayNull]).

tender root
#

yeah thought about that as well... but not a perfect solution

still forum
#

@rotund cypress remoteexecution -> unscheduled -> makes new thread wat? That's just execNextFrame. There are no Threads in unscheduled at all. And only fake threads in scheduled.

tough abyss
#

I assume his unscheduled code also spawns some code aswell. But if he is not willing to pastebin it, not much people can do

rotund cypress
#

^^

#

Its remoteExecCall:ed, then a new thread is spawned inside.

#

@still forum have you ever experienced something like this?

still forum
#

The freeze you mean?

little eagle
#

Have you already tried commenting half of it out?

jade abyss
#

Write a macro for it

still forum
#

#define COMMENT_THIS_LINE_OUT //

jade abyss
#

๐Ÿ‘ Good macro

still forum
#

#define END_OF_SCRIPT_STATEMENT ;

subtle ore
#

HAH

jade abyss
#

๐Ÿ‘ even better macro!

subtle ore
#

#define ADD_THIS +

jade abyss
#

#define IF_SCRIPT_STATEMENT(A) if(A)then ;

river meteor
#

Can someone help me understand what an extdb3 protocol is?

subtle ore
#

If you're rp then look at the docs

still forum
#

@river meteor @tough abyss Is the best guy to help you with that

subtle ore
#

Google is cool too

still forum
#

#define THE_BEST_SEARCH_ENGINE google

subtle ore
#

#define BEST_BROWSER_TO_USE firefox

river meteor
#

not according to Richard Stallman

tough abyss
#

@river meteor its basically picking which method you want to use, i.e SQL = SQL querys , SQL_CUSTOM = Prepared statements via ini file. You could use multiple methods with multiple databases if you want aswell

Example of sqf using extdb3
https://bitbucket.org/torndeco/extdb3/issues/69/set-of-functions-used-to-handle-extdb3-api

Or Addon
https://forums.bistudio.com/forums/topic/211872-oo_extdb3-a-driver-for-extdb3-addon-mysql/

river meteor
#

Thanks. I'm actually using that first link API and trying to call his db_AddDatabaseProtocol, passing it "SQL" as the protocol, however the 4th parameter is for protocol options. What is protocol options?

tough abyss
river meteor
#

Ah I see now. Thanks

subtle ore
#

#define INVASION_OF_SCRIPTING maybe

jade abyss
#

โ˜ Would cause an error. Noob

subtle ore
#

๐Ÿ–•

#

#define maybe (random 1)

little eagle
#

You forgot something.

subtle ore
#

What would that be commy?

little eagle
#

0.5

subtle ore
#

๐Ÿคฆ

still forum
#

because you can't if numbers ....

subtle ore
#

#define maybe (random 1 > 0.5)
:/

#

Well yeah

edgy dune
#

I remeber making a script for this but i forogt where I saved it,but how can you change a AI's faction with scripts?

#

is it this?

#

so say I wanted to make a AI independt would it be

#
_this setSide east;
meager heart
#

@edgy dune [_unit] joinSilent createGroup EAST;

edgy dune
#

aye thx

#

opss wrong chat

ivory nova
#

Sorry outside so canโ€™t confirm for myself: is it possible to nest for do loops? If so, will the child for dos complete before returning to the parent?

cosmic kettle
#

@ivory nova yes.

ivory nova
#

@cosmic kettle awesome, thank you

jovial ivy
#

With attachTo, is there any way to just change its offsets. Or do I have to detach then run attachTo again?

little eagle
#

Just another attachTo. detach is not needed in that case.

jovial ivy
#

Ohh gotcha. I didnโ€™t know if that would cause any issues.

edgy dune
#

so I have this weird thing. My friend tried to copy a script of mine form my google drive right. if he copies it form google drive directly the script doesnt work,but if he pastes the script first on say discord or word and then copies it,the script works. any ideas why?

little eagle
#

Maybe it replaces the ascii quote marks with the cursive ones.

#

โ€œ โ€ instead of ""

edgy dune
#

u think? cuase other scripts he gets from my drive works and they have quotes too

#

lemme see about that

#

the only diffrence between the two codes is that,one is in a for loop,the othe isnt

tough abyss
#

get your friend to use a program like meldmerge to compare differences between file & copy/pasted text

little eagle
#

Probably user error.

edgy dune
#

aye ill try the compare thing,maybe user error

limpid pewter
#

Hey can someone please check over this https://hastebin.com/coligibipe.php . The function is supposed to act like an out of bounds script, basically it will give the player 10 seconds when they leave the AO area to reenter the AO, and if they don't, then the script kills them.

It works well when the player goes from within the AO to outside the AO, but if the person goes out and then tries to come back in, it just keeps on counting down to killing loop and kills them (it should cancel the loop with the if () exitWith {}:).

The main issue is that the checkstate variable is not getting updated when the player re-enters to AO area, it should asign a 'false' value, but instead it stays 'true'. I have been trying to work it out for about an hour, and i just need a par of fresh eyes to work it out.

little eagle
#

This looks extremely convoluted.

cosmic kettle
#

@limpid pewter is checkState variable even needed? probably for debug purpose I assume?

#

and as Commy said, it took a while to take in, not usually a good sign.

tough abyss
#

It kinda looks like you been chopping & changing the code at random to make it work.
Recommend you add some systemchat lines to help whats happening in the editor or on a testserver.

little eagle
#

It needs a concept.

limpid pewter
#

haha yeah ik, but to be able to bring up a display when they leave the AO, you need both a onActivate and onDeactivate part of the script so you can show the display when they're outside of AO and remove dispay once there are back inside.

Yes checkstate is needed@cosmic kettle because it ensures that the code within the if then statement doesn't continually run while the loop is running. If checkState wasn't there it would just constantly keep creating the display when inside the AO (meaning tha there could be many differnet displays open at once.

little eagle
#
while {true} do {
    waitUntil {
        sleep 1;
        player-not-in-zone
    };

    private _startTimeOutside = time;

    waitUntil {
        if (time - _startTimeOutside > threshhold) then {kill};
        sleep 1;
        player-in-zone
    };
};

You think this would be a good idea to structure it?

limpid pewter
#

wow, nice an elegant. It may work, i will try this out and get back to you. thanks

#

didn't think of using waitUntil

subtle ore
#

you're making my head hurt

#

wtf is this

little eagle
#

Me?

subtle ore
#

Yeah, what the hell. why not just switch this? Or hell a if statement

#

obviously not the latter

#

But, why the two waitUntil s?

little eagle
#

Because it's essentially a two state fsm.

limpid pewter
#

That's what i did. But it is 'extremely convaluted' and wasn't working correctly, i think commy's willwork

little eagle
#

That's what a two state machine is. Two waitUntils. ยฏ_(ใƒ„)_/ยฏ

subtle ore
#

Yeah. but why.

little eagle
#

You have a better idea?

subtle ore
#

Well something more cleaner would be nice

little eagle
#

Always.

subtle ore
#

I don't necessarily think I have a better idea per say

#

but this is just ugly

cosmic kettle
#
fnc_inzone = {
 // checks
};
if (fnc_inzone) exitWith {sleep 1;//recheck};
//penalise

?

subtle ore
#

yeah you should be able to achieve something cleaner with that solution

little eagle
#

It doesn't do all the things mine does though.

#

Where is the out of area countdown?

cosmic kettle
#

true, it's not what he asked for.

#

//penalize does all that handling in my approach

subtle ore
#

Well we're really arguing method

little eagle
#

I only see one idea that works.

#

The other needs work.

subtle ore
#

Uh, what?

little eagle
#

My suggestion "works" if you implement the pseudo code.

#

The other one is a if with //penalize
that apparently handles the tricky part somehow.

limpid pewter
#

Probably a bit big, i shall post to hastebin

cosmic kettle
#

Lol hold your horses, I just posted a couple of lines, no need for the tantrum.

little eagle
#

I'm just saying.

limpid pewter
subtle ore
#

throws cookie at commy

little eagle
#

Moldi, that doesn't work that way. The 3rd waitUntil you added breaks it.

limpid pewter
#

kk

little eagle
#

This script is based on state 2 changing back to state 1 immediately via while true.

#

So reaching the end of one while iteration is "renetering" the zone.

subtle ore
#

Are you excellent at dodging cookies or something?

little eagle
#

I have no idea what your problem is.

limpid pewter
#

that's ok, thanks for the ideas tho, i learned what a fsm is now ๐Ÿ˜ƒ Very useful

cosmic kettle
#

๐Ÿค”

limpid pewter
#

And i understand what you mean about the thrid waitUntil

little eagle
#

Don't get too crazy with those waitUntil and at all costs avoid putting them inside each other. They're worse than goto's.

limpid pewter
#

yeah ok. i will try not to ๐Ÿ˜›

little eagle
#

Never thought that I'd defend a while-true-waitUntil-loop against this channel of all places, nor that such a simple concept would be so contentious. ยฏ_(ใƒ„)_/ยฏ

limpid pewter
#

idk what all the arguing was about really, but ithanks everyone for the help

little eagle
#

I don't know either. Still waiting for a different idea that is cleaner and actually does the same.

limpid pewter
#

In about 15 mins, i shall test, i have a feeling it will work welll

limpid pewter
#

Yeah it works sorta, just need to polish the timings of it all. thanks

little eagle
#

yw

#

"Template" of the concept:

// initial code (once)
while {true} do {
    waitUntil {
        // state 1 code (continuous)
        sleep 1;
        // state 1 -> state 2 CONDITION
    };
    // transition 1->2 code (once per transition)

    waitUntil {
        // state 2 code (continuous)
        sleep 1;
        // state 2 -> state 1 CONDITION
    };
    // transition 2->1 code (once per transition)
};

For the critics here.

subtle ore
#

Quit poking me and stab me already Commy ๐Ÿ‘€

#

Ouch

meager granite
#

Does deleting projectile entity right in the "Fired" event handler deletes it only on next frame? ๐Ÿค”

peak plover
#

Event handlers should rununschedyled and suspend everything until the code there is complete

meager granite
#

Its not about script, actual deletion doesn't happen until next frame

peak plover
#

๐Ÿค”

meager granite
#

player addEventHandler ["Fired", {_p = _this select 6; systemChat str _p; deleteVehicle _p; systemChat str _p}];

peak plover
#

Yeah, think you are correct

meager granite
#

Hm, its not just Fired

peak plover
#

Maybe you can do sh else other than delete?

#

Move it to 000 or sth, see if that works

meager granite
#

Checked OA, its 1:1 there

#

How come I never noticed this before

peak plover
#

๐Ÿค”odd

meager granite
#

I feel like total noob now for never noticing this before.

peak plover
#

Makes you feel like you missed sth, like you should check some code

meager granite
#

Hm, is it possible to force player to place explosive charge through script?

#

unit fire ["DemoChargeMuzzle", "DemoChargeMuzzle", "DemoCharge_Remote_Mag"] works for AI, but not player

#

Tried UseWeapon with correct muzzle index and forceWeaponFire, neither work ๐Ÿค”

#

Found a way

player action ["SwitchWeapon", player, player, 24];
player fire ["DemoChargeMuzzle", "DemoChargeMuzzle", "DemoCharge_Remote_Mag"];

24 is DemoChargeMuzzle index in my test

limpid pewter
#

_mine setDamage 1;? nvm

little eagle
#

Those muzzle indexes change all the time if you drop and pickup weapons. Not sure that is very reliable.

lone glade
#

you could use the action command, dunno what action is used for placing explosives tho

meager granite
#

Yeah I have a way to find needed index

rotund cypress
#

Event handlers should rununschedyled and suspend everything until the code there is complete

#

Of course it doesnt suspend if ran unscheduled ๐Ÿคฆ

#

It doesnt work like that

#

@peak plover

peak plover
#

It suspend engine ?

rotund cypress
#

Doesnt work like that, engine and the scripting itself is completely two different things.

#

Suspension in the engine does not work like suspension in SQF

#

I would think that the engine just doesnt fire the bullet before the eventhandler is ran.

tame portal
#

@rotund cypress when the game goes to execute sqf code it can't do other work

rotund cypress
#

Yeah exactly, which means it doesnt suspend at all

#

And obviously if it has multiple threads it can do other work at the same time

tame portal
#

I think was he meant is that when unscheduled code comes up the engine runs the code as soon as possible and thus "suspends" other work

still forum
#

which is trueish