#arma3_scripting

1 messages ยท Page 83 of 1

tough abyss
#

don't think so.

#

It's a control, so if you get the idc then maybe with ctrlText

rich bramble
#

Is there a way to access the "Description" editor field of a unit from sqf?

tough abyss
#

hmm. Don't think so.

hallow mortar
#

! is a modifier that inverts whatever boolean (true/false) you give it. For example, !alive takes the bool result of the alive command and inverts it, so the overall expression returns false if alive would return true, and vice versa.
This modifier can be applied to any bool, including the result of triggerActivated, in the same way.

#

(! is a shorthand for not, if that helps)

tough abyss
#

I hope the new 3d editor format can be accessed like the description.ext

candid sun
#

you'd think getDescription would do it, but no

tough abyss
#

Because the mission.sqm can't

#

It's one of BI's troll commands

warped hornet
#

Is is possible to kick someone who is already in freefall out of it?

#

I know you can set the global freefall height but that doesnt seem to do anything if they are already freefalling other than prevent it from happening after they naturally exit freefall

candid sun
#

oh

#

is that it?

tough abyss
#

That could be it

candid sun
#

"Returns unit description set in Editor and visible on role selection screen in MP. Works in MP and SP.
"

rich bramble
#

@candid sun Maybe, thanks. I'll give that a try, brb :)

tough abyss
#

1.48, so it's pretty new

rich bramble
#

I'm somewhat expecting it to return "MEDIC", "ENGINEER", etc. If it wasn't such a new command I wouldn't even be surprised it if returned "zdravotnรญk", "inลพenรฝr", etc ;)

tough abyss
#

Can confirm that it works

#

roleDescription player

rich bramble
#

@tough abyss Awesome, thanks!

tough abyss
#

Thank 25252551, he found it

rich bramble
#

@candid sun Thanks :)

warm hedge
#

Probably by changing animation?

drifting sky
#

Is there any way to test what stance a unit has been ordered by the player to take?

candid sun
#

my pleasure

west portal
candid sun
#

is there any way to set the texture for a 3D dialog object?

boreal parcel
tough abyss
#

setObjectTexture

#

Oh dialog object

#

dunno

candid sun
#

need something like ctrlSetModelTexture

#

was wondering if it was called something less intuitive

#

like the black MX gun - that uses the same model as the normal MX. if you create the black MX as a dialog object it's not black though

lone glade
#

use the icon ?

candid sun
#

where's the fun in that though?

tough abyss
#

It's a different weapon class (with the same model). It has a different icon I think

lone glade
#

^

candid sun
#

icon is definitely different yeah

#

just looks silly when i create a 3D object from a list which has the icons, but the object is a different colour

tough abyss
#

What 3d object?

drifting sky
#

Can anybody think of a way of choosing a waypoint part way to a destination, on a road that a group will actually use to get to that destination?

manic kettle
#

Simplest solution I can think is to split distance to a destination by x number of points...or say every 200m.
Then use the NearestRoads function to find the nearest road segment, set waypoint to it and repeat

drifting sky
#

I've already tried that, but that causes a lot of double backing because the nearest road is not necessarily the road the ai chooses to drive on to get to the destination.

drifting sky
candid sun
#

like i'm going through cfgWeapons, getting weapon icons + names, adding them to a list

manic kettle
#

I've never used it. But it seems to give you an array of positions go the destination. I don't know how long each position is, but it may be used every x positions...
Just a guess.

drifting sky
#

Actually, what would be more useful is a way of detecting when a group can reach a waypoint

manic kettle
#

I feel like if you use the above to sum a distance and divide by speed you could get that.

candid sun
#

then creating a 3D dialog object of the selected weapon using it's defined model

drifting sky
#

Also, a way of choosing how direct a path the group takes. They tend to flank way far wide.

candid sun
#

but it's not consistent for weapons with non default textures like the black mx

pliant stream
#

is there a way to branch atomically in sqf?

candid sun
#

branch?

pliant stream
#

if x then y otherwise z

candid sun
#

try a switch case

#

maybe

pliant stream
#

it's not atomic

tough abyss
#

Hello all... can someone tell me what language you are using to script for arma?

tough abyss
#

Ah, thank you :)

pliant stream
#

it's a nice little language with the friendliness of assembly but worse syntax ;)

tough abyss
#

I come from MONO-C C# will that be of any use to me?

pliant stream
#

i think that's always a silly question. "i know X programming language, will that be useful for language Y?"

tough abyss
#

sqf and arma configs are c like acording to Flummi

pliant stream
#

if you know basic programming principles that will be useful to you

tough abyss
#

alright

pliant stream
#

OOP will be useful

tough abyss
#

i have another silly question if you do not mind :)

sullen marsh
#

Why do you specifically need to branch atomically?

tough abyss
#

basically all my knowledge about Arma engine is either from youtube video's or playing DayZ.... a bad thing to start using scriping right away?

pliant stream
#

no

candid sun
#

start scripting yesterday imo

pliant stream
#

@sullen marsh i dislike the idea of the scheduler fucking my shit up

#

can't do that if i don't let it

tough abyss
#

is it possible to script AI behaviour?

candid sun
#

don't wanna miss any of that good banging-your-head-against-a-wall time

sullen marsh
#

Sounds like you've got some sort of race condition going on there

#

Why not just not use the scheduler?

pliant stream
#

that's what i'd like to prevent

#

well i am that's the point

snow pumice
#

Hey
i want to set an variable to the object leaving the trigger

How can i do that?
I tried this but it wont work (the hint works, but the var does not)

_trg setTriggerStatements [
        "this", 
        "hint 'In Gas'; [] spawn tag_fnc_teargas;",
        "hint 'Kein Gas'; player setVariable ['outOfGas', false];"
    ];
pliant stream
#

i wouldn't have to worry if it was unscheduled now would i

#

the entire script would be atomic

warm hedge
#

Seems nothing's wrong

sullen marsh
#

It'd be synchronous actually

warm hedge
#

What is the teargas function? Does it have outOfGas variable in it?

winter rose
sullen marsh
#

Atomic means it'd all execute inside a single cpu cycle

snow pumice
# winter rose is the trigger server-side perhaps?

its created on the unit placing the gas
It should trigger for every unit on the server

here is more code


if (_ammo isEqualTo "SmokeShellYellow") exitWith {

    private _trg = createTrigger ["EmptyDetector", getPos player];
    _trg attachTo [_projectile, [0, 0, 0]];
    
    _trg setTriggerArea [10, 10, 5, false];
    _trg setTriggerActivation ["ANYPLAYER", "PRESENT", true];
    _trg setTriggerStatements [
        "this", 
        "hint 'In Gas'; [] spawn ES_fnc_teargas;",
        "hint 'Kein Gas'; player setVariable ['outOfGas', false];"
    ];

    _projectile setVariable ["trigger", _trg, true];
    [_projectile] remoteExecCall ["ES_fnc_teargasDelete", 2];
};
sullen marsh
#

And that'd be a pretty small script

pliant stream
#

that's what it means in another context yeah

winter rose
snow pumice
winter rose
#

well, hint works so code should run on said client machine

pliant stream
#

either way let's not argue semantics

snow pumice
#

fucking hell
sorry
i want to set it to true, not false

pliant stream
#

synchronous then

snow pumice
#

man thats embarrassing
thanks for your help

warm hedge
#

Yeah that's what I thought actually. It happens whenever it happens

sullen marsh
#

I think ifs are atomic

#

well

#

they have to be

pliant stream
#

what i mean is that a script in the scheduled environment can be paused while unscheduled they cannot

sullen marsh
#

I assume you need some multi-path branch like a switch

pliant stream
#

if (x) then { y } else { z }; if x takes more than 3ms the scheduler will pause before y

sullen marsh
#

Well, in that case there's nothing else that will be atomic

tough abyss
#

there also exists unsuspendable sheduled environment. Which is governed by the rules of the sheduler but you still can't use sleep, waitUntil and uiSleep
e.g.
0 spawn {call {"unsuspendable sheduled"}};

pliant stream
#

you what now

tough abyss
#

Just because you use call doesn't mean it's unsheduled

sullen marsh
#

I still get the feeling there's some race condition you're trying to outrun with this search, what are you actually trying to do in the script

pliant stream
#

i know that commy i don't think anyone said otherwise

tough abyss
#

ok. Ignore me then

#

First rule: ignore me when I talk BS

pliant stream
#

but take these two examples X; X; X; [X, X, X] if X is some statement that takes more than 3ms the first one will pause twice but the second one won't

sullen marsh
#

I don't think you're going to find a way

little raptor
#

Well actually I think it returns the player forced one

#

(if not Auto)

jade acorn
#

when a unit dies, player can pick up its weapon without having to open unit's inventory - so I assume it creates a groundweaponholder. I'd like to set damage to that weapon (or to the weaponholedr) so it cannot be looted by the player but I don't see any eventhandler that would include the dropping weapon event

#

possibly something else than damaging every holder in player's vicinity every frame

pliant stream
#

yeah probably not

#

just thought i'd ask if anyone had figured one out

proven charm
#

why not just delete the groundweaponholder?

jade acorn
#

weapon will disappear then, no?

proven charm
#

yeah

jade acorn
#

