#arma3_scripting

1 messages ยท Page 98 of 1

ornate whale
#

I can only change activate for deactivate (button press and release).

granite sky
#

You could trigger off animStateChanged instead but that's likely hard work and probably has gotchas. Sleep after onUserAction might be the best bet.

ornate whale
granite sky
#

yes

#

There might be a way to convert animation state => stance with config. I'm not sure how the game does it otherwise.

ornate whale
untold copper
#

Are you using onKeyDown EH?
No idea what onUserAction event is.

queen cargo
#

Doing such things is bad for numerous of reasons
Having a star/stop method, best used with with a timeout and keep alive would be the much, much better option

Designwise, keeping a local loop (scheduled) active that says "yes continue doing that" every X seconds with a corresponding start and stop remoteexec
An external loop, checking if it still should continue doing that and aborting if it was not told to continue in X seconds
Is the smarter thing to do and much more network friendly because of less chatter

granite sky
#

What, like have a local monitor thread on every box?...

#

I'm not sure you understand. This is just replacing setMass with remoteExec ["setMass", 0]

queen cargo
#

It is replacing remoteExec with setMass
Not the other way around

granite sky
#

ok now I have no idea what you're talking about.

queen cargo
#

In here, you said that you are spamming remoteExec

granite sky
#

remoteExec target 0 is spam in my book.

#

When there's a command that should just be updating things efficiently.

queen cargo
#

Instead, do a start/keep/stop remoteExec call to reduce the spamming of the remoteExec, reducing network chatter

#

Spamming, in for code, means running an operation over and over again (eg. "spamming that page refresh")

untold copper
ornate whale
untold copper
ornate whale
ornate whale
untold copper
ornate whale
keen stream
#

Because it works. Most people really don't care. The amount of time required to work properly with RV's SQF is huge.

#

Only a bunch of idiots like us would do this type of thing.. Because we are masochists... ;)

gusty flame
#

Thanks for all the answers guys!

solid prism
#

Morning Everyone

winter rose
#

'afternoon

solid prism
#

I am having issues uses an attach to effect with a aircraft but itโ€™s a little complicated

#

I was told this channel might be able to help

winter rose
#

sure, if the issue is expressed ๐Ÿ™‚

solid prism
#

Iโ€™m not home so iโ€™m going to do my best with what I can on my phone

#

am I able to post config in here or no?

#

idk the rules on posting files

fair drum
#

Just use pastebin or something if it's long

solid prism
#

iโ€™ll have to wait till later then for the config

fair drum
#

And if it's purely config, use the config channel

solid prism
#

iโ€™ll head that way then

#

thansk

ornate whale
little raptor
#

I mean the action property in anim state config

#

but why do you even need that?

#

just use the stance command in animStateChanged EH

kindred tide
#

what happens if you exitWith from an exitWith block?

little raptor
#

you exit the exitWith block

kindred tide
#

does it mean the original exitWith will not do the exiting and continue execution of what was after it

little raptor
#

no

kindred tide
#

ok

little raptor
#

it means you return early

#
if (true) exitWith {
    if (true) exitWith {2};
    1
};
0
#

returns 2

kindred zephyr
#

this is kinda offtopic but discord seems to be mad sometimes when i try to send chunks of sqf through private chats, has anyone experienced this lately? it kinda has been happening more and more for me and my bud

sullen sigil
#

never had that issue

stable dune
kindred zephyr
stable dune
#

Hello,
If I want to make some kind of IED.
Well , I have.
But it's only an object where it is "bomb" attached to it , that is not a bomb, just a simple object.
So when I want to make it explode.
I delete the current object and create the bomb (like "Bomb_03_F") position of my "bomb".
When I do this on a dedicated , on server, the created bomb does not affect players, none of the client sides do not get damaged.
How do I need to create a current bomb that explodes and kills players near it.

proven charm
stable dune
#

Yes, it explodes. But does not do damage

proven charm
#

created on server?

stable dune
#

Yep

#

It does work if I do that on local (local host tested, host dies ๐Ÿ˜€)

hallow mortar
#

Definitely using createVehicle and not createVehicleLocal?

stable dune
#

Yep

#

That's why I do not understand what I should do differently

winter rose
#

going out on a limb but it might be that the server does not have time to propagate the bomb, and once it is destroyed there is nothing to propagate
try adding a slight delay between creation and explosion?

stable dune
#

Thanks, I will try that.

proven charm
#

so create it on ground

winter rose
#

Yes, it explodes. But does not do damage

It does work if I do that on local (local host tested, host dies ๐Ÿ˜€)

proven charm
#

i was just thinking he uses a command to make it explode... that should not be needed

cobalt path
#

Question, this gives me error saying "Error Missing )". Why?

_loop = true;

if (_loop = false) exitWith {};

while {true} do
{

sleep 1;
waitUntil
{
    player distance2D teleportoriginobject01 < 2
};
player setPosATL (getPosATL teleportdestinationobject01);

};
warm hedge
#

_loop = false is invalid

cobalt path
#

thanks!

sullen sigil
#

use !loop as the condition instead

#

(or isEqualTo/isNotEqualTo for comparisons)

distant egret
#

leader player limitSpeed -1; // remove the limit This seems to have been broken?
Trying to make an helicopter move with limitSpeed and FlyInHeight.
And setting to -1 (trying to reset) will just slowly move the helicopter backwards.
While setting to 100 it will move again.

acoustic abyss
#

how to change sector owner?
[SECTOR, "WEST"] call bis_fnc_sectorcontrol;
doesnt do anything

winter rose
acoustic abyss
acoustic abyss
# winter rose that's because this function does not even exist

anyway
do you know how to start capture proccess for a sector?
After save/load sectorControl doesnt work, I decide just switch owner of sector by a script, but its not a proccess as default, now its just a switch between sides of sector

doesnt work - I mean that sectors cannot be captured by any side, Im already report to BIS about this bug

winter rose
#

nope, sorry - no experience in that

kindred tide
#

if you create a wall of repair trucks, is it invincible because they all repair each other?

little raptor
#

no because they won't

kindred tide
#

hm, they do in A2

#

they dont repair other repair trucks in A3?

#

oh, it looks like it depends on whether player is in them

hallow mortar
#

It wouldn't be truly invincible because repair doesn't prevent one-shot kills

kindred tide
#

oh, their resource for repair is finite

#

but they can repair each other

sullen sigil
#

What's the function for creating editor preview images for units? Have forgotten it and now cannot find it meowsweats

warm hedge
#

editorpreview or smth

#

BIS_fnc_exportEditorPreviews

sullen sigil
#

BIS_fnc_exportEditorPreviews thanks

#

I seem to recall seeing recommended settings for it somewhere? Got anywhere for that? ๐Ÿ˜…

#

Ah nvm, it's in the see also

#

Ofc

warm hedge
#

If you don't read BIKI, I won't slap you. Lou will

sullen sigil
#

thats why i dont read it

jade acorn
#

what do I have to do to make a part of initIntro.sqf file be played as an init of my Outro phase? Wiki says that this file is used for intro phase and both outro phases but does not say how do I put my code there so part of it is only in intro, the rest in outro.

hallow mortar
#

I'm surprised there isn't a command to get the current phase ๐Ÿค”

warm hedge
#

Phase, as in, mission, intro, outro?

hallow mortar
#

No, different phases. Honger only mentioned those to confuse you

warm hedge
#

Ah, yeah

jade acorn
#

right now I have a trigger in outro-win that runs my code but there is and will always be a small delay between phase start and trigger

hallow mortar
#

You could check the time? If it's under a certain amount it's probably intro, over a certain amount probably outro

#

Unless time resets on phase change, which wouldn't be totally surprising but would be very sad

coarse dragon
#

just wondering if anyone knows anything about this?

#

AI view block

hallow mortar
#

Just a guess but it's probably for blocking the AI's view

coarse dragon
#

would one know how to make something like it?

south swan
#

open object builder, create new file, create big cube in View Geometry LOD, save, pepper with some minimal config.cpp, use blobdoggoshruggoogly

sullen sigil
#

would a view block attached to yourself still block ai view ๐Ÿค”

south swan
#

ah, good old Oblivion bucket-on-a-head moment

coarse dragon
#

anyone wanna make it for me?

sullen sigil
#

changing setcaptive can cause problems (tho it can make ai dead check bodies which is neat for sp)

south swan
#

seems to work when attaching a random person-sized rock to player in editor

sullen sigil
#

hmmmmmm

#

noted thank you for the test

#

didnt think about just using an actual object instead lmao

hardy valve
#

Hello - Is it possible to create a rearm timer for a server? One that prevents the player from rearming a vehicle for X amount of time? Any help is appreciated

winter rose
#

see setAmmoCargo and the "Service" mission event handler

addMissionEventHandler ["Service", {
    params ["_serviceVehicle", "_servicedVehicle", "_serviceType", "_needsService", "_autoSupply"];
}];
fair drum
#

can you use the reforger string table editor for arma 3? or is it a completely different format?

winter rose
#

different format

hardy valve
winter rose
#

don't hesitate to post in this channel if you need help

hardy valve
# winter rose don't hesitate to post in this channel if you need help

WIll do - i have a few things im stumped on. I also wanted to know how to change the plane landing script in warlords to make them appear on the runway as opposed to flying in and landing. The problem is that they crash in the trees and dont read the runway properly and land wonky and crash 100% of the time. Is that possible to create a script where the plane spawns near the player - or better yet spawn them inside of the jet?

#

Mind you I am very green with scripts

winter rose
#

like "create a jet and teleport the player in it"?

hardy valve
#

Yes but i am not sure how to incorporate that into the already existing script in the warlord mission/functions

winter rose
#

ah, that, I do not know ๐Ÿ˜„

hardy valve
#

I think i found the requestaircraft function, but from there i am lost lol

coarse dragon
#

anyone know why that dont work?

still forum
#

because you're doing it wrong

hardy valve
winter rose
#

still no idea! ๐Ÿ˜

#

I never tampered with WL scripting

ornate whale
hardy valve
winter rose
#

it's a framework, and an official one so I do not know what is allowed / secured

hardy valve
ornate whale
winter rose
sullen sigil
#

