#arma3_scripting

1 messages · Page 614 of 1

quaint oyster
#

yea I don't think I can figure it out, tried quite a few things with BIS_fnc_countdown and some other stuff, I just don't know what I'm doing :p

tough abyss
#

you could just store a timestamp in global variable and compare it with current time to see how much time has passed since you last update the timestamp

quaint oyster
#

What would be the best way to do that from a script which is constantly called from a kill event handler? I tried one with a while loop and it started consuming resources due to it firing off the while loop repeatedly.

tough abyss
#

what do you mean constantly called from a handler? if you update the timestamp in the kill handler you can find out when's the last time a kill event happened

quaint oyster
#

So I got the kill handler in another file, it executes this script when the player gets a kill: https://discordapp.com/channels/105462288051380224/105462984087728128/748429884677685300
Which has multiple things that it does, it stacks a variable and what I'm trying to do is make it so that somehow a timer is started which executes code when a timer of some sort is expired, currently demonstrated by the sleep 15; in my script above, but I'd like to add time to it, I think I could probably use BIS_fnc_countdown in some way, but I'm not sure how to do so without making a while loop check if the BIS_fnc_countdown is finished. I'm very very tired rn so I'm trying hard to explain it clearly

winter rose
#

do -not- code while tired. rest on it, then come back

tough abyss
#

using sleep is unnecessary. my idea
pseudo code:

if isNil "expire" then { expire = time + 15 };
if (time > expire) then {
  // do timer expired stuff
};
if <want to add 15 seconds> then {
  expire = time + 15; // or expire = expire + 15 depending on your requirements
};
#

that way your script can decide if it's time to expire or it should extend the expiration date

quaint oyster
#

The sleep timer needs replaced with something better, I'm trying to find a method I can interrupt and add to it to extend. I have the sleep in currently for demo purpose but it does work, but it stacks that entire if statement then eventually you have it setting your killstreak count to 0 multiple times overwriting kills, everytime you get a kill. I'll see if I can't use that tomorrow after some rest. :p

frigid oracle
#

I was doing some more research. Is holdActionAdd more MP friendly than addAction?

winter rose
#

no

frigid oracle
#

Aight.

#

I tried following Hypoxic's advice and use remoteExec on say3d inside an addaction and have been bashing my head trying to figure it why it wouldn't work. I also can seem to find much on making addaction MP friendly.

#

Also should I avoid putting stuff inside an obj init and use execVM to preload stuff from an sqf or is that bad practice/may have issues.

winter rose
#

avoid init fields like the pest yeah

#

they get executed for server + every client, and connecting ones

#

if you only use one script once, execVM is fine
otherwise, make a function - it gets loaded in RAM once

frigid oracle
#

So for one time addactions n such execvm is fine got it.

winter rose
#

execVM reads from HDD/SSD, preprocesses, compiles, then run every time
CfgFunctions does reads from HDD/SSD, preprocesses, compiles and keep in RAM -once-, then you can call the code anytime

brittle dock
#

I have put up 4 markers on Stratis, do anyone know how I can make players spawn randomly in the area inbetween the 4 markers? I know I got to use setPos, but not how to designate the area between the markers or how to make the setPos randomly apply to that area.

#

unfortunately I can't post pictures here but I have an example picture.

winter rose
#

you can post a link to the picture (with a description), but I think we figure your situation well with this description 😉

brittle dock
#

There we go 🙂 (Trying to make players randomly spawn anywhere within the blue lines)

winter rose
#

oh, that's not the same as what I had in mind indeed - that's spawning in-between the markers yes, as you stated

brittle dock
#

Hell yeah, thank you!

#

Do I understand it correctly that you can have more or less "infinite" number of positions in the polygon?

#

at least thats how I understand this array of Position3D positions in format: [position1, position2...., positionN]

winter rose
#

yep

#

1toN

brittle dock
#

nice, now I can get back to work

#

Yeah ^^

#

Thanks 🙂

winter rose
#

=) my pleasure

brittle dock
#

Do you know what the first parameter is for? The Position3D format that is before "inPolygon"?

winter rose
#

the position to check?

brittle dock
#

Yeah

winter rose
#
private _markerNames = ["marker_1", "marker_2", "marker_3"];
private _markerPositions = _markerNames apply { getMarkerPos _x };
private _pos = [0,0,0];
while { !(_pos inPolygon _markerPositions) } do
{
  _pos = [random worldSize, random worldSize, 0];
};
#

a *bit* raw, but it works

brittle dock
#

Ah nice, I see what it does, pretty much exactly what I'm looking for!

winter rose
#

free of charge

brittle dock
#

Thanks, I'll use it then! 😄

rustic plover
#

what the hell with setDir command? :D It works from time to time correctly, but sometimes it doesn't work. Object returns to default direction... sometimes :D

winter rose
#

setDir then setPos?

rustic plover
#

Without setPos

winter rose
#

add a setPos to force synchronisation

#
_obj setPosATL getPosATL _obj
rustic plover
#

after setDir, yeah?

#

i'll try

winter rose
#

@rustic plover result?

rustic plover
#

i'm eating now :D in 5 min

#

hm, works

winter rose
#

HURRY è_é 😄

#

Bon appétit!

rustic plover
#

thank you, Lou <3 yeah, setPos does correct synchronization!

vague geode
#

Is is possible to play a sound (like with playSound3D) but make it possible to stop it mid way though?

What I am basically going for is to enable players to emmit a sound (like music for example) from there vehicle via an action in the "mouse wheel menu" but I also want them to have the ability to stop the sound even midway through the sound file.

Is that doable in any way?

winter rose
#

kind of, yes
next patch will bring us reference to the soundsource, but before that you can grab it with a nearestObject command "#soundsource" - then delete it when you want

vague geode
#

I found the createSoundSource-command in the community wiki but it appears that it can only play certain predefined sounds...

open star
#

I don't want patches, I want my completely revamped Engine, Arma 4 >:(

#

Wait were they revamping it or were they making/using a new engine, I already forgot.

winter rose
#

new one - Enfusion

open star
#

Enfusion, huh..

#

What's the language do we know?

winter rose
#

yep - called EnScript, similar to C++

open star
#

This says it's similiar to C# being an Object-Oriented Scripting Language.

#

If it's closer to C# I will have a much better time writing and making scripts.

#

Ahh, it is similiar to C# purrrfect.

vague geode
#

Me too, used to code plugins for another game in C#...

open star
#

I straight up made games in C#, making Command Line Games and UI Games.

#

Though my Command line games were more fun and better made, I suck at UI :D

fair drum
#

I'm not a programmer so I have to start from the beginning.

#

well... this looks complicated

open star
#

C#?

#

It is immensely easier to understand and learn compared to ASL.

vague geode
#

@fair drum 90% is trial and error... 😉

open star
#

Python and C# are languages I would recommend to new programmers or beginning programmers.

#

Python to learn Syntax, because it's a very nice language and really easy, first language I learned.

fair drum
#

ive started hyperskill on jetbrains for python

vague geode
#

Python, a nice language... 🤣

C# on the other hand... 😌

#

@fair drum I would advise you to start with higher, Object-Oriented languages because in my opinion it is easier to understand in and of themselves but also because they are a bit closer to the real world.
They also alot more readable than C, Python etc.

fair drum
#

there a good learning platform like how python has jetbrains/hyperskill?

crisp cairn
#

Hey all, I was hoping someone could help with this confusing issue I am having. I am working with ACE interaction framework and scripting in the actions to work with Booleans so far it works fine. But when I get the object to attach to another using attach the object for some reason resets and then shows all the actions again and if I activate the same action to attach the object it then has all the other actions disappear. I've been trying to think why this is happening, does anyone have an idea?

exotic flax
#

Can you give an example of what/how you're doing it? Because that one sentence explanation is also confusing

crisp cairn
#
_iedHide= ["EODS_Hide_IED","Hide IED in Object","Icon",
{
      private ["_ied","_object","_newObject"];

      _ied = cursorTarget;
      _newObject = nearestObjects [player, EODS_IEDS_PCU_OBJETOS_ESCONDER, 3];
      _object = _newObject select 0;

      _ied setVariable ["EODS_IED_Hide",false];
      _ied attachTo [_object,[0,0,-1]];

},{(cursorTarget getVariable ["EODS_IED_Hide",true])},{},[], [0,0,0], 100] call ace_interact_menu_fnc_createAction;
#

So I am using Ace Interaction and according to certain actions being completed it will show certain actions. Simply when this is true off the start it will show and when its the action is selected and then the object is attached it should hide itself again. Simply it works but for some reason all the actions re appear on the object if that makes sense. In note, when the objects are not attached it works fine but when they are are the variable becomes true again

#

I hope that makes a bit more sense

fair drum
#

what can I add to help get voiceovers while riding in helis more clear? there a way to decrease the sound of vehicles?

willow hound
#

I suggest the fadeSound command.

fair drum
#

will that affect a playSound command?

#

like lower it as well?

#

i guess it wouldn't if i send the voiceover through a radio channel

willow hound
#

Don't know, you'll have to try.

fair drum
#

it appears that fadeSound does nothing. I set it to 0 expecting to mute which it didn't, and then soundVolume returned the standard unchanged "1"

willow hound
#

@crisp cairn I'm not quite sure, but I believe that it is possible that cursorTarget might return the object that your IED has been attached to (_object in your code). If that is the case, then cursorTarget getVariable ["EODS_IED_Hide", true] can't find your variable ("EODS_IED_Hide") in _object's namespace, so it returns the given default value, true, and the action is shown.

#

@fair drum Did you use the correct syntax time fadeSound volume?

fair drum
#

update: looks like ACE handles sound volume so you might have to disable their handler...

ace_hearing_disableVolumeUpdate = true

#

so all in all...