I want to keep as many visual elements as possible and get rid of only the gameplay ones, so far I have solved the problem of lifting uniforms and everything else from corpses by disabling the inventory window when trying to loot, only the issue of weapons that can be picked up separately remains

#

I guess I will be just deleting them if there is no cool solution

little raptor
#

disable its simulation

#

there is also lockInventory. iirc it's still bugged but I think it was fixed for 2.14

jade acorn
#

but how do I find that groundweaponholder? Is it created right after unit gets its damage 1 or after it's ragdoll is disabled?

little raptor
#

use the killed event handler

#

then search the nearby weapon holders and get the one for which getCorpse is the dead unit

jade acorn
#

btw disabling simulation on a body doesn't lock player from looting worn headgear and facewear ๐Ÿ˜„

winter rose
#

disabling simulation on a weapon holder also doesn't prevent seeing the action (it prevents from taking the weapon though)

little raptor
#

you can remove the weapon holder and create a simple object of the weapon model meowsweats

jade acorn
#

trying to pick up a weapon with simulation disabled may change its position I guess, I remember some falling through walls when being interacted with in this state

#

still a better option than removing stuff from units ๐Ÿ˜„

little raptor
#

there was a solution but I don't remember rn

#

I thought it was disabling sim

snow pumice
# winter rose is the trigger server-side perhaps?

Will the trigger not work if i create it from the server?
Or better said, the code in activation / deactivation will be executed locally for the unit triggering the trigger right?
So if i use hint it will show for every player actiavting that trigger and not only for the creator of the trigger right?

little raptor
#

no

#

server triggers only execute on the server

#

triggers execute their codes locally

snow pumice
little raptor
#

if not a local trigger then no

#

it executes the code locally on each client separately (if it triggers for them)

#

I think think_turtle

stark fjord
#

It does.

little raptor
#

ok so only for creator

#

because setTriggerStatements has local effect

little raptor
stark fjord
#

Afaik condition evaluates where trigger is local no?

little raptor
#

dunno blobdoggoshruggoogly
I think it executes locally everywhere, same as statements

snow pumice
#

will try this out later, thanks

but maybe you can help me with this
I want to create an trigger when a smoke is thrown, i attachted the trigger to the smoke
When the smoke is gone i want the trigger to get deleted
With the evh firedMan i check for the smoke, created the trigger and safed him into a var on the smoke
Than i remote execd to the server with the smoke as a paramter
The server attaches the deleted evh and when the smoke is deleted the trigger gets deleted to

This works ~1-2 times and than suddenly stops working, the server still recives the object etc and executes the function but somehow the evh for deleted does not get triggered
Any idear why?
Or how i could solve this in a other way?
I dont want the "thrower" to remove the trigger becuase he could disconnect

winter rose
snow pumice
#

but maybe this is the reason why it bugs so much

winter rose
#

then make the client call a server-side trigger creation function

#

no need for the client to do tons of stuff

otherwise, FiredMan โ†’ create trigger + smoke death event = trigger deleted on client - on disconnect, the trigger doesn't exist anymore

#

given the feature, IDK what is your stuff, client-side trigger may be wrong.

snow pumice
#

feature is a gas granade, it gets thrown and the trigger should handle adding / remove the effect for players getting near the gas

If i put the trigger on the server, what should be the code in the setTriggerStatements / activation?
I tried this but then only the server got the code executed

little raptor
#

don't use server triggers

#

use local triggers

#

projectiles are local

#

basically what Lou said

winter rose
little raptor
#

he wants to show effects for players

#

better use local triggers anyway
otherwise he'll need remoteExec for something that is local -> pure waste of resources

snow pumice
little raptor
#

uhmmm think_turtle
do you want to show the effects for a specific type of projectile?

snow pumice
#

only if a yellow smoke is thrown

winter rose
#

what is the effect you have, client-side?

little raptor
#

you can use projectileCreated event handler locally on each client. no need for remoteExec then

snow pumice
little raptor
#
addMissionEventHandler ["projectileCreated", {
  params ["_projectile"];
  if (typeof _projectile != "blabla") exitWith {};
  _trigger = createTrigger ["EmptyDetector", [0,0,0], false];
  _trigger attachTo [_projectile, [0,0,0]];
  _projectile setVariable ["trigger", _trigger]
  _projectile addEventHandler ["deleted", {
    params ["_proj"];
    deleteVehicle (_proj getVariable ["trigger", objNull]);
  }];
}];

something like that

snow pumice
little raptor
#

I think it will be JIP compatible as it is

#

they should still have a projectile created for them

little raptor
#

everything is local

#

including the trigger

winter rose
#

just that people joining after the throw and before smoke deletion might not have the effect
not sure if projectileCreated triggers on JIP projectile creation

snow pumice
#

Thank you guys ๐Ÿ™‚

snow pumice
#

Works like a charm

vivid bridge
#

Hello! I want one of the three bots on the red side to randomly run the script (_killer setcaptive false ) when a bot comes from the blue side

please tell me the script below i have an example of the script but it does not work

#

private _killer = selectRandom [a1,a2,a3];
if ((bob distance _killer) < 5) then {
_killer setcaptive false;
};

wicked roostBOT
#
How to use SQF syntax highlighting in Discord

```sqf
// your code here
hint "good!";
```
โ†“

// your code here
hint "good!";
winter rose
warped hornet
winter rose
warped hornet
#

Ill play around with that combo a bit thank you

twin oar
#

// Find the MHQ1 asset
_mhq1 = nearestObject [player, "MHQ1"];

// Check if the MHQ1 asset is found
if (isObjectHidden _mhq1) then {
    hint "MHQ1 not found!";
} else {
    // Teleport the player to the position of MHQ1
    player setPos getPos _mhq1;
    hint "Teleported to MHQ1!";
}

#

This is the teleport string I use attached, in regards to #arma3_editor

stable dune
#

!quote 5

lyric schoonerBOT
twin oar
#

How do not use โ€˜SetPosโ€™ for a teleporting feature

south swan
#

by using any sane setPos* command. Like setPosASL

winter rose
#

setPosWorld, setPosASL, setPosATL, etc yes

winter rose
obsidian mirage
#

When using a MineActivated event handler, do I put it in a trigger and also for the projectile, does that mean the mine I am using?

winter rose
twin oar
obsidian mirage
vivid bridge
winter rose
hallow mortar
#

I wouldn't recommend writing anything in SQS format as it is deprecated. Use SQF instead.

south swan
obsidian mirage
twin oar
winter rose
vivid bridge
granite sky
winter rose
vivid bridge
winter rose
winter rose
sullen sigil
#

what's the model command you're supposed to use with set/getPosWorld? modelToWorldWorld?

winter rose
sullen sigil
#

yees

#

i think the model offset is causing me problems as am using setPosASL with modelToWorldWorld

winter rose
#

kinda

obsidian mirage
#

Finally, how do I put the mine in the players inventory, without making them pick it up?

sullen sigil
#

ah ty

#

i'll see if this fixes my issue

#

havent done any scripting for nearly a month now ๐Ÿ™ˆ

winter rose
obsidian mirage
#

is there any command that puts it in the players inv?

winter rose
#

you can use addItem or addMagazine

sullen sigil
winter rose
vivid bridge
obsidian mirage
#

thx

sullen sigil
haughty quartz
#

guys should i buy arma reforger?

#

or just wait for arma 4

winter rose
sullen sigil
#

wrong channel this is for scripting (code not plays)

haughty quartz
#

ok

sullen sigil
#

though i suppose the channel topic doesnt eliminate screenplays about arma 3 from here

winter rose
haughty quartz
#

thanks

twin oar
#

Is there a way to incorporate a live feed of an area in game?

#

Like seeing a pos from a UAV but without using the UAV terminal

south swan
sullen sigil
#

fuck you beat me to it

sullen sigil
#

which is ok for planes, not really ok for a big non aerodynamic blob

#

now i just have the problem of turning whilst moving is significantly faster thonk

wicked roostBOT
#
How to use SQF syntax highlighting in Discord

```sqf
// your code here
hint "good!";
```
โ†“

// your code here
hint "good!";
warped hornet
digital hollow
sullen sigil
vivid bridge
#

Guys, can you suggest a script for ejecting weapons from the hands of a bot?

sullen sigil
#

nvm sqfbin down again ๐Ÿ˜ฆ

winter rose
little raptor
#

it is yeah

#

in any case you can't "snap" units out of freefall anim. you should just make sure they never get into it in the first place

winter rose
sullen sigil
#

...though my problem could be a lack of diag_deltaTime in KJW_CapitalShips_fnc_orientShip buuuutttt wouldn't make sense for its time to change upon the ship starting movement thonk

little raptor
#

why do you add 3 per frame EHs? meowsweats
and why do you keep reading configs every frame? meowsweats
and also I have no idea what you're doing in that code ๐Ÿ˜“

sullen sigil
#

because i havent bothered performance optimising yet because its just in single player
configs im going to end up caching when i can be bothered

#

but the code takes an object that doesnt move and sets its position and orientation etc in accordance with the variables (targetvelocity and targetorientation)

sullen sigil
#

but for some reason its much quicker at orienting while its moving when it should(?) be the same speed surely

little raptor
sullen sigil
#

oh

#

