#arma3_scripting

1 messages Β· Page 721 of 1

vague cipher
#

yea you could do that too

little raptor
#

that's an extremely unoptimized code

#

tho the blame falls on RavenSunray I guess...

torn beacon
#

Thanks for explaining πŸ™‚

#

hahaha yeahhhh I didnt exactly give @vague cipher the best foundation

vague cipher
#

You could broadcast it out instead and let the client computers on the otherside determine themselves and cut out the necessity for O(N*M) time on the local computer that then needs to propagate to others anyway but πŸ€·β€β™‚οΈ

little raptor
#

wat? that's even worse

vague cipher
#

In terms of network I would assume so yes. Either way I do not see a method that you'd optimize it further aside from caching who are the admins and skipping out doing iterations over allPlayers constantly, or caching the resultant of evaluating their name already for admin or not as you don't need to keep evaluating for it past the first time.

#

I feel like its not very productive either in the end to point out if something is unoptimized as the purpose is to learn, optimization means nothing if someone does not understand code anyways as optimization typically involves unintuitive code for beginners

torn beacon
#

My group enforces names so that this shouldn't be an issue

little raptor
#

ofc in that case it wouldn't "slow down the game"

vague cipher
#

I think you're missing some steps to how you should be learning programming though. You don't teach people advanced stuff before they know the basics.

Optimization involves counter-intuitive changes at times, or much more complex data structures, and other nitpicky stuff. It's simply not productive to a beginner to be overwhelmed with information when they don't even know some basics on how to even interpret such information or algorithm properly.

Its skipping some steps and does not contribute to a better programmer overtime as you don't have the fundamental knowledge to understand why a HashMap is better than an Array in some situations, while other situations an Array is better instead despite the perceived benefits of a HashMap.

You should be building people's knowledge up bit by bit and not give them something they can't clearly handle just yet.

There's a reason why software engineering you learn the fundamentals of data structures first (at least in my case at my time in school) vs algorithms.

Having fundamental knowledge is the basic foundation at being a good and efficient software engineer as that skill set lets you tack on any type of problem and be able to decipher and understand solutions posted online even if they get increasingly complex in implementation

#

There's a reason why in tech interviews they smile more on the people that have unoptimized algorithms but could clearly explain and talk through what they're thinking of and their process at obtaining the solution vs people that just immediately skip to the optimized problem but couldn't explain it as well.

ebon citrus
vague cipher
#

What? My stuff wasn't software design at all lol, it was just computer science. Software design is modelling out how to properly implement something so that it satisfies the product needs while also being good architecturally and technical-wise.

Either way yes, a discord server is not the best place to properly learn how to get into computer science from scratch, but they should also be given stuff that should ideally be adjusted to their skill level or they're just going to get confused and both parties will end up being frustrated imo.

ebon citrus
vague cipher
#

I agree with that lmao

#

SQF is a nightmare syntax wise

#

I would say if they want to get an easy job in the industry to just learn JavaScript and React-Native instead

#

Highly marketable skills and in high demand typically. Especially if you are capable of demonstrating true full-stack engineering capability, or have some focus on back-end side of things

#

I would say that regardless of language, helping them understand the pseudocode which is language independent is better than nitpicking over optimization details while still providing them an implementation that actually works in the actual scripting language at hand. Over-thinking and over-optimizing when something isn't a problem is not a good trait to have in reality as well. Of course, every little bit adds up in a game over time, however its more productive a majority of the time to get your feature out first before sitting down and optimizing it if it really becomes a problem, esp something as low priority and quite light as this would be.

ebon citrus
vague cipher
#

I mean the game is not that great to be real so there is some merit there. But yes, bad scripts do contribute to bad performance.

If people don't optimize then that's their problem, I do not see why you would want to foster an environment that is less conducive to people learning easier and are fine with a "they should be frustrated" type mindset. Scripting in games is usually the gateway for people to get into computer science and into the industry as a whole.

Over-focusing on optimization is a really bad trait to have.

However I see that we agree to disagree here so I'll drop this convo πŸ‘

unique sundial
#

Do yo realise that handledamage fires multiple times and is very sensitive to any damage and you are making it remote execute a comnand from it. This will cause network spam the least

torn beacon
torn beacon
copper raven
copper raven
#

I hate this "undefined" crap so much lol, it's clearly defined in the first script but is somehow breaking on the second iteration of the loop

ts_patrol_fnc = [] call compileFinal preprocessFileLineNumbers "TS\ts_patrol_fnc.sqf";
ts_banditcamp_fnc = [] call compileFinal preprocessFileLineNumbers "TS\ts_banditcamp_fnc.sqf";

you certainly aren't storing the compiled code, you are compiling, calling it, and then storing it's result (whatever that might be), then later, you're trying to spawn whatever either of those functions returned.

unique sundial
torpid pewter
#

Is there a script command I can use that I can trigger with the in game debug console to make a player fire continuously?

I'm testing some sound related things on a dedicated server and I connect to it with two clients on the same PC and I want to alt tab between clients to test and have one or both players fire while alt tabbed.

torn beacon
unique sundial
#

just make sure you add them with addMPEventHandler

little raptor
torpid pewter
#

I tried oneachframe {player forceWeaponFire ["arifle_MXC_Holo_pointer_F", "single"]; player setAmmo [currentWeapon player, 1]};
which while absolutely hilarious because it's firing faster than a minigun, is a little overkill i just need it to fire a shot every half second or so. The sleep command doesn't work with oneachframe so I'm not sure what to do.

#

Well changing that "1" to any integer above 1 stops the minigun behavior, but I guess now I know an instant script to turn any infantry weapon into a minigun.

winter rose
torpid pewter
#

Thanks that is useful, even though I was able to get it working just by changing the number. Do you have any idea why setting that ammo to 1 causes it to fire literally as fast as your framerate (so 60 fps being 60 rounds a second) instead of the weapons max fire rate? I even got it to work on a slammer by putting

oneachframe {player forceWeaponFire ["cannon_120mm", "player"]; player setAmmo [currentWeapon vehicle player, 1]};
winter rose
#

I guess it considers that emptying the magazine sets the bullet reload time to zero, therefore allowing for the MG effect

torpid pewter
#

Well all I know is that this definitely is more of a feature than a bug. The AI will never see it coming πŸ”«

cold pebble
#

Anyone of the top of their head know if ```sqf
markerPos "aMarkerWhichDoesn'tExist"

returns [0,0,0], [], or a different error?
cold pebble
#

And if I was to deleteMarker this marker, it'd just silently fail iirc

little raptor
#

Yeah

pastel pier
#

I require your help once more. I am still looking at simple objects and super simple objects. I am a bit confused how things work. I have this code that in my interpretation will make a simple object with door 1, door 1 handle and glass 1. Be in the animated open state.

[["Land_i_House_Big_02_V1_F","A3\Structures_F\Households\House_Big02\i_House_Big_02_V1_F.p3d",0,2.884,[["door_1_rot",1],["door_1_handle_rot_1",1],["glass_1_hide",1]],[]],[180,5,5], 0,false,false] call BIS_fnc_createSimpleObject; 

However the opposite is happening. When i change the last parameter it creates a super-simple object with open door and glass. While this is supposed to be just a 3d model. Can anyone enlighten me what could be possible be wrong in my thinking?

[["Land_i_House_Big_02_V1_F","A3\Structures_F\Households\House_Big02\i_House_Big_02_V1_F.p3d",0,2.884,[["door_1_rot",1],["door_1_handle_rot_1",1],["glass_1_hide",1]],[]],[180,5,5], 0,false,true] call BIS_fnc_createSimpleObject; 
little raptor
#

Also there's no need to use the BIS function... meowsweats

pastel pier
#

Why not it's supposed to make your live easier.

little raptor
#

I don't see how that's easier 🀷

pastel pier
#

Instead of 123 lines of code i now just need 3. So back to topic the super simple object that is supposed to be just a 3d model can have it's doors animated open but a simple object that has extra functionality like retexturing can not animate it's doors.

little raptor
#

Just try the normal way and report back

#
_obj = createSimpleObject ["class", _pos];
_obj animate ...
#

If you replace classname with model path it becomes a super simple object

#

Now do you see 123 lines of code? thonk

#

(the last line could be a forEach loop)

silk ravine
#

Sooo looking at BIS_fnc_endMissionServer and addMissionEventHandler MPEnded, am I completely blind or does ArmA actually does not transmit which side "won" the mission? Is there no Mission variable I can read that is filled with that ?

fair drum
silk ravine
fair drum
dreamy kestrel
#

Stupid question perhaps, but how do you find the default map control for use with primitives such as drawEllipse? Or is it truly like the docs suggest?

private _defaultMapCtrl = findDisplay 12 displayCtrl 51;

https://community.bistudio.com/wiki/drawEllipse
Thanks...

#

Better question, once drawn, how do you erase that drawn element? without necessarily clearing the whole map.

willow hound
#

The example suggests that it needs to be drawn every frame, so you erase it by not drawing it anymore.

dreamy kestrel
#

huh okay interesting

#

so if we setup a service or callback etc then we need to do a bit of bookkeeping to remember that we can tell 'stop'.

little raptor
#

Wat? meowhuh

#

I have no idea what you just said, but anyway, the correct way to draw is using an array in draw3D EH

#

Then you fill that array with what you want to draw

#

And when you don't want to draw you just clear the array

dreamy kestrel
#

in terms of creating or deleting an ellipse 'object' let's say. done in terms of the 'Draw' EH, which implies some bookkeeping must be done.

little raptor
#

Well for simple primitives you can just use markers

#

They're faster too

dreamy kestrel
#

yes I understand; I asked about ellipse specifically though.

little raptor
dreamy kestrel
#

sure, I just add a variable on the MAP control itself. caller responsibility to remember to remove the event handler, i.e. delete the 'shape' variable on unload, let's say, etc. ez pz.

astral lynx
#

is there a way to pass a variable to an event handler w/o making it global?

copper raven
#

what event handler in particular

astral lynx
#

key down

#

UIEH

copper raven
astral lynx
#

kk thx ill look into it

pulsar aspen
#

howdy, can somebody tell me where I can find the script for enabling decon showers? google didn't help

ebon citrus
#

Or try this section

#

Probably BIN_fnc_deconShowerAnim

If my guess isnt super wrong

#

Yep, you can make pretty much any object spray water with thay

#

πŸ˜‚

pine wind
#

Does anyone have a script to put text onto the screen when you first spawn?

copper raven
#

there are many engine commands, and bis functions that display text on screen, pick one and run it in an init script, preferably initPlayerLocal

pine wind
#

I literally asked if anyone has a script. Not if there are any

copper raven
#

they should have examples that you can use

pine wind
#

Anyway to use scripts in pub zeus servers?

#

Also nothing about text shows up

copper raven
copper raven
brazen lagoon
#

@copper raven is there an event handler that's called right before death, and only once?

ebon citrus
#

What is your use case for such eventhandler anyways? @brazen lagoon

brazen lagoon
#

i'm using selectPlayer to swap unit skeletons dynamically

#

but I want those skeletons swapped back on death

#

Killed doesn't seem to be working correctly

ebon citrus
#

Why not?

brazen lagoon
#

well I don't know, that's what I'm trying to figure out

ebon citrus
#

What are you using to swap skeletons?

brazen lagoon
#

selectPlayer

ebon citrus
#

And by skeletons, i suppose you mean swapping controllable character

brazen lagoon
#

yes, the wh40k mod has different skeletons for different units

#

and if you swap loadouts without also swapping skeleton then weird things happens

ebon citrus
#

🀨

brazen lagoon
#

I don't know why Killed doesn't work as I expect

#
_new_unit setVariable ["OLD_TYPE", _type, true];
private _eh_index = _new_unit addEventHandler ["Killed", {
    _this spawn {
        params ["_old_unit", "_killer", "_instigator", "_useEffects"];
        private _eh_id = _old_unit getVariable "SWAP_EH_INDEX";
        if !(isNil "_eh_id") then {
            _old_unit removeEventHandler ["Killed", _eh_id];
        };
        private _type = _old_unit getVariable "OLD_TYPE";
        private _group = group _old_unit;
        if (isNil "_group") then {
            _group = createGroup (side _old_unit);
        };
        _new_unit = _group createUnit [_type, position _old_unit, [], 5, "NONE"];
        _new_unit setVariable ["SPAWNED_AI", true];
        sleep 10;
        [_old_unit, _new_unit] call SWAP_WITHOUT_EH;
        _new_unit setDammage 1;
    };
}];```
I would think that this would selectPlayer into the old unit classname on death, but it does not work as I expected
#