ace_hearing_disableVolumeUpdate = true;
5 fadeSound 0.3;
sleep 5;
playSound "blah";```

this works^
#

@winter rose is this worth a wiki mention considering a large amount of the community uses ACE? otherwise fadeSound will not work.

crisp cairn
#

@willow hound Ye I think I understand, so what do you suggest?

winter rose
#

@fair drum no, it should be on the ACE wiki

willow hound
#

@crisp cairn You could try changing the condition to cursorTarget getVariable ["EODS_IED_Hide", false].

vague geode
#

How can I turn off or disable the landing autopilot on a vehicle? The problem is that whenever you release UAV controls it autometically turns on the landing autopilot causing it to move to the next landing site.

oblique arrow
#

You can disable a UAVs autonomy @vague geode

#

but that disables all autonomous movements

vague geode
#

@oblique arrow Even that doesn't work.

oblique arrow
#

Hm odd

jovial steeple
#

How do I stop onMapSingleClick?
https://community.bistudio.com/wiki/onMapSingleClick

When I do the below the onMapSingleClick that has my code doesn't run.

this addAction ["<t color='#FF0000'>Send to</t>",
{
onMapSingleClick '
MyCode;
true';

onMapSingleClick '';
}];

winter rose
#

well, you define onMapSingleClick then remove it immediately

jovial steeple
#

So I need to wait until my script reaches the result I want then run the empty one?

#

Running this in an objects Init.

winter rose
#
onMapSingleClick {
  hint "yay!";
  onMapSingleClick {};
};
jovial steeple
#

That worked, thank you Lou. I promise I will make the jump to .sqf at some point.

winter rose
#

it's not just that, it's that another script or mod can override the one-instance onMapSingleClick

ornate marsh
#

Having some difficulty, I'm wanting to add an action to a player when they step inside a trigger and remove it when they step out of it, but its not working. Tried removing it from them in the "On Activation" box, but there isn't a thisList variable to get a list of people inside the trigger

winter rose
#

add the action once forever, and set its condition to be "player inArea myTrigger" @ornate marsh

ornate marsh
#

ah right, so in the init.sqf, or initPlayerLocal.sqf?

winter rose
#

initPlayerLocal I suppose

orchid stone
#

@warm hedge @fair drum

sorry didnt see the responses.

ABDDN_SERVER_MILITARYRIFLELOOT = ("true" configClasses (configfile >> "CfgWeapons") select {(getText(_x >> "cursor") == "arifle") && (getText(_x >> "DLC") == "")} apply {configName _x});

#

appreciate the addition comments regarding the DLC requirements. still brain storming how to make it more modular to accept other mods/DLCs if the server allows. always something 🙂

#

that still needs some additional filtering, because it's spawning rifles that aren't actual objects. not sure what thats about yet. can share once i get that squared away

wild prairie
#

IIRC, you may need to spawn the weapon holder instead of the weapon itself

tough abyss
#

Hi how do i make an ai character leave the squad with a trigger?

fair drum
#
[unit] join grpNull;
strange seal
#

is there a way to reference high command units instead of group variable names? like if I want the first 3 high command units to do something without relying on the same groups from spawn being there

warm hedge
#

Also isn't your pfp enough to be 🔨 ed?

unborn drum
#

I believe the rules don’t mention pfps, simply derogatory behavior

warm hedge
#

I knew one who kicked from the server because of “illegal symbols,” anyway better to discuss further in #offtopic_arma

unborn drum
#

However I would understand if a mod took issue because of the rules wording, “zero tolerance policy”

winter rose
unborn drum
#

My original question pertained to an EMP script by ALIAS. I encountered an issue where a variable wasn't being defined and I was hoping to get some help from somebody whether to attempt to locate the issue or suggest a new script. I'm just looking to have an EMP go off and remove/disable a few items such as GPS devices, TFAR radios, flashlights, night vision devices, helicopters/tanks. Whether the script has visual effects isn't important, just the effect. I appreciate any assistance!

open star
#

Removing, would probably be the easiest solution here, as TFAR disabling has been buggy as of late.

unborn drum
#

I've got a smidget of code to simply modify the range of radios which works just fine

#

Problem is, can't remove ILBE radio backpacks without disappearing other items

open star
#

Well believe it or not, the 152 is meant to be able to withstand nuclear fallout and EMPs

#

You could scramble the LR frequencies, every few seconds.

unborn drum
#

I had figured the circuits were hardened, though for the sake of the experience I'd be willing to look past it.

#

What do you mean scramble?

open star
#

So, every idk 1 second, set their frequency to a random integer between 1-80

#

So you're scrambling their frequencies, so they can't be used.

unborn drum
#

Alright, thats actually a great idea. Only a handful of people carry 152s, most carry 7800s. how would I go about scrambling long range radios?

open star
#

I don't have anything on hand as I'm on my phone, but you'll want to look for the framework for TFARs frequencies then how you can script set them

#

I'm not 100% off the top of my head and writing pseudo code on the phone is awful.

unborn drum
#

Yeah, no worries. How difficult is it to remove items from inventories?

#

My end goal is to place an asset, have it become the center of the EMP, range the emp spherically, and be able to set it off during a mission

#

messing with radios, dropping helicopter systems, messing with tanks, and removing some items from inventories

open star
#

Not that hard, you just need to know the items name or ID

#

If you have ACE Arsenal, just hover over the item and throw bottom name with _ is the item name.

unborn drum
#

Yep! I've actually already got them

open star
#

Yeah, then you'll just be doing a check to see if the player has it.

#

Honestly I would make an array with all the items you want removed from inventories, then have it check through the array for a matching name.

#

Save you a lot of lines in your code.

unborn drum
#

That's what I've got so far, I copied in assets I wanted into the other script I found

winter rose
#

forEach*

#
{
  private _soldier = _x;
  {
    _soldier unassignItem _x;
    _soldier removeItem _x;
  } forEach ["obj1", "obj2", "obj3"];
} forEach _soldiers;
```@unborn drum
unborn drum
#

Mind explaining what _soldier and _x mean?

#

I assume _soldier simply means unit?

winter rose
#

yep, to replace the _x so you can have two forEach

open star
#

basically _x is for each obj removed
_solider for each player

unborn drum
#

gotcha

#

To be sure, I'm to make an .sqf file that contains that bit of code as well as the TFAR long-range scuffling, and simply execute it from zeus using an Achilles module? How would I go about limiting the range of the effect to a sphere around an asset?

open star
#

Use Zeus Enhanced, Achillies is outdated.

unborn drum
#

I use both

open star
#

They're the same but, I believe if I'm not mistaken its radius you choose by default will be spherical.

unborn drum
#

There are differences between the two and I like elements from each. As for the radius, could you point me toward how to select the location to which the range emanates from and how to define the range?

open star
#

That is where I will blank, as I'm not sure how to make a custom radius deal.

unborn drum
#

Haha, alright. I really appreciate the assistance!

onyx sonnet
#

is it possible to rebind or disable an inputAction?

winter rose
#

you can "intercept" it with UI event handlers yes

onyx sonnet
#

i want to use shift p but it is already bound to something, and theres an action for this. just to check this would be the correct way to go about this right

winter rose
#

Shift+P is DLC menu shortcut iirc

onyx sonnet
#

yeah

#

so if i use a display event handler on on key down, filter out the necessary keys then what?

winter rose
#

then that's it

brittle dock
#

So I seem to have a performance issue in my mission.
Currently I have this in my "init.sqf":

// Mission Init
[] execVM "scripts\missionIntro.sqf";
[] execVM "scripts\missionParams.sqf";
[] execVM "scripts\objectClasses.sqf";
[] execVM "scripts\mainTask.sqf";
[] execVM "scripts\playerSpawn.sqf";
[] execVM "scripts\vehicleSpawn.sqf";
[] execVM "scripts\minefieldSpawn.sqf";
[] execVM "scripts\airdropSpawn.sqf";

How would I go about making it better? Because currently one of the scripts gets an error, unless I comment another one out. (Even though they're not related and doesn't share any variables)
So it would seem there are 1 scripts too many getting execVM'd.
I've read that you can precompile and that using execVM the way I use it shouldn't be practiced.

An example on how I should rewrite that "init.sqf" would be appreciated.

#

"AirdropSpawn.sqf" will be run several times throughout the mission, but the others will not. The mission will have no JIP.

winter rose
#

@brittle dock the issue is not the amount of execVMs, the issue is what is in them

if you have code that will be run multiple times, better make it a function yes (to prevent reading from the disk multiple times)

brittle dock
#

Ah I see, yeah I use for "_i" from 1 to 100 do for the minefield script to spawn them randomly, same for vehicles but to a lesser amount.

#

I'll check up on functions.

#

Btw, I've seen examples like [4] execVM what does the number 4 do?

onyx sonnet
#

arguments accessible as _this in the script

#

i think

#

idk

winter rose
#

it simply passes it as a parameter to the script @brittle dock

#
[1, "two", true] execVM "myFile.sqf";

// myFile.sqf
_this; // [1, "two", true]
params ["_param1", "_param2", "_param3"];
_param1; // 1
_param2; // "two"
_param3; // true
brittle dock
#

Ah okay, thanks

onyx sonnet
#

trying to intercept the shift + p bind via event handlers, not working though. is it displayAddEventHandler I need to use or something else?

findDisplay 46 displayAddEventHandler["KeyDown", {
    _isShift = _this select 2;
    if (_keyCode isEqualTo 25 && _isShift) exitWith {
        // shift p
        diag_log "disabled shift + p";
    };
}];```
onyx sonnet
#

@winter rose can you help? ive got no clue whats going wrong

winter rose
#

@onyx sonnet ↑

onyx sonnet
#

oh thanks, i thought it said it didnt return anything

#

yeah its not even printing the debug text. do i need to put it anywhere else apart from the init.sqf?

high marsh
#

it's a UI event handler

onyx sonnet
#

uh okay?

#

where do i put them?

high marsh
#

look at your first message

onyx sonnet
#

how do i use it then

high marsh
#
findDisplay 46

this is your main display, you're adding the handler "keydown" to it. Which fires when a key is PRESSED

#

if your code returns TRUE then it overrides DEFAULT behavior

onyx sonnet
#

got it, but im pretty sure the if statement isnt passing

high marsh
#

? , doesn't matter where.

#

it's literally whatever the last condition was

#
(findDisplay 46) displayAddEventHandler["KeyDown",{
  (primaryWeapon player != "") //this would either return true or false, override or not.
}];
onyx sonnet
#

yeah i see, ima try that, thanks

#

yeah its not working in my init.sqf

#

like, a diag_log isnt even getting printed

high marsh
#
waitUntil{!isNull (findDisplay 46)};
if(local player) then {
  (findDisplay 46) displayAddEventHandler["KeyDown",{
      diag_log format["Key Pressed: %1",_this # 1];
  }];
};
onyx sonnet
#

thanks :)

high marsh
#

👍

vague geode
#

Can I put code into the a waypoints completion condition followed but some code that checks is the execution was successful and then returns a boolean?

E.g. waypoint setWaypointStatements ["(vehicle this) setFuel 1; waitUntil { fuel (vehicle this) == 1 }; true;", "systemChat format ['The vehicle of %1 has been refueled.', name this];"];

copper raven
#

maybe

vague geode
#

Can I put code into the a waypoints completion condition followed but some code that checks is the execution was successful and then returns a boolean?

E.g. waypoint setWaypointStatements ["(vehicle this) setFuel 1; waitUntil { fuel (vehicle this) == 1 }; true;", "systemChat format ['The vehicle of %1 has been refueled.', name this];"];

Ok, the answer is yes, but not as shown above.

What you can do is: waypoint setWaypointStatements ["(vehicle this) setFuel 1; (fuel (vehicle this)) == 1;", "systemChat format ['The vehicle of %1 has been refueled.', name this];"];

onyx sonnet
#

can i use spawn inside of a function to spawn another function?

#

doesnt seem to be working

#
_testFunc = {
    diag_log "test";
    titleText["test", "PLAIN"];
    sleep 2;
    titleFadeOut 0.5;
};
waitUntil{!isNull (findDisplay 46)};
if(local player) then {
    (findDisplay 46) displayAddEventHandler["KeyDown",{
        _keyCode         = _this select 1;
        _isShift         = _this select 2;
        _isCtrl          = _this select 3;
        _pDown             = _keyCode isEqualTo 25;

        _thingOne = _isShift && !_isCtrl && _pDown;
        _thingTwo = _isShift && _isCtrl && _pDown;
        diag_log "key pressed";

        if (_thingOne) then {
            diag_log "a";
            [20] spawn _testFunc;
        };
        if (_thingTwo) then {
            diag_log "t";
            [100] spawn _testFunc;
        };

        (_keyCode isEqualTo 25 && _isShift);
    }];
};
copper raven
#

What you can do is: waypoint setWaypointStatements ["(vehicle this) setFuel 1; (fuel (vehicle this)) == 1; true;", "systemChat format ['The vehicle of %1 has been refueled.', name this];"];
(fuel (vehicle this)) == 1; true;
(fuel (vehicle this)) == 1 this does nothing, true is left on the stack

#

_testFunc is not defined when you call it inside the eh

#

local variables carry over into lower scopes, but not into completely new scripts

#

@onyx sonnet

onyx sonnet
#

but is that not a lower scope?

#

because its in the function of the event handler

vague geode
#

@copper raven Oh, yeah forgot to remove that. I did test it without it.

copper raven
#

it's not called in the same context as where you define it, "but not into completely new scripts"

onyx sonnet
#

okay so should i just define the function in the event handler func?

copper raven
#

that, or assign the function to a global variable instead

#

_ = local

onyx sonnet
#

alright, thanks

sharp grotto
#

I will risk the public shame. Why is this code bad ?`😅

    waitUntil {
        waitUntil {sleep 2.75; !alive player};
        0 fadeSound 0;
        cutText ["","BLACK FADED",0];
        waitUntil {sleep 1; alive player};
        0 fadeSound 1;
        false;
    };
};```
grim coyote
#

use killed and respawned event handlers instead

sharp grotto
#

it causes the whole server to stall and causes a ton of problems (pending messages, mass kick etc) and i spent 100 hours to debug 500+ server files :D
even tho it just runs client side 🤷‍♂️

winter rose
#

it is bad because it does not read as what it does
it is also bad because it makes it run billions of times

#

you "wait until" nothing after all.

[] spawn {
  while { true } do {
    waitUntil { sleep 2.75; not alive player };
    0 fadeSound 0;
    cutText ["","BLACK FADED",0];
    waitUntil { sleep 1; alive player };
    0 fadeSound 1;
  };
};
#

@sharp grotto ↑

sharp grotto
#

Thanks alot, i guess iam stupid 😄

onyx sonnet
#
case 0.8: {
fadeSound 1;
_vol = 1;```