KJW_CapitalShips_fnc_turnShip and KJW_CapitalShips_fnc_accelerateShip just handle changing the target variables in accordance with their speeds and so on so can be ignored really

#

i'll do another pastebin with just the ones that matter

#

(i know the eachframe config lookups are horrible im going to just stick all of the config information into a variable on it when the ship is initialised once i have energy to do that)

little raptor
#

what is the problem rn?

#

object banking?

sullen sigil
#

the object is quicker at changing orientation when its moving than when its stationary

#

to do a loop de loop
24.67s moving
192.41s unmoving

little raptor
#

what does this even mean? meowsweats

sullen sigil
#

hang on i'll draw a diagram to compensate for my poor written communication skills

#

doing this

#

when its moving it takes ~25 seconds to point upwards again
when its not moving it takes ~192 seconds to point upwards again

#

(to do a 360 in pitch i suppose)

#

does that help

little raptor
sullen sigil
#

AHA

#

found it

#

_ship setVectorDirAndUp ([_dir, _up] apply {_ship vectorModelToWorldVisual _x});

#

changing it to vectorModelToWorld has solved it

#

going to double check

#

yeah turning on the spot is just as fast

#

just need to tweak config values now and (probably) change the config lookups to variable checks

#

though i will say i only noticed a .0005ms difference in performance in either so ๐Ÿคท

little raptor
#

it's much bigger than that

sullen sigil
#

i probably didnt test it correctly then

#

as a sidenote the multiple pfhs are purely for organisations sake right now and will be consolodated into one eventually don't worry

little raptor
#

are purely for organisations sake
you can just make separete functions

sullen sigil
#

i know i just find it easier this way

little raptor
#

you iterate over the same objs every frame

#

so you should just do [_x] call fnc1; [x] call fnc2 for each obj in 1 each frame

sullen sigil
#

im changing the configs to variables now then im putting it into one pfh

#

oh i didn't even think of that boost either

#

...evidently

twin oar
#

Would this work for placeable sandbags?

#

Kind of like what SOG does with its FOB creations

#

// Define the sandbag barrier object class name
_barrierClassname = "Land_HBarrierWall4_F";

// Define the initial health and decay rate of the barrier
_initialHealth = 100;
_decayRate = 1;

// Define the required supplies for maintenance
_requiredSupplies = 10;

// Create a sandbag barrier
_createBarrier = {
    private["_position", "_barrier"];
    _position = _this;

    // Create the barrier object at the specified position
    _barrier = createVehicle [_barrierClassname, _position, [], 0, "NONE"];

    // Set the initial health of the barrier
    _barrier setVariable ["health", _initialHealth, true];

    // Add the barrier to the global array for tracking
    barriersArray pushBack _barrier;
};

// Decay the barriers over time and handle maintenance
_decayAndMaintenanceLoop = {
    while {true} do {
        {
            private ["_barrier", "_health", "_supplies"];
            _barrier = _x;

            // Decay the barrier health based on the decay rate
            _health = _barrier getVariable ["health", _initialHealth];
            _health = _health - _decayRate;

            // Check if the barrier needs maintenance
            if (_health <= 0) then {
                // Find the nearest player/team or modify as per your requirements
                _supplies = player getVariable ["supplies", 0];

                // Check if there are enough supplies for maintenance
                if (_supplies >= _requiredSupplies) then {
                    // Deduct the required supplies
                    player setVariable ["supplies", _supplies - _requiredSupplies, true];

                    // Reset the barrier health to the initial value
                    _health = _initialHealth;

                    // Update the barrier's health variable
                    _barrier setVariable ["health", _health, true];

                    // Play a maintenance sound or show a message
                    hint "Barrier maintained!";
                } else {
                    // Play a decayed sound or show a message
                    hint "Barrier decayed!";
                    // Alternatively, you can remove the barrier here using `deleteVehicle _barrier;`
                }
            } else {
                // Update the barrier's health variable
                _barrier setVariable ["health", _health, true];
            }
        } forEach barriersArray;

        sleep 1; // Adjust the decay rate by changing the sleep time
    }
};

// Create an array to store the barriers
barriersArray = [];

// Execute the decay and maintenance loop
[] spawn _decayAndMaintenanceLoop;

// Example usage:
{
    // Specify the positions where the barriers should be created
    [_x, 0] call _createBarrier;
} forEach [
    // Provide the positions for the barriers here
    [1000, 1000, 0],
    [2000, 2000, 0]
];

sullen sigil
#

leopard can sleep better now

winter rose
#

not with that font

#

ScummVM called, they want their font back!

sullen sigil
#

monocraft

#

vet29 made an arma mod for it as well

#

but its on his gh unreleased on ws

hasty current
#

Is there any way to run script code if a Man hits a wall? Like isTouchingGround but for non-vertical collisions

#

I tried the EpeContact EventHandler, but it (predictably) didn't ever fire, since Man isn't a PhysX object

winter rose
#

not out of the box no

hasty current
#

sad.. thanks, though ๐Ÿ‘

#

I'll figure something else out using lineIntersectsSurfaces, math, and possibly a hackhack or two

wind flax
#

How would you go about creating a server function within a mod? I'm assuming I need to create a initServer.sqf, but I'm not quite sure which event handler to use on the config end

granite sky
#

"creating a server function"? Assuming that you didn't scramble that request, best to use CfgFunctions.

wind flax
#

Basically I need a function which is packed within the mod, which would on the the server

#

client -> someFunction (some function is defined within the mod)

finite dirge
#

Should be back up for now ๐Ÿ‘

winter rose
#

sorry to hear, and thank you!

drifting sky
#

Is there any way to force ai groups to take more direct paths to far away destinations? Is the "suppression" mechanic part of the reason they flank so wide? What about the "general" or "command" skills of the group leader? The problem I'm having is east and west forces are flanking so wide, they're spreading out over several miles, and often going around each other entirely. It gets worse the longer the mission is played, which makes me wonder if the ai are trying to bypass "beaten" zones, hence the question about the suppression mechanism.

granite sky
#

Infantry?

drifting sky
granite sky
#

Infantry go quite direct unless distracted by nearby enemies, in my experience.

drifting sky
# granite sky Infantry go quite direct unless distracted by nearby enemies, in my experience.

I've got two objectives about 2 km apart from each other. Guys and vehicles spawning at each objective going to the other end up spread out like 3km perpedicular to the direction between the objectives. Now, I can mitigate this by giving them waypoints part way to their destination, BUT, I cannot figure out a way to do this while keeping vehicles on roads leading to their destination. And without keeping vehicles on the roads, they tend to try to go through areas they cannot really pass through.

granite sky
#

I honestly don't know how you're making your infantry drift that much.

#

Maybe with full reveal + search & destroy waypoints.

drifting sky
#

they spread out more and more over time. After about 45 minutes, they're going way out in the boonies. I think they're trying to go around beaten zones, but I'm not sure.

jade abyss
#

Attached objects won't collide with eachother

granite sky
#

They haven't walked 2km in 45 minutes?

#

Do you mean after engagement or something?

drifting sky
#

they start out in cars.

#

or apcs/tanks

#

But anyway, everybody ends up flanking way too far wide

#

There isn't a waypoint that makes ai move toward and attack enemies on their way to a destination, is there???

winter rose
#

1/ mods? like, AI mods?
2/ "wander" waypoint?

drifting sky
#
  1. No ai mods except for my own, which currently only changes cfgskills and ai related weapon / ammo parameters. 2) I don't recall what a wander waypoint is. Dismissed??? If so, then not using any of those waypoints.
granite sky
#

"move"

#

I'd avoid search and destroy if you care about where they go.

#

Can't really tell what you're talking about though.

#

Doesn't correspond to any AI behaviour I've seen, and I've watched a lot of vanilla AI behaviour.

#

If AIs have a move order to a destination but they're moving continually away from that, it's usually because they're fleeing. But that's very post-engagement.

#

You can disable fleeing.

#

There's also a mechanic where squad leaders will split off a couple of squad members to investigate a position, but in that case it's obviously a split squad.

drifting sky
#

Can I post a screenshot here?

#

I'll use imgur. https://imgur.com/dfFNSUk This is after only about 5 minutes of mission time. You can see that some blue groups are already flanking way around unnecessarily. Why aren't they taking a more direct path?

winter rose
wary sandal
#

should i avoid using globals in EachFrame events to maximize perf?

drifting sky
#

Well, it's going to be a scripting solution if there is one.

winter rose
#

(or anywhere else for that matter)

winter rose
drifting sky
#

What kinds of modifications could cause this???

wary sandal
#

maybe i could make an _functionlib array that contains all the functions

winter rose
drifting sky
#

As an asside, what happens when there is a conflict between a group's combat behaviour and the combat behaviour of the units in that group?

winter rose
granite sky
drifting sky
granite sky
#

Only some. Unit position is individual for example. Vehicle navigation is always group behaviour.

drifting sky
#

What about bounding overwatch? group, or unit?

granite sky
#

No idea.

drifting sky
#

is the movement planning of idividual units based on the unit or group behaviour? For example, can I have some units in a group moving stealthily, and not others?

granite sky
#

You certainly can for a player group. I imagine the same applies to AI squads.

#

(but this doesn't completely follow, as some player group orders act on a level that's not even script-accessible)

drifting sky
#