is there any way of detecting when an ai unit speaks (and what they said if possible but i'll just take an event for now)

coarse dragon
#

you can get a Ai to lip sync to a speech you have done

winter rose
sullen sigil
#

radio system/ai callouts

#

so contact, man, 100 meters, front etc

#

use case is eavesdropping on enemy ai radio comms

winter rose
#

hmmm I don't think there is such a thing

sullen sigil
#

i suspect as such given cant find anything on biki but feels like it wouldve been added by now

#

though at the same time i cant think of any other use case

winter rose
sullen sigil
#

yeah unfortunately ai speaking is engine driven it seems notlikemeowcry

#

have checked through mission events too and theres nothing

#

theres no getter for setRandomLip either so i couldnt even take a guess

#

meh, back to just using randomness based on group combat state

winter rose
sullen sigil
#

eh, not really much point as cant get the voice lines

winter rose
sullen sigil
#

my hope was to be able to get the voice line the AI had spoken then play it to the player whilst their spectrum device was in the right frequency

winter rose
#

I see
no cigar I'm afraid. perhaps an EH request ๐Ÿ‘€

sullen sigil
#

but seems its not possible unfortunately

sullen sigil
#

meh, i'll request anyways

ornate whale
#

How do I make sure that a piece of code is executed within one game frame, so I can be sure that the conditions has not been changed.

if (condition) then {
command;
command;
//is the condition still true here?
command;
...
};```
still forum
#

isNil{ code... }

ornate whale
still forum
#

yea

#

just remember the game freezes while inside there

ornate whale
#

I have this code https://sqfbin.com/gumiqetapapukixitage. It works, but in-between any condition checks, there might be a few frames gap I suppose, and if the conditions change during those gaps, then this code migh become unpredictable.

fair drum
#

if I have some variables %1-%12 and the line ends with ...Monitor%4and I need to put a 4.) next to that, how can I not trigger %44 and not have the space if I did ...Monitor%4 4.)?

still forum
#

%4%5 and put the 4.) into another argument

#

or just
format [...] + "4.)"

#

or if its just for displaying, you can use a zero-width space

drowsy umbra
#

Having some trouble using flyInHeight. I'm putting this in the init of my helicopter: this flyInHeight [5, true]; but I keep getting an error, "Init: flyinheight: Type Any, expected Object". What does that mean?

granite sky
#

alt syntax is 2.14 only

drowsy umbra
granite sky
#

this flyInHeight 5 is perfectly valid IME

drowsy umbra
#

okay tysm

granite sky
#

I'm not sure what the difference is supposed to be for the alt syntax.

#

oh, it's kinda documented.

#

I only used very low flyInHeight values to hold helis on the ground after a setVelocityTransformation, so maybe it doesn't work for actual hovering.

#

worst case you can force it with setVelocityTransformation but that's a lot more work.

molten yacht
#

Is there a good way to set, say, the 1st, 2nd, 3rd, 5th, 6th, and 7th elements of an array while leaving the 4th alone?

#

Or is it just _arr set [0,value]; for each one

granite sky
#

{ _arr set [_x, _value] } forEach [1,2,3,5,6,7]; ?

winter rose
#

yep this, use for/foreach if needed

granite sky
#

The set-spam should be faster though. Depends on what you're optimizing.

molten yacht
#

yeah I'll just setspam

winter rose
#

devs: spending a lot of efforts to be lazy ๐Ÿ˜›

granite sky
#

Now if the array only has 8 elements then the faster way is probably to create a new array using resize (fill version) and then copy elements 0 and 4 into it.

#

But if there's some arbitrary amount of extra crap on the end then that's probably not a great idea.

ornate whale
#

Is there any possibility that this piece of code executed withing one frame could cause stutering of my game?

winter rose
#

yes, if you have a Pentium II

ornate whale
#

According to my calculations, under the presumption that the game runs at stable 60FPS (if only CPU dependent), the total available execution time for each frame is 16,66 milisecs. That would mean that my code consumes 0,00024% of that capacity, i.e.** 0.0024โ€ฐ** of my frame. But my calculations could be wrong, because graphical FPS is not the same as game engine ticks, or am I wrong? ๐Ÿค”

winter rose
#

1/ if it is needed, just do itยฎ
2/ only two instructions in an unscheduled thingy are not going to kill the game
3/ the game: you lost it

granite sky
#

One of your calculations is wrong too :P

#

should be 0.024% of a frame.

#

wait, did you use some weird-ass percentage symbol

ornate whale
granite sky
#

you used a weird symbol and got it wrong? :P

vapid scarab
#

Is there a way to retexture a unit to be completely black?

ornate whale
sudden bear
#

I am not sure to be on the right channel but I have some question about how to mod the CAS Modul. To be more precise, I just bought the new creator DLC and spotted they added their plane to the CAS effect modul. I really enjoy the SOG dlc but thereโ€™s no plane added. So do you know how to edit or add plane to the list ?

ornate whale
winter rose
open fractal
#

god dammit

cold mica
#

I know players can have a custom face texture. But can an AI unit get a custom face texture? If so, what command would it be to apply a custom face texture on an AI unit?

cold mica
#

Thank you โค๏ธ

fluid wharf
#

Probably a very simple question, but I'm brand new to scripting and am experimenting and figuring things out mostly on my own.

I've got a simple sequence where a heli is unable to move via the script inside the heli init
Transport2 disableAI "MOVE";

A trigger later down the line overrides that and the heli takes off, flies a while, and then lands to collect the player squad. The issue is, the heli only lands for a few seconds before taking off again and moving to a Transport Unload waypoint to transport the players. I have the following script also in the helicopter's init
Transport2 disableAI "TRANSPORT UNLOAD"; but it isn't working.

The trigger that is supposed to set the heli to move to the transport unload waypoint is a radio trigger, but the heli will leave and go to the transport unload waypoint without the trigger being used. Obviously, something is wrong with the script itself but I can't figure out what

cold mica
winter rose
fluid wharf
# winter rose see https://community.bistudio.com/wiki/disableAI for possible values you are tr...

I think this is where I'm going wrong ๐Ÿ˜… Like I mentioned, I am BRAND new to scripting and have near-zero knowledge with it and really only know a handful of things I can do using the object's init box. I've been using the disableAI "MOVE" script a lot and taking it literally- I assumed it stopped the MOVE waypoint specifically. I'm going to be trying Uncle's method of utilizing a Hold waypoint.

winter rose
fluid wharf
kindred tide
#

setRepairCargo available since OFP, getRepairCargo introduced in A3. i'm taking an SDL vacation from this for now

warm hedge
#

It is not about skill, it is about imagination

#

Or... something else

thorny gull
#

So I need a bit of help, I am trying to make a script to go in a helicopter on a flight deck, so that when a player is detected inside, it forces them to dismount (this will be a respawn and is currently sync'd to a module) I have tried a few things but cannot get what I could find to work

manic sigil
#

Thatd be the command to use, all you have to do is work out how you want it to trigger, and point it at everyone aboard.

#

At least, thats a very hard instant get out :p

jaunty zephyr
#

i guess most sqf scripters are more enthusiastic gamers than professional coders.
some player one day decides he wants a scenario where x does y. so he goes and asks somebody how to do that. the resulting answer is treated as magical incantation rather than something that can be taken apart and understood. and so it is copied around, de-formatted, horribly disfigured but never changed.

thorny gull
tough abyss
#

thats not true :P

#

but yeah there is a certain amount of players who are like that

jaunty zephyr
#

taken times ten โ€ฆ and you get a gargantuan mess that makes every programmer puke, and works sort-of

#

its the majority, me thinks. ofc, high-profile projects like ACE or ACRE are created by and attract professionals

tough abyss
#

i saw my code doing circles and found it so badly copy pasted that even the simple stuff stopped working

little raptor
manic sigil
#

Hadn't considered GetIn EH; would that work if a unit spawns into it rather than boards?

slender meadow
#

Does anyone have experience using isLocalOnly vs turning things into simple/super simple objects? Which would be more performant in a scenario with a large number of decorative objects?

#

I can find basically no information on isLocalOnly apart from:

When enabled, the object will exist as a local instance on every client. It will not be synchronized over the network. Use this primarily for static (decorative) objects in order to optimize large-scale scenarios.
cosmic lichen
#

Well

#

It helps in theory. If it's noticeable, that's a different story

#

From my experience there is no noticeable difference

sullen sigil
#

in MP it just stops network sync which does have a noticeable difference if you are creating custom maps from complete scratch using editor props (which I have done before, ~20k objects without issues)

#

Whether it was without issues because of local only or not? ๐Ÿคท

cosmic lichen
#

If you want to get the best performance you need to combine different methos

#

simple object + dynamic simulation + conditional show/hide + localOnly

#

and so on.

tough abyss
#

but at least they put their name under the code

solid hill
#

Hello. Im trying to have an AddAction in my mission on multiplayer but I am the only one who can see the action as the host. Can somebody please tell me how to bake it global?

This script is in the init of a laptop in Arma 3
casa1crew = laptop addAction ["pickup CASA 1 Crew", {[c11, c12, c13, c14] join p24; laptop removeAction casa1crew}];

ornate whale
# slender meadow Does anyone have experience using isLocalOnly vs turning things into simple/supe...

I think that, with isLocalOnly, if you disable damage and physics simulation on bigger objects (boxes, containers, hosues..), and enable simple object option on small decorations (bottle, laptop, radio, tv, furniture, or distant big objects..), then it might work. But everything local should be non-interactive (like doors) or have no effect on other units, players etc. Not sure about the performance gains though. You might put the objects into separate layers in Eden editor, and then edit them in bulk, and try both local and non-local options. And as @cosmic lichen suggested, you might combine different approaches. One group "Local only - simple objects on", second group "Local only - damage on, simulations off", third group "Global - fully interactive things".

crude needle
slender meadow
#

I mean to do simple objects in multiplayer you need to convert them with a script, as even before the box got removed it didn't work in mp. I'm pretty sure they only exist on the server, with just the geometry/textures passed to clients?

#

So I don't really know if they'd work together?

#

I'll probably do a test with like 1000 props and see if there are any noticeable performance gains.

#

Is there any inbuilt performance testing tool other than the one for how many ms script takes?

#

Or any better way to do it than just looking at average fps for 5 minutes?

ornate whale
slender meadow
#

Ok, thanks

#

Client fps is really my main goal. In the past thatโ€™s the main thing thatโ€™s been a problem for missions I make

#

I have no idea how I managed to miss the second link meowsweats

ornate whale
kindred lichen
#

As a professional developer, scripting in arma is only frustrating due to figuring out all the nuances of when bis functions fail. Also, i miss libraries with overloaded functions. Took me way too long to realize joinSilent only accepts arrays and not units.

slender meadow
#

Regarding dynamic light sources, do you know whether streetlights on the map would be good to hide when not in range of players?

#

Or would that not do anything for performance?

ornate whale
slender meadow
#

Ok

crude needle
slender meadow
slender meadow
crude needle
#

Depends on the object you are looking at, some have it, some don't.

ornate whale
kindred lichen
#

Player joinSilent grp; fails - [player] joinsilent grp; correct

#

Or like you can't use moveInDriver on someone already in the vehicle.

tough abyss
#

i know what you mean. coding for 2 hours testing everything and than its cause of one little freaking detail

slender meadow
ornate whale
slender meadow
slender meadow
ornate whale
# slender meadow Ok, some other weirdness mustโ€™ve been going on when it failed then
cold rampart
#

How about lacking a debugger :D

queen cargo
#

Also, i miss libraries with overloaded functions.
my friend you dont have to wait for long
OOS is getting better

tough abyss
#

thats what i do. i test little bits in the debug console to see if it works xD

queen cargo
#

How about lacking a debugger ๐Ÿ˜„
for that OOS will also have a solution in some future

cold rampart
#

I'm looking at ur doc but it's not really clear to me as what the idea of OOS is

#

it's a new scripting language?

tough abyss
#

wasnt that the object oriented one?

spare lynx
#

Sorry to bother you replying to such an old post but did you ever get this to work properly? I found the same video recently and i've been trying to get the script to work for an op i'm planning to do with my unit and part of it is having low gravity (its using the optre phobos moon map) for immersion.

fleet sand
spare lynx
#

I would greatly appreciate it

cold rampart
#

And I'm also missing some sort of performance profiller

#

Would be nice to know which scripts are being suspended a lot (e.g. are performance heavy)

sullen sigil
#

and even then looks pretty bad

crude needle
vapid scarab
#

Scenario: Mission on dedicated server, im zues, I have a function that needs to run on a player.
If from my client I run

// zues module
params ["_posASL","_unit"];
_isUnit = isPlayer _unit;

Assume the object passed to _unit is a player controlled unit, is _isUnit true?

winter rose
#

yes

ashen ridge
#

This code make sense?sqf 0 setOvercast 1; 0 setRain 1; forceWeatherChange; // Force immediate change overriding smooth transitions

#

0 setOvercast 1; Instant effect
0 setRain 1; Instant effect
So why the need of forceWeatherChange?

little raptor
#

0 setOvercast 1; Instant effect
0 setRain 1; Instant effect
no it doesn't mean instant effect

ashen ridge
#
time setRain rain
time: Number - transition time in seconds to the new value
#

transition time of zero seconds

little raptor
#

it just says "I want the weather to be like so in X seconds"

#

doesn't mean "magically change the weather"

#

e.g. if you want rain, first the clouds should appear, then the rain slowly starts pouring

#

and instead of randomly guessing stuff, just test

ashen ridge
#

Arma 3 is open here

#

But my IQ is very small.

little raptor
#

nothing will happen immediately

ashen ridge
#

I understand. I tested them alone.

granite sky
#

I guess the point is that the values are not the weather and only influence the progression of it, but this is... not explained in the wiki.

ornate whale
fallen locust
#

"Would be nice to know which scripts are being suspended a lot (e.g. are performance heavy)"
soonโ„ข ;)

ashen ridge
#

Thanks for the help, i'm doing ok ๐Ÿซ‚

split nebula
#

you mean โ„ข? :)

#

...

#

fail

#

looks correct in the chatbox but all sorts of different in the chatlog

fallen locust
#

Yea i know :P

true frigate
#

Hey, sorry if this is super simple, but I've looked online for this and also just tried it myself but I can't seem to get any of it working. Does anyone know a way we can create a restricted Virtual/ACE arsenal that also works with loaded equipment?
The standard restriction for getting gear works fine, the issue is that currently players can load anything up and it will simply allow them to keep it - we've switched to a kit list recently and sadly we can't actually enforce it due to this at the moment.

I should mention, we don't want to disable loading or saving loadouts - I'm aware that some modes like KP Liberation had a great save/load system but I wouldn't know where to begin with making something like that.

If anyone knows how I might be able to go about making one of these, or knows of a place I could find one, please let me know ๐Ÿ™‚

granite sky
#

Antistasi has a system but it is appallingly complex

#

Somewhat easier if all items are either available or unavailable but still quite a chunk of code.

civic cradle
granite sky
#

Hundreds of lines. Plus it's an Arsenal hook so fundamentally complex.

civic cradle
#

:/

#

bugger

granite sky
#

How are you setting the restrictions?

civic cradle
#

from what louis has said to me in the past the way they tried was "We're using the old KP liberation script that removes items loaded from arsenal if they're not allowed"

#

and regarding the restrictions

#

the basic way

#

sorry if thats not the awnser ur looking for, im not the one really doing it but louis has gone to sleep for now

ashen ridge
#

After testing many broken weather mods (and lost many hours of my free time) i'm doing my own weather script, with much less than 50 lines.

#

Just messing with setForecast, all rest automatic by Arma 3.

#

"Set here the time of change, for example, 30 seconds will change all in a 30 seconds cycle" - Really yes, lovely SUNNY STORM DAY!

cold rampart
#

Soon as in addon or soon as in buildin arma

winter rose
#

ping @ashen ridge

ashen ridge
#

It come back

ornate whale
ashen ridge
#

Yes, i fixed and updated the link ๐Ÿค“

ornate whale
ashen ridge
#

@ornate whale thanks a lot, i tried to add dynamic weather on my missions many times, and today i finally understand how it works. for servers with greater timeMultiplier the changes will be faster, but there is nothing else we can do to make it faster other than increase timeMultiplier.

sharp grotto
#

Ah nvm, should read better xD
You want it faster, not slower.

ashen ridge
#

I use 0 setOvercast 1 from a 0 overcast and still the change takes 1 hour to fully happens in a progressive, flowlly and nice way (timeMultiplier = 1).

#

The same change will take 30 minutes if timeMultiplier is 2

#

Default server were 24h is 24h (timeMultiplier 1) will allways need to wait 1h more or less for a full progressive, flowed overcast change, from 0 to 1.

#

There is nothing that can be done about that, as i understand now.

#

The engine just don't let you go mad about changing overcast, like you can do with Fog for example, were a 10 setFog 1 really takes 10 seconds.

ornate whale
# ashen ridge The engine just don't let you go mad about changing overcast, like you can do wi...

Another method would be to fade out the screen, force the change, and fade in again. Or, you can make a mid-mission cutscene with the camera pointing at the horizon, and speed up the time x times, then give the control back to the player. Like it was in Far Cry 2 hideouts. Or you can use fog as a masquerade for the transition. Build up a dense fog, force change the weather, then remove the fog.

From wiki:
NOTE: To get instant, seamless overcast change to overcast 1 advance the time 24 hours with skipTime while setting overcast transition time to 86400 seconds (24 hours) - Killzone_Kid (12:08, 15 August 2013)
86400 setOvercast 1;
skipTime 24;

// to remain on the same date:
skipTime -24;
86400 setOvercast 1;
skipTime 24;

Or try setAccTime.
https://youtu.be/WSxdmv4r9f0?si=quw_pW5vydDMvz7m

Set acceleration to as fast as possible with setAccTime command. Also use setTimeMultiplier 120.

โ–ถ Play video
flint sentinel
#

are variable names case sensitive?

warm hedge
#

In what sense?

flint sentinel
#

specifically, in Alive, if I name a TAOR marker Town1 and then later reference it as town1, will it read Town1?

warm hedge
#

Well in that sense that is definitely insensitive

cedar cape
#

Im using POLPOX Artwork supporter and i cant find a way to have 2 animations play one after the other

warm hedge
#

You don't

cedar cape
#

how would i do an execution animation then?

warm hedge
#

switchMove or some other commands

cedar cape
#

ok

cedar cape
#
man2 switchMove "Acts_Executioner_Kill";
man1 switchMove "Acts_ExecutionVictim_Kill_End";```
warm hedge
#

Because switchMove updates the animation right now

cedar cape
#

so how would i do it

warm hedge
#

Read BIKI around there. For instance playMove playMoveNow

cedar cape
#

currentley it only plays executionVictim_Kill_End and not the one at the begining

#

ok

#

still doesent work

#

the first animation isnt playing and its just skipping to the last one

drowsy geyser
#

how would i remove a specific eventHandler in another file?
_killedEH = player addEventHandler ["Killed", {//some code}];
do i need to setVariable on it?

#

and then remove it using getVariable? does this work with eventHandlers?

granite sky
#

Store the handle on the player with setVariable.

#

player setVariable ["myTag_killedEH", _killedEH]

ornate whale
#

Why is it that this code changes the orginial variable "targetsArray", and not just the private copy "_targetsArray"? Does it act as some kind of pointer?

private _targetsArray = _group getVariable "targetsArray";
(_targetsArray select _index) set [1, true];
granite sky
#

yeah, = on an array or hashmap just creates a reference.

#

If you want to make a copy instead, you can use +

ornate whale
#

I thought I would need to do this at the end on the third line. Like replacing it all.

_group setVariable ["targetsArray", _targetsArray];```
granite sky
#

Yeah that doesn't actually do anything.

#

It's just setting the reference to what it already is.

warm hedge
#

I think getVariable only returns the variable in it, not a reference of it, unlike _a = _b?

granite sky
#

Technically everything's a reference at lower levels.

drowsy geyser
granite sky
#

language just doesn't act like it.

#

@drowsy geyser yes

ornate whale
#

Can I turn on SQF (or similar) syntax highlighting in Notepad++? If so, how?

granite sky
#

2.12 added isEqualRef if you want to play around.

#

There was an SQF highlighter for Notepad++ but I think it's a bit dead.

ornate whale
#

How do you code then? Which software do you use?

granite sky
#

badly

#

I use VS Code because people forced me into using 4-space indents.

warm hedge
#
player setVariable ["test",[1,3,4]] ;
_a = player getVariable "test" ;
_a set [1,5] ;
player getVariable "test" ;//[1,5,4]```Oh! I never knew this. Thanks for your insight
granite sky
#

There are SQF syntax highlighters for VS Code but I never found a really good one. If I have a sticky syntax problem I'll sometimes paste the code into ADT.

sullen sigil
#

theres an sqf-vm linter now

ornate whale
manic sigil
#

Its what I use, and it serves me just fine.

#

Granted, I am a trash coder, so 'serves me fine' in the voice of a McDonalds patron.

hallow mortar
sullen sigil
#

Is there any way of blocking an AI's road route? i.e they will not path through that position?

#

Rather than just blocking it off so they get there and go around

granite sky
#

I don't think so, but Arma's pathfinding is undocumented.

sullen sigil
#

that sounds like a brilliant rabbit hole to dive into

#

though time is probably better spent just thinking of an alternative

true frigate
# granite sky How are you setting the restrictions?

Hey! Sorry for the late reply (been at work today), we have a list of allowed items, essentially when a player loads a loadout - if that loadout contains any items that aren't in that list it should reset the loadout to empty.

granite sky
#

It is feasible to build up a road navigation map in SQF and use that to generate waypoints, although you get some corner-cases with badly-made maps.

#

@true frigate This is ACE arsenal, right?

true frigate
#

Virtual Arsenal

granite sky
#

The BIS one?

true frigate
#

Just vanilla, yep. The issue is half of our members use ACE arsenal and the other half use Virtual - so somehow it has to work for both ๐Ÿ™ƒ

#

This is why I've been banging my head on brick walls for months on this haha

granite sky
#

months...

true frigate
#

Yeah..

hallow mortar
#

Why not force everyone to use one or the other?

true frigate
#

I wish that was an overexaggeration, but we've been waiting for a kitlist too

granite sky
#

that's the starting point, yes

#

well, and roadsConnectedTo

true frigate
queen cargo
#

There also was some Navigation mod which allowed for road based navigation

granite sky
#

Antistasi community has a navgrid generator and editor that you could potentially use for other mods. It mostly works.

#

Then you can just write a basic Astar on top of that, which is quicker in SQF than you might imagine.

granite sky
#

Not sure how you'd do it with the BIS arsenal. You'd probably need to hook the UI button.

#

Might be easier to trigger a check when people exit the arsenal.

sullen sigil
granite sky
#

oh that, yes.

#

Best to just avoid blocking roads if possible.

sullen sigil
#

ye idea was for police roadblocks but theres no point if they just drive around

stable dune
#

Hello,
Does anyone have some kinda workaround to check when the player gets assigned to the curator/ deleted ?
I need to add EH on my curator (s),
What would be the easiest way to do that ?
Didn't find any EH/ scripts for this.
Can I handle these via when the curator module is created/ for each already in the editor placed curator modules or something?

granite sky
#

You could try the "curatorUnitAssigned" scripted event handler.

#

Alternatively you could just install the curator event handlers on every client for every curator :P

stable dune
ornate whale
#

Is "ceil" a good way to prevent while-do {sleep x-y}; from cycling to infinitely smaller numbers? Next worry are extremely large negative numbers, overflowing, etc.

queen cargo
#

OOS is a highlevel lang for SQF @cold rampart

granite sky
#

It can't cycle to infinitely smaller numbers. The minimal sleep is a single frame.

ornate whale
#

The point of the code is to make AI lose track of player after certain amount of time.

sullen sigil
#

dont they do that anyway

ornate whale
sullen sigil
#

fair enough

granite sky
#

hmm, I'm wrong. sleep for less than ~0.001 seconds apparently doesn't do anything.

#

Simplest way though is just add a fixed 0.01 and then you guarantee minimum one frame.

#

well, or _value max 0.01 if you don't want to occasionally sleep two frames when one was enough. In this case you don't care about that sort of accuracy though.

limber heart
#

what script can i use to provide a global hint with the players name who did the add action

little raptor
stable dune
#

True.
It's string.

little raptor
#

well I guess you mean you want to format a message?

#
[format ["Player %1 completed the action", name player]] remoteExec ["hint", [0,-2] select isDedicated];
limber heart
#

so it would be like "Hello" remoteExec["hint" ]

stable dune
limber heart
#

just returns players name publically?

little raptor
limber heart
#

thank u โค๏ธ

#

trying to pair this with a change time script for players to use, just dont want some goober changing the time tryna troll

little raptor
#

you can use a whitelist or something

limber heart
little raptor
#

yes

limber heart
little raptor
#

hardcoded way would be:

Soarin_whitelist_UIDs = createHashmapFromArray (
  [
      "1234534342323",
      "5124124124124",
      ....
  ] apply {[_x, nil]};
);

// later in some script, such as an addAction

if !(getPlayerUID player in Soarin_whitelist_UIDs) exitWith {}; // not in whitelist
sullen sigil
#

Why a hashmap there?

little raptor
#

in case there are many UIDs blobdoggoshruggoogly

#

for faster lookup

sullen sigil
#

Ah, fair

#

Someone pr'd my two primary weapons to change the cba options array to a hashmap but just caused a bunch more issues than it solved meowsweats

little raptor
#

probably did it wrong blobdoggoshruggoogly

sullen sigil
#

Had it convert from array to hashmap on setting change -- so it just wouldn't convert to hashmap if you didn't change the setting in that session iirc

#

Either way not fussed about performance for that given its a local lookup when player presses a key

little raptor
#

its a local lookup when player presses a key
it can still be slow

#

depends how many items you search in, and what kind of items
roughly speaking, an array of 10 numbers or fewer is fast enough without hashmap

sullen sigil
#

rather than it being mid firefight or something

manic sigil
#

onKeyDown for a speed boost is not ideal x_x any suggestions for a 'press E to add 10 forward velocity'?

sullen sigil
#

question is unclear, what are you actually needing suggestions for?

#

how you handle the input or what you do?

little raptor
sullen sigil
#

hey leopard im over 3 weeks into trying to fix that lag bug with no further headway kekw

#

i love this game

ornate whale
#

Is "time" always at most in 3 decimal points, or does the engine handle it more precisely under the hood?

#

I wanna make sure that I for example don't try to compare myTime == 10 when actually myTime=9.9998989898 and it would never meet that condition.

south swan
#

You don't compare two floats for exact equality

#

Define some arbitrary small acceptable error and check for "close enough"

ornate whale
#

like is X between (Y and Y+0.1) ?

south swan
#

Yes

ornate whale
# south swan Yes

I was sloving it with rounding, ceilling or floring, or min maxing the numbers

south swan
#

Or waitUntil {time > 10}, for example

ornate whale
#

I wanted to do something like this, but I imagine how this line is runing throught the CPU again, and again ๐Ÿ˜„, without any restrictions.

south swan
#

waitUntil is rarely an efficient thing

hallow mortar
ornate whale
#

Can I use exitWith to jump out of the eventHandler body?

winter rose
hallow mortar
#

exitWith will just exit the EH code (assuming it's top-level within that and not exiting a sub-scope of the EH code). You can't use it to return to the script the EH was added in; EH code is not "inline" with the script it was added in, it's a separate context with no connection.

exotic flame
#

Is it possible to disturb the compass in Arma 3 ?

drowsy geyser
#

Is there a way to smoothly delete a control created with ctrlCreate i.e. fade it out? because ctrlDelete deletes it immediately

granite sky
#

ctrlSetFade

exotic flame
proven charm
#

how can you change the flag on carrier? (via script)

warm hedge
#

What carrier?

proven charm
warm hedge
#

USS Freedom you mean?

proven charm
warm hedge
#

Well using both flag and carrier words I could imagine flag holder, but you are talking about Aircraft Carrier right?

proven charm
#

yes

warm hedge
#

Then no

proven charm
#

really, i mean the flag/banner on the carrier tower. its US by default

warm hedge
#

No, I mean, no

proven charm
#

oh weird

warm hedge
#

What have you ever seen?

proven charm
warm hedge
#

I mean why you think is weird?

proven charm
#

well i expect some leavel of customization

#

the destroyer can have it's flag changed among other things like name

warm hedge
#

Well USS Freedom is not that customizable more like impossible by default

#

I've made a Mod to have multiple Gerald R Fords but that uses very stupid workaround

little raptor
#

If you mean the flag on the island

proven charm
little raptor
#

You can make a simple object if you want. But not super simple object

proven charm
#

ok

warm hedge
#

It does have no hiddensels

proven charm
#

hmm setObjectTexture and setFlagTexture doesnt do anything. I guess it really is nondoable

warm hedge
#

Pretty much it is

proven charm
#

can I make mod that changes the textures? or is it all in single texture

sullen sigil
#

if setobjecttexture or setflagtexture dont do anything then its model baked

proven charm
#

ok

proven charm
warm hedge
#

This is why I suggest you to check this up

proven charm
#

ok thx ๐Ÿ‘

#

i think im going with Leo's advice to use the UserTexture1m_F object to cover the US flag because then I can support any flag

#

thx all ๐Ÿ™‚

still forum
#

๐Ÿ‘‹
I'm looking for a repro of a UI eventhandler crash.
That long known bug where deleting a display from inside a eventhandler crashes the game.
Anyone have some repro for that I can test? Or multiple different ones?

I just found what caused this in KeyUp eventhandler and it was very easy fix, I want to check other cases to see if its the same

distant egret
#

Had a couple of crashes yesterday when doing 3DEN attribute UIs with list boxes, not sure because of something I did wrong and somehow fixed it in the end though. I'll have a look if I can reliably replicate it.

still forum
#

I just fixed it in KeyUp, KeyDown, Char, IMEChar, IMEComposition

I see Eden attributes also has it. If you somehow delete that control from there, you're likely to crash

proven charm
#

I had once this problem where trying to delete RscShortcutButton made arma crash. Don't know if this is related or not. The control was inside controls group

still forum
#

Probably is

granite sky
#

There are notes about that crash in the CBA progress bar code. I think that was KeyDown again though.

still forum
#

That's keyUp, that's the first I fixed today

amber basalt
#

Is there easy way to achieve something like this:

private ["_unit", "_weapon", "_ammo", "_rocket", "_missile", "_ammoCount", "_magazineReloadTime"];

_unit = _this select 0;
_weapon = currentWeapon _unit;
_ammo = _this select 4;
_rocket = nearestObject [_unit, _ammo];

if (isNull _rocket || (!isPlayer _unit)) exitWith {};

_missile = ["M_Sidewinder_AA", "M_Sidewinder_AA_F35"];

if (!(_ammo in _missile)) exitWith {};

_ammoCount = _unit ammo _weapon;
hint format ["Ammo Count: %1", _ammoCount];

// Must be two since the magazine size is two and this script is executed upon firing the weapon 
if (_ammoCount == 2) then {
    // Trying to modify it like this, but it's not possible to modify the config files
    _magazineReloadTime = getNumber(configFile >> "CfgWeapons" >> _weapon >> "magazineReloadTime");
    _magazineReloadTime = 1;
};

(the script doesn't work because apparently you can't modify the config files in script runtime)
The issue is that the _magazineReloadTime is very long on those ammo types (30 seconds). I'm modding vanilla Arma 2 OA, but I assume it's the same thing in A3.
https://community.bistudio.com/wiki/setWeaponReloadingTime won't work either because the issue isn't reloading time itself between the rounds, rather the magazines.
After looking up from this discord that removing the weapon and adding it back might work, tried this, it didn't work:

// Must be two since the magazine size is two and this script is executed upon firing the weapon
if (_ammoCount == 2) then {
    _unit removeWeapon _weapon;
    hint format ["Ammo Count after removing weapon: %1", _ammoCount];

    _unit addWeapon _weapon;
    _unit selectWeapon _weapon;
};

I tried adding sleep timers between the removeWeapon, addWeapon and selectWeapon, and it seems that it just adds the same weapon back, it has the same reload timer.

Could perhaps use mods as last resort that are optional if there is no really way to fix this with scripting, what do you think? thanks.

still forum
#

Well you can make a mod? And config patch it

amber basalt
#

Yeah this is what I thought, but our server runs on vanilla Combined Operations, although we have an optional modpack, a scripted solution would be better (just that if it's possible), since not all players are going to download those mods.

#

If everything else fails (before using the mods), would it be possible to alternate between two different types of weapons that still have the same magazine? The problem is that this isn't an option for the Spike launcher that we're going to use alongside with the sidewinder modifications, since afaik there's only one type of that weapon.

brisk harness
#

im attempting to make my 1st arma mission but its not going well lol. im trying to have opfor and bluefor hold fire until a sniper kills bluefor officer then all set to open fire. I got them to hold fire with "set ai mode" but i cant seem to get my trigger to cooperate with the second "set ai mode" to allow them to fire.

winter rose
tulip ridge
#

Trying to make a "cooldown" script to only allow x action to work every y amount of time.
Easy enough, but when testing I realized that it also didn't work for the first y amount of seconds at the start of the mission.

Should have been easy enough but I think I've been staring at it too long and could use a second pair of eyes.

// Some other conditions...

// _lastUsed is set to time when activated, defaults to 0 if not set
// _cooldown is config property, 25 seconds in this case
if
(
    (time - _lastUsed) > _cooldown // Checks if vehicle is on cooldown
) exitWith { false };

true;
brisk harness
granite sky
#

@tulip ridge

defaults to 0 if not set
You'd need to default it to -_cooldown or lower for your use case if you want it to work correctly from the start of the mission.

#

time starts at 0.

winter rose
tulip ridge
brisk harness
willow hound
#

Remove the trigger owner and set the Activation to None.

acoustic yew
#

Hello, I am sorry for interjecting, May I ask if my remoteExec code is alright?

[convoyGroup, _pos] remoteExec ["MOVE", 2];```
winter rose
brisk harness
granite sky
#

you have to use leader convoyGroup unless there's a player in the group.

#

or groupOwner convoyGroup

winter rose
#

will amend

#

added text highlight in the doc as well ๐Ÿ˜„

sullen sigil
#

insert me shilling cba events instead of remoteexec

winter rose
#

(& John Jordan for the fix)

ornate whale
#

How do you usually interpolate values if you want to make smooth transitions?

proven charm
little raptor
#

LinearConversion meowsweats

south swan
#

there being 2 different implementations of BIS_fnc_lerp is double sus notlikemeow

ornate whale
#

Thank you all.

simple trout
#

Can't remember if that's what you are looking for exactly, but It is trying to delete a ui element in an event handle

vernal hinge
#

Quick quesiton. Is there any way to get this command to work with a domain? I've read that it only works via IP but maybe some of y'all know a workaround?

connectToServer ["play.domain.com", 2302, "test"];```
ornate whale
#

How performance demanding is FiredNear on all AIs in the level? It gets triggered every time anyone shoots, so AIs would trigger each other. So if one fires, all 10 AIs (including the shooter) will detect the sound. How much performance would this cost, if I had few condition checks in the handler?

this addEventHandler ["FiredNear", {
    params ["_unit", "_firer", "_distance", "_weapon", "_muzzle", "_mode", "_ammo", "_gunner"];
}];```
little raptor
#

what you get should be very close to what you'll actually experience

#

the actual one is slower tho, but you have no means to measure it

little raptor
vernal hinge
little raptor
#

if you mean the actual code, it depends on which langauge is used

#

in C++, gethostbyname. in C#, DNS.GetHostAddresses (iirc)

#

looks like getaddrinfo should be used instead

sullen sigil
#

is there any way of returning a control to its config-defined values without having to look up all of them or re-create the control? meowsweats

little raptor
#

no

fleet sand
#

Hi guys simple Question. What would be the best practice to make a array objects to appear and disappear. More Context: I am making like PVP arena and i want to have selected objects in arena with a variable name to have a % to either be there or not To make arena a bit more randomized so its not always the same. How would i make it so script selects random object from array then either hides it or unhides it depending if the object has been selected and if the object was hidden in the first round how to unhide it in the second round if its selected again ?

sullen sigil
#
private _yourarrayofobjects = [];
{
  private _chance = 0.5;
  private _value = random 1;
  if (_chance < _value) then {_x hideObjectGlobal true; continue;};
  _x hideObjectGlobal false;
} forEach _yourarrayofobjects;```
#

should be roughly what you're looking for, alter _chance accordingly

#

atm half objects on average will show

#

if you want some objects to appear more often than others then things can get funky there, depends how much copy+paste into init you want to do

fleet sand
sullen sigil
#

depends how fine control you want

#

you could simply do something like uh

granite sky
#

showObjectGlobal -> hideObjectGlobal.

sullen sigil
#
private _yourarrayofobjects = [];
{
  private _chance = _x getVariable ["Legion_AppearanceChance",0.5];
  private _value = random 1;
  if (_chance < _value) then {_x hideObjectGlobal true; continue;};
  _x hideObjectGlobal false;
} forEach _yourarrayofobjects;```
then put
`this setVariable ["Legion_AppearanceChance",0.5];` in the init, and replace 0.5 with how much you want it to appear
#

oh is that how that works

#

oh wait its just not a command

#

bruggin

#

fixed

fleet sand
sullen sigil
#

thats just for keeping it as a percentage

#

dont touch

#

no need

#

i think i intended to put random _max and just put random 1 instead

#

ive been doing gui all day my brain is fried

granite sky
#

understandable

fleet sand
#

understandable

sullen sigil
#

it didnt even touch a single gui component i just modified the scripts

#

because when i did touch a gui component i ended up with this

ornate whale
#

What is the speed of sound in Arma 3?

warm hedge
#

Almost same with IRL

near wharf
#

Can anyone help? I just bought a bisecthosting arma3 server. I'm trying to get EZM and enable scripts. I've tried everything I've seen online. Pls dm.

winter rose
#

โ€ฆI suppose?

near wharf
kindred zephyr
#

Hey, Sorry i was a bit busy.

Looks like the control does takes the r2t BUT only the first frame of the camera is get and then no updates. Does it has to be in a OEF eventhandler?

Edit: I was just being a dumbass and had PIP option disabled xD

vapid scarab
#

If I was to define a 3den Module in a mission file's description.ext, would it show up?

cold mica
vapid scarab
#

Im kinda hoping someone could answer it before I get to testing it

cold mica
#

Is there anything wrong with running everything in a scheduled environment?

Say I wrap all my code in init.sqf between a [] spawn {} command, would it be bad for me?

sterile flower
#

Gotta share some gold I just found out, Chatgpt can write scripts for arma3

#

Idk how deep it can go but so far it is much better than I am and can actually explain which field to put it in

#

In detail

cold mica
#

ChatGPT can lie to you about what's possible in SQF, because it isn't fully knowledgeable in it.

sterile flower
#

Damn my b

winter rose
#

you can eventually use it to learn/dig, but never ask us to fix its code ^^

sterile flower
#

Yeah no worries

#

I wouldnโ€™t do that, Iโ€™ve just been using it to write tedious stuff

#

Stuff that I already know is possibly and that I could do but Iโ€™d have to spend an hour or more looking at the wiki for just for it to become irrelevant 30mins later

sterile flower
cold mica
#

it doesnt know all the commands so it can just make it up

split oxide
# cold mica Is there anything wrong with running everything in a scheduled environment? Say...

Scheduled vs. unscheduled really comes down to a matter of how important it is to have your code happen immediately and in order. As far as the init.sqf, technically it's already scheduled. In singleplayer (according to the wiki), init.sqf is scheduled but it the engine waits for it for to finish before continuing, letting your init.sqf run before modules are initialized and post init functions are called.

cold mica
#

I dont know a situation where an unscheduled env would be better than scheduled env

sterile flower
warm hedge
#

Is there a way to order a helicopter to move into a position precisely, like make them closer to the WP itself ~1m not ~70m?

granite sky
#

If you mean an easy way then the answer is no.

warm hedge
#

Yeah apparently I've tried a workaround that it tries to overshoot the designated position itself and eventually gets closer than 70m, but found is unreliable enough so

granite sky
#

yeah, the waypoint completion radius check is low-precision so it's pretty random.

#

EachFrame velocity adjustment after the waypoint completes is maybe the easiest method.

warm hedge
#

Well, yeah, please BI, I mean two decades ago... please make a simple thing simple

#

Have no experience with setDestination but does it even work after all?

granite sky
#

I've only tried it for ground vehicles and it's weird enough there.

#

It switches out of waypoints about halfway between them, so it'd probably require a lot of setup to fly to a point. Likely harder than EachFrame velocity adjustment.

sterile flower
#

Oh, you arenโ€™t talking about landing my bad

#

One thing Iโ€™d maybe try is within the waypoint attributes see if you can adjust the precision necessary for the waypoint to be completed

warm hedge
#

Yeah landing is not what to achieve but basically flyover

granite sky
#

setWaypointCompletionRadius isn't useful except to increase the completion radius from default.

still forum
#

I could build it for you with battleye compatibility but that'll take some unspecified amount of time

vernal hinge
#

Nah thank you I'm good. I already figured it out via some ui navigation. Definitely gonna look into this extensions stuff tho

kindred tide
#

@warm hedge setDestination for an agent driven helicopter is good, i even got a whole landing script for landing/hovering precisely where i need it.

#

it is your responsibility though to make the trajectory safe, he wont do that kind of thinking for you

little raptor
#

It could lead to disaster when you take into account all the mods/modules that rely on scheduled environment

#

The general rule is: use as few spawns/execVMs as possible. Even combine your loops if you can

little raptor
# cold mica I dont know a situation where an unscheduled env would be better than scheduled ...
  1. Making sure a block of code runs without interruption
    E.g. if you have 2 codes, each one reading and modifying a global variable, and they run scheduled together, it causes data race. Each read and write process has to happen unscheduled (it's not limited to read and write but you get the idea)
  2. Timing in scheduled env is very inaccurate. For accurate timing one should only use unscheduled env
  3. Some processes must happen unsch to be safe. E.g. if you create a vehicle and reposition it in schd env, the engine might simulate the vehicle before you get to put it in a safe pos, leading to explosion
    Well 3 is just the same as 1 meowsweats
sullen sigil
#

unschedule everything unless you know you need it to be scheduled

little raptor
#

No. That's also bad. Even worse if you don't know what you're doing. At least if you f up in schd you won't mess up the FPS

sullen sigil
#

you instead mess up the execution time of everything that is scheduled which is much less noticeable so you dont notice youve done something stupid

south swan
#

uncheduled is better because it forces you to fix bad code earlier aviator

honest coral
#

just dont write bad code aviator

kindred tide
#

if you were creating a mission with fully emergent gameplay, where nothing is 'scripted' and it's more like a sim, what would you use scheduled for?

sullen sigil
#

if you need the fps to remain somewhat stable and the code doesnt need to be executed immediately

kindred tide
#

that means that theres quite a few different systems/modules that run together and have to interact a lot, would you want the pain of synchronizing them if they were sched

astral bone
#

Is there a way to save stuff to a text file? Just out of curiousity.
My mission.sqm is kinda large and Im wondering if I could have it save some stuff outside of it. I prpbably wont implement it but again, just curious.

sullen sigil
#

example of something that using the scheduler for is a good idea is my imposters mod's main loop -- it's high cost (checking nearly every ai) but doesnt need to be executed at all if theres lots going on (youre not going undercover mid firefight etc)

kindred tide
#

sounds like a state for an FSM

sullen sigil
#

possibly but easier to disable/modify when its script

winter rose
honest coral
kindred tide
#

i cant get VSCode because it requires win10, and guess what

astral bone
# winter rose define "save stuff"

save information for a mission outside of the description.ext and mission.sqm, but still inside mission folder, and only for the mission

#

Like, text for example.

manic kettle
#

Describe your use case

winter rose
#

yes please

winter rose
kindred tide
#

steam will stop working on win7 in 140 days anyway

astral bone
#

I have a mod that writes data to the sqm file, currently it has written 265,747 characters. I am wondering if it was possible for it store it's data in a dedicated file.

winter rose
#

what is that data

#

if text, use stringtable
if object position, use spawn scripts
if "random.txt"โ€ฆ use "random.txt"

astral bone
#

Modify a text file via a script

winter rose
#

no can do.

#

(not without an extension)

hallow mortar
#

I'm assuming this is an Editor mod and this is all dynamically generated data, like object custom attributes or whatever, so it's not possible to hardcode it into a stringtable etc.
I think you're probably stuck with it, no good solution

astral bone
#

ah oki, yea, thought so :P

kindred zephyr
#

Is there any way for camera position commands to take ASL?

Im currently facing a situation in where a cam that I have for a scene has to be above water but while trying to set up positions it always ondulates with the waves motions.

//Ondulates, the script is in a loop changing around a relative position in  very short intervals to simulate a smooth traverse path
_cam camSetPos _aglPos;
_cam camCommit _speed;

And of course, using setPosASL obviously removes that issue but makes the movement super jittery. Would there be anyway to simulate the commit movement buttery smooth interpolation effect or have an alternative to camSetPos?

The logic of the relative position is getting a circumference from an object adding a degree, decreasing my movement interval and angle for my transitions helps greatly, but still causes really noticeable jitter.

Any ideas?

sullen sigil
#

can you not just use setVelocityTransformation?

#

alternatively, ASLtoAGL or ASLtoATL etc

kindred zephyr
#

the camSetPos takes only agl, transforming it actually gives me worse results sadly

sullen sigil
#

ah, ASLtoAGL then

kindred zephyr
#

indeed, that still leaves me with the problem of the ondulation above waves when not in a surface :c

#

setVelocityTransformation might be the solution

#

have to try if it actually moves the camera object

sullen sigil
#

It shouldn't do meowsweats

sullen sigil
#

i.e no change due to waves

winter rose
#

yet AGL is ASLW

sullen sigil
#

oh notlikemeowcry

winter rose
#

that's why I guess, AGLToASL may not consider waves in that case
tbh IDK

sullen sigil
#

wait im looking at the wrong page anyway

sullen sigil
#

if setvelocitytransformation works use that though

#

it is a complicated command to get your head around initially tho

winter rose
#
private _camPosASL = [0,0,10];
_camPosAGL = ASLToAGL _camPosASL; // does it consider waves?
// if not:
private _camPosASLZero = +_camPosASL;
_camPosASLZero set [2, 0];
private _waveZOffset = -(ASLToAGL _camPosASLZero select 2);
_camPosAGLww = _camPosAGL vectorAdd [0, 0, _waveZOffset]; // ww = without wave
kindred zephyr
winter rose
#

ah, and you are camCommitting so it's not instant
nah I'm afraid you're out of luck here, "it is how it is"

kindred zephyr
#

sadly ๐Ÿ˜ฆ

#

I guess I can still try to remove the offset of the waves manually and account it in the position transition in camSetPos, even if its not a lot, that cam is kinda nauseating xD even reducing the wave bobbing a bit is a win

winter rose
#

if you can deal with vectors, you can always setPosASL & setVectorDir manually

kindred zephyr
#

the cam having a target set already deals with the vector direction anyway, and setPosASL is something that, while works, gives me very jittery results.
I wonder, maybe if I go in super low intervals for angle transition and loop speed it would be better thonk

At what point would someone benefit from an OEF eventhandler in this situations?
right now im arbitrarily moving 1deg every 0.025 sec

winter rose
#

visual = onEachFrame, definitely

#

I reckon a full scripted camera system could be done in Arma

sullen sigil
#

if camera is local it can be

#

my capital ships system could be changed to camera easily

kindred zephyr
#

cameras are always local yeah

sullen sigil
#

yeah twas what i was getting at

#

its easy enough to do once you learn how to setvelocitytransformation

#

or even setposasl/setvectordirandup on each frame

winter rose
#

"Draw3D" EH would be better I suppose

sullen sigil
#

no real difference locally

kindred zephyr
sullen sigil
#

once you have setposasl/setvectordirandup you can just feed them into svt on each frame, no need to bother with interval really as is local

#

If you need any reference this moves by a bunch of arbitrary values on each frame

#

Works perfectly in SP, just has MP interpolation issues on orientation, not an issue for you

exotic flame
#

Is there a way to detect when selectPlayer _unit is used ?

granite sky
#

I can't see an event handler, surprisingly.

cold mica
little raptor
#

well there is one per machine (or maybe better said, game instance) ofc

cold mica
#

On a separate note, how could I recreate execution from initPlayerLocal.sqf in the XEH_preInit.sqf file. I am running a bunch of CBA_fnc_addSetting functions, some running globally, that I want to run on players only.

Currently, I have it like so:

if (!isDedicated && hasInterface) then {
  // Code
};

But this does not run the code the same way as if running it from initPlayerLocal.sqf. Am I missing something?

winter rose
cold mica
#

!isDedicated prevents HCs from running it.

winter rose
#

is initPlayerLocal.sqf for players only, or for HC as well? and player-server?

cold mica
#

Players only. I do not want to run anything on HCs.

winter rose
#

then if hasInterface will target just peeps with interface, aka players (server or not)

cold mica
#

No way, I'm looking this up. Was my life a lie?

cold mica
#

Wow, TIL what a Player Server is

winter rose
#

a "listen server" iirc

cold mica
#

Makes sense.

#

How about this. Would these two executions have the same result?

XEH_preInit.sqf

if (hasInterface) then {
// Code
};

initPlayerLocal.sqf

// Code
winter rose
#

no clue about XEH thingies ยฏ_(ใƒ„)_/ยฏ

#

note, maybe preInit is not good

cold mica
#

I appreciate the attempt nonetheless

brisk plover
#

Hey all, firstly trigger warning I'm going to say the "C" word. I'm looking to commission someone for two basic mods. I'm talking a ACE self interaction that makes noise & a new ammo type for a weapon. I've tried to do it myself but I've hit a wall, coding is not my strong suit

ornate whale
#

If I bundle my scripts as an addon on Workshop, and I have some fundamental code lines in files like init.sqf or initServerPlayer.sqf, would it work, if someone wanted to make a mission with it? And in which file can I let the users to configure my addon behaviour? Currently I have options in init.sqf. I don't want to distribute the sourcode on GitHub.

sullen sigil
#

no you will need different logic

ornate whale
sullen sigil
#

use cba postinit/preinit event handlers

ornate whale
kindred zephyr
kindred zephyr
ornate whale
kindred zephyr
#

yeah, you can do it in modules

#

or

#

you can do unit eventhandlers for classes or parent classes

ornate whale
kindred zephyr
#

yup

#

what specifically you want to do

#

?

ornate whale
# kindred zephyr what specifically you want to do

Now, I have an init.sqf, where I declare some variables, mainly for configuring the scripts, and also I add some event h. to AI units. I tried to create a customInit.sqf and I gave it preInit=1, but it does nothing

kindred zephyr
#

This is an example, if you want to do client sided base addons to do something on units, but you might be better off doing it properly and have it be accessible on server machine

class Land;
class Man: Land ///<-- declaring that camanbase inherits from man
{
                class EventHandlers ///<-- telling the game to add to the eventhandlers class in the desired class
          {
              class MKClass
              {
                  init = "anyFunction goes here";
              };
          };
};
ornate whale
kindred zephyr
#

cfgVehicles inside config.cpp

ornate whale
kindred zephyr
#

you could probably use the file patching to "test live", but i have no idea on that

warm hedge
#

diag_mergeConfigFile does, but if you have no clue how to use, just pack it into a Mod

granite sky
#

Normally non-mission config is only loaded at startup.

ornate whale
flat eagle
#

why doesnt getArtilleryComputerSettings return grid? it would make life so much easier

warm hedge
pulsar pewter
kindred zephyr
balmy fox
#

I have a script I am trying to make work for a medavac tent, with a doctor in it. I want to be able to pull uncon/critical patients into it from the field, and hold action on the doctor to have them full healed.

Issue is that I cannot get it to work, and I am fairly noobish at scripting. So I was hoping I could get some extra eyes onto what I am missing.
The doctor in the tent has this line in it's init: [this] execVM "baseDoctor.sqf";

And I was trying to use an .SQF file to launch it, but the file keeps getting deleted. So I switched to using TypeSqf Editor, and a non binarized mission file.

leaden ibex
#

Hey there, I am trying to remove a magazine with specified amount of ammo in it from the players inventory/GroundWeaponHolder. I check if the magazine is in there with

private _magazines = magazinesAmmo player;
private _removed = false;
{
  if (_x#0 == _magazine && _x#1 == _ammoCount) then {
    _removed = true;
    // TODO really remove the mag from the players inventory
  };
} forEach _magazines;

I am looking at the functions, but none of them allows me to remove the exact magazine by ammo count. Any ideas? monkaHmm

wary needle
#

anyone know how to make the blood mist particle effect apear?

granite sky
#

@leaden ibex I think you have to remove all magazines of that type and then re-add the ones you want to keep.

leaden ibex
#

I want to die

#

But yeah, that's a way I didn't think of... Even though I am already doing this for some reason in my mortar script with ground weapon holders

#

Thank you! 4:30am brain is not functioning as it should dogeKek

fair drum
# balmy fox I have a script I am trying to make work for a medavac tent, with a doctor in it...
// Global execution

params ["_doctor"];

if (local _doctor) then {
    _doctor allowDamage false;
    ["MOVE", "COVER","FSM"] apply {_doctor disableAI _x};
    _doctor setVariable ["lambs_danger_disableAI", true, true];
    _doctor setUnitPos "UP";
};

if !(hasInterface) exitWith {};

[
    _doctor,
    "Get Medical Treatment",
    "\A3\Ui_f\data\IGUI\Cfg\HoldActions\holdAction_revive_ca.paa",
    "\A3\Ui_f\data\IGUI\Cfg\HoldActions\holdAction_revive_ca.paa",
    "_this distance _target < 3",
    "_caller distance _target < 3",
    {},
    {},
    {
        params ["_target", "_caller", "_actionID", "_arguments", "_progress", "_maxProgress"];

        private _units = _caller nearEntities ["CAManBase", 10];
        if (_units isEqualTo []) exitWith {};

        _units apply {
            [_x] remoteExec ["ace_medical_treatment_fnc_fullHealLocal", _x];
        };
    },
    {},
    {},
    15,
    0,
    false,
    true
] call BIS_fnc_holdActionAdd;

you need to remoteexec the ace heal local function to where the unit is local

tough abyss
#

can I bypass the limitations of ambientAnimCombat by manually terminating a BIS_fnc_ambientAnim instead?

#

having some issues with getting an AI unit to actually trigger with this knowsAbout player

fair drum
#

which limitation?

tough abyss
#

the fact that theres like 7 animations instead of 40

#

i'd like to have a bunch of units stand at briefing, then break when they start getting shot at or detect a player

#

currently using [this, "LISTEN_BRIEFING", "LIGHT"] call BIS_fnc_ambientAnim;
if ((this knowsAbout player) > 1) then {this call BIS_fnc_ambientAnim__terminate; test2=true};

#

through the test2 in there for debug, not even getting set to true.

fair drum
#

you can't get around the # of animations that you have available without rewriting your own version of the function.

tough abyss
#

ugh. is there some way to do this i'm not aware of?

fair drum
#

use the group/unit's behavior for detection rather than knowsAbout, use a FiredNear event handler, etc

balmy fox
#

works perfectly.

hallow mortar
tough abyss
#

so I should write an sqf script for this, and then execvm?

wary needle
#

does anyone know how to activate the blood effect?

fair drum
tough abyss
#

thanks lads

fair drum
wary needle
#

its not some function i can call? lame

#

ngl to much work for a little blood spater

fair drum
#

do you want it on the screen or on the character?

#

@wary needle

leaden ibex
# granite sky <@153480398054227978> I think you have to remove all magazines of that type and ...

I hate this so much, but it will work, thank you for the idea!

private _magazines = magazinesAmmo player; 
private _removed = false;
private _index = 0; 
{ 
    if (_x#0 == _magazine && _x#1 == _ammoCount) exitWith { 
        _removed = true; 
        _magazines deleteAt _index; 
        player removeMagazines _magazine; 
        { 
            if (_x#0 == _magazine) then { 
                player addMagazine [_magazine, _x#1]; 
            }; 
        } forEach _magazines; 
    };
    _index = _index + 1;
} forEach _magazines;
fair drum
#

oops I mean in context with _forEachIndex

leaden ibex
#

Can't just - [x] as it would delete all the occurrences and player could have multiple magazines with the same ammo. Was my first try.
So I switched to index. What could be wrong?

#

Does forEach "not guarantee" it being one by one? monkaHmm

fair drum
#

Its a warning if you use _forEachIndex

#

which you aren't

leaden ibex
#

tbh, I didn't even know _forEachIndex exists kek

#

But what can be wrong with it, looking at it, it would be ok.
Mainly as I delete only once and leave.

#

The only problem I could see is using normal forEach and deleting one by one insted of using forEachReversed

fair drum
#

I would use continue

tough abyss
leaden ibex
#

I want to exit the forEeach, as I only delete one of the magazines. No need to continue searching

fair drum
#

oh ok

leaden ibex
#

So using the magic variable _forEachIndex could be used here without any worry, right?

split oxide
#

yeah, as long as you stick with the exitWith

leaden ibex
#

Alright, wonderful, thank you!

fair drum
#

take a look at the notes under deleteAt's wiki page and make sure you don't run into conflicts with _forEachIndex not keeping up

leaden ibex
#

Yeah, that's what I've written as I can see as the only problem.
_forEachIndex continuing counting while the array itself is getting smaller

#

I actually wonder how forEach handles it monkaHmm
Might need to do some testing

#

Yeah, it get's fucked

#

after the first 2, the array itself is only 7 long, but still runs 12 times

#

(BI please fix KappaLul)

granite sky
#

The code you pasted is fine anyway. Issue is with deleting from an array that you're iterating over, which you're not doing.

leaden ibex
#

I am

split oxide
#

You're exiting when you delete, which is fine

leaden ibex
#

But in a way that won't matter

granite sky
#

wait, there's an outer loop

#

why is there an outer loop :P

split oxide
#

there's an inner loop that readds the remaining mags

#

but the outer loop is the one exited on delete

granite sky
#

yeah it's fine, just kinda weird. Normally you'd do the outer one as a findIf

leaden ibex
#

Outer loop checks if the mag is in the players inventory, as it could be on the ground too.
Deletes the one instance of the mag in the mags array
removes all the mags from player inventory
inner loops add them back in

#
private _magazines = magazinesAmmo player;
private _index = _magazines findIf {_x#0 == _magazine && _x#1 == _ammoCount};
if (_index != -1) then {
  _magazines deleteAt _index;
  player removeMagazines _magazine;
  { 
    if (_x#0 == _magazine) then { 
      player addMagazine [_magazine, _x#1]; 
    }; 
  } forEach _magazines;
};

should also work then

#

(I am coming from C, findIf is magic for me and my brain isn't wired for that)

split oxide
#

wouldn't you want to remove magazines before the deleteAt, as you would then preserve the magazine you removed

balmy fox
#

Are you scripting infinite ammo?

leaden ibex
#

I won't, as I delete ALL the magazines of a type magazine, no matter the ammo count in them

leaden ibex
granite sky
#

you could probably simplify it with private _magazines = magazinesAmmo player select {_x#0 == _magazine}

balmy fox
leaden ibex
#

True that. Can save me the loop again

granite sky
#

and a chunk of the findIf

split oxide
#

oh I see _magazine is supposed to be another variable different than _magazines

#

either way, good luck ilbinek

leaden ibex
#

_magazine is just a string of the classname

split oxide
#

something wrong

leaden ibex
granite sky
#

yeah, just loses the condition within the loop.

leaden ibex
#

yep

leaden ibex
split oxide
#

Yeah I see that now

#

it's just cropped

leaden ibex
#
private _magazines = magazinesAmmo player select {_x#0 == _magazine};
private _index = _magazines findIf {_x#1 == _ammoCount};
if (_index != -1) then {
  _magazines deleteAt _index;
  player removeMagazines _magazine;
  {
    player addMagazine [_magazine, _x#1];  
  } forEach _magazines;
};

is the final form

granite sky
#

x/_x typo in first line

#

otherwise it is perfectly Arma

leaden ibex
#

Wrote it here, VSC should tell me I am a dumbass once I copy it over

#

Hey, Czechs got to continue in writing "Arma" code eh? rtzW

wary needle
acoustic yew
#

Ello :D
Im sorry for interjecting may I ask if there is a way to use while loop and have it "run" every 10 seconds?

I saw someone using while loop like this:

while {sleep 5;!isNull convoyGroup} do {
    // 
    convoyGroup setFormation "FILE";
    convoyGroup setCombatMode "RED";
    convoyGroup setBehaviour "CARELESS";
    convoyGroup setFormation "FILE";
};```
is this the same thing?
tulip ridge
#

Yeah
Although most people put the sleep at the end of the loop, rather than in the condition
It's the same thing either way though

tulip ridge
#

Yeah, just change the 5 to a 10

acoustic yew
#

okay ^^

#

also should I use isNull or isNil for a group?

tulip ridge
#

Depends on what you're checking for
Use isNil if you want to check if a variable exists, isNull if you want to see if the group the variable is for exists

acoustic yew
#

I mean convoyGroup is a variable and a group....

tulip ridge
#

If you're wanting to check if the group exists, use isNull

acoustic yew
#

okay :)

tulip ridge
#

You'd use isNil if you're checking if a variable exists

if (isNil "someGlobalVariable") then
{
    someGlobalVariable = ...;
};

You'd use isNull to check if group exists

if (isNull myGroup) then // myGroup could be null if all the units in the group died, joined another group, etc.
{
    myGroup = group player;
};
acoustic yew
#

tysm

acoustic yew
tulip ridge
#

No, that's specifically for isNil

acoustic yew
#

okay :D

tulip ridge
#

Was just giving an example for it to show the different use-cases

trim hull
#

hey all, I'm trying to filter config classes, getting a 'access/' is not a class ('side' accessed) in-game popup
min example:

{
    _displayName = getText (_x >> 'displayName');
} forEach (configProperties [configFile >> "cfgFactionClasses", "(getNumber (_x >> 'side')) <= 2", true]);

any idea how I can prevent this error? It's not a blocker, but it's an annoying popup for players...

south swan
#

configProperties [configFile >> "cfgFactionClasses", "isClass _x && ((getNumber (_x >> 'side')) <= 2)", true] blobdoggoshruggoogly

#

or "getNumber (_x >> 'side') <= 2" configClasses (configFile >> "CfgFactionClasses")

trim hull
#

...thanks. I had tried configProperties [configFile >> "cfgFactionClasses", "(isClass _x) && (getNumber (_x >> 'side')) <= 2", true] which still caused the issue, didn't think removing that first set of brackets would do that aha

south swan
#

probably errors out when trying to access 'side' inside non-class property. And probably works with isClass _x && (... because that's special case that can exit early.
Then the proper code should be isClass _x && {(getNumber (_x >> 'side')) <= 2} (notice the curly braces), so the right part isn't even executed when running on non-class

still forum
still forum
#

for each still runs on the old array

still forum
south swan
still forum
#

Even without special treatment

#

If it errors then it's necessary. Ahh, yes ๐Ÿ˜„ indeed

#

Huh I didn't think about when I added that isClass thing

south swan
#

fun interaction indeed

still forum
#

If you make it "isClass _x" with two spaces, it would break ๐Ÿ˜„

south swan
#

as it did with "(isClass _x)" for the original poster

still forum
#

We love Arma ๐Ÿซ‚

storm crystal
#

how do you make a script that applies to everyone indivually when exec with initPlayer doesn't work?

still forum
#

needs more details

#

why does initPlayer not work

storm crystal
#

i don't know

#

but i think i fixed

#

i didnt needed initPlayer

sullen sigil
#

Has anyone created a script that moves the player's control to a new unit (not remotecontrol, player straight up becomes new unit) without getting rid of the old unit? Cannot seem to figure out how to do it with selectPlayer

#

from looks of it it doesnt seem doable in MP meowsweats

leaden ibex
# sullen sigil Has anyone created a script that moves the player's control to a new unit (not r...

I did something like this, but it serves as an "emergency respawn" for dead units. They are moved into custom spectator interface, but I guess it could be used.

/*
    Name: WMT_fnc_Respawn

    Author(s):
        ilbinek

    Description:
        Respawn a unit

    Parameters:
        UID of the unit to respawn

    Returns:
        Nothing
*/

params ["_uid"];

// Check that the UID is really local player, otherwise exit
if (_uid != getPlayerUID player) exitWith {};

// Check if the player is dead, otherwise exit
if (alive player) exitWith {};

// Create a unit
private _group = createGroup PlayerSide;
private _unit = _group createUnit [typeOf player, position player, [], 0, "NONE"];
_unit setUnitLoadout (getUnitLoadout player);
if (!isNil "WMT_Local_Group") then {
    [_unit] joinSilent WMT_Local_Group;
};

// Not working in arma 3? Maybe they will fix it one day and the unit will be visible in the slot selection screen?
// If they fix it, we might create a "spectator" slot that will create always at least one spectator that will be able to spectate the game
// So people that disconnected can still spectate (but that won't happen)
setPlayable _unit;

// Delete old body and move player into the unit
hideBody player;
selectPlayer _unit;

// Set HIA3 target as the new unit
HIA3_Spectator_ViewUnit = _unit;

// Make HIA "move" the camera in 1st person of the unit
player cameraEffect ["terminate","back"];
camDestroy HIA3_Spectator_Camera;
[player] call HIA3_spectator_fnc_changeTargetUnit;
HIA3_Spectator_ViewUnit switchCamera "INTERNAL";

// Turn off HIA3 spectator
("HIA3_SPECTATOR" call BIS_fnc_rscLayer) cutText ["","PLAIN"];
sullen sigil
#

Thanks; my intention is for the player to be able to hit respawn and if CBA setting enabled then they will just leave their body -- which gives medics fun and also gives the player fun

#

selectPlayer just didn't seem to do anything at all when I was testing on my dedi

leaden ibex
#

This worked in testing in MP, but didn't ask the admins if it was ever used

sullen sigil
#

hm, wonder what i was doing wrong then

leaden ibex
#

Possibly that?

sullen sigil
#

selectPlayer was just having zero impact at all

#

like, wasn't even giving me control of the unit selected

leaden ibex
#

did you set it playable? monkaHmm
Did you create the unit dynamicaly?

sullen sigil
#

yes and yes

#

but setPlayable only works in SP according to BIKI

#

i ran the command anyways ๐Ÿคท

leaden ibex
#

(I know, bot who knows? Exactly why I do too kek)

sullen sigil
#

i think i'll probably have to come up with something else -- i'm trying to refrain from just spawning a unit on the player and giving it all the players wounds but i think i may have to unfortunately

#

or i just setdamage 1 to the player then setdamage to previous damage... ๐Ÿค”

#

that doesnt work on dead units nvm

leaden ibex
sullen sigil
#

...it may be i was createvehicle'ing notlikemeowcry

#

serves me right

leaden ibex
#

At least you figured it out!

sullen sigil
#

Ya, thank you ๐Ÿ˜„

leaden ibex
#

just tested on dedi, also works kalm

sullen sigil
#

Currently seeing how much I can automate on the trello for this project too kekw

kindred tide
#

how do i turn some word in a task description into a clickable link that scrolls the map to some location?

#

like e.g you have a mission description in your diary that highlights names of some villages and when you click on them the map shows where they are

winter rose
#

<a marker="MyMarker">clicky</a>?

queen cargo
#

... guys
how to get the backpack added via addBackpackCargoGlobal
dont want to get ingame to fix the script of some idiot of my clan

dusky lichen
#

I had any mod idea that would work I'm not sure if it's on the workshop as I can't check right now but an ambush module that you can place down in Zeus and eden, it would branch off the "hold fire unless fired upon" ROE, for example and this is mainly for like resistance groups if you're doing a World War II role play for example you could have a single Frenchman surrendering in the middle of the street or something or maybe even a Russian or whatever the moment the players go to interact with him or shoot him the AI on either side of the road stand up and open up on the convoy/group, it would also make it easier for the Zeus not have to babysit/mircomanage the AI to make sure they don't start firing or running around trying to set one up

#

I am unable to do it myself so i figured i would drop the idea in here for you script jockeys to mess with and see what happens

#

You could also add an extra module onto this for the AI will not engage unless players are within a certain range

#

They will remain prone and hold fire and then stand up and open fire if players come within say 200 M for example

#

That would work really well if you're doing Vietnam or Japan World War II as they did that constantly

#

I don't expect it to be perfect by any means but it's better than nothing

winter rose
#

iiit's not exactly how it works ^^ you can ask here for help or go #creators_recruiting to hire (even for free) a scripter to do that, but suggestions or wishes here are not the way to go ๐Ÿ™‚

half tartan
#

anyone ever had experience with missions refusing to initialize once they hit a certain size

#

i've been prodding around with a very edited version of the old BeCTI from years and years ago; it still seems to work today, but behaves strangely between testing and launching on the dedicated server my group is using

#

playing the scenario locally in "multiplayer" (a local LAN) has zero issues; but when I port the mission to the server, it spits an error code that it's got an undefined variable in the missionstart sqm, even though the variable is defined literally three lines above it

#

even more perplexing, sometimes the issue can be "fixed" by just aborting the mission and trying again a few times until it goes through

#

bisterious

granite sky
#

It sounds like your mission is making incorrect assumptions about init ordering.

half tartan
#

i apologize in advance, because i'm a bit stupid and also very new to script editing beyond prodding at config files

granite sky
#

It's not making it up about the undefined variable anyway.

half tartan
#

right, i'm assuming whatever issue is in the code, not the engine; just trying to get a better understanding of how it works

granite sky
#

And yes, mutiplayer init can be unpredictable enough that a variable is sometimes undefined.

half tartan
#

i don't know a whole lot about init ordering; does multiplayer init get shaky under heavy load or something similar?

#

thanks for your help, by the way

granite sky
#

Well, each machine is separate and networking is unpredictable.

#

If your client init needs something to have happened on the server then it should explicitly wait for it.

#

Some ordering is probably guaranteed, but undocumented.

#

Like you can assume that publicVariables arrive in order.

half tartan
#

right, gotcha

granite sky
half tartan
#

already got it open on the other monitor ๐Ÿ˜„ thanks!

kindred tide
# winter rose <@302586760679129088> try https://community.bistudio.com/wiki/createDiaryRecord ...

that page helped, i did it this way:

   _playerTask = player createSimpleTask ["Convoy"];   
   _linkFrom = format ["mapAnimAdd [1, 0.1, %1]; mapAnimCommit;", locationPosition _from];
   _linkTo = format ["mapAnimAdd [1, 0.1, %1]; mapAnimCommit;", locationPosition _to];   
   _playerTask setSimpleTaskDescription 
    [        
        format
        [
            "Destroy convoy going from <execute expression='call %1'>%2</execute> to <execute expression='call %3'>%4</execute>", 
            _linkFrom, text _from, _linkTo, text _to
        ], 
        "Destroy convoy", 
        "Convoy"
    ];```
half tartan
#

forgive me if this is very stupid;


if !(_team in _teams) then {

[_team, _side] call CTI_S>

 7:44:58   Error position: <_teams) then {

[_team, _side] call CTI_S>

 7:44:58   Error Undefined variable in expression: _teams

 7:44:58 File mpmissions\__cur_mp.utes\Server\Functions\Server_OnPlayerConnected.sqf..., line 56

 7:44:58 "[CTI (INFORMATION)] [frameno:38836 | ticktime:904.586 | fps:46.6472] [FILE: Server\Functions\Server_OnPlayerConnected.sqf] Team [O Alpha 1-1] units are now being removed for player [Roke] [76561198043112464]."

 7:44:58 Error in expression <r _x && !(_x in playableUnits) && _x != _hq) then {deleteVehicle _x}} forEach _u>

 7:44:58   Error position: <_hq) then {deleteVehicle _x}} forEach _u>

 7:44:58   Error Undefined variable in expression: _hq

 7:44:58 File mpmissions\__cur_mp.utes\Server\Functions\Server_OnPlayerConnected.sqf..., line 76``` 

if i'm understanding correctly, the the _teams and _hq undefined variables are reading as such because the server is waiting to define them before *something*, but network connectivity issues cause the server to wait to define those variables; if a player joins before those variables are defined, then it'll spit the error
#

so the "fix" would be to figure out how the server wants to define those variables and when, then try and engineer a way to make them defined before a player joins?

fallen locust
#

if player. backpackContainer << will couse interesting stuff to happen
if object, everycontainer << Also will be extreamly fun to add stuff to that backpack :P

#

have fun1

cosmic lichen
#

Or use defaults as fall back