```sqf
                _vol = 0.8;
                switch (soundVolume) do {
                    case 0.8: {
                        fadeSound 1;
                        _vol = 1;
                    };
                    default: {
                        fadeSound 0.8;
                    };    
                };
#

anyone know whats wrong here

copper raven
#

remove colon after default

onyx sonnet
#

ty

ornate marsh
#

any know of a way to turn off the light on the Assembled Device? tried this _device setHit ["light_1_hit", 1]; but to no avail

warm hedge
#

setHitPointDamage perhaps

surreal peak
#

although I doubt that would work over setHitPointDamage

ornate marsh
#

switchLamp worked

surreal peak
#

huh, good to hear. Didnt think that would work

onyx sonnet
#

@copper raven new error

 Error in expression <soundVolume) do {
case 0.8: {
fadeSound 1;
_vol = 1;
};
default {
fadeSound 0.8;>
17:23:50   Error position: <1;
_vol = 1;
};
default {
fadeSound 0.8;>
17:23:50   Error Missing ;
17:23:50 File mpmissions\__CUR_MP.Altis\initPlayerLocal.sqf..., line 25
17:23:50 Error in expression <soundVolume) do {
case 0.8: {
fadeSound 1;
_vol = 1;
};
default {
fadeSound 0.8;>
17:23:50   Error position: <1;
_vol = 1;
};
default {
fadeSound 0.8;> ```
winter rose
#

fadeSound takes a left-hand parameter

#

fadeSound 1 // wrong
0 fadeSound 1 // correct

#

@onyx sonnet ↑

onyx sonnet
#

thank you

thick chasm
#

How could I spawn random units in an area when triggering a laptop or object with a trigger?

winter rose
onyx sonnet
#

my bad

tough abyss
#

think this is relevent here, How does one create a live camera feed that displays on a target screen?

winter rose
#

@tough abyss ↑

tough abyss
#

thanks, ill have a look.

crisp turtle
#

Hello lads, i have a question:
I have a little animation on a script that is supposed to move a part of a vehicle. I'd like for a sound to be played around the vehicle when the animation is complete.
this is the line i have put in the SQF:

_tonko = _this select 0;
_dis = 200;

playSound3D ["A3\sounds_f\sfx\doors\RollDoors\RollDoorsSlam_2.wss", _tonko, false, (getPos _tonko), 5, 0.6, _dis];

When testing, it does the animation and nothing happens. Bigg sad, anyone know what i'm doing wrong?
So far what i think i'm doing wrong is either: Not defining the sound correctly or rolldoorsslam_2.wss is not a sound that exists.

tough abyss
#

have you got your description.ext setup?

crisp turtle
#

I have

#

You thinking of possibly defining it in cfgsounds?

tough abyss
#

I think so yea. Thats what I did when I done something similar

worthy spade
#

Is there any empty object in Arma 3 that I can use as a point of reference, or do I have to use something like an invisible helipad? I want a point in space that has a position and direction, on which I can attach other objects to.

EDIT: Perhaps a game logic?

fair drum
#

whats the command for making a unit game master? since modules are only loaded as mission start, if a groups zeus gets d/c'd they lose the zeus ability. if I put it in the init for the unit, it should load whenever the unit spawn.

tough abyss
#

not 100% sure what your saying, however If you create a respawn position for the unit side and place down a playable slot, then set the slots variable name as say 'Z1'. place down the Game master module in Eden and set the owner as 'Z1'. This should work for you.

faint oasis
#

hi, i have a question ? someone now how to convert a distance (9685 meters) to 9.7 km ?

copper raven
#

_meters / 1000 toFixed 1 i guess

crude vigil
open star
#

@fair drum You can also set the owner as their SteamID 64 which in turn any time they log in or log out, they will have Zeus, and you can set down multiple.

faint oasis
#

@copper raven@crude vigil thx it work

copper raven
#