Another asside. Is it possible to determine what stance a player commanded unit has been ordered by the player to assume?

granite sky
#

I'm going to guess not.

#

Although given that commanded pos is highest priority, I guess that's just the stance they're in? so unitPos

#

Although maybe that only returns the setUnitPos value.

twin oar
jade acorn
#

as "upload it to an external site so it's easier to read"

drifting sky
#

Apparently unitpos does return what the unit was ordered by the player to assume. Someobody told me yesterday that it does not.

jade acorn
#

maybe they meant setUnitPosWeak

twin oar
#

Ohhh

#

Will do

twin oar
drifting sky
twin oar
vivid bridge
drifting sky
wary sandal
#

everything is in meters on arma right?

cosmic lichen
#

yes

drifting sky
little raptor
drifting sky
little raptor
#

I guess I was thinking about the fact that setUnitPos can't change player issued stance

little raptor
#

it could be because the group is fleeing think_turtle

#

did you check that?

little raptor
drifting sky
#

I disabled fleeing, they still flank really far

#

I'm pretty sure they were not being sent anywhere except to an area near the correct objective

little raptor
#

still if it happens again try to log the fleeing

#

I think they still flee when they're out of ammo

drifting sky
#

does the group as a whole flee, or individual units?

little raptor
#

I don't remember but I think individuals think_turtle

granite sky
#

IME the whole group flees at once, but then the getter is on the units.

drifting sky
#

I just tested it again, no sign of any fleeing going on. Still flanking very wide, even after just a few minutes of mission time.

granite sky
#

Did you actually check fleeing _unit?

drifting sky
#

yes

#

Could "safe" combat behavior or "green" combat mode cause them to want to go the long way around to an objective?

#

It seems like if anything that should make them take a more direct path

granite sky
#

In vehicles, yes. Not seen it with infantry but then I don't normally use safe for moving towards an enemy objective.

#

In vehicles careless is the only one that doesn't avoid threats, IIRC

drifting sky
#

I'm using SAFE and GREEN in an attempt to make them move more quickly when they are not in contact with the enemy

granite sky
#

I'm not sure why those guys down in the corner would even know about the enemy.

drifting sky
#

Some of them immediately set out on a round about path as soon as they spawn, even when no enemies are within kms of their position.

granite sky
#

hmm, I wonder if you're hitting a specific blocked path case here.

#

Like it first tries the direct route, but it's impassable so it random-rolls some bullshit.

drifting sky
#

it happens on any map, seemingly regardless where the bases are located

granite sky
#

yeah no idea then. Not seen it.

#

Like in Antistasi I routinely buy squads and send them at enemy objectives. They take the direct path.

drifting sky
#

Hmm... setting them to "AWARE" and "YELLOW" instead of "SAFE" and "GREEN" hasn't fixed the problem

#

I notice that for like half a second after a group is initially created, they show up as their position at map origin. I wonder if that could have something to do with it.

granite sky
#

Try replicating the behaviour with no mods and outside your mission.

#

It's a common thing to spawn units elsewhere and then move them. Pretty dangerous.

#

Ideally don't do that, or at least only give them the waypoint after they've been placed properly.

drifting sky
#

I'm not spawning them elsewhere, I just see that for a moment it shows the group position at map origin.

#

Sorry, I mean it shows the leader's position at map origin. But I am creating them at the location they're supposed to start at.

#

Oh never mind that... the marker is at the origin... it hasn't updated for the goup's position yet. However, all the rest of the problem still remains.

boreal parcel
#

is there a way to get the new player unit in onPlayerKilled.sqf?

#

similar to onPlayerRespawn.sqf's _newUnit, _oldUnit

wary sandal
#

How more intensive are hashmaps compared to arrays?

flat oasis
granite sky
boreal parcel
hallow mortar
little raptor
#

and they're slower when iterating over them (probably not that imprtant in SQF since it's not that fast anyway)
and unlike arrays they don't support all data types

granite sky
#

onPlayerRespawn is called if/when the player respawns. I'm not sure what's ambiguous about that unless you're concerned about frame timings.

#

I think the default behaviour is that the player is force-respawned after 15 seconds of being dead. So in that case the killed handlers would fire 15 seconds before the respawn handlers.

boreal parcel
#

I also understand its probably not onPlayerKilled calling onPlayerRespawn, just not sure how to word it

granite sky
#

It's similar to events. Arma calls them when specific things happen.

#

Although it does apparently run those scheduled, unlike events which are all unscheduled.

analog inlet
drifting sky
#

My problem with ai groups flanking wide to get to objectives definitely has something to do with the presence of enemies. When I remove all enemies, the remaining groups on that single side take direct paths to the objective.

boreal parcel
drifting sky
analog inlet
boreal parcel
analog inlet
#

lovely, thank you!

boreal parcel
#

no problem

graceful kelp
#

so i have an issuie, were using input action to get the inputs of the helicopter, but when in free look and the cyclic input isint being touched, just the view controls, it still registers the cyclic controls, the helicopter itself dosent move but the inputaction thinks something is happeneing

candid sun
#

whale, _this select 1 is what you're looking for

#

caller (_this select 1): Object - the unit that activated the action

wary needle
#

Anyone know if there is a way to promote someone to zeus like in the way its done in the zeus enhanced mod?

jade acorn
#

how can I make a thermal-only lightsource? I have a unit in uniform that is almost transparent and player should be able to see that unit only in thermals (but it is invisible in every camera mode). So far I have an eventhandler to switch the uniform to a similar one with "hot" rvmat but was thinking about attaching a thermal light source to his body to make the entity visible in TI, but not fully. setLightIR works only for NVGs

winter rose
jade acorn
#

I was hoping for a config-less script as it's for a mission rather than a mod

stark fjord
#

Amm laser command can create ir only light, but light source cant. So i guess, eh, and if player puts on nvg, create light source, if they take it off, delete light source

hallow mortar
stark fjord
#

Right. Light has no heat

manic flame
#

Hello everyone, Im having some trouble with an arma script I recently wrote, it errors saying _scrapCarried is undefined.

https://sqfbin.com/fogopevuqajisaxoyanu

RPT Log:

13:44:05 Error in expression <se 1 past.";
private _currentScrap = _scrapCarried getOrDefaultCall [_callerU>
13:44:05   Error position: <_scrapCarried getOrDefaultCall [_callerU>
13:44:05   Error Undefined variable in expression: _scrapcarried
winter rose
manic flame
#

Roger

#

Reformatted

#

I see, thank you

flat oasis
#

sup, i wanted to do marker area like in pic using script so i wrote this code

_markers = TRA_Markers; // Array
_markersNum = count allMapMarkers;
_markerPos = []; // Array of x, y, z pos of every marker 

{

 _Pos = getMarkerPos _x;
 _markerPos pushBack _pos; // pushing each pos 
} forEach _markers; 

{
  _newMarker = createMarker ["Area_Marker", _x];
  "Area_Marker" setMarkerShape "ELLIPSE";
  "Area_Marker" setMarkerColor "colorOPFOR";
  "Area_Marker" setMarkerSize [200, 200];
        
}forEach _markerPos;

but still not making the marker

winter rose
#
private _markers = TRA_Markers; // array of markers

{
  private _name = format ["Area_Marker%1", _forEachIndex];
  createMarker [_name, getMarkerPos _x];
  _name setMarkerShape "ELLIPSE";
  _name setMarkerColor "colorOPFOR";
  _name setMarkerSize [200, 200];
} forEach _markers;
manic flame
#

Hi, it's me again;
For some reason my target vehicle is not being deleted after the action is completed. The 'vehicle' in the image should be deleted after the action is complete.

https://sqfbin.com/eyavupupedimeyedecok

winter rose
#

also currentScrap is not used

#

wait, I did not notice - I do not know CBA_fnc_progressBar

manic flame
#

that's fine, CBA progressbar code

#

I wanted to access _target within the progressbar code but it no workey

#

Im going to try like this, but last time it did not work

#

*corrected _this

winter rose
manic flame
#

they do, that's why im asking...

#

Not entirely sure how to pass _target from addAction down to the progressbar scope

jade acorn
#

how about joining ACE discord where CBA devs are too and ask directly at source ๐Ÿ˜„

manic flame
#

anyways, i've figured it out regardless

#

i just made target a public variable and now it seems to work

winter rose
manic flame
#

The progressbar prevents movement unless aborted so it shouldnt be a problem

winter rose
#

ok, good then

manic flame
#

Unless a player found a way to perfectly align his camera with 2 scrap pieces it shouldnt pose an issue

winter rose
#

also, even if the player dies, he gets monies

manic flame
#

I dont think the player will die grabbing scrap

twin oar
manic flame
#

Do hashmaps always return strings? Whenever I set my hashmap and try to return its data using getOrDefault it always gives me "any"

little raptor
#

And no they don't always return string

manic flame
#

well, surely.. im just generally confused

#

for some reason my hashmap wont get the new data

little raptor
#

How do you set it?

manic flame
#
_generatedScrap addAction ["Obtain Scrap", {
    
            private _caller = _this select 1;
            callerUID = getPlayerUID _caller;
            private _currentScrap = scrapCarried getOrDefault [callerUID, 0];
            target = _this select 0;
            ["Obtaining Scrap...", 3, {
                true
            }, {
                private _scrapMined = selectRandom scrapAmmount;
                hint format ["+%1 Scrap!", _scrapMined];
                systemChat format ["%1", _scrapMined];
                {
                    scrapCarried set [callerUID, _scrapMined];
                    deleteVehicle target;
                } remoteExec ["call", 0];
            }, {
                hint "Aborted!"
            }] call CBA_fnc_progressBar;
        }];
#

I get the data using getOrDefault as seen

#

then I set the data using set

#

i get no errors

little raptor
#

Well then you must've set it to nil

manic flame
#

shouldnt be nil... i'll double check.

little raptor
#

Or scrapCarried is nil itself

manic flame
#

scrapCarried nil? But that would mean set and get wouldnt work.. or?

#

this is how its defined

little raptor
#

It would mean they return nil

#

In unscheduled environment they would just silently fail. In scheduled you'd get an undefined var error

manic flame
#

Im currently on initServer.sqf

#

i believe its unscheduled

little raptor
#

You're in addAction which is scheduled

#

From what I see it could be that scrapAmount is not defined

manic flame
#

Oh, @little raptor i figured it out

#

Inside the remoteExec "_scrapMined" becomes "any"

little raptor
#

Yes

little raptor
manic flame
#

oh no scrapAmmount is defined

#

it works perfeclty

#

its seems the scope is brokey

little raptor
#

Oh wait your remoteExec code doesn't include the _scrapMined var at all

#

Didn't notice on mobile

manic flame
#

I fixed it by making _scrapMined a public variable

little raptor
#

Well ofc it's not defined then

manic flame
#

asides that i dont know other workarounds

#

yeah i know

#

not good

little raptor
#

Pass it as args to remoteExec

manic flame
#

oh

#

jeez you're right lmao

winter rose
manic flame
#
[_scrapMined] {
  private _scrapMined = _this select 0;
  scrapCarried set [callerUID, _scrapMined];
  deleteVehicle target;
} remoteExec ["call", 0];
#

wold this work?

little raptor
#

If you fix it yes

manic flame
#

what do you mean?

little raptor
#

Well target's not defined either

manic flame
#

ah no that's fine

little raptor
manic flame
#

[_scrapMined] {?

#

im lost lmao

little raptor
#

[[scrap], {}] remoteExec

little raptor
twin oar
manic flame
#
[[_scrapMined], {
    private _scrapMined = _this select 0;
    scrapCarried set [callerUID, ];
    deleteVehicle target;
}] remoteExec ["call", 0]
little raptor
#

Yeah

manic flame
#

alrighty

#

lol sorry for messing up, still getting used to this

little raptor
#

You cut it out

manic flame
#

its alriiiighttt ๐Ÿ˜†

#

yeah fixin thatr

#

@little raptor working flawlessly, thanks again.

#

Guess who's back. Just a small question, @little raptor . How would I go in adding more arguments?

I tried adding more to the array _scrapMined was located at:

[[_scrapMined, _myOtherVariable], ...

though it seems not to work.

#
  • I fixed it by not passing the variable and just re-obtainingt he data
winter rose
twin oar
winter rose
#

thanks

winter rose
#

my answer would be "try and see"?

twin oar
#

Haha okay!

twin oar
winter rose
#

if you want to? you could name it "potato.sqf" that it would work the same ^^

twin oar
#

Ahh okay cool much appreciated

#

Will try soon ๐Ÿ™‚

dreamy kestrel
#

Q: is there a way to intercept when a function is called?

sullen sigil
#

no

twin oar
#

And for the variable of supplies required would I use _spawn?

#

So it would spawn that exact variable each time?

steep gale
#

Hey im trying to figure out if its possible to whitelist items in the arsenal to a players uid has anyone done it

twin oar
dreamy kestrel
little raptor
#

as KJW said no

little raptor
#

there are non-SQF ways tho

proven charm
dreamy kestrel
# proven charm whatcha trying to do?

there may be better ways to do this, looking into one upstream approach now...
I want to tell when BIS|ACE arsenal has been configured with virtual items...

#

or at minimum inquire what those items might be

proven charm
#

I'm sure there are ways to detect that but I dont use arsenal my self so...

sullen sigil
#

is there not a cba event for ace arsenal

south swan
#

preOpen/open/close events for arsenal are available even in vanilla blobdoggoshruggoogly

#

but inventory change... meowsweats

dreamy kestrel
#

not looking for hooks to the arsenal itself. for the virtual items.
for an inventory manager thing I am doing. draws from the same set of items.

#

so I need to know either upstream when that set is assembled, or when the virtual items have been discovered.

sullen sigil
#

surely you only need to know when the manager is in use? thonk

south swan
#

"set is assembled"/"virtual items have been discovered" aren't exactly self-explanatory (at least for my ear) meowsweats

dreamy kestrel
#

no like I said, when inventory manager is opened, it will load the virtual items

sullen sigil
dreamy kestrel
little raptor
#

code

sullen sigil
#

isnt createvehicle at 0,0,0 then setposasl faster

south swan
sullen sigil
#

exactly.

little raptor
sullen sigil
#

ah

south swan
#

and if scripter doesn't want to find a non-colliding position, why bother with setting 10 meter radius in the command call?

little raptor
#

this has nothing to do with unschd env as you said

sullen sigil
#

put vehicle in pos i tell it to ๐Ÿ˜ 

little raptor
#

maybe you bork the vehicle when you spawn it?

#

did you check its damage?

dreamy kestrel
little raptor
#

I mean maybe it gets damaged

sullen sigil
#

is getvariable literally the same thing as using hurrdurrmyvariablename

south swan
#

unarmed uses the minigun model and just hides the weapons and doesn't configure turrets to use them blobdoggoshruggoogly

hallow mortar
sullen sigil
#

e๐Ÿ…ฑ๏ธic thanks

granite sky
#

Also as long as you don't use with, but no-one does that.

sullen sigil
#

what the hell is with

granite sky
south swan
#

switching default namespace

sullen sigil
#

i am terrified of that

south swan
#

as you should be

sullen sigil
#

either way im now being distracted by a bug in my code thats just making everything spin around faster and faster its quite fun

boreal parcel
#

I have a couple questions about hashmaps, can you set multiple key/values at once? or do you need to set one at a time?

also, I want to store some code in each value for my hashmaps like a function or something, is that possible? something like

params["_thing"];
TRA_buildObjectInits set [
    "object_class",
    {
        params ["_thing"];
                // modify thing, probably addActions
    }
];

[_thing] call (TRA_buildObjectInits get "object_class");
granite sky
#

Values can be anything (unlike keys). Code is fine.

boreal parcel
#

sick so I can actually call it like that? perfect

granite sky
#

You can use insert to add multiple values at once.

sullen sigil
#

i believe you can use emojis as keys

boreal parcel
#

no

hallow mortar
#

You can use emojis as keys if it's a supported unicode character, because you can use strings as keys

granite sky
#

(or just createHashMapFromArray)

sullen sigil
#
private _myhash = createHashmap;
_myhash insert [["๐Ÿ˜‡","i like trains"], ["๐Ÿ˜ ","i hate trains"]];
private _trains = _myhash get "๐Ÿ˜‡"```
little raptor
boreal parcel
# granite sky (or just createHashMapFromArray)

is there any difference in speed of creation and what not? although I dont think it matters much as itll only create on server start.

TRA_buildObjectInits insert [
    [
        "object_class",
        {

        }
    ],
    [
        "object_class",
        {

        }
    ]
];
boreal parcel
little raptor
#

imo it needs some macros tho because it looks weird rn ๐Ÿ˜…

boreal parcel
#

I was gonna say its not very pretty looking

sullen sigil
#

pretty looking? sqf? wake up

hallow mortar
#

how dare you. everything I code is gorgeous.

sullen sigil
#

mine isnt ๐Ÿ˜„

boreal parcel
#

some people are real masochists and it shows

hallow mortar
#

It would be pretty if you weren't using the minecraft font

sullen sigil
#

it helps me read it

#

best part? thats a shit ton of cba waituntilandexecutes just beneath it

#

๐Ÿ–• fuck the scheduler ๐Ÿ–•

boreal parcel
#

hes learned to code on that one minecraft mod that adds programmable computers and robots

sullen sigil
#

i had a job interview and forgot to turn the font off before it

stark fjord
#

Aint nobody stopping you from writing everything unscheduled ๐Ÿ˜‰

still forum
rich bramble
#

@pliant stream Out of interest, what do you need uninterrupted branching for? If you've got something where you want the action to happen while the condition is still in the 'correct' state, you're not going to be able to guarantee that unless the condition is only determined by local effects, the action only has local effect and you're running in unscheduled code. Since the first two are usually not true, synchronous branches wouldn't do you much good anyway.

hallow mortar
sullen sigil
#

i hate that even more than i hate my own code

#

and im 5 months into this project and have been "nearly finished" for 2 of them

boreal parcel
#

thats just horrid

#

you use light mode as well?

#

some weird people

sullen sigil
#

tbf i use light mode for python

#

just fits it better

stark fjord
#

Notepad++ should be used as dear god made it.

#

In light mode that is

sullen sigil
#

n++ is dreadful use vscode

stark fjord
#

Nope.

sullen sigil
#

this is far better

stark fjord
#

Nope.

sullen sigil
#

that being said i have like 6 pfhs in here too

#

god i hate this code

jade acorn
#
player addEventHandler ["VisionModeChanged", { 
 params ["_person", "_visionMode", "_TIindex", "_visionModePrev", "_TIindexPrev", "_vehicle", "_turret"]; 
_arrayOfUnits = entities [["O_G_Survivor_F"], [], false, true];
if (_visionMode == 2) then {
  { _x forceAddUniform "TCGM_m_BodyErebus_G" } forEach _arrayOfUnits; } else {
  { _x forceAddUniform "TCGM_m_BodyTransparent_G"}; forEach _arrayOfUnits; 
};
hint str _visionMode;
}];``` any suggestions on how to optimize this? New entities of that class may be spawned during the scenario so I cannot keep the _arrayOfUnits outside
#

(I gave up with the TI light idea)

sullen sigil
#

can you not add an init field piece of code to add to the arrayofunits or something?

#

or must it stay out of a mod

jade acorn
#

mission, not mod

sullen sigil
#

see i make mods for missions then just never do the missions
but i think thats probably the best you're going to be getting without modifying other classes

#

insofar as reliability

hallow mortar
#

You could keep the array of units in mission namespace and have an entityCreated EH that adds new ones to it.
I dunno if there's a huge amount of optimising that needs to be done though unless you expect to have a lot of these units. Your entities is tightly targeted and shouldn't take too long if there aren't a lot of them to collect.

still forum
#

If you're looking for a font, FiraCode

sullen sigil
#

"nerd font" is the first result of google after searching that

#

i only write in python sqf and c# so its not that big of a deal for me

#

just readability is nicest in monocraft

jade acorn
sullen sigil
#

distance check is probably more expensive than just inserting into the array tbh

stark fjord
#

Also if you fancy total garbage as variable names i guess you could do this missionNamespace setVariable["Dยฎ%cc|",1234]; //or missionNamespace setVariable ["ห™ลฑโ€d Xing  โ€  ยซล” $&*", 123]

jade acorn
#

and now I'm thinking that there might be no performance benefit from this

sullen sigil
#

i was wondering whose balls those were

jade acorn
#

anyway, here's a theme to accompany your font

sullen sigil
#

i cant read any of that

boreal parcel
sullen sigil
#

errrr
probably actually

boreal parcel
#

if he was to use CBA

sullen sigil
#

i know honger hates ace idk about cba

jade acorn
#

I am using cba indeed, actually forced to use it

sullen sigil
#

good

sullen sigil
#

ive never used remoteexec in my life thanks to cba

jade acorn
#

and this works with both preplaced and later added units?

sullen sigil
#

yes

#

5: _applyInitRetroactively Apply โ€œinitโ€ event type on existing units that have already been initilized. [optional] <BOOLEAN> ((default: false) should be true though for u

jade acorn
#

alright, I'll try it

sullen sigil
#

never schedule always cba

#

(sometimes schedule)

boreal parcel
#

just dont code honestly

#

its bad practice

sullen sigil
#

real talk

#

your mod should rely on gaslighting players

#

omg i should make a mod that does nothing except add a cfgpatches entry but i claim it gives +12% fps

boreal parcel
#

im going to make a mod specifically to down your FPS to 1

#

just because

#

but ill label it as the ultimate star wars mod pack

twin oar
#

Iโ€™m having some issues related to using the vehicle respawning module

jade acorn
#

it is broken

boreal parcel
#

vehicles respawning and exploding infinitely?

boreal parcel
jade acorn
#

everytime I used it in scenarios it would constantly respawn and explode vehicles

boreal parcel
#

I had no idea, totally nearly ruined a mission using it

twin oar
jade acorn
#

it was borked by some update I reckon, unusable imo

boreal parcel
#

yeah same here, eventually after battling with it to delete the wrecks it stopped spawning vehicles

twin oar
#

Just sometimes it randomly puts it down at 0,0,0

#

Then never spawns back in

twin oar
jade acorn
#

you should try running an event handler or a trigger instead

twin oar
jade acorn
# twin oar

it might "work" in your case because 0,0,0 is land if I see it on your screenshot correctly

#

if it's water like Altis or Stratis the vehicles will be destroyed, get respawned again and eventually just start flying, really really borked

pliant stream
#

unscheduled is always uninterrupted, the whole point is to have the same behavior for a critical section in the scheduled environment

twin oar
#

Would something like this work

#
// Vehicle Respawn Script
// Place this code in the vehicle's init field or in a trigger

_vehicle = _this select 0; // Get the vehicle object
_respawnDelay = 300; // Respawn delay in seconds

// Save the vehicle's initial position and rotation
_initialPos = getPosATL _vehicle;
_initialDir = getDir _vehicle;

// Start the respawn loop
_respawnLoop = {
    waitUntil { sleep _respawnDelay; true }; // Wait for the respawn delay
    
    // Delete the current vehicle
    deleteVehicle _vehicle;
    
    // Create a new vehicle at the initial position and rotation
    _newVehicle = createVehicle [_vehicleModel, _initialPos, [], 0, "CAN_COLLIDE"];
    _newVehicle setDir _initialDir;
    
    // Assign any desired attributes to the new vehicle, such as loadouts, crew, etc.
    
    // Start the respawn loop again for the new vehicle
    _vehicle = _newVehicle;
    call _respawnLoop;
};

// Start the initial respawn loop
call _respawnLoop;
granite sky
#

I don't get it. You only have a time delay on respawn? Nothing about the status of the previous vehicle?

twin oar
#

So the wreck would be deleted and the new one would spawn

pliant stream
#

and networked effects would obviously require more complex synchronization i'm not thinking about that

granite sky
#

Are you trying to replace the module or fix it?

little raptor
twin oar
#

It only matters that the vehicle can respawn, and has the marker attached

granite sky
#

Ok, isn't the point to respawn the vehicle when it's destroyed?

#

You have nothing in your code that detects whether or when the vehicle is destroyed.

dreamy kestrel
#

okay, so with ACE virtual arsenal config, easy enough to follow along how that is arrayed.
analog to that, BIS, I gather not as discriminating? i.e.

// _type:
//      0: generally 'items'
//      1: 'weapons'
//      2: 'magazines'
//      3: 'backpacks'
private _cargo = _object getvariable ["bis_addVirtualWeaponCargo_cargo",[[],[],[],[]]];
//                                                                       ^^ ^^ ^^ ^^
private _cargoArray = _cargo select _type;

is that accurate?

rich bramble
#

@pliant stream My point was that unscheduled is only 1/3rd of the necessary requirements to get a real benefit in most'interesting' cases where a player would notice it if an if/else branch was taken on 'stale' condition data.

twin oar
#

The code I have isnโ€™t being used yet

#

Iโ€™ve been using the module and itโ€™s broken apparently

rich bramble
#

Have you tried writing your critical bit in sqs? iirc that's always executed uninterrupted

pliant stream
#

yeah and as i said i'm not thinking about networked state here

#

and no i haven't looked into sqs, but i guess i should check it out

boreal parcel
#

can I get an object by its variable name set in editor via

missionNamespace getVariable ["vehicle_var", objNull];
```?
#

and also would isNil find that vehicle isNil "vehicle_var"?

dreamy kestrel
rich bramble
#

Oh, interesting alternative to writing it all in sqs (which, apaprently, sucks pretty hard). KillzoneKid suggests having an *.sqs script that only does a single thing
_this call someFunctionWrittenInSQF

granite sky
#

@boreal parcel Uh, yes? You can think of object variable names as doing vehicle_var = this in the init box.

#

More interesting questions are like whether they're updated to track new units on respawn.

pliant stream
#

huh

boreal parcel
#

alright thanks, and yeah thankfully in the scenario im using it in I dont need to worry about respawn

rich bramble
#

I'm not sure though if the engine complains when you try and call sqs stuff from the scheduled environment

pliant stream
#

so exec is like call but for SQS?

rich bramble
#

That's a question for the real old-timers in here. I only know sqs as "ye olde language"

wary sandal
#

is there a command like entities that also retrieves empty/crewed vehicles?

#

a command that retrieves units, vehicles, projectiles (and flares) would be ideal for me

pliant stream
#

i'll try it out thanks

granite sky
#

vehicles are entities, aren't they?

#

Not sure what the best command is for projectiles. Maybe some variant of allObjects

winter rose
#
vehicles select { crew _x isEqualTo [] };
```?
pliant stream
#

if that pans out it would allow for a generic implementation of synchronous code blocks

dreamy kestrel
pliant stream
#

something i've been searching for a while

indigo snow
#

exec is for .sqs, what execVM is for .sqf

pliant stream
#

right thats what i'd thought as well

cedar kindle
#

we need more goto's

indigo snow
#

you probably want to avoid using .sqs

molten yacht
#

Is initPlayerLocal called before or after you actually spawn in as your unit?

indigo snow
#

i dont know arma's inside but it might fire up a separate parser / lexicon / whatever programming term it is

pliant stream
#

yeah i only would have used it if exec was blocking and allowed me to call an sqf script passed to it

indigo snow
#

use execVM for .sqf?

stark fjord
#

B4

pliant stream
#

no that doesn't help me

#

i want to run a piece of code synchronously in the scheduled environment

#

i can already run multiple atomic statements synchronously but not branch

molten yacht
#

Is there any reliable way to execute a script only after someone has spawned in?

cedar kindle
#

and it's taking longer than 3ms?

rich bramble
#

From my understanding exec will spawn a new thread. This new thread might have to wait until it is executed but when its turn comes up, it will execute without interruptions.

boreal parcel
#

any reason the deactivation would fire shortly after trigger activation even though the player never leaves the trigger area? it does it over and over again, activates and deactivates

// Create trigger
_trigger = createTrigger["EmptyDetector", getMarkerPos _x, true];
_trigger setTriggerActivation ["ANYPLAYER", "PRESENT", true];
_trigger setTriggerArea [TRA_milActivationRadius, TRA_milActivationRadius, 0, true];
// Set Trigger Statements
_trigger setTriggerStatements
[
    format["this && (thisTrigger getVariable ['%1%2', false] isEqualTo false) && (TRA_zonesActive < TRA_maxZonesActive) && (TRA_activeAi < TRA_maxAiActive)", _x, '_active'],
    format["[thisTrigger, %1] spawn TRA_fnc_spawnMilitary;", str _x],
    format["[thisTrigger, %1] spawn TRA_fnc_deactivateZone;", str _x]
];
pliant stream
#

no most likely not but what if the statements before it take 2.99ms ;D

#

and yeah it's probably unlikely but hey i like correctness

indigo snow
#

you might reach 3ms by using all your workarounds for correctness ;)

pliant stream
#

but if my code works it doesn't matter if my script runs 17ms when it never gets interrupted

little raptor
#

also is _x a string?

boreal parcel
boreal parcel
pliant stream
#

also it's not like i'm writing huge critical sections, more like 3 simple statements

warm swallow
granite sky
#

It's 2.14

#

So only available on dev branch at the moment.

dreamy kestrel
warm swallow
#

ohhhhhh i see. thank you for pointing that out

molten yacht
#

Basically there's an OnPlayerRespawn script already

#

and I'm wondering how to mirror the radio code I have to the same slots without them respawning

little raptor
little raptor
#

it also sets two variables on the trigger itself
that's the point

#

if those setVariables are related to the trigger activation code then it makes sense that it deactivates

sullen marsh
#

There's a reason it was depreciated O_O

stark fjord
#

but only

Available only for INSTANT and BASE respawn types.

#

if you use something else, then you might as well use postInit and waitUntil player is alive

molten yacht
#

illegal to spend effort on my laziness

stark fjord
#

examples for?

molten yacht
#

the postInit/waitUntil method for doing something

#

like I mean if you literally already have something lying around, otherwise I'll just go figure it out later

stark fjord
#

postInit is defined inside function class in cfgFunction,

But you could also do something like init.sqf

[] spawn
{
  waitUntil{alive player};
  //player is now alive, but might not have his screen game screen yet
};
molten yacht
#

will this fire once or on respawn as well

stark fjord
#

once

molten yacht
#

ok, cool

#

thank you

boreal parcel
manic flame
#

What is the simplest way to interact with a dialog? I made one called TruckDialog, I init it using createDialog;

private _userDialog = createDialog "TruckDialog";

the dialog id is 3000, and the button id is 3002
how can i make it so when a button is pressed, some code is executed?

opal zephyr
#

Is there any way to show/hide proxies on a characters uniform model?

opal zephyr
#

^could this be done through animations?

#

My end goal is to be able to show and hide them via script

unborn bronze
#

Hey! I'm looking for a script that could create a circle of fire/smoke around an area. I know very little about particle emiters but I have some basic knowledge about SQF. If you have a quick implementation idea I could orient myself with, that'd be of great help!

-Found Emitter 3Ditor thanks!

shadow flare
#

I'm having issues with making my script here work.
I'm working on a fork of ZEI (code is https://github.com/hbjydev/lrpgzei)
My RPT is here: https://sqfbin.com/igonupatuxagohomisom

I'm trying to add a new template, same format as the existing ones, but I keep hitting Trying to create an invalid center EMPTY as seen in the RPT I linked.

I'm happy to share any specifics if need be. ๐Ÿ™‚

foggy hedge
#

Is there a way to run code when a specific gun is being fired? RIght now I'm using a Fired eventhandler that exits if the passed _weapon argument does not match the gun I want, but I'm wondering if there's a way (probably with a CBA eventhandler or something in the weapon config) to add the script specifically on that gun (instead of using Fired eventhandler and exiting if wrong gun) to save frames.

opal zephyr
high tendon
#

i cant seem to find a link to an SQF download for NotePad ++ anyone have a link or another solution?

granite sky
#

The Notepad++ SQF extension does appear to be dead.

#

Mostly people surrender to Microsoft and use VS Code.

high tendon
#

I got VS Code life is good now. Thxs

jovial tusk
granite sky
#

No idea.

runic warren
#

Long shot but, how would I go about running an init through a config eventhandler? I have tried using the animationSources entry, but they always revert as soon as I spawn the vehicle, regardless of initPhase.

this execVM 'this AnimateSource ["hide_gunnerfa_gun", 0, 0}';

#

This is the last ditch effort because I don't know how else to force that Source on lol

twin oar
#

How do I whitelist a certain player to a like defined roles

high tendon
#

I am having trouble finding the info i need to complete this script. I am trying to find the correct terminology when it comes to limiting the players view. Limiting their view for things like when they look through NVGs.

#

I am making the Altyn helmet usable but I want there vision to be limited when they toggle the visor down

fair drum
gilded niche
#

How to script a waves attacks??

#

Where multiple enemies attack in waves and when you survive one wave the next starts

sharp stag
#

I have a mod that makes it so that when you have a simunition mag in, the AI only get incapacitated rather than actually getting hurt when you shoot them. I want to make it so enemies will no longer shoot at me and will just sit down and wait after they go unconscious the first time. The problem is using _x and forEach. it works fine when I put in a specific units variable name and ask it to do the script, but whenever I use forEach it says that _x is undefined. Here is the code:

_bluforGroup = createGroup blufor;
while {true} do
    {
    if (lifeState _x == "INCAPACITATED") then
        {
        hint "He's Down!";
        [_x] joinSilent _bluforGroup;
        _x setBehaviour "CARELESS";
        while {lifeState _x == "INCAPACITATED"} do
            {
            sleep 1;
            if (lifeState _x == "HEALTHY") then
                {
                hint "I'm Dead";
                sleep 4;
                _x action ["SitDown", _x];
                };
            };        
        };
    sleep 1;
    } forEach units side resistance;
winter rose
fair drum
dreamy kestrel
#

Q: about JIP procedures... these happen when players join a MP server, correct?
What happens following that, i.e. during player deployment, i.e. if your mission has any concept of spawn points, respawning, etc.
If you are connecting any variables on a JIP player object, would these not be invalid by the time players (re-)spawned?

dreamy kestrel
#

right I understand that. but there's a divide isn't there? from joining, to respawned and/or deployment, correct? i.e. in terms of the actual OBJECT that is considered to be player, per se, is there not?

#

IOW, we are creating an object that is subsequently assigned as the player object, IIRC.
So player joins, chooses spawn point, deploys, then a new object is created.
So anything that might have been attached to the joining object, no longer valid, correct?

jade acorn
#

respawn and deployment imply player has already joined the server. Joining in progress does everything as in normal joining with the start of a mission, except global scripts are re-executed again, like it's written in the article I linked.

dreamy kestrel
#

I'm not sure that's what I am asking...

#

Mission in progress, that much is understood...

#

Player is joining, his object (loosely at that point) is staring out into oblivion, until the spawn point is chosen.
That is one player object.

#

After spawn chosen and deployed, that is a whole other object to be considered. Anything JIP that might have put variables or what not on the joining player object, cannot be relied upon. IIRC, but I am seeking clarification where that is concerned.

#

IOW the hidden slot objects are the object that JIP sees initially as player? The thing that ends up deploying to a given point, that is a different object than those.

#

yes no maybe?

jade acorn
#

my smol brain is having hard time comprehending the jibby jabby you throw at me despite my highest intentions to help you. I have no idea what do you mean by the hidden slot objects. Do you have an example of a code that you are afraid it might not consider JIP players when triggered? Is it about some scripted event that happens when players - who join with the mission start - deploy, but will not run for JIP ones?

#

rule is that whatever you have scripted to be run on mission start for players, it wil be re-run again every time a player joins mid-mission.

#

unless you store code that goes through didJIP to prevent that.

dreamy kestrel
#

well, again, I'm not questioning the consistency that JIP runs when join happens.
my question is more to do with the slot objects. those are actual Man objects that are the things players choose going in, commander, squad lead, whatever. are you with me that far?

jade acorn
#

if by slot objects you mean playable entities that are left non-taken or AI controlled in the lobby then yes.

dreamy kestrel
#

right okay. my question is, when players are joining, is it these objects in particular that JIP sees? i.e. if we have anything touching player in any regard during JIP.

jade acorn
#

JIP player jumps into the lobby, sees the list of playable entities part of which is already taken by players who joined with the start of the mission, the rest are "empty". JIP player takes one of these free slots and goes through the same process the earlier players had gone, including activating any globally executed scripts and whatever you have put in initPlayerLocal or similar. Units are synchronized over the network so JIP will see everything the "normal" players see and hhave seen.

dreamy kestrel
#

fair enough, I understand that; full faith and confidence JIP will run.
player chooses point and deploys, between joining and deployment, I think we are creating a new Man object.
so anything we did to player object during JIP, forget about it, disregard...
something along those lines.

#

I mean if I am asking you something, you don't know what you don't know, or have not had the experience with it, fair enough...

#

just trying to sort out virtual arsenal, in particular ACE VA, and it is installing some JIP features involving player.
but frankly I do not think these can be depended upon.
which is one reason in previous iterations, I want to say that ACE VA was installed on actual secondary objects, arsenal box, fob building, mobile respawn, things of this nature, for a reason.

#

because while still JIP, the objects should be relatively static, for JIP purposes

#

so too their corresponding actions

#

anyway, I appreciate the effort, thanks, man ๐Ÿป

still forum
fleet sand
#

Quick question dose anybody know how to make object face up.
here is example code i have so far:

LEG_createRune = {
    params ["_pos"];
    private _textureObj = createVehicle ["UserTexture1m_F",[0,0,0],[],0,"None"];
    _textureObj setObjectTextureGlobal [0,"Img\Rune_01.paa"];
    _textureObj setPosASL _pos;
    _textureObj setVectorUp surfaceNormal position _textureObj;
};
jade acorn
#

oh wait, you have setvectorup already

stark fjord
#

He has vectorUp

south swan
#

try setting vectorDir to surfaceNormal and control rotation with vectorUp blobdoggoshruggoogly

fleet sand
#

I mange to get it to face up with this:

LEG_createRune = {
    params ["_pos"];
    private _textureObj = createVehicle ["UserTexture1m_F",[0,0,0],[],0,"None"];
    _textureObj setObjectTextureGlobal [0,"Img\Rune_01.paa"];
    _textureObj setPosASL _pos;
    _textureObj setVectorDirAndUp [[0,0,-1], [0,1,0]];
    _textureObj setVectorUp surfaceNormal position _textureObj;
};
``` But now i have a problem when i am on a slope i want it to follow the terain and not to half be in terrain and half floating.
fleet sand
# winter rose that's a `_pos` problem

How ? I get position good but the problem is that. The object is not Align with a terrain surface. Witch i am trying to move with this Line of code but it isn't aligning for some reason.

_textureObj setVectorUp surfaceNormal position _textureObj;
winter rose
# fleet sand How ? I get position good but the problem is that. The object is not Align with ...

try this```sqf
LEG_createRune_that_should_be_a_CfgFunctions_fnc = {
params ["_pos"];
private _surfaceNormal = surfaceNormal _pos;
_pos = _pos vectorAdd _surfaceNormal;

private _textureObj = createVehicle ["UserTexture1m_F",[0,0,0],[],0,"None"];
_textureObj setObjectTextureGlobal [0,"Img\Rune_01.paa"];
_textureObj setPosASL _pos;
_textureObj setVectorDirAndUp [[0,0,-1], [0,1,0]];
_textureObj setVectorUp _surfaceNormal;

};

winter rose
fleet sand
winter rose
#

what was your goal again? I have no idea what you want to do
half-terrain + half-floating should not happen if set to follow surfaceNormal

manic flame
#

Is there any way to generate files through SQF code? Looking to create persistent data.

winter rose
manic flame
#

Sqlite compatible?

winter rose
#

if an extension does that, sure

manic flame
#

I'll see. Do you have any wiki page or anything with more info on this?

winter rose
#

no, know that DLLs are not official and require trusting the author

manic flame
#

Huh, alright.

#

Thats the only way for persistent data, i assume?

manic flame
#

I see, thanks.

winter rose
fleet sand
winter rose
#

then the _textureObj setVectorUp _surfaceNormal; seems to not work

fleet sand
willow hound
#

Perhaps the up dimension of UserTexture1m_F is not what you think it is.

winter rose
#

try this perhaps (I'm poop @ 3D)

LEG_createRune = {
    params ["_pos"];
    private _textureObj = createVehicle ["UserTexture1m_F",[0,0,0],[],0,"None"];
    _textureObj setObjectTextureGlobal [0,"Img\Rune_01.paa"];
    _textureObj setPosASL _pos;
    _textureObj setVectorDir surfaceNormal _pos;
};
fleet sand
#

That is not it either. BTW did i mention i hate 3D rotations and directions.
with that Object is Facing Forward tilted.

willow hound
#

If the up dimension of UserTexture1m_F is what I think it is, I believe you need _textureObj setVectorDirAndUp [_surfaceNormal, _vectorDir].

willow hound
#

I'm not sure. I doubt that something simple like [0, 1, 0] (i.e. a vector pointing straight north) works in this case - but do try ๐Ÿคทโ€โ™‚๏ธ.

winter rose
#

maybe just vectorDir _textureObj

fleet sand
#

with this:

LEG_createRune = {
    params ["_pos"];
    private _surfaceNormal = surfaceNormal _pos;
    private _textureObj = createVehicle ["UserTexture1m_F",[0,0,0],[],0,"None"];
    _textureObj setObjectTextureGlobal [0,"Img\Rune_01.paa"];
    _textureObj setPosASL _pos;
    _textureObj setVectorDirAndUp [_surfaceNormal, vectorDir _textureObj];
};
``` Its spawning face Down. Is there a way to myb not reverse but flip the numbers in array? _surfaceNormal?
winter rose
#
LEG_createRune = {
    params ["_pos"];
    private _surfaceNormal = surfaceNormal _pos;
    private _textureObj = createVehicle ["UserTexture1m_F",[0,0,0],[],0,"None"];
    _textureObj setObjectTextureGlobal [0,"Img\Rune_01.paa"];
    _textureObj setPosASL _pos;
    _textureObj setVectorDirAndUp [_surfaceNormal, [0,-1,0]];
};
#

eventually

south swan
#

_surfaceNormal vectorMultiply -1 blobdoggoshruggoogly

fleet sand
#

I mange to make it to work:

LEG_createRune = {
    params ["_pos"];
    private _surfaceNormal = surfaceNormal _pos;
    private _surfaceNormalFlip = _surfaceNormal apply {_x * -1};
    private _textureObj = createVehicle ["UserTexture1m_F",[0,0,0],[],0,"None"];
    _textureObj setObjectTextureGlobal [0,"Img\Rune_01.paa"];
    _textureObj setPosASL _pos;
    _textureObj setVectorDirAndUp [_surfaceNormalFlip, vectorDir _textureObj];
};
``` ty very mutch guys.
winter rose
south swan
#

all hail the mighty eventually, it hath come!

wary sandal
#

How do I check whether an object is a vehicle (like boat, plane, heli, UAV/UGV, etc...) or a man?

#

I hate that arma considers men and items on the grounds as vehicles

proven charm
#

iskindof

winter rose
#
private _isMan = _thing isKindOf "CAManBase";
wary sandal
wary sandal
proven charm
#

they are like "Ship" "Plane" "Tank" etc

winter rose
#

what GC8 said etc ๐Ÿ˜„

wary sandal
#

so there is no class for every type of vehicles

stark fjord
#

!(_thing isKindOf "CAManBase")
But then you might get static objects too

wary sandal
#

I wonder why Bohemia chose to design it like this

#

it's not very intuitive nor logical

#

hmm, where did the link go?

stable dune
little raptor
#

Even what Lou said isKindOf "CAManBase" is not completely foolproof

#

More technically a man is a "vehicle" that uses the "soldier" simulation and uses the CfgMovesMaleSdr animations

queen cargo
#

is it the mutex discussion again in here?

#

shall i turn on rage mode again?

twin oar
#

I did the testing of it last night, there wasnโ€™t a single issue shown except I literally couldnโ€™t place anything except through ace fortify

proven charm
#

little unsure how the PositionAGL works for example with nearobjects. if the nearobjects center is on water should i pass getposASL to it? and if the nearobjects is on ground then use getposATL?

jade abyss
#

mampf Popcorn? Anyone?

nocturne bluff
#

X39, ..

#

Macros!

jade abyss
#

uuuuuuuuuuuuhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh

#

(they still suck)

nocturne bluff
proven charm
winter rose
#

so is* AGL

proven charm
#

still dont get it ๐Ÿ˜„

winter rose
#

ASL above water, ATL above terrain?

proven charm
#

right?

winter rose
#

wait, I think we really don't understand each other ๐Ÿ˜„

proven charm
#

lol

#

well i think you need to feed the nearObjects zero z when you want objects on sea level or on ground level

#

and it does the rest

winter rose
#

yeah, that's what it means

#

afaik

#

0 = sea level or terrain level, depending of over sea true or false

proven charm
#

yep

rich bramble
#

Are there any optimizing pre-processors/transpilers for sqf? I.e. anything that could auto-inline functions?

round scroll
#

macros FTW :)

gilded niche
#

Do anybody know how to script wave attacks?

proven charm
little raptor
#

Yes. It just converts the ASL pos to AGL pos

proven charm
#

cool

wary sandal
#

I'm getting some random issues with diag_log

#

at random occasions diag_log statements are ommitted in the .rpt file, i have no idea where the issue comes from (it started being an issue only until now)