maybe I'm better off using MPRespawn and swapping the loadout into the old unit.

ebon citrus
#

What is it doing

#

Also, why do you kill the new unit too?

#

At the end _new_unit setDammage 1:

#

Is this intentional?

brazen lagoon
#

because it is triggered on kill. so I want the player to die. so that when they respawn they respawn with the proper skeleton

ebon citrus
#

So...

#

What youre doing here upon player death, is cretaing a copy of the player character that just died, moving control to that and then killing it

brazen lagoon
#

yes

#

not a copy of the player character, a copy of the unit the player spawned as originally

#

but yes

ebon citrus
#

Swap player contorl to that

brazen lagoon
#

no

ebon citrus
#

No?

brazen lagoon
#

_new_unit setVariable ["OLD_TYPE", _type, true]; this sets the type of the old unit on the new unit

#
``` this gets the old unit's type from the unit that is about to die
ebon citrus
#

But moving on

#

What does happen?

brazen lagoon
#

you go to the respawn screen, after like 20 seconds you respawn automatically without clicking respawn

ebon citrus
#

What do you expect should happen?

#

Not going to the respawn screen? After you just killed the player?

brazen lagoon
#

please be patient I'm not done explaining

#

respawn screen is expected

ebon citrus
brazen lagoon
#

when you respawn you spawn as the unit you expect (the one selected in the respawn menu), but you don't actually click respawn, which is odd IMO

#

but in any case you're the right unit for a few seconds, and then after ~5 or so seconds you get swapped back into the unit you had before respawning, but with the post-respawn unit's loadout from the editor

ebon citrus
#

@brazen lagoon could try removing the sleep 10 from your code

#

If you want to override the respawn behaviour, youre going to ahve to make it yourself

brazen lagoon
#

yeah that doesn't fix it

#

what do you mean?

ebon citrus
#

On killed, swap to another camera and do your business on the background

brazen lagoon
#

My current plan is just to use the Respawn EH

ebon citrus
#

It is unlikely the default respawn functions work with this

#

I noticed you said "selected loadout", so i presume youre using one of the respawn templates

#

No?

#

Well, the one selected in the "respawn menu"

brazen lagoon
#

yes

ebon citrus
#

What respawn menu

#

Is this your own?

brazen lagoon
#

the vanilla one

ebon citrus
#

Yeah, dont use that

brazen lagoon
#

it makes sense that there's conflicts with that yeah

#

I think I'm just going to use the Respawn EH

ebon citrus
#

The template respaw functions conflict with everything on respawn

brazen lagoon
#

and use fade out/in

ebon citrus
#

You do you

#

The smart choice would be to do your shenanigans after respawn if you insist on using the vanilla templates

#

They are very temperamental

brazen lagoon
#

yes thats what I plan on

ebon citrus
#

πŸ‘

brazen lagoon
#

Is there a better respawn template I should be using?

ebon citrus
#

Literally anything

brazen lagoon
#

I'd like to avoid having to do it all myself but an immersive respawn screen that like, shows an overhead camera or something on the point you wanna spawn at would be hype as hell

brazen lagoon
#

boo

#

yeah maybe at some point

ebon citrus
#

?

brazen lagoon
#

just a lot of work

ebon citrus
#

Yes? And?

#

Get used to it if youre going to script for arma

#

Youre going to have to do a lot of work and find weird workarounds

brazen lagoon
#

I'm aware, that's what I'm doing right now

#

but I would prefer to spend the time on high value areas

ebon citrus
#

Dont be afraid of getting wet when swimming

#

My father would say

brazen lagoon
#

hence why I was asking if there was an existing template i could use

ebon citrus
#

Or literally anything off the web

brazen lagoon
#

yes, the latter is what I was asking

ebon citrus
#

Find one you like and use that

brazen lagoon
#

I'm searching for them and I don't see anything obvious by searching for 'arma 3 custom respawn template'

ebon citrus
#

Make sure to attribute the creator

tidal ferry
#

Hey, quick question

#

So if we're using BIS_fnc_replacewithsimpleobject en masse (which I know isn't recommended implementation but bear with me)

#

And we're getting tons o' freezing at the start of missions because calling it in object inits is overloading the unscheduled script

#

Would the code:

#

this spawn {[_this] call bis_fnc_replacewithsimpleobject}

#

Help to rectify?

winter rose
#

no

tidal ferry
leaden haven
#

learn to script faster code.

tidal ferry
#

Y i k e s

leaden haven
#

This is a better implementation.

[this,true] call BIS_fnc_replaceWithSimpleObject;
tidal ferry
# leaden haven This is a better implementation. ```ada [this,true] call BIS_fnc_replaceWithSim...

I'm afraid this solution doesn't really address the root of the problem we're encountering πŸ™‚

The problem we're encountering is that because we're executing this script en masse at the start of the mission, it's clogging up in the unscheduled environment and spiking performance at the start of the mission. It usually levels off as it works through the queue, and after start/during mission we gain some benefit from using simple objects instead of large amounts of simulated objects, but we're currently looking into ways to better optimize our construction-heavy missions

The proposed solution which I needed clarification on is to instead spawn the function so that it executes in the scheduled environment, rather than the default unscheduled environment of object init, that way the engine can work through it at a more reasonable pace and we don't have as big spikes (longer execution time is a worthwhile tradeoff in our situation)

What I clarified was that using BIS_fnc_replacewithsimpleobject en-masse isn't the intended use case, so while I'm perfectly happy to admit I'm far from an expert scripter here, I'm not sure if this solution is necessarily better for our team's use-case πŸ˜›

unique sundial
vital copper
#

was wondering if someone could help me out with my inidbi and tell me what exactly i'm doing wrong

#

its not big but too big to post in here

wanton swallow
#
_camera1 = "camera" camCreate (getPosATL player);
_camera2 = "camera" camCreate (getPosATL player);

_camera1 cameraEffect ["Internal", "Back", "rtt1"]; //--All fine, i have PIP in my Control--
sleep 5;
_camera2 cameraEffect ["Internal","back"]; //--_camera1 come broken, i have black screen in my Control--

How to fix this issue?