you might want to check if distance is <1000, you can just display the number then (if you don't want to show 0.5km etc)

faint oasis
#

ok

brittle dock
#

When should isServer be used when it comes to scripts? Why is isServer used at all?

#

Let's say I have a script that spawns vehicles at the start of a mission, should that script be isServer? If so, then why?

onyx sonnet
winter rose
#

@brittle dock if you don't use isServer (the "game referee") and create vehicles in init.sqf, you will have the vehicles × number of players + 1

brittle dock
#

Ah okay, that goes for scripts that is execVM'd through init.sqf as well then?

winter rose
#

Yep

#

If in doubt, use initServer.sqf

next marsh
#

@spark sun hey sorry to bother you i would have DM'ed but its off, was hoping you could give us a hand with porting the H&M you worked on, we followed the guide but its breaking the scripts we think.

fair drum
#

@tough abyss @open star Maybe I didn't explain well enough. Lets look at a different module, the support requester module. All of the support modules are initialized on mission start to the things they are sync'd to as well. This means that if you have the requester tied to two different units but 1 person is late to the game, it will not sync with them. Therefore you must place BIS_fnc_addSupportLink in their unit's init so that when they spawn, it will run. This seems to be happening in a similar way with the game master. It is initialized with the player's unit at start. How ever, if the player locks up and has to force quit and rejoin, that unit loses its zeus and I have to manually add it as a logged in admin via ACE. What I am asking, is what is the function that adds gamemaster functionality just like how BIS_fnc_addSupportLink does supports.

tough abyss
#

'BIS_fnc_moduleCurator' this is the function that creates a 'zeus'. I believe I ha e the same issue within my unit, however when we respawn our player the module fixes itself.

#

How do you link the curator module to the player?

fair drum
#

via owner and sync apparently

exotic flax
#

give unit a variable name, set "owner" to variable name

#

sync has never worked for me though 🤔

fair drum
#

i had both a zcur unit with owner = zcur and it is also synced

#

I guess its worth mentioning that it is ZEN. which if its a bug with them, then I need the script function anyways lol.

tough abyss
#

Sorry, whats ZEN? 😂

fair drum
#

looks like BIS_fnc_moduleCurator has no documentation on the wiki... time to go diving.

#

ZEN - Zeus Enhanced
next iteration of Ares/Achilles

tough abyss
#

I presume this happens on a dedicated server?

#

Because I know there's a bug where on respawn of a unit the zeus module doesn't assign itself to the respawned unit and sits unasigned. To fix you just need to respawn again.

fair drum
#

yes its on dedi

#

i'll keep that in mind on the next runthrough

vernal venture
#

Shouldn't this work fine in InitPlayerLocal.sqf for multiplayer?

player createDiaryRecord ["Diary",["SITUATION","Here's the situation."]];

Right now when I try that, my briefing stays blank.

exotic flax
#

do you have

waitUntil {!isNull player && isPlayer player};

Before running that line? Because it might be possible that the player doesn't exist yet

vernal venture
#

I'll try that.

tough abyss
#

Try this sqf Player createDiaryRecord ["Diary", ["situation", "here's the situation"], taskNull, "", false];

vernal venture
#

Looks like the waitUntil did it.

vernal venture
#

Or not. That's weird. As soon as I put the actual text in it, it stops working.

#

Apparently it doesn't support line breaks

winter rose
#

it does

#

<br />

exotic flax
#
    player createDiaryRecord [
        "Diary",
        [
            "RULES OF ENGAGEMENT",
            "
ALL ENEMY MILITARY PERSONNEL AND VEHICLES TRANSPORTING THE ENEMY OR THEIR SUPPLIES MAY BE ENGAGED SUBJECT TO THE FOLLOWING RESTRICTIONS:<br/><br/><br/>
A. WHEN POSSIBLE; THE ENEMY WILL BE WARNED FIRST AND ASKED TO SURRENDER.<br/><br/>
            "
        ],
        taskNull,
        ""
    ];

works perfectly fine

#

just make sure you escape your quotes 😉

vernal venture
#

Aha. <br/>, I had <br>

ornate marsh
#

having some problems, wanting to remove a string from an array, but I just cant seem to do it, tried -, tried filtering it, unsure what to do. Here's the code:

_filterLocation = _randomLocation select {_x != _nameOfLocation};

basically want to remove _nameOfLocation string from array _randomLocation

still forum
#

that code, and - should both work

#

if the string is really in the array

ornate marsh
#

so should do:

_randomLocation = _randomLocation - _filterLocation;

after that?

winter rose
#
["loc1", "loc2", "loc3", "loc3", "loc4"] - ["loc3"] = ["loc1", "loc2", "loc4"]```
ornate marsh
#
    _locationsArray = ["boxPosition1","boxPosition2","boxPosition3","boxPosition4","boxPosition5"];
    _randomLocation = selectRandom _locationsArray;
    _currentLocation = nearestObject [getPos MysteryBox,"Land_HelipadEmpty_F"];
    _nameOfLocation = vehicleVarName _currentLocation;
_filterLocation = _randomLocation select {_x != _nameOfLocation};

here's the code, whereabouts should it go

still forum
#

huh 🤔

#

_randomLocation select {_x != _nameOfLocation};
won't work, _randomLocation is a string, not an array

#

did you mean _locationsArray select... ?

ornate marsh
#

basically, want to pick a random location from the array, but if it happens to be the same location it should just remove it from the array and carry on

#

wait, think I may have fixed it, lemme just check

still forum
#

why not remove the currentLocation from array first

#

before you select a random new location?

#

I think thats easier, if you're grabbing _currentLocation anyway

#

_locationsArray = ["boxPosition1","boxPosition2","boxPosition3","boxPosition4","boxPosition5"] - vehicleVarName _currentLocation;

ornate marsh
#

ah yea, thats better actually, cause then that eliminates another problem I was having

#

yea that didnt work, expects an array not a string

#

should probably put it into an array before that

still forum
#

oops sorry

#

yeah - [...] not - ...

vernal venture
#

I'm discovering that createDiaryRecord is apparently a broken mess.
Doesn't work with 3 paragraphs but works with two, but I can't find anything about a character limit in the wikis.

winter rose
#

there is none

#

note that createDiaryRecord does not take Structured Text syntax, but its own format.

vernal venture
#

Yeah, that's why I'm so frustrated. I'm just typing some plain text into notepad++
Added <br /> for line breaks. 2 paragraphs works, 3 paragraphs makes all entries stop working.

winter rose
#

something is wrong within your text then

vernal venture
#

Banned words?

winter rose
#

nope

#

pastebin your text, it will be faster

vernal venture
winter rose
vernal venture
#

That's almost more frustrating.

winter rose
#

any mods perhaps?

vernal venture
#

One or two that might affect it. And a bunch of scripts that mess with adding and removing subjects from that list. I'll have to start eliminating them and testing

winter rose
#

either run vanilla (if possible) or run without your scripts

you will then figure out in which category the issue is

vernal venture
#

Yeah. I'll have to spend some time on it. Thanks for trying it out.

tough abyss
#

so i have a question

#

can anyone help me make sense of the whole boolean thing like im dead confused im trying to use a script for my mission and to enable or disable certain parts it just says "boolean"

cunning crown
#

@tough abyss what exactly are you trying to do? And remove profanity from your message (see #rules)

tough abyss
#

delay_eruptions - number, delay in seconds between eruptions,if the delay is smaller than 0 erruptions will be disabled
enable_crater_lava - boolean, if true SFX for caldera will be generated
enable_lightning - boolean, if true lightning bolts will randomly show up in the smoke cloud
enable_lava_flow - boolean, WIP
lethal - 0,
protective_gear - array containing the class name if the items you wanna be used as protective gear near crater

#

delay_eruptions - number, delay in seconds between eruptions,if the delay is smaller than 0 erruptions will be disabled
enable_crater_lava - boolean, if true SFX for caldera will be generated
enable_lightning - boolean, if true lightning bolts will randomly show up in the smoke cloud
enable_lava_flow - boolean, WIP
lethal - 0,
protective_gear - array containing the class name if the items you wanna be used as protective gear near crater
just trying to disable certain things like lethality

cunning crown
tough abyss
#

am i just dumb?

#

let me try it

#

didnt work

jade abyss
#

Is it stringed? ( "true") if so = Not boolean

fleet hazel
#

The server calls the sound to the playSound3D player. But there is no sound. If it repeats, the sound is there. What's the problem?

unique sundial
#

player is null?

thick chasm
#

How can I with a trigger spawn ramdom units in a defined area?

fleet hazel
#

@unique sundial not

timber ridge
#

maybe someone has some insights on why some Arma 3 scripting commands / functions are not named properly so you know their purpose immediately from the name?

like this one: https://community.bistudio.com/wiki/configOf

this could easily be named "getObjectConfigPath" instead of just "configOf" which's meaning changes drastically when you read its description in the wiki page 🙂

how can we communicate this to the developers themselves, for improving readability / explicicity of this maybe?

warm hedge
#

Somehow #community_wiki is the best place to discuss Dev-Branch commands about their implementation. I don't think the name will be changed in the future though

young current
#

99.9% sure no name changes will be done

#

As that would either mean need of 2 same commands or breaking everything that uses the current command

timber ridge
#

I guess the implementation undergoes an internal code review and when it's merged into dev branch, unless the function is not used much in the actual game code, it's not gonna be renamed at all in the future?

#

yeah, but while stuff is in dev branch, should the devs worry about backwards-compatibility? i mean that's what the dev branch is for, tbh.

#

to shape things up until they're ready for "prod"

young current
warm hedge
#

That actually is the point though, I still don't see a big point to do

winter rose
#

@timber ridge what did you expect configOf to provide? (the whole tree?)

timber ridge
#

that's the point, it could've been anything.

young current
#

Dunno I had not seen the command before and I expected it to do what the description said.

timber ridge
#

maybe that's your intuition in the play if you've worked with this for a long time? I've gone back to a3 scripting a ~month ago, still not as intuitive as you'd like it to be 😄

winter rose
#

did you already forget the wonderful modelToWorldVisualWorld

timber ridge
#

😄 alright alright, I give up now

vague geode
#

I am trying to add a different dynamic loadout to a BlackWasp (Cluster) but I always get the following error: No Entry 'bin\config.bin/CfgWeapons.'. (BTW I did not misplace those slashes. The first one is a backslash and the second a normal one)

This is the code I am using:

private _vehicle = /* the vehicle of the unit */;
private _pylons = ["PylonRack_Missile_AMRAAM_D_x2","PylonRack_Missile_AMRAAM_D_x2","PylonRack_2Rnd_BombCluster_01_F","PylonRack_2Rnd_BombCluster_01_F","PylonMissile_Missile_BIM9X_x1","PylonMissile_Missile_BIM9X_x1","PylonMissile_Missile_AMRAAM_D_INT_x1","PylonMissile_Missile_AMRAAM_D_INT_x1","PylonRack_Bomb_SDB_x4","PylonRack_Bomb_SDB_x4","PylonMissile_1Rnd_BombCluster_01_F","PylonMissile_1Rnd_BombCluster_01_F"];

private _pylonPaths = (configProperties [configFile >> "CfgVehicles" >> typeOf _vehicle >> "Components" >> "TransportPylonsComponent" >> "Pylons", "isClass _x"]) apply {getArray (_x >> "turret")};
{ _vehicle removeWeaponGlobal getText (configFile >> "CfgMagazines" >> _x >> "pylonWeapon") } forEach getPylonMagazines _vehicle;
{ _vehicle setPylonLoadout [_forEachIndex + 1, _x, true, _pylonPaths select _forEachIndex] } forEach _pylons;
winter rose
#

…but there is no CfgWeapons in your code D:

warm hedge
#

setPlyonLoadout adds an weapon if there's no weapon related to the magazine IIRC

#

So it would?

vague geode
#

I don't know. It does work it just throws that error the first time it is executed but I copied that code from the Community wiki so you tell me. 😉

warm hedge
#

Actually pylon related commands are REALLY weird

vague geode
#

But the only way to get a different loadout onto all BlackWasp (Cluster)s...

warm hedge
#

I know. But still... something's wicked

ornate marsh
#
_radioCheck =
[
{
params ["_args","_handle"];       
    if (BEN_songcheck == 3) then {
            [radio, false] remoteExec ["hideObjectGlobal", 2];   
            "Songs can now be played near the teleporter" remoteExec ["systemChat",0,true];     
            ["115"] remoteExec ["playSound",0,true];       
            [_handle] call CBA_fnc_removePerFrameHandler;
        };
},
3,
[""]
] call CBA_fnc_addPerFrameHandler;

Regarding this code, I'm wanting to check a variable constantly, then when the condition is true, I want the code to only execute once, however it doesn't seem to remove the Frame Handler

#

nvm fixed it

#

added a params line

tough abyss
#

Im having an issue with an addAction.
In obj. init:

this addAction ["Turn On Generator", [true] execVM "scripts\ToggleLightsBase.sqf"];

ToggleLightsBase.sqf:

params ["_state"];
if (_state) then {
    {_x setdamage 0; sleep 0.1;} foreach [g1,g2,g3,g4,g5,g6,g7,g8,g9,g10,g11];
} else {
    {_x setdamage 0.95; sleep 0.1;} foreach [g1,g2,g3,g4,g5,g6,g7,g8,g9,g10,g11];
};

What exactly am I doing wrong?

copper raven
winter rose
#

@tough abyss

this addAction ["Turn On Generator", [true] execVM "scripts\ToggleLightsBase.sqf"];
```↓```sqf
this addAction ["Turn On Generator", { [true] execVM "scripts\ToggleLightsBase.sqf" }];
tough abyss
#

ahhhh Right.

#

thankyou.

#

always something simple

finite sail
#

for checking little errors like that

#

dedmen (not tagging him as this is just crediting him)

#

is excellent for finding that missed semicolon, that misspelled command, this missing bracket, that fat, beery miss of the shift key

queen cargo
#

there are vscode extensions for that too

finite sail
#

yes, but they are all out of date

queen cargo
#

nope

#

sqf-vm one is not

#

but not feature complete yet
still, sqf-vm is what dedmen's page uses too 🤷

finite sail
#

ah, i dont think i use that one

#

confirmed.. dont use that

queen cargo
#

also got some very ... special ... language ... for you
just in case you are interested 😏😏

finite sail
#

is it norty 🙂

queen cargo
finite sail
#

ah yes

#

i read it occasionaly

#

but the webpaage is useful for non vs code users

#

sparker makes that extension, yes i know him

queen cargo
#

nah
that is the old one, which adds tasks

#

sqf-vm language server now exists too

finite sail
#

credits say the vm is yours.... now im confused

finite sail
#

i dont know what thats for but will research

#

ok being called for foods

#

bbl

calm bloom
#

Hello guys. Anyone have in mind classname of some invisible non-collidable object i can add ace action to?

tough abyss
#

turn show model off

calm bloom
#

you mean hideobjectglobal? Yea thats a way

#

also, i had error in script

#

GroundWeaponHolder_Scripted works fine

#

i thought that it is removeing because it had no content

tough abyss
#

@calm bloom you could use a trigger maybe? not sure about a invisible object in that case.

calm bloom
#

no, GroundWeaponHolder_Scripted is just what i need, thanks for help

oblique arrow
#

Hey peeps how would I figure out what player is in the driver position of a vehicle?

#

As in if I have the truck x that I want to get the driver of

#

oh wait

jade abyss
#

👏

still forum
#

@timber ridge

this could easily be named "getObjectConfigPath" instead of just "configOf"
configOf is a command from VBS, and has the same usage in Arma as in VBS.
"getObjectConfigPath"
but that's wrong, it doesn't return the configPath, it returns the config. getObjectConfig, or configOf is no difference to me, besides that one is longer and sounds more complicated, configOf, returns the config, of ...

#

how can we communicate this to the developers themselves, for improving readability / explicicity of this maybe?
you can't

past wagon
#

is there anyone who can help me with a mission im working on? i need a couple of short scripts.

#

i just have a few questions to ask

jade abyss
#

Instead of asking if someone can help, ask your question.

still forum
#

yeah, but while stuff is in dev branch, should the devs worry about backwards-compatibility?
we do to where its reasonable. Renaming or changing a command is fine as long as its communicated properly

jade abyss
#

(No, not an offer to DM me 🙂 )

still forum
#

that's the point, it could've been anything.
you need to read the wiki for basically all commands anyway, so I don't see a problem that you have to look at the wiki to see what exactly this command does and how to use it

past wagon
#

ok

#

well i have my mission built on the island in pyrgos gulf, and i want the mission to be isolated. i would like anyone who goes outside of a certain area (who is not in a vehicle) to instantly die.

#

what is the easiest way to do that?

next marsh
#

kill them in zues

past wagon
#

im not zuesing

#

i want it to be automatic

next marsh
#

build a giant wall in the editor

past wagon
#

im not doing a wall

#

shouldnt it be easy enough to just kill anyone who enters/leaves a certain area?

finite sail
#

you want to kill them the moment they leave the island

past wagon
#

yea

#

pretty much

past wagon
#

ok i will check that out

#

i already have the marker

finite sail
#

{
if (surfaceiswater getpos _x) then {_x setdamage 1};
} foreach allplayers

past wagon
#

i dont want the water to kill them

#

i want them to die if they swim too far out

jade abyss
#

as starting point (init):

if isServer then
{
  while{true}do
  {
    uisleep 1;
    {
      //DoYourChecksHere
    } foreach allplayers;
  };
};
past wagon
#

i dont have any scripting knowledge

#

so i dont really know what that means

jade abyss
#

(there is not much to add up there. Just check the commands and read their descriptions)

past wagon
#

can anyone whip up a short script where i can just substitute something for the ellipse?

#

i know its kinda a lot to ask

finite sail
#

the easiest way would be to kill them when they got a certain distance from the centre of your ellipse

past wagon
#

well its not a circle, its an oval

finite sail
#

provided it's circular

past wagon
#

so it would be uneven

#

its an oval

#

unfortunately

finite sail
#

start with this

past wagon
#

i dont have any scripting knowledge

finite sail
#

thats the core of what you want to do

past wagon
#

yea

#

but i dont really understand the details

#

that doesnt really help

#
if player is outside [ellipse] and not in a vehicle, then kill player.

can someone translate that into a script?

tough abyss
#

@past wagon do research my man before asking 😉 google is a great help.

the easiest way I know how to do it is this:

- Put a trigger arround the area you want players to stay within.
- In eden place down a Zone Restirction Module. configure it to how you want.
- place an Area logic down and sync the logic to the trigger and the zone restriction module.

If im not mistaken this should get the outcome you want.

Try this, if it doesn't work ill help you code it.

finite sail
#

Mate, I doubt anyone is going to write it for you

#

you need to show you've done more than the idea work

past wagon
#

ok i will try it

#

@finite sail im not a scripter, i dont know any programming languages. i was just coming here to see if anyone was willing to code something for me if it was easy enough. i have watched many videos online, but they dont seem to work.

finite sail
#

ok, question 1, you are doing this in the 3den editor?

past wagon
#

yes

finite sail
#

is it going to be multiplayer or single player

past wagon
#

multiplayer

#

also @tough abyss i have done a lot of research online, but i cant really find anything that does what i want it to. also what should i put for "custom punishment" in the zone restriction module?

#

sorry pinged wrong person

finite sail
#

ive never used it, im checking it now

tough abyss
finite sail
#

custom punishment would be

#

player setdamage 1

#

or similar,ive never used that

#

ah wait

#

thats a2

#

not a3

past wagon
#

i think it is _this setDamage 1;

#

maybe

finite sail
#

yes, could well be

tough abyss
#

no

tough abyss
#

_this is used for this as in the place it is coming from, you would want to use player

finite sail
#

says you must link the module to a trigger you've already made

past wagon
#

i synced the module to a trigger area

#

@tough abyss what do i use instead of _this?

tough abyss
past wagon
#

ok im using player setDamage 1;

#

for custom punishment @tough abyss

#

will that work?

tough abyss
#

Do research, google is your best friend, the same with the wiki. I dont do alot of scripting. but i know as a fact anything ive wanted to do has somthing on the bohemia wiki.

past wagon
#

listen

#

i dont know how to script

#

ive done research, and looked for tutorials, but none of them do exactly what im looking for. the bohemia wiki doesnt seem to be for people who dont know how to script

winter rose
#

make triggers north, south, east, west
set them to trigger ANY, and in the activation field:sqf { _x setDamage 1 } forEach thislist

past wagon
#

wait what

#

what do you mean?

#

make markers north south east west?

winter rose
#

triggers*

past wagon
#

oh

#

but the area is an ellipse

#

is there a way to make a trigger in the area, and make it reversed?

winter rose
#

if your area is defined by a marker named "markerName":
in init.sqf:```sqf
if (hasInterface) then
{
[] spawn {
while { true } do
{
waitUntil { sleep 1; alive player };
if (not player inArea "markerName") then
{
player setDamage 1;
};
};
};
};

past wagon
#

ok

#

that looks good

#

but

#

what is init.sqf?

winter rose
#

a file you create at the root of the mission

past wagon
#

where do i find it?

winter rose
#

%userprofile%\Documents\Arma 3 *

past wagon
#

there is no folder called arma 3 there

#

ok i found the folder

#

it was somewhere else

winter rose
#

"Arma 3 Other Profiles" perhaps

past wagon
#

yea thats where it was

#

but now what do i do?

winter rose
#

find your mission directory…?

past wagon
#

yea im in the mission folder

#

the only file is mission.sqm

winter rose
#

a file you create at the root of the mission
so, not to sound condescending, but… 😁

past wagon
#

ok got it

#

i tried to rename the mission file folder, now it wont show up in the editor

winter rose
#

@past wagon language 👀 #rules

past wagon
#

like the name of my mission

#

ok

#

what do i do

winter rose
#

you can rename it, but keep the .islandname at the end (e.g .Altis)

past wagon
#

ohh

#

yea

winter rose
#

Ctrl+Z in Windows should dename it

past wagon
#

if i name it something.Altis that should work, right?

winter rose
#

yes.

past wagon
#

kk thanks

tough abyss
#

only if its on the altis map

#

else your gonna have a problem when loading the mission lmao.

past wagon
#

yea

#

i am getting an error

#

@winter rose

oblique arrow
#

can you share the error?

past wagon
#

yea

#

discord wont let me drag it in

#

its an image

oblique arrow
#

You can upload the image to a website like imgur and then post the link here

past wagon
#

kk

ornate marsh
#
_randomLocation = selectRandom _locationsArray;
    switch (_randomLocation) do 
    {
        case "boxPosition1":
        {
        _newLocation = boxPosition1;
            {
                [_x,true] remoteExec ["hideObjectGlobal",2];
            } forEach nearestObjects [getPos _newLocation, ["plpBase_ct_Static_Cases"],5,true];
            _newPosition = getPos _newLocation;
            _newRotation = getDir boxPosition1;
            MysteryBox setPos _newPosition;
            sleep 25;
            _lightning = createVehicle ["Lightning1_F",_newPosition,[], 0, "CAN_COLLIDE"];
            [MysteryBox, ["poof",500]] remoteExec ["say3D",0,true];
            sleep 5;
            deleteVehicle _lightning;
            [MysteryBox,false] remoteExec ["hideObjectGlobal",2];
            MysteryBox setDir _newRotation;
            {
                [_x,false] remoteExec ["hideObjectGlobal",2];
            } forEach nearestObjects [getPos _newLocation,["plp_cts_RecycleBinGreenOpenEmpty"],5,true];
        };

having a problem right at the end of this code. Everything works perfectly fine, but when i do the setDir, it'll do it for about 5 secs, then the rotation resets to what it was before. This is on dedicated server, not single player

past wagon
#

@winter rose

wraith cloud
#

@ornate marsh try setDir before setPos

ornate marsh
#

ok, will do

winter rose
#

@past wagon
replace if (not player inArea "markerName") by if !(player inArea "markerName")

past wagon
#

ok

queen cargo
#

🤔🤔
Who would like to have something similar toawait [...] call fnc

still forum
#

you mean await spawn

queen cargo
#

Kinda
More like, literally, awaitable calls

past wagon
#
if (hasInterface) then
{
  [] spawn {
    while { true } do
    {
      waitUntil { sleep 1; alive player };
      if !(player inArea "Zone1") then
      {
        player setDamage 1;
      };
    };
  };
};

does this look good @winter rose ?

winter rose
#

does it work?

finite sail
#

hehe

past wagon
#

let me try

#

but you dont see any immediate problems?

queen cargo
#

As I got my SQC parser for sqf-vm working now, I can do it without engine Support and thus literally mean:
await fncasync(...) ; or private promise = fncasync()

winter rose
#

@past wagon nope

queen cargo
#

Getting some basic await idom done in sqf is rather simple, thanks to arrays being passed by reference

past wagon
#

@winter rose it works, but is there an easy way for me to exclude air vehicles?

winter rose
#

will players use air vehicles or just AI?

past wagon
#

players

#

and ai

winter rose
#

also, it is better if you state all the situation before

#
if (hasInterface) then
{
  [] spawn {
    while { true } do
    {
      waitUntil { sleep 1; alive player };
      if (vehicle player == player && !(player inArea "Zone1")) then
      {
        player setDamage 1;
      };
    };
  };
};
```will kill only on-foot units
past wagon
#

does that include people swimming?

#

@winter rose

winter rose
#

yes.

oblique arrow
#

btw all you fancy peeps with your smart looking projects and I cant even figure out how to create a mine every x seconds at a certain position heh

winter rose
#

I can even figure out
good for you 👀

oblique arrow
#

awe no booli

past wagon
#

@winter rose do you just want me to replace it in the init.sqf file?

winter rose
#

if you want

#

who dares win

past wagon
#

kk

#

@winter rose thank you so much, man. this has really helped me. for the past few days i was wondering how the hell i would get this done, since i dont know anything about scripting. thanks a lot

queen cargo
#
// promise idom
private _promise = [nil /* scriptHandle */, nil /* result */, [/* args */]];
_promise spawn {
  // header
  _this set [0, _thisScript];
  private _result = nil;
  scopeName "____function_scope";
  (_this select 2) params [/* variable names */];
  // actual code
  // private _result = ...
  // ...
  _this set [1, _result];
};

// promise done ?
scriptDone (_promise select 0);
```using SQC, i could boil this down to:
```ts
private promise = async function(/* args */) { /* actual code */ };
isDone(promise)
```sooo many fancy things i can do now just thanks to SQC (and SQF-VM) :3
#

though ... doubt anyone ever will use SQC anyways ...

oblique arrow
#

Here's how far I've gotten with the code btw

layMines=false;
delay=30;

truck addAction
[
    "Activate minelayer",
    {
        layMines = true;
    },nil,1.5,true,true,"","(alive truck) && (!layMines)",10,false,"",""
];
truck addAction
[
    "Deactivate minelayer",
    {
        layMines = false;
    },nil,1.5,true,true,"","(alive truck) && (layMines)",10,false,"",""
];
truck addAction
[
    "Set mine laying timer to 5 seconds",
    {
        delay = 5;
    },nil,1.5,true,true,"","alive truck",10,false,"",""
];
[insert a bunch of other addActions here]
truck addAction
[
    "Set mine laying timer to 30 seconds",
    {
        delay = 30;
    },nil,1.5,true,true,"","alive truck",10,false,"",""
];

while {true} do {
   while {layMines} do {
   createMine ["APERSMine", position truck, [], 0];
   sleep delay;
   };
sleep 5;
};

The addActions all seem to work fine but it wont spawn the mine sadcat , also ignore that it just uses the truck position I havent implemented adding a bit of distance behind the truck yet

oblique arrow
#

Ooooh yeah I was trying it in debug

#

and the [code here] thing isnt in the real code, I just didnt want to fill up a bunch of chat space with another 5 or so addActions

#

oki

#

and then try that in debug?

#

oki I'll try that in a few minutes

#

rooHappy Thank you

#

Then I'll just have to figure out how to set up the execVM correctly so I dont need to start it through the debug console

#

Oki

oblique arrow
#

hyperBongo it works, thank you a lot @tough abyss

#

now i gotta implement the vectorAdd thing

#

the list of the numbers for a vector is [x,y,z], no?

jade abyss
#

afaik, next patch will be [n,n] too

strange seal
#

If anyone can help, I'm trying to make a heli insert radio call (get a position from mapSingleClick, make a waypoint, set waypoint to TR unload, and then RTB) but the waypoint created never seems to get set to TR UNLOAD any advice?

silent latch
#

Can SOMEONE please tell me why this script works on my test server but NOT the real server

#

ive implemented it correctly

#

the commands are whitelisted

robust brook
#

show me silly boy

silent latch
#

// author: Infamous
// Description: does some things to create a betting system


// closes last dialog
closeDialog 0;

// define variables

playerListArray = [];

_display = findDisplay 126500;
_start = _display displayCtrl 12402;
_localPlayer = "";


// creates bet dialog

createDialog "send_bet";




{    

    if (!(name player == name _x)) then {
        playerlistArray pushBack _x;
        _name = name _x;
        lbAdd [91831, _name];
    };
}forEach allPlayers;


_start ctrlAddEventHandler ["ButtonClick", {
    
}]; 

buttonSetAction [12402, "
if ((lbCurSel 91831) isEqualTo -1) exitWith {hint  ""Select a player""};
_unit = playerListArray select (lbCurSel 91831); 
_value = ctrlText 11400;
_value = parseNumber _value;
if (_value == 0) exitwith {hint ""You can't bet 0 Dollars""};
if (isNull _unit) exitWith {};
if (life_atmBank < _value) exitWith {
    hint ""You dont have enough money"";
};
closeDialog 0;

[_unit, name player, _value, clientOwner] remoteExecCall ['life_fnc_acceptBet', _unit];

"];

robust brook
#

alr give me one sec

#

what's happening ?

#

not working at all or

silent latch
#

it works on my test sever

#

ive tested it with another player

#

yes

#

i asked pizza boy too and he couldnt help so

robust brook
#

I have time just give me a sec

past wagon
#

@winter rose earlier today you made a bit of code for the init.sqf file that instantly kills any player outside of a certain zone. If i wanted there to be more than one zones, can i just duplicate the code in the init.sqf file, so it appears twice, once for the first zone, and another for the second?

past wagon
#

i want players to have 5 minutes from the start of the game to get to the second zone. Is there a way for there to be multiple init.sqf files so the two pieces of code can run simultaneously?

thick chasm
#

How can I put targets (shoot it) and with a trigger later of cqb, up every targets?

still forum
#

Anyone know of a script way to check if aircraft gear is up/down? Besides checking animation source that is?

winter rose
#

@past wagon you would have to use inAreaArray

potent dirge
#

@past wagon you could spawn a script. I believe spawn runs given commands in another thread so code can run simultaneously

spark kiln
#

Alright so how hard would it be to place 2 static signals on map (multiplayer) and have players try to find them using the spectrum device like a compass.

#

and would it still work if the signal is 10k away ?

desert jolt
#

hey guys im trying to get into scripting but i dont where to write the code and for it to work

desert jolt
#

Ok thx

winter rose
#

@potent dirge in this case, the deadly areas would then overlap and the player wouldn't be fine anywhere, killing everywhere

open star
#

Could also check for inArea and use the OR operator

#

player inArea "areaOne" || player inArea "areaTwo""

worthy spade
#

Anybode knows why this stuttering happens when using setVectorDirAndUp together with setPos? https://www.youtube.com/watch?v=ZLQu1nCTXYo

Here's the code that the cube is runnig (every frame):

_vForward = [0, 0.961524, 0.274721];
_vUp = [0, -0.274721, 0.961524];

cube setPos _position;
cube setVectorDirAndUp [_vForward, _vUp];
still forum
#

are you running that in a loop?

worthy spade
#

Yes.

still forum
#

is it running unscheduled?

#

could be scheduler suspending between setPos and setVec

obtuse quiver
#

Anyone knows how to use the strigoi script from alias?

worthy spade
#
[] spawn {
  while {true] do {
    _vForward = [0, 0.961524, 0.274721];
    _vUp = [0, -0.274721, 0.961524];

    cube setPos _position;
    cube setVectorDirAndUp [_vForward, _vUp];
  }
}

👆🏼 basically like that.

winter rose
#

@worthy spade setPos resets vectorDirAndUp, so sometimes the reset will be visible

worthy spade
#

Shouldn't it always end in the correct rotation regardless, since setVectorDirAndUp runs later?

warm hedge
#

I don't see there's _position. Declaration of while is wrong

#

Or, just a typo?

worthy spade
#

_position is just getPos cube, initialized once.

still forum
#

yeah spawn

warm hedge
#

Probably spawn is why

still forum
#

so its probably suspending

#

easy fix

cube setPos _position;
cube setVectorDirAndUp [_vForward, _vUp];

->

isNil {
cube setPos _position;
cube setVectorDirAndUp [_vForward, _vUp];
};

obtuse quiver
#

i watched his tutorial, i know how the parameters works but i don't know where to place that stuff

#

like in a unit, marker or trigger

worthy spade
#

That worked, but such an odd fix. What does isNil do that keeps it from suspending?

#

Is it just seen as one statement by the scheduler?

winter rose
#

it runs unscheduled

obtuse quiver
#

i think im missing something, when launched it cannot find "AL_strigoi/strigoi.sqf"

winter rose
#

forcing open doors, but you are missing the "AL_strigoi\strigoi.sqf" file!

obtuse quiver
#

it's not in the demo mission folder

#

where it should be

winter rose
#

then, the demo mission is wrong or something else happened ^^

obtuse quiver
#

mmmh, the mission worked, i think im doing something wrong

#

this is what i should put somewhere ["strigoi_1",300,true,0.1,50] execvm "AL_strigoi\strigoi.sqf";

still forum
#

That worked, but such an odd fix.
not really, scheduler can always suspend in scheduled code. It has its 3ms time limit and once it received it it stops.
What does isNil do that keeps it from suspending?
isNil executes its code in unscheduled, freezing the game while it does it, ignoring the schedulers 3ms limit
@worthy spade

obtuse quiver
#

oh god im so stupid...i misspelled the name of the mission, sorry for the unnecessary messages

worthy spade
#

Yeah, that makes sense to me. What's odd is just that isNil seems lika such an arbitrary choice based on its definition, rather than having a more intentional approach, e.g. noSuspend or something. Very useful nonetheless. Thanks for the help.

winter rose
#

it is a workaround, it is not the command's first purpose… but as usual, "life found a way"

ionic orchid
#

does the code within isNil {} add to that 3ms limit? (I'm assuming it would)

winter rose
#

I would say perhaps 🐮 (I think too)

warm hedge
#

3ms limit?

winter rose
#

scheduler's 3ms per script limit

#

scripting-wise, is there a way to see if something is not a vanilla assets such as a mod? (not DLCs)
my only idea right now is to check "author" to see if it is not BI or Bravo One…

#

@warm hedge perhaps? You have XP here

warm hedge
#

Bit please

winter rose
#

"bit please"?

#

(oh, a moment? sure thing, of course - thanks)

warm hedge
#

I mean, yeah. I've currently working on something related to DLCs and MODs

#

Would inherited things (like just a retextured vanilla vehicles/weapons) return as MOD contents?

winter rose
#

wait, you're already on it? 😅 I didn't expect such a QRF!
hm no, only new "models"/"classes"

warm hedge
#

So if the models aren't from vanilla, will say it's a MOD?

winter rose
#

oooh I see where you're headed, a filter by model?

my ideal thing would be "anything non-vanilla/DLC/CDLC"
I am trying to grab all air assets

#

if there is no easy way, I can use a workaround (or rethink the idea), don't dig too much on this really 🙂

#

much appreciated if you help me think already ^^

warm hedge
#

Been thought if is possible to do. Is there any way to check a MOD is a vanilla/DLC/(CDLC)? I've kinda no clue, looks my brain's deadly tired

tough abyss
#

is it possible to 'turn off' a trigger via script? what I have is a auto opening gate way for a checkpoint, However i want the auto open/close to be togglable?

warm hedge
strange seal
#

you should be able to have a trigger with a small radius around the gate, in the on activation field have it open, and on deactivation have it close

winter rose
#

enableSimulation true/false on the trigger works too

strange seal
#

with blufor present or something as the trigger

tough abyss
#

@strange seal Hu? please read my entire question before giving advice ;)

@winter rose ```sqf

if (_state) then {
{_x enableSimulation 0; sleep 0.1;} foreach [t1,t2];
} else {
{_x enableSimulation 1; sleep 0.1;} foreach [t1,t2];
};

i got this whipped up. but stuck with the _x, I know _x means any player on server, but im not sure how to convert it to work for triggers.
winter rose
#

_x means any player on server
no

#

_x means "current iterated item in the forEach"

#

also, enableSimulation doesn't take a number, but a boolean

tough abyss
#

Rightttt. So, in theory that should work with the number changed to boolean?

winter rose
#
_x enableSimulation _state
vague geode
#

Is there any way I can change the sunrise and sunset time?

winter rose
#

changing the date only

wild prairie
#

This may be an odd request, but is there a way to run getArray for every class defined under CfgVehicles?

#

I realize this may is inneficient, but I'm looking to throw an error at the player if a class is missing a value, and I can't predict what other addons may be loaded

#

Specifically, I want to check every uniform class to see if they have a hitpoint, in case they didn't inherit from one of the base classes.

exotic flax
#

If a class is missing a variable it will either show an error anyway (unless errors are disabled).
And the server SHOULD ensure no weird/broken mods are present, so it should never be the case that an object doesn't have a value (or 0 value) if you don't want to

wild prairie
#

I've figured out a (dirtier) way to do it, nevermind, thanks.

oblique arrow
#

Hm okay peeps I need some help again, I'm trying to add the ability to change between mine types to my minelayer but the _selectedMine variable isnt working
I have (in a shortened form with just the relevant bits):

layMines=false;
delay=30;
driverside = side driver truck;
_selectedMine = APMines;

APMines = 100; //Number of AP Mine
ATMines = 100; //Number of AT Mines


truck addAction
[    "Select AP mines",{
        selectedMine = APMines;
    },nil,1.5,true,true,"","(alive truck) && (_selectedMine != APMines)",10,false,"",""
];

truck addAction
[    "Select AT mines",{
        selectedMine = ATMines;
    },nil,1.5,true,true,"","(alive truck) && (_selectedMine != ATMines)",10,false,"",""
];

[] spawn {
  while {true} do {
      while {layMines} do {
        _relpos = truck getRelPos [5, 180];
        if(_selectedMine == APMines) do {
          createMine ["APERSMine", _relpos, [], 0];
          APMines = APMines - 1;
          hint "AP mine";
        };
        if(_selectedMine == ATMines) do {
          createMine ["ATMine", _relpos, [], 0];
          ATMines = ATMines - 1;
          hint "AT mine";
        };
        sleep delay;
      };
      sleep 5;
    };
};
ionic orchid
#

remove the underscore from selectedMine?

#

the addAction is pointing to a different variable, too

oblique arrow
#

But when I test it the two addActions dont show up since the condition with the selectedMine isnt fulfilled and when I start laying mines I get an error that the variable selectedMine isnt fulfilled

#

oh ye I forgot to add the _ to the addActions

ionic orchid
#

afaik _ implies a local variable - but I always prefix local vars with private, so I'm not sure if that's true or not

#

try without the _

oblique arrow
#

Nop no worky

ionic orchid
#

well

#

selectedMine only holds the count of mines, not the type of mine

#

it reads like it would create one of each mine and then stop

oblique arrow
#

selectedMine only holds the count of mines, not the type of mine
does it? it should hold either APMines or ATMines

ionic orchid
#

it just copies the number

oblique arrow
#

ConfusedDog am confused now

ionic orchid
#

try using selectedMine = "APERSMine", etc instead, and have the 100 count in a different variable

oblique arrow
#

Oooooooh now I get what you mean

#

that makes sense, I'll go fiddle around with it

ionic orchid
#
APMines = 100; //Number of AP Mine
ATMines = 100; //Number of AT Mines

selectedMine = 0; //Value is 0
selectedMine = APMines; //Value is 100
selectedMine = ATMines; //Value is 100
oblique arrow
#

Ye

#

Thanks bongocat

#

I was mixing numbers and names without noticing it

ionic orchid
#

yeah, you're most of the way there, you just need to split them into two variables and you'll be sorted

oblique arrow
#

Yep

winter rose
#

can anyone confirm that ```sqf
setMousePosition [safeZoneX + safezoneW, safeZoneY + safezoneH];

warm hedge
#

Bottom-right isn't it?

#

Just tested and it warps to bottom-right

winter rose
#

OK, I run the game interface @ 4K but render 50% (1920×1080)
sooo there may be a bug to be sorted here 🙂
thanks!

warm hedge
#

Oof. Hit the green gangs!

winter rose
#

wait… JUNE

warm hedge
#

Wait, you're not on Dev-Branch Lou?

winter rose
#

I was, but went back to release to play w/ friends :<

warm hedge
#

Just tested and fixed on the latest for sure

still forum
#

I guess you need my special two weeks ahead dev-branch with version 1.98 written on it build

winter rose
#

I wouldn't mind :p

#

perf as well? 😄

still forum
#

maximum perf, with all the multiplayer security features disabled

winter rose
#

hahaha I could use that to dev missions actually 😄 if it's an exe swap

still forum
#

yeah it is, but I guess you need to join my unit for that

winter rose
#

…BI?

ionic orchid
#

I had a problem with setMousePosition if you called it after creating a dialog - it would snap some other position and ignore what you gave it

#

I was using it to put the mouse position back where it last was, in the end I didn't find any decent way to do it - making it apply the next frame meant you'd get one frame of the mouse being in the wrong position

fresh cape
#

Anyone know why this happens? I run this code whilst in one of the listed vehicles

_blockedAir = ["CUP_O_Ka50_SLA","CUP_B_AH1_DL_BAF","CUP_B_AH1Z_DYNAMIC_USMC","CUP_B_AH64D_DL_USA","O_Heli_Attack_02_F","CUP_B_Mi35_Dynamic_CZ_Ram","CUP_O_Mi24_P_RU","I_Plane_Fighter_04_F","B_Plane_Fighter_01_Stealth_F","B_Plane_Fighter_01_F","O_Plane_Fighter_02_F","O_Plane_Fighter_02_Stealth_F","CUP_B_AV8B_Empty","CUP_O_SU34_CSAT","O_T_VTOL_02_infantry_F","O_T_VTOL_02_vehicle_F","CUP_B_F35B_Stealth_USMC","CUP_B_F35B_USMC","O_Plane_CAS_02_F","CUP_O_Ka52_RU","CUP_O_Ka52_GreyCamo_RU","CUP_O_Ka52_Blk_RU"]; 
if ((typeOf vehicle player) in _blockedAir) then 
{ 
 systemChat typeOf vehicle player;  
 systemChat "is blocked";  
};```
When in a **CUP_B_F35B_Stealth_USMC** etc works fine and shows the systemChat
When in a **CUP_B_AH1Z_DYNAMIC_USMC** for example doesn't work

But if i'm pilot or gunner in **CUP_B_AH1Z_DYNAMIC_USMC** and run `systemChat typeOf vehicle player; ` in console it shows correct output `CUP_B_AH1Z_DYNAMIC_USMC`
or running this whilst in the vehicle
```sqf
if ((typeOf vehicle player) == "CUP_B_AH1Z_DYNAMIC_USMC") then
{
    systemChat typeOf vehicle player;
};```
Returns correct and shows system chat
copper raven
#

yea a simple google search with CUP_B_AH1Z_DYNAMIC_USMC shows that there are some casing mismatches, in string comparisons are case sensitive

fresh cape
#

Thank you

exotic flax
#

Simply use toUpper on both sides of the equation to "fix" that problem

winter rose
#

toLowerANSI (or toUpperANSI yes blobdoggoninja)

ionic orchid
#

(finds & replaces all toUpper/toLower with ANSI versions)

calm bloom
#

Hello everyone! Have anyone encountered this?

20:04:26 Failed attempt to execute serverCommand '#monitorDS 5' by server.```
#

i dont really get what is wrong, server password is directly copied from the script

#

mean server admin password

#

are there any whitelist configs?

fair drum
#

did you log in to the server?

jade abyss
#

i just know #monitor N 🤔

fair drum
#

#monitorDS does the monitor on the console of the server itself. you have access to the box?

#

cause if you want to zeus or play, its probably better to log in to admin and just use #monitor

calm bloom
#

i use

"password" serverCommand "#monitorDS 5";```
#

i execute that on server script

jade abyss
#

Did you set the serverCommandPassword?

#

Or just the adminPW?

calm bloom
#

hm

#

probably not

#

you mean that its server.cfg parameter, right?

jade abyss
#

Yeah

calm bloom
#

thank you

fair drum
#

whats a good way to make a AI turret rotate at a constant speed?

jade abyss
#

model config

#

you mean that its server.cfg parameter, right?
@calm bloom Tested locally, worked for me. All fine on your side?

calm bloom
#

Yep, thank you again for the tip

#

i was using wrong parameter

#

didnt know that servercommandpasword exist

jade abyss
#

me neither, until i read it on the page

fair drum
#

i mean without modding the configs.

#

like i know there is lookAt but didn't know if there was a "rotate by x degrees" command

calm bloom
#

ha ha , holy cow it is even highlited in the top

#

shame i have missed that)

potent dirge
#

Is there really any difference between the class configs of units other than their loadouts (with the exception of traits like Medic, Engineer, Demo)

fair drum
#

depends, some mods add extra stuff. Like OPTRE adds the ability to fall large distances with their "Bulldog" class.

potent dirge
#

Bulldog class? What's that?

fair drum
#

its their jet pack class

potent dirge
#

Oh wow, I never really messed with the jetpack in OPTRE because I couldn't get it to work without dying

#

Are the militia armors still OP?

fair drum
#

idk haven't played with in a long time

#

it frustrated me with how broken the maps were

#

ai shooting through walls and stuff

past wagon
#

@winter rose i have figured out how im gonna have a second zone that waits 5 minutes from the start of the game before killing all players outside

#

i just need one zone active at a time

#

not both

#

so i need the first part of the code to repeat on loop 300 times, since there is a sleep 1 in the code, repeating it 300 times will last 5 minutes. then it moves on to the second part of the code, which loops indefinately

#

First part:

if (hasInterface) then
{
  [] spawn {
    while { true } do
    {
      waitUntil { sleep 1; alive player };
      if (vehicle player == player && !(player inArea "Zone1")) then
      {
        player setDamage 1;
      };
    };
  };
};
#

Second part:

if (hasInterface) then
{
  [] spawn {
    while { true } do
    {
      waitUntil { sleep 1; alive player };
      if (vehicle player == player && !(player inArea "Zone2")) then
      {
        player setDamage 1;
      };
    };
  };
};
#

how would i go about creating these loops?

#

also the two pieces of code are identical except for "Zone1" and "Zone2"

potent dirge
#

waitUntil { sleep 1; alive player }; will not execute

#
if (hasInterface) then {
    [] spawn {
        waitUntil {vehicle player == player && !(player inArea "Zone2")};
        player setDamage 1;
    };
};

Sorry for large tab formatting

willow hound
#

@potent dirge Why should it not execute?

potent dirge
#

Doesn't waitUntil only take conditional statements?

willow hound
#

It takes code that must return a boolean, and the given code does return a boolean - after suspension.

#

It does work, just tested it to make sure 😄

potent dirge
#

I stand corrected then

willow hound
#

But your code is of course the better approach nonetheless.

potent dirge
#

@past wagon why not use triggers? Just set them to activate when a player walks in. You can do the time thing by running time >= 300 for 5 minutes from mission start, you can use that for your conditional

#

And make it repeatable unlike my code above which will only run once

robust brook
#

missionNamespace or publicVariable? for broadcasting variables to all clients, executed server side

past wagon
#

@potent dirge the reason i am not using triggers is because the area is a circle, and everywhere outside of the circle is a death zone, so there is no way to put triggers all around the area really.

#

the code already works for the first zone

#

i just need it to run the first piece of code 300 times, then move to the next piece of code and run it indefinately

#

i have no knowledge of scripting

#

i just need someone to explain how to create a loop

potent dirge
#

If you really want a script try this untested quick function I made

/*
    Usage: [_area, _time] spawn fn_deadZone
        _area = Area you're working with
        _time = time from mission start in seconds you want zone to be active
*/


params ["_zone", "_wait"];



if !(hasInterface) exitWith {};

waitUntil {!(player inArea "_zone") && time >= _wait};
player setDamage 1;
past wagon
#

listen

#

i dont need new code

#

i just need to put the code that i have into a loop

#

into 2 loops actually

willow hound
#

@robust brook publicVariable, I'm pretty sure missionNamespace is local to each machine.

robust brook
#

@past wagon are you wanting to call it in a trigger?

past wagon
#

no this is all in the init.sqf file

#

it is working great right now

willow hound
#

@past wagon Can players join your mission in progress?

past wagon
#

no

#

they have to be playing from the start

robust brook
#

@willow hound missionNamespace = Returns the global namespace attached to mission.

potent dirge
#

Okay sorry if you've done this before but can you outline what you're trying to achieve with your script please

willow hound
#

@robust brook Yes, but global as in global variables such as MyVar = 0;, not multiplayer global.
I think at least.

past wagon
#

HERE IS WHAT I NEED

Loop 300 times:

if (hasInterface) then
{
  [] spawn {
    while { true } do
    {
      waitUntil { sleep 1; alive player };
      if (vehicle player == player && !(player inArea "Zone1")) then
      {
        player setDamage 1;
      };
    };
  };
};

Loop forever:

if (hasInterface) then
{
  [] spawn {
    while { true } do
    {
      waitUntil { sleep 1; alive player };
      if (vehicle player == player && !(player inArea "Zone2")) then
      {
        player setDamage 1;
      };
    };
  };
};
#

can anyone help me understand how to do this?

potent dirge
#
_loop = 0;
while (_loop < 300) do {
    // YOUR CODE
    _loop = _loop + 1
};

Simplest way I can think of to loop 300 times, although I would suggest restructuring your code instead of looping 300 times

#

Oh and put it into a separate script don't jumble everything in your init.sqf

past wagon
#

i dont know how to script

#

im just working with the code i have

#

also why cant i just put it in the init.sqf file?

robust brook
#
//Loop 300 times
[] spawn {

  if !(hasInterface) exitWith {};

  for "_i" from 1 to 300 do {

    if (vehicle player isEqualTo player && !(player inArea "Zone1")) then {
      player setDamage 1;
    };
  };

};

//Loop Forever
[] spawn {

  if !(hasInterface) exitWith {};

  for "_i" from 0 to 1 step 0 do {

    if (vehicle player isEqualTo player && !(player inArea "Zone1")) then {
      player setDamage 1;
    };
  };

};
#

@past wagon

potent dirge
#

Just make a new file name it whatever you want ending with .sqf e.g. zone.sqf. Then paste [] execVM "zone.sqf" in your init.sqf

past wagon
#

yo

#

im gonna try that

#

so this will just instantly kill anyone outside of those zones?

#

but wait

#

//loop 300 times and //loop forever arent actually parts of the code, are they?

#

i dont know how to code

#

i literally have no idea how to loop something

willow hound
#

// is a comment in the code.

past wagon
#

yea

robust brook
#

anyone in the area will die basically

past wagon
#

no

#

i need anyone OUTSIDE

#

the area to die

robust brook
#

oh yeah nvm

#

lol

past wagon
#

I ALREADY HAVE THE CODE

#

i just need someone to help me loop it

robust brook
#

I gave you the example

past wagon
#
if (hasInterface) then
{
  [] spawn {
    while { true } do
    {
      waitUntil { sleep 1; alive player };
      if (vehicle player == player && !(player inArea "Zone1")) then
      {
        player setDamage 1;
      };
    };
  };
};

this code does exactly what i want, i just need someone to put it into a loop

robust brook
#

it is already in a loop?

surreal peak
#

you got cba installed?

past wagon
#

well

surreal peak
#

or just vanilla

past wagon
#

no

#

vanilla

#

i have already explained why i want it looped

willow hound
#

What @robust brook has given you is exactly what you want.

#

Well, what you requested at least.

past wagon
#

@robust brook i am going to put the code twice, first with "Zone1" and then with "Zone2"

potent dirge
#

@past wagon Why do you want it looped again, sorry if you've explained

past wagon
#

^^^

#

i want it to loop the code for zone1 300 times, then move on to zone two, where it will loop for the rest of the mission

#

zone2 is inside zone1

potent dirge
#

300 times for 5 minutes?

robust brook
#
//Loops Forever
while { true } do {
  //Anything in here will get repeated forever
};

//Another way to loop forever
for "_i" from 0 to 1 step 0 do {
  //Anything in here will get repeated forever
};
past wagon
#

yes

#

5 minutes

winter rose
#

5 × 60 = 300

surreal peak
#

woah

past wagon
#

@robust brook thanks

#

but i also need a way to loop something 300 times

potent dirge
#

You can just use the function I made you earlier then, it does exactly that

past wagon
#

ok let me look

willow hound
#

sleep 1; looped 300 times is most likely not going to be five minutes though.

potent dirge
#

I used time

surreal peak
#

he showed how to loop 300x

past wagon
#

but is there a way i can loop the code i already have without changing it

#

?

#

like what @robust brook showed me but for 300 times instead of indefinately

#

i want someone that i can just put around my code

surreal peak
#

you can

past wagon
#

*someTHING

#

lol

surreal peak
#

just move the brackets

past wagon
#

wait

#

can you give me an example?

potent dirge
#
_loop = 0;
while (_loop < 300) do {
    //YOUR CODE HERE
    _loop = _loop + 1
};

Same code I showed you earlier or you can use @robust brook method both will work

past wagon
#

ok thanks nash

#
while { true } do {
if (hasInterface) then
{
  [] spawn {
    while { true } do
    {
      waitUntil { sleep 1; alive player };
      if (vehicle player == player && !(player inArea "Zone1")) then
      {
        player setDamage 1;
      };
    };
  };
};
};

does this look good for the infinite loop?

robust brook
#

bro just run what I gave you without the comments

potent dirge
#

So long as while (true) is there at the top it will loop indefinitely

past wagon
#

ok but do i need to indent the brackets at all?

#

do i need to indent the loop code lines?

surreal peak
#

no

potent dirge
#

No but it makes your code look nicer for others and makes it easier to read

past wagon
#

ok

surreal peak
#

makes look nice

past wagon
#

so that code that i just posted looks perfect?

#

nothing wrong with it?

robust brook
#

lol

surreal peak
#

teset it

past wagon
#

ok

potent dirge
#

In my opinion you might need to restructure, but it's your code and if it works for you, it works

willow hound
#

@past wagon That code you posted will not work.

#

It will spawn new endless loops forever.

past wagon
#

why not?

#

ughhhh

#

maybe you guys dont understand what i want

#

i will try my best to explain it again

potent dirge
#

Yes please do

past wagon
#
loop [MY CODE] 300 times then loop [MY CODE] forever
#

well the two parts of my code are different

exotic flax
#

Looks like a "if player outside of area, kill it" script, just terribly written 🤷‍♂️

past wagon
#

umm

#

does anyone want to call me?

#

so i can explain this better?

potent dirge
#

Again I will suggest restructuring your code, you don't need to stick to the one you've written there are better ways

past wagon
#

i dont know how to code

exotic flax
#

What are you trying to achieve?

past wagon
#

^^^

willow hound
#

This is great entertainment.

past wagon
#

i need to work with the code i have, because i dont know how to script

#

i have zero scripting knowledge, but if people help me, i can figure out how to make it work

exotic flax
#

We can help you with your code if we know what you want...

past wagon
#

ok let me try again

#

to explain this

willow hound
#

Not again...

robust brook
#

comedy

potent dirge
#

I think he wants to kill any players that are outside a safe zone, after 5 minutes from mission start

#

Right?

past wagon
#

There are 2 zones, "Zone1" and "Zone2". "Zone1" is the bigger zone and "Zone2" is inside of it. I want players to die as soon as they leave "Zone1". After 5 minutes from the start of the mission, i also want players to die as soon as they leave "Zone2". Players have 5 minutes from the start of the game to enter "Zone2" (which is inside of zone1)

#

its like a battle royale, where the zone restrictions get stricter

#

and you need to move in closer

potent dirge
#

I made a function for you that works with as many zones as you want

exotic flax
#

Easiest is to have a single "kill script" and just make the area smaller

past wagon
#

well

#

i dont know how to do that

#

i need to work with what i know how to do

#

i am kinda knew to arma 3 editing

potent dirge
#

Well this is an opportunity to learn and improve

past wagon
#

yea

#

after zone2 restriction is active, i dont need the zone1 restriction anymore, since zone2 is inside of zone1

#

I want the zone1 restriction to last 5 minutes, and then it stops restricting zone1 and starts restricting zone2 forever

winter rose
#

so you don't want this to loop 300 times, you want this to last 300 seconds

past wagon
#

yea, but within the code there is "sleep 1" which means that if i loop it 300 times, it will last 300 seconds

potent dirge
winter rose
#

(missing a sleep)

past wagon
#

@winter rose is there a better way to make it last 300 seconds than to loop it?

willow hound
#

Looping sleep 1; 300 times means it is going to last at least 300 seconds.

past wagon
#

why?

winter rose
#

is there a better way
no (and no need to tag me every time, I read the channel; also, plenty of people can answer here)

past wagon
#

but i dont think there is much other code around the "sleep 1" so it wont last much more than 300 seconds

#

ok

winter rose
#
private _endTime = time + 300;
while { sleep 1; time < _endTime } do
{
  // ...
};
past wagon
#

ok let me put that into my code...

winter rose
#

@willow hound you didn't see anything 👀

willow hound
#

Nope

past wagon
#

is this good?

private _endTime = time + 300;
while { time < _endTime } do
{
  if (hasInterface) then
{
  [] spawn {
    while { true } do
    {
      waitUntil { sleep 1; alive player };
      if (vehicle player == player && !(player inArea "Zone1")) then
      {
        player setDamage 1;
      };
    };
  };
};
};
robust brook
#

lol

potent dirge
#

bruh

past wagon
#

what

willow hound
#

Almost, you're getting there.

robust brook
past wagon
#

what is it?

winter rose
#

for 300s, you are spawning eternal (while true) loops

past wagon
#

ok

#

then what did you want me to do instead with that piece of code?

potent dirge
#

throw it away

robust brook
#

fr

past wagon
#

IM SO CONFUSED

#

WHAT DO YOU MEAN???

potent dirge
#

The code you wrote earlier with all the while trues, throw it away

robust brook
past wagon
#

i dont write code

#

i have never written code

fair drum
#

if I do

[] spawn { while { blah } do { blah } };
if (blah) then { blah };

will my code move to the if then statement while the while loop is running?

past wagon
#

the code i have was written by Lou Montana

winter rose