little raptor
wanton swallow
little raptor
wanton swallow
# little raptor is this your actual code? I don't see anything wrong
_camera = "camera" camCreate [((getPosATL player) # 0) + _randomValue, ((getPosATL player) # 1)+_randomValue,
                ((getPosATL player) # 2) + 500];
_camera cameraEffect ["Internal","back"];

//[] execVM "Client\Player\fn_DisplayIntroPIP.sqf";

_camera camSetTarget player;
_camera camPreparePos ([((getPosATL player) select 0) + 21,((getPosATL player) select 1) + 21,((getPosATL player) select 2)+ 25]);
_camera camPrepareFOV 0.700;
_camera camCommitPrepared 30;

Client\Player\fn_DisplayIntroPIP.sqf

_introWatchUnitDisplay = findDisplay 46 createDisplay "RscDisplayEmpty";
_ctrl = _introWatchUnitDisplay ctrlCreate ["RscPicture", -1];
_ctrl ctrlSetPosition [-0.25, 0.5, 0.75, 0.5];
_ctrl ctrlSetText "#(argb,1024,1024,1)r2t(rtt1,1.0)";
_ctrl ctrlCommit 0;

introWatchUnitCamera = "camera" camCreate (ASLtoAGL getPosASLVisual player);
introWatchUnitCamera cameraEffect ["Internal", "Back", "rtt1"];
#

If uncomment //[] execVM "Client\Player\fn_DisplayIntroPIP.sqf"; then camCommitPrepared 30 and all other action with _camera will not execute.

#

Other way, if i call [] execVM "Client\Player\fn_DisplayIntroPIP.sqf and then do _camera cameraEffect ["Internal","back"];: PIP become broken.

little raptor
# wanton swallow ```sqf _camera = "camera" camCreate [((getPosATL player) # 0) + _randomValue, ((...

maybe try this:

_camera = "camera" camCreate [((getPosATL player) # 0) + _randomValue, ((getPosATL player) # 1)+_randomValue,
                ((getPosATL player) # 2) + 500];
_camera cameraEffect ["terminate","back"];
_camera cameraEffect ["Internal","back"];
_camera camSetTarget player;
_camera camPreparePos ([((getPosATL player) select 0) + 21,((getPosATL player) select 1) + 21,((getPosATL player) select 2)+ 25]);
_camera camPrepareFOV 0.700;
_camera camCommitPrepared 30;

[] call Compile PreprocessFileLineNumbers "Client\Player\fn_DisplayIntroPIP.sqf";
_introWatchUnitDisplay = findDisplay 46 createDisplay "RscDisplayEmpty";
_ctrl = _introWatchUnitDisplay ctrlCreate ["RscPicture", -1];
_ctrl ctrlSetPosition [-0.25, 0.5, 0.75, 0.5];
_ctrl ctrlSetText "#(argb,1024,1024,1)r2t(rtt1,1.0)";
_ctrl ctrlCommit 0;

introWatchUnitCamera = "camera" camCreate (ASLtoAGL getPosASLVisual player);
introWatchUnitCamera cameraEffect ["terminate","back", "rtt1"];
introWatchUnitCamera cameraEffect ["Internal", "Back", "rtt1"];
wanton swallow
little raptor
#

no

wanton swallow
#

I need two cameras in one time.

little raptor
little raptor
wanton swallow
#

Thought that _camera camCommitPrepared 30; is the reason for waiting

little raptor
wanton swallow
#

@little raptor Show mission intro in whole screen.

#

First camera appears in the sky above player.

#

And fly to player in 30 seconds.

wanton swallow
#

Another example:

_display = findDisplay 46 createDisplay "RscDisplayEmpty";
    _ctrl = _display ctrlCreate ["RscPicture", -1];
    _ctrl ctrlSetPosition [-0.25, 0.5, 0.75, 0.5];
    _ctrl ctrlSetText "#(argb,1024,1024,1)r2t(rtt1,1.0)";
    _ctrl ctrlCommit 0;

    _ctrl1 = _display ctrlCreate ["RscPicture", -1];
    _ctrl1 ctrlSetPosition [0.5, 0, 0.75, 0.5];
    _ctrl1 ctrlSetText "#(argb,1024,1024,1)r2t(rtt2,1.0)";
    _ctrl1 ctrlCommit 0;

    introWathUnitCamera = "camera" camCreate (ASLtoAGL getPosASLVisual man1);
    introWathUnitCamera cameraEffect ["External", "Back", "rtt1"];

    introWathUnitCamera1 = "camera" camCreate (ASLtoAGL getPosASLVisual player);
    introWathUnitCamera1 cameraEffect ["External", "Back", "rtt2"];
wind flax
#

Hey there. Does anyone know how to take a remote image (from a webserver), download it, and then able to display it as a texture? Would be very helpful. I've looked around and seen some extensions that would be a step, but not sure if anyone else has done it.

copper nova
#

Is it possible so save the progress of a holdaction? So that next time the duration is shorter, or the amount of ticks is already filled?

cosmic lichen
#

You could save the progress yourself and add a shorter one

unique sundial
#

nice idea

copper raven
copper raven
wind flax
#

I was thinking about using Killzone_Kid's URL Fetch extension, but I'd need to figure out how to store the image, and be able to use it as a texture

copper nova
copper raven
#

it can be in any of the events

#

codeProgress probably, and adjust your duration there

#

it's completely up to you, but in the end you will probably have to use multiple ones, like for example, code progress > save current progress, code interrupt > adjust the duration to the saved progress, or whatever way you wanted initially

copper nova
#

Ah okay πŸ™‚

copper nova
#

What I could save via the codeProgress is the current progress and those are these ticks. But how can I get the elapsed time? πŸ™ˆ

winter rose
copper raven
copper nova
#

I've got it working now. Thanks πŸ‘

plucky hornet
#

Hey guys, I have setup a MP mission with tasks to train different aspects of the game, I was wondering if there is a way to give a task only to the player who is activating the trigger which starts the task?
I have setup an addAction like so

this addAction ["Kortlæsningsøvelser", { 
    kortlaesning_1 = true; 
}];

With a trigger which then starts the task.
!isNil "kortlaesning_1"

Thanks in advance guys πŸ™‚

plucky hornet
#

Okay, from what I can see, the task will be created local to the player who triggered it anyway πŸ™‚

plucky hornet
#

Another question, when all the tasks have been completed I have been using BIS_fnc_deleteTask to delete the tasks again, my problem is I dont know how make them repeatable now.

runic spoke
#

Is there a way to figure out what an #ParticleSource is?
typeOf returns #ParticleSource
str _particleSource returns : id : < no shape >

I'm trying to figure out if the particle source is from a smoke projectile. (Smoke Launcher)

copper raven
#

i don't think you can

#

just check if there is a smoke projectile near the particle source

runic spoke
#

Problem is, there is no projectile either, if you use the fired eventhandler, projectile is null.

copper raven
#

yes, it's because they're scripted

runic spoke
#

Okay there is a near SmokeLauncherAmmo however, there is only one, tried deleting it no luck.

            waitUntil 
            {
                uiSleep 0.01;
                _nearParticles = _this nearObjects ["#particlesource", 30];
                !(_nearParticles isEqualTo [])
            };
            {
                deleteVehicle _x;
            } forEach _nearParticles;```

works like a charm though.
copper raven
#

that ammo is shot by the tank

#

then there are SmokeShellVehicles created by a script

#

8 i think on vanilla tanks

#

don't remember now

runic spoke
#

ahhhhhhh, fuck yes that works

#

That deleted my flying shells πŸ˜‚

#

I just used SmokeShell

#

Thanks Sharp.

copper raven
#

yeah, though that is inherited by many smoke ammos(so you might delete unwanted ones), but i guess it doesn't matter in your case

runic spoke
#

Just trying to delete anything within a zone, tired of smoke everywhere lol

#

SM_Fired = 
{
    params ["_vehicle","_weapon"];
    
    if (_weapon == "SmokeLauncher") then
    {
        deleteVehicle _projectile;
        _vehicle spawn
        {
            private _nearParticles = _this nearObjects ["SmokeShell", 5];
            {
                deleteVehicle _x;
            } forEach _nearParticles;
            true
        };
    };
};

_vehicle removeAllEventHandlers "Fired";
_vehicle addEventHandler ["Fired", SM_Fired];```

still needed the spawn or it don't work at all.
meager epoch
#

Is there any way to let the game know when the establishing shot is done?

copper raven
tough abyss
#

I'm trying to make a trigger that only fires when 2 or more people are present

#

And this includes people in vehicles, which is what keeps a simple count from working

copper raven
#

though that will bypass the trigger detection thing

tough abyss
#

yeah cant I just put this && before that?

#

to keep the other triger condition

copper raven
#

actually nvm it shouldn't

copper raven
tough abyss
#

arma doesnt like your code

copper raven
#

uhm wut?

tough abyss
#

Never mind got it

#

it was spitting an error

copper raven
#

what error?

tough abyss
#

Something about a parenthesis

#

I got rid of it though

copper raven
#

that code is syntactically correct, so it's on your end

tough abyss
#

yeah Idk it seems to work

#

thanks!

plucky hornet
visual brook
#

For some reason. setObjectScale doesnt work on my dedicated server

winter rose
#

that's unfortunate.

visual brook
#

Genuienly dont know why it wont work

winter rose
#

can't know either…

what I mean is: if you are looking for help, please state your issue, setup and attempt πŸ˜„

visual brook
#

Fair enough. Care to elaborate on setup?

winter rose
visual brook
#

we are in scripting

winter rose
visual brook
#

Thank you for your help lou

#

I didnt read the wiki properly

#

the object wasnt attached

copper nova
#

I have one more question. How can I implement that only ONE player can use a global hold action. So not several players can use the action at the same time. Only when the other has canceled.

shadow river
#

is there any script or mod in the workshop that allows me to change the ace arsenal of an unit that is being controlled by someone?

#

when i try it it says that cannot edit dead unit or something

wet shadow
copper nova
#

That's how I have it too. However, the player performing the action no longer sees the holdaction progress while executing it

#

conditionShow: _target getVariable ['inUse', false] isEqualTo false;
codeStart: _target setVariable ["inUse", true, true];
codeInterrupted: _target setVariable ["inUse", false, true];

winter rose
#

you can setVariable "userDoingTheAction'
this way if the object is null (e.g if the guy disconnects) others can do it

copper nova
#

But that doesn't solve the problem. After changing the variable in codeStart to the user doing the action, the show condition is no longer fulfilled, because it isn't null. And this also applies to the player who is currently performing the action.

#

So as I said the hold action disappears πŸ‘€

tough abyss
#

Good evening. Do not tell if you can how to implement that bots began to pick up weapons from the ground or crates if he does not have it?

winter rose
copper nova
#

Oh okay I'll try that πŸ™ˆ

somber radish
#

So I'm back nagging about extensions

#

I am having trouble using callExtension

#

the only return value I am getting is Call extension 'extDB3' could not be loaded: Den given module was not found.

#

(From RTP)

#

I have also tried with my own

#

CallExtension 'MyExtension11' could not be found

#

also fail

#

Any advice?

#
In your Arma 3 installation folder (for example: ..\arma3\yourextension.dll).```
winter rose
#

where is your extension, what is its file name, etc etc

inland summit
#

hello everyone, i am join here to ask where i can get my hands on the sqf to bytecode conversion tool? i could find any info on it. do anyone knows? thankx!

#

*couldn't

#

ups, my bad, i check here and find the information! thank you very much!

copper raven
inland summit
dawn walrus
#

Hey, quick question just to see if anyone here has any solution. I found this composition on the workshop, to get flickering lights. (great for spooky scary stuff). It works wonderfully in SP, though once put on MP dedicated it no longer functions. You can see them trying to flicker, but its a very, very short like single frame, as opposed to the proper random couple seconds that the little script shows.

Here is the entire thing, pasted in the init of the light object. In my scenario, I am using the hanging camping lanterns.

if (isServer) then {
l4 = this spawn {
while {alive _this} do {
_this switchLight "OFF";
sleep (random 3);
_this switchLight "ON";
sleep (random 3);
};
};
};

l4 in this case is the variable name of the light. Any of you have any idea why it would just poop out any not function on dedicated server? I planned on using this for a segment in an upcoming mission, and while i've tested out everything else, this is the one aspect that isn't working and its kind of a bummer, because it really helps to create the atmosphere I was going for.

wicked roostBOT
#
How to use SQF syntax highlighting in Discord

```sqf
// your code here
hint "good!";
```
↓

// your code here
hint "good!";
winter rose
inland summit
#

you could run this on clients instead of server, using remoteExec.

if (isServer) then {
    l4 = this spawn {
        while {alive _this} do {
            [_this,"OFF"] remoteExec ["switchLight", [0,-2] select isDedicated,_this];
           sleep (random 3);
            [_this,"ON"] remoteExec ["switchLight", [0,-2] select isDedicated,_this];
           sleep (random 3);
        };
    };
};
crude vigil
#

also remoteExecuting like that would be very costly network wise.

inland summit
crude vigil
#

why would u need sync on such thing.

inland summit
#

because if this is for scaring people, some will be at light, and some at totally dark, it breaks immersion

#

thats the point of @dawn walrus

crude vigil
#

Unnecessary use case, imo

winter rose
#

it will just be a blinking light that will go forever, just an ambient effect
not syncing it is an acceptable loss, I don't think it would be an "advantage" in any sort (especially if the mission is coop)

inland summit
#

so, @crude vigil is the acceptable response

winter rose
#

if there is an absolute need of sync, yours is (although select isDedicated…)

inland summit
#

meh, select isdedicated is for special cases like hosting and playing at the same time, targets should be different.

winter rose
#

creating the array and selecting by calling isDedicated is slower than remoteExec to everyone from the server, so it should be used for big chunks of code, not this

inland summit
#

good point, ill keep it in mind

winter rose
#

plus, light simulation may toy with server AI now that I think of it

crude vigil
#

Yeah in scenario of fighting , it is better to keep it synced

dawn walrus
#

Thanks everyone, I would rather have it working and be slightly un-synced than it not working. Its a small price to pay, and ultimatley the effect is only going to be used in a few areas, where players likely won't be lingering for too long anyway so I don't expect anyone to notice any discrepancies really.

crude vigil
#

but that random is costly

#

cos of sync requirement

inland summit
#

maybe...

#

sleep (serverTime random 3)

#

never try it, but it should give the same random time.

#

at least, for the first 300 sects

dawn walrus
#

Hmm, I remember from an old reddit post while searching for this effect, that lights/ lamps are turned off when above the 95% damage threshold. Would using a setDamage instead of switchLight have a more consistent effect? I'm envisioning basically having the script setting the light source's damage between 0 and 0.95, so that it is damaged enough to turn off the light, but not totally destroyed. Would that be more taxing to be running constantly?

winter rose
crude vigil
#

it may sync faster and better than remoteExec though maybe

winter rose
#

perhaps (I honestly don't know)

dawn walrus
#

SO by synching, that would have the effect of all the lights being synched together for players though?

crude vigil
#

hopefully. You are at the mercy of engine :P

#

but is there a fight scenario?

#

or is it solely for ambiance?

dawn walrus
#

lol as it always. Its the bane of existance, half the stuff I want to do, ends up being a bit too much for the engine to handle. Yes, but so far its only a couple zombies walking very narrow halls. So, 80% ambiance, as the players have gunlights.

crude vigil
#

if there are gun lights, chances are that they ll keep it opened, thus u re not dependent on functional aspect of light anyway.

#

so switchLight it is imo...

#

But honestly if you are not picky, just go with switchLight anyway, what are the chances that players will check if your light is synced? :P You know those people who like to find flaws. Well apart from those. ^^

#

The reason I heavily suggest switchLight because you are probably gonna be having many lights like this? All of these continuously remoteExecing is a huge network wise resource consumption.

#

That code is highly inefficient, it is the worst case performance wise that one can write, but it does the job for you..

dawn walrus
#

Yeah I know like, one dude in my group that might notice, the others are just happy with pretty much anything as long as they get to shoot something.

crude vigil
#

Question is, do you really care? I would personally care and handle it considering my experience, but do you? Your mission, your choice.

dawn walrus
#

I mean, I care, but I also care about the simplest little details. I'll go with the simple but working way, I'm not able to write my own scripts really beyond the most simple things, and I don't feel like fussing over it too much anyway, spent enough time head scratching and fixing other unrelated things.

fair drum
#

@meager epoch people here are talking about your flickering lights comp. I thought you didn't change it to switchlight and kept it based on damage

#

you want something for lights Vulture? just use something like this...

private _buildings = nearestTerrainObjects [[worldSize / 2, worldSize / 2], [], worldSize * sqrt 2 / 2, false];
private _lamps = _buildings select {_x isKindOf "Lamps_base_F"};

lampsFlicker = [_lamps] spawn {
    params ["_lamps"];
    while {!(_lamps isEqualTo [])} do {
        for "_i" from 1 to 5 do {
            _lamps apply {
                if (random 1 < 0.5) then {
                    _x switchLight "OFF";  //Or _x setDamage 0.9
                } else {
                    _x switchLight "ON";  //Or _x setDamage 0
                };
            };
            sleep (random 0.1);
            _lamps apply {
                _x switchLight "ON";
            };
            sleep (random 0.1);
        };
        sleep (random 3);
    };
};

keep it local with this. if you want global or server exec, you can use setdamage to shut the light off and on globally as well instead of using switchlight

#

i think at like 0.9 damage the light shuts off or something like that

crude vigil
#

His code should be working fine and yours is just changing all lights. And I dont see any syncing done in here either.

fair drum
#

if he uses setdamage instead of switchlight, i believe it will sync

crude vigil
#

it will, thats another thing. We already discussed it.

inland summit
#
this spawn {
    private _rsync = { random 3 };
    if (isMultiplayer) then { 
        private _rsync = { serverTime random 3 };
        waitUntil { round(call _rsync) % 2 == 0 };   
    };

    while {alive _this} do {   
        _this switchLight "ON";   
        sleep call _rsync; 
        _this switchLight "OFF";   
        sleep call _rsync; 
    }; 
};

this will sync in MP and work in SP, without net code sent.

#

uses serverTime as random seed, so it will give the same random result to all clients.

#

at least, for the first 300 secs, as serverTime states it is valid.

dawn walrus
#

Its sparked quite the discussion. But correct, I am only looking to affect certain lights, of which the base script was doing just fine. For context, these lights are placed inside of a narrow "underground" lab, basically just concrete walls with an over head concrete block placed as the ceiling, that have been placed on an airstrip thats had an area cleared out using the hide terrain module.

Don't you just love the smoke and mirrors needed to make things?

fair drum
#

thats just arma. there are a billion ways to achieve the same effect, some better than others

dawn walrus
#

Thats the truth, over the years its become very apparent, there is always ten ways to do something you want, but whether they are equally as viable or efficient is another matter.

i'll try that one Alez posted, been taking a break from starting at the editor screen.

manic sigil
#

Weird, I had a function that worked a little while back, now it's throwing a fit about a sleep in a while-do loop o.0

dawn walrus
#

I will admit that a common method I use for various triggers, is to just place a franta soda can down, give it a name, and use a simple !alive can1 check on a trigger to then trigger other things. Its probably the worst way of doing things, but is also very low on brain power required.

manic sigil
fair drum
manic sigil
fair drum
#

whats the fit its having?

manic sigil
#

Generic Error, rpt says 'suspending not allowed in this context'

fair drum
#

you need to spawn this, not call it

#

how are you executing your function?

inland summit
#

hum, have some typos and errors, i corrected the function, it works as intended now

manic sigil
#

It's been calls, for instance

#
[Dragonfly,Inspect3Tgt,[300,350,2000],"RIGHT"] call SR_fnc_heliTour;
fair drum
#

change that call to spawn

manic sigil
#

Weird, It worked before with Calls... I'll try.

ebon citrus
#

The link that explains why your code wont allow suspending^^

fair drum
#

if it had worked with calls before, I bet you did that in an already scheduled space such as init.sqf

manic sigil
#

Not always, but I can't recall when I last did without running it in an .sqf, true.

fair drum
#
Where code starts scheduled

    init.sqf
    initServer.sqf
    initPlayerLocal.sqf
    initPlayerServer.sqf
    functions with postInit attribute (although suspension is allowed, any long term suspension will halt the mission loading until suspension has finished)
    code executed with spawn
    code executed with execVM
    code executed with exec
    **code executed with call from a scheduled environment**
manic sigil
#

But that doesn't exactly fix it, because when the error first cropped up was when I was running it in an .sqf anyways.

#

Though it would explain why my freestyle bugtesting wasn't working right... hrn.

fair drum
#

just try the spawn

manic sigil
#

Okay, spawn and call, executed from a .sqf, now don't crash the game.

However, it runs the loop once and quits :/

#

Wait, hold on, may be moron

#

Yup, just dumb, calling it on the wrong vehicle. Durr.

#

I mean, that didn't explain why it worked before and then didn't, but if all that takes is changing a few calls to spawns, I'll live with the mystery.

#

Alright, think it's resolved, I guess? Ugh.

dawn walrus
somber radish
somber radish
somber radish
inland summit
#

this is what i mean by the dll tbbmalloc.dll, it plays a role on extDB2 as well

somber radish
inland summit
#

just copy the malloc library to the \dll\ folder in arma

#

tbbmalloc.dll

#

you need to make sure to use it at you start arma. set that in 'parameters' section of the launcher

#

you have the 'memory manager' option there, choose tbbmalloc

#

you should decide if you gonna use x64 or x32 arma

#

then select the plataform and memory manager accordingly

somber radish
inland summit
#

i had the same problem and i lost a lot of hours. extDB2 and extDB3 are always used in Exile, and this is a pain for first timers hosters. yw

dreamy kestrel
#

Q: is it possible to know the vehicle positions available to a vehicle from the class name only?

little raptor
dreamy kestrel
#

well, fullCrew works with an OBJECT, doesn't it? I was wondering if it was otherwise possible to identify them given a class name only, i.e. not create the object.

little raptor
fair drum
#
params [["_class", -1], ["_inclCargo", false]];

/// --- validate input
#include "..\paramsCheck.inc"
paramsCheck(_class,isEqualType,"")

private _cfg = configFile >> "CfgVehicles" >> _class;
private _turrets = 0;

if (_inclCargo isEqualTo true) exitWith
{
    private _fnc_turretsFFV = 
    {
        {
            _turrets = _turrets + 1;
            if (isClass (_x >> "Turrets")) then {_x call _fnc_turretsFFV};
        }
        forEach ("true" configClasses (_this >> "Turrets"));
    };

    _cfg call _fnc_turretsFFV;
    
    getNumber (_cfg >> "hasDriver") + // driver
    getNumber (_cfg >> "transportSoldier") + // all cargo positions
    _turrets // all turrets including FFV
};

private _fnc_turrets = 
{
    {
        if !(getNumber (_x >> "showAsCargo") > 0) then {_turrets = _turrets + 1};
        if (isClass (_x >> "Turrets")) then {_x call _fnc_turrets};
    }
    forEach ("true" configClasses (_this >> "Turrets"));
};

_cfg call _fnc_turrets;

getNumber (_cfg >> "hasDriver") + // driver
_turrets // default turrets

this is how BIS_fnc_crewCount does it, take a look at its config grabbers

dreamy kestrel
#

oh nice, thank you. could iterate all that and form a response without having to create the object. huge time saver.

#

Q: then, commander|gunner|turret how does that align with 'turrets' (?)

viral marsh
fair drum
#

what overlay? its a 21 min vid

viral marsh
#

Ah sorry. Thought it put the correct time.

#

3:02

fair drum
#

you can create your own config value for each icon (RscTitles) then use cutRsc to create and fade out those images

viral marsh
dreamy kestrel
dreamy kestrel
#

How does that also gain me the drivers, cargo (i.e. passengers), etc? I need to know all the positions.

#

I am trying to gauge if a vehicle class is unarmed that is does not have a gunner, per se, and supports _
_, i.e. cargo.

#

I could go with fullCrew, that's not impossible to do, but the draw back is, first time through must create the object.
I can stow the result in a HASHMAP after that, it's just that first aspect I'd like to avoid.

fair drum
#
private _class = "B_APC_Wheeled_01_cannon_F";
private _cfg = configFile >> "CfgVehicles" >> _class;

private _hasWeapon = count (_class call BIS_fnc_allTurrets) > 0;
private _hasCargo = getNumber (_cfg >> "transportSoldier") > 0;

//Return
[_hasWeapon, _hasCargo];
#

@dreamy kestrel

#

thats on the list of things categorized as "very high time sink, very little appreciation from players". do stuff like that after you've learned to get your game functional

dreamy kestrel
#

thank y'all for the feedback. I think I have an approach now.

fair drum
#

Stuff that takes a low amount of time you can learn

Teleporters
Parachute script on respawn
Random weathers
Death cries/sounds
Animated map briefings
A jukebox
Etc

crude vigil
# viral marsh https://www.youtube.com/watch?v=k3ZhcJiyaHE Anyone know how such an overlay cou...

It is achieved with dynamicText function, no UI scripting is necessary. No any "high time sink scripting" is required..
For more information:
https://community.bistudio.com/wiki/BIS_fnc_dynamicText (you may also want to check other functions related to that, just search Text within function list on BIKI)
https://community.bistudio.com/wiki/Structured_Text to exactly understand what to input as text. (Such as including an image)

plucky hornet
#

Hey guys, me again, trying to setup a task via the TaskFramework instead of the modules after quite a few recomendations to do so from here. So far it is going fine, but I cannot seem to setup a trigger to succed the task.
Here is what I have got;
kortleasning.sqf

[west,["KLR2","KLR1"],["KortlΓ¦sning 1.1", "GΓ₯ til koordinat 090049"],objNull, "ASSIGNED", 1, true, "MAP"] call BIS_fnc_taskCreate;

KLRT1 = createTrigger ["NONE",[905.385,490.606]];
KLRT1 setTriggerArea [10, 10, 0, true];
KLRT1 setTriggerActivation ["ANYPLAYER", "PRESENT", true];
KLRT1 setTriggerStatements ["this", "hint 'Korrekt kortlæsning, bevæg dig til xxxyyy'", "hint 'no civilian near'"];

if (triggerActivated KLRT1) then {
    ["BIS_task_01","SUCCEEDED"] call BIS_fnc_taskSetState;
};```
I have a screen with an addAction in game to trigger this script, which works fine, as the task is assigned.
I have checked the location of the trigger x100 and it should be correct.
Should I just stick to using the triggers in game or are the better advantages of using the scripted instead?
little raptor
#

so your task will never complete

#

you should instead put it in trigger completion statement

little raptor
plucky hornet
#

Yes, but as I understand the way the task system is setup, the task will only be created locally to the player who executed the script, so I does not matter?
I feel you getting tired from my ignorance πŸ˜›

little raptor
#

no

#

it's global, and you're adding the task to all west units

plucky hornet
#

My bad for misunderstanding a section of the taskframework, which stated the createSimpleTask is purely local

little raptor
#

[....] And that’s why the task framework was created in the first place - to provide comfortable but still powerful tool for synchronized task creation and management in MP scenarios.

plucky hornet
little raptor
#

but it's incorrect

#

if you just use syntax highlighting you'll see

#

!code

wicked roostBOT
#
How to use SQF syntax highlighting in Discord

```sqf
// your code here
hint "good!";
```
↓

// your code here
hint "good!";
plucky hornet
#

Sadly not :/

little raptor
#

didn't you notice that their colors are messed up?

#

it should've been all green

#

(because they were all supposed to be in a string)

#

so anyway, the reason that happens is that you're trying to put " inside a string that is wrapped with ""

#

but " closes a string... meowsweats

#

to fix this you have 3 options:
a. use "" when you want to put it inside a string:

"[BIS_task_01, ""SUCCEEDED""] ..."

b. use ' instead:

"[BIS_task_01, 'SUCCEEDED'] ..."

c. wrap the string with '':

'[BIS_task_01, "SUCCEEDED"] ...'

you also have another mistake, but I'll let you figure it out yourself

violet gull
#

Is setBleedingRemaining a local command? Wiki doesn't say but doesn't feel like it's applying from server-side script.

violet gull
#

In singleplayer tests yes lol

little raptor
#

my guess is that it's local thonk
but when you don't know your only options are either to test, or just remoteExec to everyone meowsweats

violet gull
#

Ew testing 🀒

#

Yeah just confirmed it works with 0.1 or more damage in SP, I'll just remoteExec it

plucky hornet
#

Okay so:

KLRT1 setTriggerStatements ["this", "[KLR2, ""SUCCEEDED""] call BIS_fnc_taskSetState]";

Or

KLRT1 setTriggerStatements ["this", "[KLR2, 'SUCCEEDED'] call BIS_fnc_taskSetState]";
little raptor
#

both solve your string problem. you can pick whichever you want

#

but there are still 2 problems left

#

actually 3...

plucky hornet
#

Well sh*t

little raptor
#

basic math: the number of opened brackets must be the same as number of closed ones... meowsweats

#

wait they are... 🀣

#

but anyway you get the idea

plucky hornet
#

If the idea is something is wrong with my brackets then yea'. So far I am (hopefully) able to count to four πŸ˜›

little raptor
#

you have 2 problems in that category rn

plucky hornet
#

I am clearly not getting something

#

Can't upload pics, but I dont see any "lonely" brackets

little raptor
#

well you have 2:

#

the first one is never closed

#

the second one is never opened

plucky hornet
#

I thought the first one was closed by the last

little raptor
#

the last one is in a string...

#

it's in a "different region"

#
[(])

kinda similar to the situation you got here

little raptor
#

the first one was white, but the last one was green...

spark sun
#

basically, previously you wrote this:

private _statement = "[KLR2, 'SUCCEEDED'] call BIS_fnc_taskSetState]";
KLRT1 setTriggerStatements ["this", _statement;

but you want this:

private _statement = "[KLR2, 'SUCCEEDED'] call BIS_fnc_taskSetState";
KLRT1 setTriggerStatements ["this", _statement];
little raptor
#

which now brings us to the 3rd problem... meowsweats

plucky hornet
#

That kitty sure sweats a lot

#
KLRT1 setTriggerStatements [KLR2, 'SUCCEEDED'] call BIS_fnc_taskSetState";

So here we are, at the third problem, can I get a hint?

#

yet another hint*

little raptor
plucky hornet
#

Vdauphin did it, I am innocent

little raptor
#

where? thonk

#

you misunderstood his point

spark sun
#

Look closely to what Leopard told you

little raptor
#

anyway since I guess this is gonna take forever this is what you should've done:

KLRT1 setTriggerStatements ["this", "[BIS_task_01, 'SUCCEEDED'] call BIS_fnc_taskSetState", ""];
#

your 3rd problem was that setTriggerStatements also needs a triggerDeactivated statement as well

plucky hornet
#

Thanks, I had wondered about it.. Thanks for your patience/trying, I appreciate it.. Sorry if you feel I wasted your time

#

So the first bracket did not get closed, because of the missing deactivation?

little raptor
#

no because you just didn't have any ]

#

even this "closes" it:

#
KLRT1 setTriggerStatements [];
#

if you don't close it you get a parsing error

#

which means it won't even compile

#

now it does compile

#

but throws an error at runtime (probably something like 0 arguments provided, 3 expected)

#

@plucky hornet anyway the takeaway from this experience is that everything you see in programming has especial significance and you should pay close attention to them. Some examples in SQF:
"" and '' create a string
[] creates an array
{} creates a code
() is just parentheses and are used for evaluating something sooner (changing order of precedence)
e.g.:

1 + 2 * 3 //1 + 6, gives 7

but:

(1 + 2) * 3 //3 * 3, gives 9
plucky hornet
#

I think I need to find (even) more guides online to get a better basic knowledge as well

meager epoch
meager epoch
little raptor
meager epoch
#

my flickering lights code goes nuts to butts in MP and this is somewhat of a fix which apparently works

little raptor
meager epoch
#

Gets the job done i guess blobdoggoshruggoogly

little raptor
plucky hornet
#

slight problem, the task is not getting completed upon entering the trigger area, I have been looking over the BI wiki several times and what we talked about but cant seem to figure out why :/

[west,"KLR1",["Kortlæsning 1", "Kortlæsning kursus 1"],objNull, "CREATED", 1, true, "MAP"] call BIS_fnc_taskCreate ;
[west,["KLR2","KLR1"],["KortlΓ¦sning 1.1", "GΓ₯ til koordinat 090049"],[905.385,490.606,2], "ASSIGNED", 1, true, "MAP",true] call BIS_fnc_taskCreate;


KLRT1 = createTrigger ["EmptyDetector",[905.385,490.606,0]];
KLRT1 setTriggerArea [10, 10, 10, true, -1];
KLRT1 setTriggerActivation ["ANY", "PRESENT", true];
KLRT1 setTriggerStatements ["this", "['KLR2', 'SUCCEEDED'] call BIS_fnc_taskSetState", ""];
tired coral
#

shouldn't KLR2 be 'KLR2'?

crude vigil
#

Is there something like that at all? Isnt it "EmptyDetector"?

plucky hornet
crude vigil
plucky hornet
#

Thanks boys and/or girls

fair drum
#

And it should sync

fair drum
fair drum
vague geode
#

Does anyone have an(y) idea why this diary record isn't showing the button [Join Platoon]-button?

_diaryRecord = player createDiaryRecord ["Diary", ["Command structure", ""]];
_diaryRecordText = "<font color='#b5f862'>1st Platoon, A Company</font> <execute expression=''[player,B_Player_A_1_1,'Join'] call BIS_fnc_dynamicPlatoons''>Join Platoon</execute> (Lt. Genius Play Unique)<br />";
player setDiaryRecordText [["Diary", _diaryRecord], ["Command structure", _diaryRecordText]];

It just shows

1st Platoon, A Company

cosmic lichen
#
player createDiaryRecord ["Diary", ["Execution", "<font color='#A52A2A'>1st Platoon, A Company</font><br/><execute expression=""[player, B_Player_A_1_1, 'Join'] call BIS_fnc_dynamicPlatoons;"">Join Platoon</execute>"], taskNull, "", true];
vague geode
cosmic lichen
#

Nope, my bad

vague geode
cosmic lichen
#

I replaced '' with "" if you look closely

vague geode
cosmic lichen
#

It was yes

vague geode
#

Ok, fair enough.

misty osprey
#

is there a command to change a group's side during the mission

copper nova
copper raven
copper nova
#

And what if I created the holdaction like this?
[ ... ] remoteExec ["BIS_fnc_holdActionAdd", 0, _chest];

Then it is not listed in the actionIDs.

copper raven
#

no, that approach wouldn't work

#

you discard the id that way, you need to make a function wrapper, that adds the action, and saves the id

copper nova
#

So it's easier, without remoteexec, to create holdaction locally for each player?

copper raven
#

to create holdaction locally for each player?
you are already doing that meowsweats

#

and you will have to still use remoteExec

copper nova
#

Oh πŸ™ˆ

#

Can you maybe help me a little bit there? I have never used a function wrapper before 😬

copper raven
copper nova
#

And how exactly I save the holdaction with setVariable?

copper raven
#

store it into object's(the one you're adding the action to) namespace with setVariable

copper nova
#

Ahhh yes I forgot about the return value there.

_actionID = [ 
...
] remoteExec ["BIS_fnc_holdActionAdd", 0, _object];    

_object setVariable ["actionID", _actionID, true];

The second function:

params [
    ["_object", objNull, [objNull]],
    ["_duration", 0, [0]]
];
_actionID = _object getVariable "actionID";
_arguments = _object actionParams _actionID;
_arguments select 2 set [20, _duration];

Is that all?

copper raven
#

the second one is somewhat ok and might work

#

but the first one doesn't make sense

#
_actionID = [ 
...
] remoteExec ["BIS_fnc_holdActionAdd", 0, _object];    

you're not getting an _actionId here, you're getting the return value of remoteExec which you can see here: https://community.bistudio.com/wiki/remoteExec

Return Value:
nil - In case of error.
String - In case of success.
#

you need to make your own action add function, and remote exec that instead

copper nova
#

Thanks I will do that πŸ˜…

vague geode
copper nova
#

When the hold action is interrupted, I call the second function. I guess also via RemoteExec?

#

Well, it works in singleplayer. I'll test it later in multiplayer.

copper raven
potent dirge
#

Evening fellas, please is there a way I can make AI aircraft stick to a certain "area" and not cross half the map to engage targets.
Because in doing so they end up getting shot by AA. In effect what I want is for them to only engage targets defensively, that is targets within a certain area or any targets that are engaging them.

fair drum
violet gull
#

@potent dirge Could create a trigger to act as a LOA; basically have the trigger tell the pilot to move away and change behavior + hold fire so they break contact more reliably when/where you want them to. Just an idea.

potent dirge
#

Thank you both for your suggestions, the LOA trigger seems like it would give me the best possible behaviour

hushed tendon
#

I'm trying to add an icon to a unit but idk how the file path works for it

_grp addGroupIcon ["a3\modules_f_curator\data\portraitanimals_ca.paa", [0, 0]];
hushed tendon
little raptor
hushed tendon
little raptor
#

Just read the wiki meowsweats

#

Also you must switch to high command to see group icons (afaik)

manic sigil
#

Is there a quick way of taking an array of strings, and assigning each one to a variable?

little raptor
manic sigil
#

Hrn, I'd still have to do array select x for each one, I believe?

little raptor
little raptor
manic sigil
#

Nah, they'd have to be global. ForEach would at least go through the array, but I'm blanking on how to assign them unique variable names.

little raptor
#

What are you trying to achieve?

#

Why do you need to assign global variables?

manic sigil
#

My mission was getting really wordy, and it was eating up a (relative) ton of space to write out each playSubtitles spawning.

At the same time, I wanted to have a way of logging into the diary the conversations, but that would require going through and taking each line of dialog out and plugging it into a createDiary copy-paste, which would have just ballooned the scripts further.

So I opted instead to go for a more streamlined approach, turning both the subtitles and the logging scripts into functions, and reducing the ungainly block of text into an array of arrays, [[chatColor,whoIsSpeaking,whatTheySay,timeSinceLastMessage],[ad nauseum]]

This works after much testing, but my test model is built around creating an array of names and the lines of dialog - the chat colors were already defined in my initialization files.

But this leaves me with the chunky line

[chatCommand,chatNames select 4,chatArray select 0,0]

And I want to tighten it up.

#

My plan is to create an array of every speaking role, and/or assign the string of speaking roles to variables, and just write the dialog into place, such:

[chatVehicle,chSgtRavai,"Not the TIME, Chao!",6]

#

I already define a metric wide load of variables in my initServer.sqf, so I'm not concerned with defining more, but wasn't sure if I'd need an array of speaking roles for anything, so wanted to find a way to do both without getting all 'chatNames select'y

little raptor
little raptor
manic sigil
#

Sure.

#

Missed a ; shy of running it as a .sqf on it's own, but you could also input each block on it's own I guess.

little raptor
manic sigil
#
  1. it's still in testing and I needed to monitor the steps

  2. while chatnames select 0 is easy to process, it's not easy to read.

violet gull
#

Are you able to block addon functions via any script commands or through the Description.ext somehow?

little raptor
manic sigil
#

A variable that is defined at mission start, eg

chSgtRavai = "DRAGONFLY 3-1: SGT. RAVAI";

and then just inputting their line of dialog, rather than calling from an array - much less likely I'll need to reference an array of dialog than the names, and keeping them 'in order' will help with readback and corrections.

copper raven
#

use macros

manic sigil
#

Ooh, that might just do, I'll have to dig into it.

fair drum
#

there's no way to enable dynamic simulation on a created unit during mission correct? because enableDynamicSimulation states that it only is for a given non AI object.

copper raven
#

i think you're supposed to use it on a group

ebon citrus
fair drum
#

oh okay gotcha

upper siren
#

I have this in the init of a playable unit

this addItem "ACE_Vector";

for some reason this gets executed every time a new player joins the server

hollow thistle
#

Init is executed for every client + server

upper siren
#

oh so everytime anyone inits that unit?

hollow thistle
#

yes

#
if (!isServer) exitWith {};
this addItem "ACE_Vector";

or

if (!local this) exitWith {};
this addItem "ACE_Vector";
upper siren
#

and because addItem has global effect it will keep adding away...

upper siren
hollow thistle
#

missing then

#

It's the same, I prefer to reduce code nesting to improve readability.

upper siren
#

okay, thanks!

mental wren
#

Personally it really depends on context. If it's literally only a single line, it's typically more readable to keep it inside of the if.
If there's more and there's deeper nesting of control structures (if/for), then you typically go for an early return.

little raptor
bitter jewel
#

i consider them the same

#

so i am interested to ask if you can give an example

upper siren
little raptor
bitter jewel
#

ah i see

little raptor
#

another example might be this:

std::find_if(arr.begin(), arr.end(), [](const auto& item) {return item == 1;})
//vs
std::find(arr.begin(), arr.end(), 1)

both will probably give the same performance (might need compiler optimizations; not sure thonk )
but:

arr findIf {_x == 1};
//vs
arr find 1;

the performance diff is night and day

devout gazelle
#

Hello!
I wonder if someone could help me with this one:
I am trying to make some TCP guards be suspicious about players passing through with this script, but Im getting errors:
I'm intending for this to be MP as well.

_Supsicious = floor (random 100); 
if (_Supicious < 50) then 
{ 
_group = createGroup WEST;{[_x] joinSilent _group} forEach units (group player1); 
Hint "Player is compromized"; 
};
little raptor
wicked roostBOT
#
How to use SQF syntax highlighting in Discord

```sqf
// your code here
hint "good!";
```
↓

// your code here
hint "good!";
meager granite
#

Are public variables not guaranteed to arrive in the same order they were sent? Had a situation where it could've been a case. Any insight?

little raptor
little raptor
devout gazelle
little raptor
devout gazelle
#

Sorry about that - but question still stands.. how to make this work MP?

#

Can you run it like this?

little raptor
#

I'm not sure what that code is supposed to do...

#

but the code itself has no MP problem

#

(except hint)

devout gazelle
#

@little raptor
I am wanting the guards in traffic control points to become suspicious about players passing through it with a chance of becoming hostile ... I will add more conditions once I get the basics - but for now there is a random chance.

little raptor
#

and the reason you're joining them to WEST is to make them hostile to the guards?

devout gazelle
#

They are indipendent for now - I am using this in the "vindicta" gamemode just to make it more interesting

#

THey never react to players if getting close

little raptor
devout gazelle
#

Players are civ when in cars or in civilian clothing

#

As for now the government forces never react to close proximity

little raptor
devout gazelle
#

So I want to script a function for that

#

Well kinda new.. So I am trying to figure stuff out really - with your help hopefully ❀️

devout gazelle
little raptor
devout gazelle
#

In vindicta I think civilians are setcaptive true maybe when they are without weapons and in vehicles..

devout gazelle
little raptor
upper siren
#

Got a question about CuratorObjectRegistered Event Handler
Wiki says

Triggered when player enters curator interface. Assign curator cost to every object in the game. This is the primary method that a mission designer can use to limit the objects a curator can place.
Which confuses me, does it fire whenever zeus places something down or does it fire whenever the local players enters the zeus interface?

little raptor
#

Triggered when player enters curator interface
meowsweats

upper siren
#

Yeah, but "This is the primary method that a mission designer can use to limit the objects a curator can place." makes it sound like its object specific?

little raptor
#

what it means is that you can give object types a certain cost

#

curator cannot place an object if its cost is too high

upper siren
#

I might have gotten confused in semantics

copper raven
upper siren
#

yeah I'm reading that rn, thanks πŸ™‚

upper siren
#

I'm trying to a log output whenever I enter the zeus interface.

player addEventHandler ["CuratorObjectRegistered", {
diag_log format ["Hello, %1!", name player];
}];

executed locally through debug console does nothing.
(editor, host local multiplayer, spawn in, execute code, enter zeus interface)

#

any pointers as to why?
I've looked at the wiki examples in addEventHandler to get something working but I feel like I'm missing sth

copper raven
#

you are supposed to add the curator event handlers to the curator module

upper siren
#

I've added it to the init of of the game master module, still no luck.

copper raven
#

just opened the game and tested, works ok

upper siren
#

did you use the vanilla zeus module or the one from ace?

copper raven
#

vanilla

#

why are you adding it to some ace module? meowsweats

upper siren
#

lets just pretend I never said that, I added it to the vanilla module πŸ˜„

meager epoch
#

is it possible to have a do - while as opposed to a while - do?

#

cause i need the code to run at least once

hollow thistle
#
while {
  // do stuff

  _condition
} do {};
pastel pier
#

Hello, i am trying to make a module in a scenario. It doesn't seem to work so i think i'm mission something. I try to just follow the wiki and copy past the examples to get a working module but it's just not showing up. https://community.bistudio.com/wiki/Modules

copper raven
hollow thistle
#

does not work in unscheduled tho.

peak lily
#

are the loadout arrays from setUnitLoadout compatible with CfgRespawnInventory classes?

meager epoch
#

another question, can i forcefully exit from an EH when a certain condition is met (without deleting the EH)?

pastel pier
#

So modules have to be created as addons right ?

devout gazelle
#

Hey I am still working on my TCP script here:
But for some reason I cannot use the sleep command anywhere to slow down the loop.
Any idea how and where i can slow down the loop?
It also returns _checks = 0.. I guess it goes through all 5 checks in a millisecond..

_distance = player1 distance bargate;  
_checks = 5; 
while {_checks > 0} do  
 {
_suspicious = floor (random 100)+_distance;
_checks = _checks - 1;
hint format["The guards have checked you %1 times",_checks];
Sleep 2;
hint format["Your detection chance is %1",_suspicious];
Hint "Guards are not suspicious";  
Sleep 5;
 If (_suspicious < 30)then  
{  
 _group = createGroup WEST;{[_x] joinSilent _group} forEach units (group player1);
Hint "You have been comprimized!"; 
} else {   
};  
};
devout gazelle
# copper raven you can't suspend in unscheduled environment

I don't know what to do with this info at this level of competance...
Apparently using sleep in a while loop is not possible. I presume you want to use spawn instead of a while loop, but I no idea how.
EDIT: Just realized you can use sleep within a while loop - but apparently not when i nest it with IF /then/else..

distant oyster
devout gazelle
#

The script is run from a execVM

distant oyster
#

I just tested the code you posted and it works

#

well modified a little bit as I don't have your variables but general syntax is functional

devout gazelle
#

@distant oyster Thanks!

I got this down - and it's working:
Would be nice to see your version as well !

[] spawn {
    private _checks = 5;
    while {_checks > 0} do {
        private _distance = player1 distance bargate;
        private _suspicious = random 100 + _distance;
        hint format["The guards have checked you %1 times", _checks];
        _checks = _checks - 1;
        sleep 2;
        hint format ["Your detection chance is %1", _suspicious];
        if (_suspicious < 30) exitWith {
            private _group = createGroup WEST;
            {[_x] joinSilent _group} forEach units (group player1);
            hint "You have been comprimised!";
        };
        sleep 5;
        hint "Guards are not suspicious";
    };
};
distant oyster
#

as i said, just the global variables:

_distance = player distance cursorObject;  
_checks = 5; 
while {_checks > 0} do  
{
    _suspicious = floor (random 100)+_distance;
    _checks = _checks - 1;
    hint format["The guards have checked you %1 times",_checks];
    Sleep 2;
    hint format["Your detection chance is %1",_suspicious];
    Hint "Guards are not suspicious";  
    Sleep 5;
    If (_suspicious < 30)then  
    {  
        _group = createGroup WEST;
        {[_x] joinSilent _group} forEach units (group player);
        Hint "You have been comprimized!"; 
    } else {   
    };  
};
  
};
#

no wait

#

now

#

and executed with @little raptor 's Advanced Developer Tools Debug Console (Run scheduled) which uses spawn I suppose

undone dew
#

coming back to a script I was trying to get working last week, it needs to continuously spawn objectives capping at 3 active, no idea why it's not working or where to go from here

#
TaskSpawner.sqf:
if (!isServer) exitWith {};

taskCounter = 0;
publicVariable "taskCounter";

ts_patrol_fnc = [] call compileFinal preprocessFileLineNumbers "TS\ts_patrol_fnc.sqf";
ts_banditcamp_fnc = [] call compileFinal preprocessFileLineNumbers "TS\ts_banditcamp_fnc.sqf";

private _taskTypes = [ts_patrol_fnc, ts_banditcamp_fnc];
while { true } do {
    if ( count taskCounter < 4 ) then {

        [] spawn ( selectRandom _taskTypes );
        
    } else {
        sleep 30;
    };
};```
#
ts_patrol_fnc,sqf:
 
 private _ObjectiveMrk = ["marker_1", "marker_2", "marker_3", "marker_4", "marker_5", "marker_6", "marker_7", "marker_8", "marker_9", "marker_10", "marker_11", "marker_12", "marker_13", "marker_14", "marker_15", "marker_16", "marker_17"] call BIS_fnc_selectRandom;

    [west, "task", ["We've detected a CSAT recon element in the marked area - track them down and eliminate them. Reward: $750", "($750) CSAT Patrol"], _ObjectiveMrk ,1, 2, true] call BIS_fnc_taskCreate;
    _grp = [getMarkerPos _ObjectiveMrk, EAST, (configfile >> "CfgGroups" >> "East" >> "OPF_F" >> "Infantry" >> "OIA_InfSquad_Weapons")] call BIS_fnc_spawnGroup;
    [_grp, getMarkerPos _ObjectiveMrk, 150] call BIS_fnc_taskPatrol;

    _ObjectiveMrk setMarkerColor "ColorOPFOR";
    _ObjectiveMrk setMarkerText "CSAT";

    taskCounter = taskCounter + 1;
    publicVariable "taskCounter";

        while {{ alive _x } count (units _grp) > 0} do
        {
        waitUntil {{ alive _x } count (units _grp) == 0};
        ["task","Succeeded"] call BIS_fnc_taskSetState;
        [750,0] remoteExecCall ["HG_fnc_addOrSubCash",west,false];

        _ObjectiveMrk setMarkerColor "ColorUnknown";
        _ObjectiveMrk setMarkerText "";
        ["task"] call BIS_fnc_deleteTask;
        taskCounter = taskCounter - 1;
    publicVariable "taskCounter";
 
    "PATROL"
};
copper raven
leaden haven
#

Why is it impossible to lock out the copilot seat in a helicopter?

player addEventhandler ["SeatSwitchedMan", {
    params ["_unit", "", "_vehicle"];
    private _pilot = driver _vehicle;
    private _gunner = gunner _vehicle;
    private _copilot = _vehicle turretUnit [0];

    if (_vehicle isKindOf "Air" && {
        !(_vehicle isKindOf "ParachuteBase") && {
            if (_unit in [_pilot, _gunner, _copilot]) && {
                !((_this # 1) getVariable ['isPilot',false])}
            }
        }) then {
            moveOut _unit;
    };
}];

This code is not working. I am trying this with an RHS Mi-8 chopper and it never works. Should I just spawn an invincible AI in the seat instead?

undone dew
#

i just need them to run the scripts and update the Counter variable when the objective is finished so the loop can spawn a new one

little raptor
cold pebble
#

Quick question for anyone who may know of the top of their head; onMouseButtonDown UI EVH, is the LMB 0 and RMB 1 for the _button param

cold pebble
#

ty πŸ™‚

little raptor
#

you can just put a systemChat meowsweats

cold pebble
#

Saves me even opening arma 🀣

azure aspen
#

Just getting started in scripting been toying around a little bit with some stuff. I can't get much to work so far.

private _bomb = xbomb 
_bomb addAction ["<t color='#FF0000'>Defuse bomb</t>", {}];

I've put the var name in the item I want to addAction to be xbomb

distant oyster
azure aspen
#

I knew it was something simple. 🀣 My bad. Been playing around scripts all night

#

Thanks

distant oyster
#

no worries, we all started somewhere πŸ˜‰

undone dew
#

I tried rewriting this stupid script, i'm still getting this fucking "_taskCounter is undefined" bullshit even though it's clearly defined, why is this not working no matter what I try

if (!isServer) exitWith {};

private _taskCounter = 0;

_ts_patrol_fnc = execVM "TS\ts_patrol_fnc.sqf";
_ts_banditcamp_fnc = execVM "TS\ts_banditcamp_fnc.sqf";

private _taskTypes = [_ts_patrol_fnc, _ts_banditcamp_fnc];
while { true } do {
    if ( _taskCounter < 4 ) then {

    [] spawn { 

        _taskCounter = _taskCounter + 1;
        selectRandom _taskTypes; 
        waitUntil { scriptDone _taskTypes };
        _taskCounter = _taskCounter - 1;

         };
        
    } else {
        sleep 30;
    };
};```
distant oyster
undone dew
#

so i need a global variable?

distant oyster
#

easier. you pass it as a parameter

undone dew
#

example please ;_;

distant oyster
#
[_taskCounter, _taskTypes] spawn {
  params ["_taskCounter", "_taskTypes"];
...
#

also

        selectRandom _taskTypes; 
        waitUntil { scriptDone _taskTypes };
``` doesn't make sense. you are not using the output from taskTypes and try to use scriptDone on an array
undone dew
#

yeah i know but i was gonna tackle that after this, ive already been struggling with this shit for a week straight lol

distant oyster
#

the changes to _taskCounter are also not propagated to the upper scope, so that should be a global variable

#

are there bis functions that show a structured text hint? since you can't remoteExec structured text hints

undone dew
copper raven
distant oyster
#

"Debugging is like being the detective in a crime movie where you are also the murderer." - Filipe Fortes

undone dew
#

it's still only spawning 2 objectives no matter how high I set the "taskCounter < #" line >_>

copper raven
#

yes because your code is wrong

undone dew
#

and it's only spawning one task/group of enemies, I'm assuming it has to do with the TaskID being overwritten every time it's looped and makes a new task, how do you generate new tasks with a new taskID?

undone dew
#

saying "its wrong" isn't helping, obviously it's wrong, I'm asking why is it wrong and what is the proper way to write it ;_;

copper raven
#

i told you the issue already, and even pasted you the message link from the previous time

undone dew
#

i rewrote it to just use execVM like so ```sqf
if (!isServer) exitWith {};

taskCounter = 0;
publicVariable "taskCounter";

_ts_patrol_fnc = execVM "TS\ts_patrol_fnc.sqf";
_ts_banditcamp_fnc = execVM "TS\ts_banditcamp_fnc.sqf";

private _taskTypes = [_ts_patrol_fnc, _ts_banditcamp_fnc];
while { true } do {
if ( taskCounter < 4 ) then {

    [_taskTypes] spawn {
        params ["_taskTypes"];
        taskCounter = taskCounter + 1;
        selectRandom _taskTypes; 
                     };

} else {
    sleep 30;
};

};```

sorry if i'm being a dick, this has been making me pull my hair out for like 8 days

#

i assumed what you said before meant I shouldn't use the "preprocessFileLineNumbers" lines because they were just using the return of those functions

#

so i tried to rewrite it to simply run the scripts and update the counter

copper raven
#

no, you shouldn't have called the functions

#

you need to store the compiled code, and then reuse it later

#

otherwise you discard the result, and lose the reference to it

undone dew
#

ok, thanks for the explanation

dreamy kestrel
#

Q: re: drawing shapes on a map... how is it I can connect some 'shape arguments' with a draw request? seems like maybe that is more bookkeeping that I must do (?)

_map ctrlAddEventHandler ["draw", {...}];
copper raven
#

use an array

dreamy kestrel
#

yeah, thinking that, or a HASHMAP, i.e. given named shapes and so forth

hollow tinsel
#

Can you show a custom screen when using startLoadingScreen?

dreamy kestrel
#

Q: does {...} count _hashMap provide _y?

dreamy kestrel
velvet merlin
#

allMissionObjects "EmptyDetector" - only returns scripted triggers. how to get editor placed ones?

little raptor
#

maybe they're of different type?
if so try this:

allMissionObjects "" select {isClass (configFile >> "CfgNonAIVehicles" >> typeOf _x)}
#

or even better:

allMissionObjects "" select {getText (configOf _x >> "simulation") == "detector"}
velvet merlin
#

hm works only for the scripted too

#

ok seems the "guarded by" are not considered normal triggers..

#

wanted to test if you can move their position (editor placed or scripted)

#

but apparently doesnt work..

little raptor
velvet merlin
#

testTrigger and testTrigger2 are seen as not defined

#

for the scripted its bin\config.bin/CfgNonAIVehicles/EmptyDetector

little raptor
#

I guess they're not actually triggers then. they're scripted

velvet merlin
#

seems the guard points are not triggers indeed

copper raven
devout gazelle
#

Question: Id like a script for guards checking civilian players for papers and weapons based on proximity and chance.
The closer you are to the guard patrol, the higher the chance for them to order you to stop. I made the random chance working and I attached a trigger to one of the guard leadera, but id like for ALL guard leaders to be scanning players.
Any ideas?

#

How do I attach a trigger to all AI independent guard units ... I am thinking foreach and iskindof... but I dont know how to write it

distant oyster
devout gazelle
distant oyster
#

for leaders:

{
    // code
} forEach (allGroups select {side _x == independent} apply {leader _x});
devout gazelle
#

Nice! Is it possible to add iskindof to determine unit type?

distant oyster
#

and for all units:

{
    // code
} forEach (allUnits select {side _x == independent});
devout gazelle
#

So ita not ALL leader but only specific type of units or unit names

distant oyster
#

either check in the loop agains the _x variable of use another conditional select

#
{
    // code
} forEach (allUnits select {side _x == independent && _x isKindOf "Man"});
devout gazelle
#

@distant oyster
Thanks a lot ..
So if I want it to nest with this function :

call{Trigger1 attachTo [Guard1,[0,0,0]]}
#

I guess I need to define the position of each "independent", "man".. And I need to spawn a trigger of each of them and attach that trigger to them.

distant oyster
devout gazelle
#

@distant oyster
How do I define _x ?

distant oyster
#

see biki for forEach, it is a magic variable

copper raven
#

why are you even using triggers for this?

#

and this will be insanely inefficient

devout gazelle
#

@copper raven I am happy you realized! It was just a test to see if you had a better solution XD

#

I guess it's better to use distance - but triggers allows a easy way for me to define conditions - so there you have it πŸ™‚

distant oyster
#

my idea would be to simply turn that whole logic around. instead of the independent units getting a trigger why not giving the player a trigger?

winter rose
#

@devout gazelle as in: check around the player if there are independent leaders, instead of checking around all independent leaders if there are player units

independent numbers are more likely to be higher than the amount of players

proven charm
#

is onDraw EH called every frame for the map?

copper raven
#

yes

#

(if the map is open)

proven charm
#

ok thx

distant oyster
#

doesnt onDraw mean when the map is moved?

proven charm
meager epoch
#

Is KeyName supposed to be replaced with something in:

player addUserActionEventHandler ["KeyName", "Activate", {
  ...
}];
#

Also, is the EH supposed to be attached to the player (the one who activates the action)?

still forum
#

keyName is the name of the action

#

no that EH doesn't get added to anything

#

Did you read the wiki page?

meager epoch
#

πŸ‘€

devout gazelle
little raptor
#

better not use triggers at all meowsweats

devout gazelle
#

@little raptor
That is why I am here - to learn from those with more experience.

#

But not sure if i learnt that much from your answer.
Any able to elaborate on this?

little raptor
#

attaching triggers = bye bye FPS

#

also triggers evaluate their conditions in unschd env

tough abyss
#

I'm trying to find a way to spawn multiple ai's on a trigger if its possible
I followed along a video explaining how to do a single unit and tried tweaking it to spawn a squad
Can some one take a look I will show you the one I followed and what I did.
From the Video

group_1 = creategroup west;  enemy1 = group_1 createunit ["b_soldier_f",getmarkerpos "spawn1",[],0,"form"]; enemy1 domove (getmarkerpos "waypoint1")

What I changed

     group_1 = creategroup East;  enemy1 = group_1 createunit ["rhsusf_army_ocp_squadleader","rhsusf_army_ocp_teamleader","rhsusf_army_ocp_rifleman","rhsusf_army_ocp_autorifleman","rhsusf_army_ocp_grenadier","rhsusf_army_ocp_teamleader","rhsusf_army_ocp_autorifleman","rhsusf_army_ocp_grenadier","rhsusf_army_ocp_riflemanat",getmarkerpos "spawn_1",[],0,"form"]; enemy_1 domove (getmarkerpos "waypoint1")
bitter jewel
#

you are trying to pass all your units to createUnit at once, but createUnit syntax does not allow this

#

you have to call createUnit for each of your units individually instead

distant oyster
#

or use BIS_fnc_spawnGroup

meager epoch
#

Can I force a difficulty in an SP scenario? If yes, how?

#

and by force, i mean put a custom difficulty

fair drum
astral lynx
#

I'm making a script right now for mp where if the opfor faction does something then it sets off stuff for the blufor faction, that i am fine with, however I was wondering if there is a way I can test it w/o bringing in a 2nd person

#

like for example if opfor drops a crate from a plane then it'll alert the people on the blufor faction so they can go get rid of it
in this case both factions would be player controlled not ai controlled, im trying to see if there is a way I can be on BLUFOR at the same time as opfor so that I can activate it and then do the other part on BLUFOR without needing to have 2 computers or another person

dreamy kestrel
#

hello, Q: I have created some units, aligned CIV, there are definitely two different objects.
they are not appearing in allUnits however.
additionally I am creating some EAST units in patrol of the civilians.
I see groups there, but they too are not showing up in allUnits.

bitter jewel
#

An eden placed, not server only, radio alpha trigger with onActivation as:

systemchat format ["%1", local thisTrigger];

played in MP (not dedi) results in a systemchat on every machine, and in addition it is false for everyone but the host player.

#

but if i understood the advice repeated on this channel this should not be the case

dreamy kestrel
crude vigil
winter rose
crude vigil
# winter rose Triggers placed in Eden can be server-side only or not (checkbox)

An eden placed, not server only, radio alpha trigger with onActivation as:
Assume it is server only... the trigger itself still exists on all machines, as the server only part defines where the evaluation will be done. So it would return the same thing anyway.
(Of course trying this in "On Activation" while server only is ticked will not yield anything obviously but thats out of context as he clearly defined "not server only".)

elfin comet
#

Would someone be willing to help me out with using remoteExec to change a bool via setVariable? I have at least gotten it to stop making errors, but it still doesn't seem to be changing the bool in question.

A voice chat would be preferable as that is little more conducive to how I learn, but I understand if people want to use text instead.

I overlooked the fact that setVariable can deal with locality on it's own.

devout gazelle
# little raptor attaching triggers = bye bye FPS

I was wondering about why, but more interesting is ideas about how.
Wiki isnt always helpful in that way, so this is why i ask someone that could show examples that i can test. Saying something doeant work points me away from the wrong direction not towarda the correct one.
Nevertheless I am grateful for the advice!

dreamy kestrel
#

Q: how do I ensure that my remoteExec lands on the correct machines? specifically this is to attach some particle sources. testing it under isServer&&hasInterface, i.e. selfHosted (?), so -2 does not seem like the correct targets argument. Is it a JIP (i.e. true) or a targets that I want?
https://community.bistudio.com/wiki/remoteExec#Syntax
Perhaps detecting selfHosted, 0 is best, when not, then -2 i.e. every other machine besides the server.
Thank you...

little raptor
# devout gazelle I was wondering about why, but more interesting is ideas about how. Wiki isnt a...

well it's obvious. use loops instead:
now I'm not 100% sure how you wanted to do what you said but this should give you an idea:

while {true} do { //infinite loop
  _cnt = {//_cnt: number of alive guards
    alive _x && {
        _guard = _x;
        if (!scriptDone (_guard getVariable ["inspect_script", scriptNull])) exitWith {true};
       {
          if (side _x == CIVILIAN && _x distance _guard < 15 && { //only check if player is a civilian & within 15m radius
              time > _x getVariable ["nextInspect", 0] && { //only consider for inspecting every few seconds
                 !(_x getVariable ["Inspected", false]) //not already inspected
              }
          }) then {
              _x setVariable ["nextInspect", time + 10]; //check this unit 10 seconds later
              if (random 1 > _chance) then { //inspect
                _x setVariable ["Inspected", true];
                _script = [_guard, _x] spawn MY_fnc_Inspect;
                _guard setVariable ["inspect_script", _script];
              };
          }
       } forEach allPlayers;
       true;
    }
  } count _guards;
  if (_cnt == 0) then {break}; //no guards are alive anymore. break the loop
  sleep 1;
}

if you expect there to be fewer players than guards you can swap the inner and outer loops.

upper siren
little raptor
#

well triggers evaluate their conditions unschd
plus he wanted to attach the triggers to the guards (or to the players?). attaching is inefficient

#

triggers by default get evaluated twice a second
you can change this

upper siren
#

Yeah that's why I said "by default" :D

#

Isn't "normal" code unscheduled aswell?

#

E.g. I init some script on the server that checks if players are in area and does that every 2 seconds.

upper siren
#

Initserver.sqf

little raptor
#

initServer is schd

#

that checks if players are in area and does that every 2 seconds.
this by definition is also schd (unless you use a per frame EH)

upper siren
#

Interesting, never really thought about that

#

Thanks :)

devout gazelle
#

@little raptor
Thanks for the effort!
I am attempting to wrap my head around what you've done and find how to test it.

devout gazelle
#

I have a question:
I want TCP guards to check if a player has weapons and papers.
If they detect weapons in your backpack or holster or you don't have papers they will consider you hostile.
If you are clean and have paper item on your person - guards will let you go.
Any ideas how to script such a check?

winter rose
#

yes

mental wren
#
if (hasWeapon || !hasPapers) then {
  beHostile;
};

dab

devout gazelle
# little raptor well it's obvious. use loops instead: now I'm not 100% sure how you wanted to do...

So I am making a script for military police/guards patrolling towns and setting up check points to search civilians for legal papers and counterfeit

I want a specific type of independent units to act as guards (like a certain faction class for example).
The guards will scan you every 7 seconds 5 times with a random chance of being suspicious the closer you get to them.
If they are suspicious they will approach you, search you and ask for papers.
If you have no weapons and have the paper item, they will go back into safe mode and head back to the guard post or continue patrolling.
I've already made some parts of the script that "works", but problem is that I want to run the script just on Military police and not on normal AI.

My solution was to spawn a trigger on all the patrols, but you found a better method that I haven't really figured how to implement yet.
This is what I have so far:

#
[] spawn {
    private _checks = 1;
    private _Compromized = false;
    while {alive guard1 and _checks < 5} do {
        
        private _distance = player1 distance Guard1;
        private _suspicious = random 100 + _distance;
        
        if (_distance < 25) then
        {
        hint format["The guards have checked you %1 times", _checks];
        sleep 4;
        hint format ["Your detection roll is %1...", round _suspicious];
        _checks = _checks + 1;
        };
                        
        if (_suspicious > 25 && _suspicious < 50) then
        {
        Hint "The guard is starring suspiciously at you...";
        guard1 dowatch player1;
        guard1 setBehaviour "AWARE";
        guard1 doMove (position player1);
        guard1 globalRadio "Hey you! Papers!";
        }; 
        
        if (_suspicious < 25) exitWith {
            private _group = createGroup WEST;
            guard1 dowatch player1;
            {[_x] joinSilent _group} forEach units (group player1);
            guard1 setBehaviour "COMBAT";
            hint "You have been comprimised!";
            _compromized = true;
        };
        if (_distance > 25) exitWith {
            hint "You are at a safe distance.";
            _compromized = false;
        };

    
    sleep 7;
    };
    
    if (_checks >= 5) exitwith
        {
        guard1 setBehaviour "SAFE";
        guard1 doMove (getMarkerPos "guardpost1");
        hint "Guards are not suspicious";
        
        };
    
    if (!alive guard1) exitWith
    {
    Hint "The guard is dead";
    };
};
upper siren
#

!code

wicked roostBOT
#
How to use SQF syntax highlighting in Discord

```sqf
// your code here
hint "good!";
```
↓

// your code here
hint "good!";
upper siren
#

@devout gazelle

#

I think you only used one `

devout gazelle
#

Now it worked πŸ˜›

stray flame
#

Eyo! I have been working on a scenario for my unit for a few days now with most thing going smoothly. Its about 2 teams stranded and separated and them having to find eachother while working around limited resources.

I say this because as it flows, I want both groups (both in BLUFOR) having markers set from the editor that only members of that same group can see. I've spent about a day total digging for solutions for this and I cant seem to find a script of config that works. I would like some help constructing a script where some markers and only visible to members of a specific group and invisible to members of the other. Can anyone help me out with this?

#

I am mostly new to scripting only recently begun trying to learn the ways scripting works. So most of the time that I read someone talk about the technical aspects of what a function or so is in context of a script I just blank out

hollow thistle
stray flame
#

I have designed basic functional scripts before so I know enough to tell where one begins and the other ends but why a thing is where it is still hasn't been something I can consistently understand unless I recognize the like in question

stray flame
hollow thistle
#

The mod is based on CBA template and is not really begginer friendly.

tl;dr it's a loop that updates the markers for everybody in your group/side/however it's set up

stray flame
#

So far ive got a functional script for tracking groups by location with a marker but its basically displayed globally

#

The markers I wish to set should be static

#

Also, I should ask

#

This mod you sent me

#

What would I need to edit for it to work with my intent?

hollow thistle
#

Ah wait, you meant markers as in Markers that track positions of your group members? (Blue force tracker)

#

Because I've understood it like this.

#

Or just normal map markers visible to only certain group?

stray flame
#

I mean static markers only visible for a single group

hollow thistle
#

Ah, well I misunderstood.

#

It's a lot simpler then.

stray flame
#

in this case its a marked crash site

#

makes no sence for a team across the map to know what the crash team just found out (in context of the mission)

hollow thistle
#

I would suggest putting the markers in 2 separate editor layers layers.

stray flame
#

Alright

#

easy enough

hollow thistle
#

Then make them all alpha 0/invisible

#

and show them on init with a check in what group player is in.

stray flame
#

how can I construct this script?

#

First step simple enough, layers are set correctly to the markers

#

BTeam_Markers

#

With

"C_Mark" and "J_Mark"

hollow thistle
#
if (group player == crashedGuysGroup) then {
    private _markersToShow = getMissionLayerEntities "crashed_guys_markers" select 1;
    {
        _x setMarkerAlphaLocal 1;
    } forEach _markersToShow;
};
stray flame
#

in the init.sqf right?

#

testing

#

would any seprate commands from triggers effecting these markers break anything?

hollow thistle
#

maybe, can't say without knowing what commands.

stray flame
#

MarkerPos

hollow thistle
#

I think not, IIRC it will update the position of the marker for everyone but if it's invisible to some people it should not matter.

stray flame
#

can I test the functionality of this script by playing alone on a hosted server or?

hollow thistle
#

yes, if you mean dedicated server just change groups. For local hosted boot the game 2 times.

stray flame
#

hm?

#

" For local hosted boot the game 2 times"?

#

its player/local hosted server

#

hmm

#

got it to work with Bteam (the ones who should see it)

#

lets try with A

#

Holy moly it works

#

thanks for the help

#

I will probobly be back later for some help with respawn script

#

Do I repeat the script (with edits for what layers and groups it applies to) if I want the same to apply for another team with different markers?

hollow thistle
#

yeah, you could make it maybe a bit smarter and set the layer to uncover on the group as variable or smth.

#

But you can also just copy paste it for other groups if there's not many of them.

stray flame
#

Just 2 groups

stray flame
#

ok this one should be more simple

#

how do I set respawn on squad members?

#

Trying to find a way to do that. Without map markers for respawn

glossy pine
#

for example if i have this array

[3,4,2,5]

How i can get the index of the highest number? i know that selectMax returns me the highest number of the array but how i get the index of where that number its?

pine saddle
#

I have a stupid question, is it possible to use a flagpole to call this ?:
Function name:MRH_fnc_EndCredits;
Author: Mr H.
Description: plays movie like end credits with player names
Return value: None
Public: Yes
Parameters:
0 -<NUMBER> speed (default 20)
1 - <STRING> mission title
2- <STRING> mission maker's name
3- <STRING> special thanks
4- <STRING> extra text
5- <STRING> year
Example(s):
[20,"MRH Milsim Tools demo","[TGV] Mr H.","Special thanks go here.<br/>Accepts structured text","Extratext comes here<br/> accepts structured text","Made in 2018"] call MRH_fnc_EndCredits;

Or do i need to set up a script ?

little raptor
fresh ibex
little raptor
#

e.g.:

_sorted = [];
{
  _sorted pushBack [_x, _forEachIndex];
} forEach _arr;
_sorted sort true;
_minIndex = _sorted#0#1
#

or:

_min = selectMin _arr;
_index = _arr find _min
flint topaz
little raptor
flint topaz
#

I don't know how to create an ace interation call they never worked for me

little raptor
#

you don't have to make an ace interaction

#

it can be a vanilla addAction

#

so just to summarize what you should do:

  1. not sure how ACE arsenal works, but this either goes in initServer.sqf, or initPlayerLocal.sqf + replace createVehicle with createVehicleLocal:
my_dummy_box = createVehicle ["HelperBase_F", [0,0,0]];
[my_dummy_box , [...]] call ace_arsenal_fnc_initBox;
  1. in a box init:
this addAction ["Open ACE Arsenal", {
  params ["", "_caller"];
  [my_dummy_box, _caller] call ace_arsenal_fnc_openBox
}];
flint topaz
#

[...] this is the "export" part of the arsenal correct?

little raptor
#

it's the limited arsenal thingy

flint topaz
#

yeah

little raptor
#

I haven't used ACE arsenal in a long time. I just pulled that from the docs:

[_box, ["item1", "item2", "itemN"]] call ace_arsenal_fnc_initBox
#

Β―_(ツ)_/Β―

flint topaz
#

see my issue is I know other languages but can't seem to understand the docs nor logistics of this one

little raptor
#

that's because you don't understand the syntax I guess

flint topaz
#

pretty much

#

so I can create a "initServer.sqf" file within the server files correct so it loads on all missions right?

#

or is it per mission?

little raptor
little raptor
#

like I said I don't know where it goes

#

because I don't know how ACE fetches the list (local or global)

#

if you can't test just use the second approach

#

I think it'll work just fine

silk ravine
#

@still forum Is it intentional that Arma bonks itself to the Desktop when an include can not find the requested file while being accessed by compile preprocessFileLineNumbers ?

copper raven
#

yes

#

the only way to avoid that is to run with -nologs (or fix the bad include path πŸ™ƒ )

silk ravine
#

god damn it xD why tho

copper raven
#

im pretty sure it got fixed though(?)

#

or only in description.ext or something like that

silk ravine
copper raven
#

yes, you can use the __has_include

#

can you check if it crashes for description.ext includes?

silk ravine
#

I currently have nothing in my desc ext

#

or at least no includes

copper raven
#

just add one

#

and test

#

(with file that doesn't exist)

meager epoch
#

how can i add new rows and stuff like an apostrophe or quotation marks in a hint

cosmic lichen
#

\n -> new line

copper raven
#

\n and escape

silk ravine
#

It simply will not load the description.ext in that case, at least via test in MP

#

but I am getting an error message in the editor

#

no crash

copper raven
#

interesting

#

and what if you preprocessFile "description.ext"?

#

i assume it will crash the game

meager epoch
#

what about ' and "? or do they not conflict with the quotes from the hint

cosmic lichen
#

hint """quotes"""

silk ravine
#

that is very likely, but I really do not wanna try that right now xD

cosmic lichen
#

hint "'differentQuotes'"

meager epoch
#

right, one more question

#

how can i add a & in the briefing

copper raven
#

&amp;

#

maybe

meager epoch
#

ait ty

cosmic lichen
#

yes

silk ravine
#

or, you know... just write and