#arma3_scripting

1 messages · Page 541 of 1

quartz coyote
#

it works

#

thanks for the collective thinking

astral tendon
#

How can I allow the camera created with the camCreate to move around with the mouse cursor?

knotty arrow
#

thanks, i fix it @young current

#

u can't i think, only doing a script with an eventhandler @astral tendon

real moat
#
class UTF {
    tag = "UTF";

    class functions    {
        file = "functions";
        
        class InsigniaProvider {};
        class A3LogExamples {};
    };
};
#

Does anything seem amiss with this functions.hpp?

#

I have fn_InsigniaProvider.sqf and fn_A3LogExamples within the functions directory

#

Though VS Code says the functions cannot be found

#

And I get "fn_InsigniaProvider.sqf not found" in game

cosmic lichen
#

are the functions called fn_XXXX

#

?

#

Is it a mod or a mission?

real moat
#
└───scripts
    │   #readme.md
    │   functions.hpp
    │
    ├───EXT
    │   └───IgiLoad
    │       │   IgiLoad.sqf
    │       │   IgiLoadInit.sqf
    │       │   supported.txt
    │
    ├───UTF
    │   └───CheckJIP
    │       │  checkJIP.sqf
    │
    ├───Functions
    │       fn_A3Examples.sqf
    │       fn_InsigniaProvider.sqf
#

I use fn_ in the filename

#

Its a mission

cosmic lichen
#

scripts\functions should be the path then

real moat
#

That is the path

#

See above

cosmic lichen
#

file = "functions";

#

file = "scripts\functions";

real moat
#

oh, so it ref the root file?

#

I see

cosmic lichen
#

Try that.

real moat
#

Giving it a go

cosmic lichen
#

So far I know it always starts at mission's root

real moat
#

Awesome, was looking for that thanks

wanton swallow
#

Hi all. How to ignore this restriction?
Attempt to override final function
I want to override functions with debug console which was be declared in CfgFunctions.

high marsh
#

allowRecompile = 1; in your description.ext

#

You can't ignore it because it's a security feature from preventing the function from being hijacked.

#

can't remember if it was allowrecompile or allowfunctionrecompile

wanton swallow
#

Yes, thank you.

daring parrot
#

this newbie have a few dumb question to professional. :/

#

the addon and mod is same thing?

#

seriously i cant understand about the difference between them.

winter rose
#

a mod is, let's say a whole lot of addons in order to make a full game modification ( = mod)
an addon is "just" a file with content in it

daring parrot
#

oh so addon is something like parts of the mod?

#

it's new knowledge to me, thank you for the answer

tough abyss
#

1 addon could be a mod or 10 addons

summer trout
#

I have this in init in an object:
{ _x addEventHandler ["Killed", {null = [_x] execVM "death_sounds\player_ded.sqf";}]; } forEach allUnits;

and this in my addon:

stype = floor(random[1,18,38]);
music = format ["death_sounds\deathsound_%1.wav", stype];
_aslPos = getPosASL _PO;

playSound3D[music, _PO, false, _aslPos];```

And I get an exception that _PO is undefined...

Why does it happen?
still forum
#

_x is undefined

#

you are passing a undefined variable, thus _PO is also undefined

#

local variables carry over into lower scopes

#

but you don't have a scope there. you are creating a new script

summer trout
#

But isn't _x the object in forEach loop?

#

Even if it is undefined, then how does it successfully add event handler?

cosmic lichen
#

the first _x is fine

#

The second one is undefined

summer trout
#

So how would I fix it?

cosmic lichen
#

Killed eventhandler has a parameter which includes the unit which was killed

summer trout
#

Ok

#

Thanks

cosmic lichen
#
  _x addEventHandler ["Killed", 
  {
    params ["_unit"];
    null = [_unit] execVM "death_sounds\player_ded.sqf";
  }];  
} forEach allUnits;```
winter rose
#

```sqf too

summer trout
#

Ok

#

Thanks

tough abyss
#

What you have all units screaming when a unit is killed?

edgy dune
#

Well why not,but why do null=?

still forum
#

no reason to

winter rose
#

habit from init / trigger fields

tough abyss
#

Would prefer _dummy instead, 1. it is local 2. it removes any questions "why null"

winter rose
#

some do 0 = (…)

#

@tough abyss I am not 100% sure but I think these fields throw an error if you use local vars too =\

tough abyss
#

Yeah in init yes. Stupid just like not allowing return value stupid

#

There is no reason for either by the way

winter rose
#

that's what I think too
historic code… never changed

tough abyss
#

Arma wouldn’t be Arma if not for little surprises like these

hollow thistle
#

just use _ = ... shortest you can type and it's local.

winter rose
#

I think these fields throw an error if you use local vars

tough abyss
#

Yeah you can also have variable with name ""

winter rose
#

a = ^^

still forum
#

I could fix the = returning nothing bug. And maybe allow for things like
var1 = var2 = 5;

But... That means you couldn't write any code in init boxes anymore.. so you're not gonna get that fix

cosmic lichen
#

I would gladly sacrifice init boxes for that 😄

obsidian violet
#

Hi guys!
im trying to add the ACE action to make an object able to be loaded in ace cargo.
The object is the type of dog with a custom variable name of klt_dog

[klt_dog, 1] call ace_cargo_fnc_setSize;
I tried using this function that do give me the ACE interaction to load the object, however when I load the object into a vehicle the object does not dissapear,
and i get the text. "this object cannot be loaded".

any clues?

winter rose
#

f- init boxes yep!

winter rose
#

they simply shouldn't exist 👀

tough abyss
#

server/clients/both
none

faint oasis
#

i have a question ? how to hide a smoke create by the command "create vehicle" ?

surreal peak
#

hideObjectGlobal should do it if it's made with createVehicle

white sky
#

Is there away to disable colorSelectBackground. Setting the alpha to 0 hides what you have selected

plain current
#

You mean you wan't it so u can't see whats selected? Set it to the same value as the background? @white sky

dull drum
#

Hi guys! Where can one find a list of such visual effects as ObjectDestructionFire1Tiny and others? Thanks!

#

Found one small list under the configfile >> "CfgVehicles" >> "ModuleEffectsFire_F" >> "DestructionEffects" "

white sky
#

@plain current Then it hides whats selected I have the background alpha set to 0 as I'm using a image for the dialog

spark turret
#

hello again!
any better way to get a position opposite of another position instead of doing
pos1 select 0 - (pos1 select 0 - pos2 select 0)
etc etc
?
something like "pos0 getVector pos1" (not actual function)

#

im having an infantry group move opposite direction of a position which markes their attacking enemy. and im really to lazy to type out all the "select 0" -shit-
shoot

digital hollow
#

I would use the origin getPos [distance, heading] syntax

spark turret
#

ahhh that looks very interesting

#

very nice thank you for pointing me in the right direction

spark turret
#

can i use selectRandom to select from code? if yes how would i do that?
im trying to do something like defining function stuff somewhere and then be able to call it fast

#
_doThisStuff = {hint "Hello im hinting"};
_dothisstuff;

but it dont work

grim coyote
#
call _dothisstuff;```
spark turret
#

ouuu mesmerizing. thanks

wispy cave
#

which of the following do I use to add a voice to the arsenal? Item?

    BIS_fnc_addVirtualItemCargo
    BIS_fnc_addVirtualMagazineCargo
    BIS_fnc_addVirtualWeaponCargo```
still forum
#

I'd say none

wispy cave
#

well, people are complaining that they can't load their loadout because the item novoice is not included

still forum
#

voices(CfgVoices) are not items(CfgVehicles)

astral tendon
#

I cant unload my DLC trought steam anymore, is there other way to disable it?

cold pebble
#

So is this the update which has provided the createSimpleObject command the ability to use classname rather then shapename as a local object? Or am I too early still

hollow thistle
#

it is.

still forum
#

no

#

that was always possible

hollow thistle
#

but it's not a separate command

still forum
#

what we got is createSimpleObject for local only

hollow thistle
#

nevermind I thought he wanted local, sorry too hot today.

still forum
#

yeah

#

i hav wet blanket

#

can recommend

cold pebble
#

Objects created with Syntax 2 can be textured. The default direction should match the direction of the object if it was created with createVehicle.

#

Whats that talking about exactly? Its 😖 me

still forum
#

you can only retexture if you spawn from class

#

not from shapename

#

as shapename are "super simple object" not just simple

cold pebble
#

Yup, soryr got that bit

#

The 2nd sentence is the bit which confuses me

still forum
#

it just says "this spawns just like createVehicle, everything is completely normal and nothing very weird and unexpected happens"

cold pebble
#

Oh, ok, fair enough 😄

still forum
#

whereas syntax 1 says "it's sometimes wrong"

cold pebble
#

🤣

still forum
#

like if you createVehicle an object, it always points northwards

#

but syntax 1 might spawn it pointing southwards

cold pebble
#

Sorry for the plethora of questions, can simple objects have eventhandlers added? I see it supports set/getvariable but nothing about EVH's

still forum
#

I'd say no

#

they don't get hit

#

so

#

what other EH's are there?

#

they don't respawn..

#

don't get damge

cold pebble
#

Hmm, was wondering whether I'd be able to use hit/handledamage, as maybe with BIS wizardry it works but just doesn't damage the object as such

still forum
#

nu

cold pebble
#

Cheers for the help 👍

#

Now CVL is being set off default, might aswell get using createSimpleObject

real moat
#

If you addEH on initPlayerLocal will it be lost if the player dies?

still forum
#

depends on the eh think

#

repsawn might carry over?

real moat
#
this addEventHandler ["ace_firedPlayer", {
    params [
        "_unit",
        "_weapon",
        "_muzzle",
        "_mode",
        "_ammo",
        "_magazine",
        "_projectile"
    ];}
];
tough abyss
#

Whaaaaat

real moat
#

Is this wrong?

still forum
#

that's not a valid eventhandler

tough abyss
#

Lol

real moat
#

Okay, I must have misunderstood how it works

real moat
#

Oh

#

So its not how the BI one works then

tough abyss
#

Ace prefix should give plenty of clues

real moat
#

Like this then?

#
[
_unit,
_weapon,
_muzzle,
_mode,
_ammo,
_magazine,
_projectile
] call ace_firedPlayer;
still forum
#

no

#

read the page i linked

real moat
#

Mhmm, am reading it

still forum
#

till the end

edgy dune
#

is there away to get the loadouts saved to my profile? kind of wat like liberation does

#

ah nvm

#

sorry

real moat
#

Do I always need to add event handlers, or can I just call them? Those from ACE/CBA

still forum
#

eventhandlers aren't called

#

they handle events

#

the bottom of the page I told you to read has examples

tough abyss
#

"Gear" with the action command don't trigger the InventoryOpened event handler. This is right?

#

It should

#

I will re-test

cold pebble
astral tendon
#

Just repeating the question, is there a new way to disable DLC for testing my missions with out DLC assets?

solemn token
#

You can disable the dlcs within the steam Library

tough abyss
#

you can untick all DLC in steam but I dont know if this will work

exotic flax
#

The launcher also allows you to enable/disable DLC's (just like mods) in the DLC tab

summer trout
#

When I put this script on a whiteboard object

And go singleplayer (or client-host multiplayer but with 1 person (only me)) then images load well.
But when I host it and someone else joins, then everyone BUT MY client has those images loaded... Why I don't have those loaded when in multiplayer?

carmine oak
#

anyone got any scripts to auto convert buildings/objects from livonia to cup cherno?

plain urchin
#

@summer trout try remoteExec'ing it

astral tendon
#
waitUntil {
_TargetThatUnitCanSee = allplayers;   
_targets = []; 
{if ([objNull, "VIEW"] checkVisibility [eyePos _unit, eyePos _x] >= 1 AND alive _x) then {_targets pushBack _x}} forEach _TargetThatUnitCanSee; 
if ((count _targets) > 0 or (!alive _unit)) then { //error here?
 _unit call VoiceCivSpotedOfficer; 
 true; 
  };
 };

This script start to give error afther this DLC, its saying type any expecting bool. what happened?

wanton swallow
#

Hi all.
How to localize text for each client when server do BIS_fnc_taskCreate?

[_side, format["DeliverTouristTown%1", _side], [format[localize"STR_WF_M_DeliverTouristTownDesc", _twn], localize "STR_WF_M_DeliverTouristTownTitle", "Attack"], _twnPos, "CREATED", 0, true, "Attack", true] call BIS_fnc_taskCreate; //This code localize text for a server. and all clients get text, which localized for server locale
winter rose
#

@wanton swallow remote exec a function that will create the task locally

maiden warren
#

Hey, need a little help, I'm spawning a random object from array on a marker, I have 4 locations as coords in an array, the object spawns on a marker but I need it to be spawning on these 4 random locations.

When I was using only one object it worked fine. Not sure how I can do this code.

Here's the code I'm using to spawn a random object.
_randomSpawnBox = _boxes select floor (random (count _boxes)) createVehicle getMarkerPos "marker_2";

It spawns fine on marker_2.

I need it to be something like this but a way that will make it work :)

_randomSpawnBox = _boxes select floor (random (count _boxes)) createVehicle getPos _randomLocations;

Cheers

still forum
#

select floor (random (count _boxes)) no

#

^ yes

#

for random locations do the same. also selectRandom one of them

maiden warren
#

and instead of 12345 i use classnames

#

?

still forum
#

yes

#

your _boxes/_randomLocations arrays that you already have

maiden warren
#

yea

#

so basically this

#

_boxes = selectRandom ["O_supplyCrate_F","Box_AAF_Uniforms_F","CargoNet_01_box_F","Land_Pallet_MilBoxes_F"];

#

from what I understood

winter rose
#

var name would be private _boxClass =

maiden warren
#

private _boxClass = selectRandom ["O_supplyCrate_F","Box_AAF_Uniforms_F","CargoNet_01_box_F","Land_Pallet_MilBoxes_F"];

winter rose
#

perfect! 👍

#

variable names are really important to code understanding ;-)
comments shouldn't explain how the code works, if any
they should explain why you coded this way

maiden warren
#

nice

#

selectRandom is far better than what I was doing 😄

#

thanks for that

#

so how do I get it to spawn on random location

#

_spawnBox = _boxClass createVehicle getMarkerPos "marker_2"; I have this now

#

works fine, it spawns randomly

#

the box I mean, object

winter rose
#

depends if you have an area or a position array 😄

maiden warren
#

i have an array of coords

winter rose
#

selectRandom at it again!

maiden warren
#

I know that part hehe

#

but in createVehicle

#

cant figure it out

#

_spawnBox = _boxClass createVehicle getPos _boxLocations

winter rose
#
private _creationPosition = getMarkerPos selectRandom ["marker_1", "marker_2", "marker_3"];```
for createVehicle, check the wiki
https://community.bistudio.com/wiki/createVehicle
maiden warren
#

so now I have _creationPosition variable that selects random marker right

still forum
#

if you have an array of coordinates

maiden warren
#

but how do I implement that variable

still forum
#

then getPos on a coordinate won't make sense

meager granite
#

Why change getAmmoCargo and other get cargo commands? They used to return infinite number in case of entity not having any ammo cargo.

#

Checking returned value with finite was a great and easy way to know if vehicle can rearm\refuel\repair

still forum
#

what they return now?

meager granite
#

0

still forum
#

Logically they should return 0

maiden warren
#

so if not getPos what should be used

still forum
#

well they fixed a bug then I guess

meager granite
#

More like cut down a feature

still forum
meager granite
#

Not I have to do config check instead of quick and simple finite getAmmoCargo _vehicle

still forum
#

why can't check for 0?

#

because that would also detect rearm vehicles that are just empty?

meager granite
#

This only works if vehicle is fresh with full cargo

#

In my mission I set cargo to 0 and do custom behaviour

still forum
#

set a variable onto the vehicle, before you set to 0

meager granite
#

And clients did this check too to quickly know if custom rearming behaviour should be used

#

Yeah, still a totally uncalled for change

still forum
#

same as waitUntil, and breaking assignedTeam for no apparent reason. and the waitUntil chaos. And tons of other commands that have new return values now which aren't listed at all in any changelog

maiden warren
#

_spawnBox = createVehicle [_boxClass, _boxLocation, [], 0, "CAN_COLLIDE"];
how can I get _boxClass to work here, i switched classname for that variable but its not working which is logical, how would one implement it so it would work

#

_boxClass, array of classnames for object, _boxLocation, array of coordinates for spawning

meager granite
#

setMagazineTurretAmmo no longer can set ammo above magazine limit. Got told its a measure against cheaters.

#

Except cheaters have myriad of other ways to mess game up while useful feature of having more ammo in non-modded environment is gone.

still forum
#

@maiden warren use selectRandom...

maiden warren
#

private _boxRandom = selectRandom [["O_supplyCrate_F","Box_AAF_Uniforms_F","CargoNet_01_box_F","Land_Pallet_MilBoxes_F"], [7908.46,10229.1,0.147013],
[7911.83,10241.3,0.128614],
[7915.92,10244.7,0.144957],
[7926.76,10233.1,0.145]];

still forum
#

🙄

#

_randombox = selectRandom [box1,box2,box3]
_randomposition = selectRandom [pos1,pos2,pos3]

maiden warren
#

I had that before

#

Thats not the issue xD

still forum
#

what you just posted is wrong

maiden warren
#

I know

#

private _boxClass = selectRandom ["O_supplyCrate_F","Box_AAF_Uniforms_F","CargoNet_01_box_F","Land_Pallet_MilBoxes_F"];
private _boxLocation = [
[7908.46,10229.1,0.147013],
[7911.83,10241.3,0.128614],
[7915.92,10244.7,0.144957],
[7926.76,10233.1,0.145]];

still forum
#

where's your selectRandom for box location?

maiden warren
#

it was in

#

but I was testing different ways to try to make it work

#

what i dont get is the createvehicle part

still forum
#

show the full code

#

your arrays, up until the create vehicle

maiden warren
#

private _boxClass = selectRandom ["O_supplyCrate_F","Box_AAF_Uniforms_F","CargoNet_01_box_F","Land_Pallet_MilBoxes_F"];
private _boxLocation = selectRandom [
[7908.46,10229.1,0.147013],
[7911.83,10241.3,0.128614],
[7915.92,10244.7,0.144957],
[7926.76,10233.1,0.145]];
_spawnBox = createVehicle [_boxClass, _boxLocation, [], 0, "CAN_COLLIDE"];

#

on spawnBox if i use the classname in quotes it works fine

#

but then the box is not random

still forum
#

code looks correct

#

maybe you are just unlucky with the randomness

maiden warren
#

hm

#

but can you have a variable right there

#

the boxClass

still forum
#

yes

maiden warren
#

turns out you can

#

lol

#

it works

#

for some reason

#

well, thank you for your help, I appreciate it very much

tough abyss
#

the ammo(etc)cargo were calculated as cargo/maxcargo, the max cargo for vehicles not capable of this kind of cargo was 0, you see where it is going. It doesn't return -INF because it was division by 0. I can try to request that in this case it returns -1 maybe?

#

And tons of other commands that have new return values now which aren't listed at all in any changelog

#

99.99% of those returned NOTHING with null object as argument instead of default value. Mostly edge cases this is why no reason to list them all maybe?

meager granite
#

You can set negative ammo with setAmmoCargo so -1 is not perfect either

#

Honestly, don't see a reason why -INF was an issue at all

tough abyss
#

You can set negative ammo with setAmmoCargo so -1
Is this a feature or a bug? if a bug this could be fixed

still forum
#

returning default with many commands has been expected for years tho.
like trusting alive objNull to return false. I use that quite alot

tough abyss
#

me too

#

handy

still forum
#

default values are useful. If you want to extra check for null then you can do that.
returning nil however causes undefined variables and kills scripts

tough abyss
#

undefined behaviour

meager granite
#

For a second I thought that alive objNull doesn't return false anymore

still forum
#

I don't actually know. didn't try

meager granite
#

It does

still forum
#

I don't see the sense in now changing things that have been like that for years, and never really bothered anyone
Sure a programmer might see "ugh that's ugly" or "that shouldn't be like that if we were to make it nice" but that's true about most of SQF.

tough abyss
#

but it is correct default value

meager granite
#

Its a cut feature of the command, if you ask me.

tough abyss
#

if you set ammocargo to -1 does it deplete your ammo when you resupply from it?

meager granite
#

It doesn't

tough abyss
#

so what is the use of -1?

#

or any negative value for that matter?

meager granite
#

Not really, just saying that returning -1 is not as precise and perfect as infinite

#

Actually, I might change vehicles that have cargo to -1 myself and then do check against -1

#

No changes to command needed

tough abyss
#

you could set -1 on objects you want to pass as not having this capabilities

meager granite
#

Still, it broke my mission and it sucks

#

Yeah, gonna do that

tough abyss
#

so make it return -1 if cannot have that kind of cargo?

meager granite
#

Right now I'll just set cargo to -1 if vehicle had any cargo on spawn. And have clients check for -1 to see if vehicle is capable of rearming\repairing\refueling.

tough abyss
#

so it will be compatible with proposed change in the future?

meager granite
#

That too, yeah

#

Still, infinite was perfect there. Also a useful case for finite command usage

#

Hm, spawned ammo truck with APC nearby, after some shooting and instant rearming, getAmmoCargo still returns 1 🤔

#

Are all cargos infinite now?

#

transportAmmo = 1e+012;

#

Oh, they practically are

#

I guess BI couldn't fix infinite rearming from remote vehicles and made it infinite everywhere? 👌

faint oasis
#

i have a question do you know how to force connect the pipe between scba and gas mask please ?

meager granite
#

You mean force it on land?

faint oasis
#

wait i will send a screenshot

meager granite
#
            hiddenUnderwaterSelections[] = {"hide"};
            shownUnderwaterSelections[] = {"unhide","unhide2"};
#

These are selections that get shown\hidden when you're near water

#

Easiest way would be to create mod with rebreather that always has these hidden or shown.

faint oasis
#

when i add the scba in a script

#

and when i use the CBRN specialist

#

and i add the scba in arsenal before launching the mission

#

@meager granite so do you know how to do that ?

meager granite
#

Oh, I thought you were talking about rebreather

#

read that as scuba

faint oasis
#

ok and no i speak of that

#

so do you know how to do that ?

meager granite
#

Its backpack's texture

#

Don't know proper texture for it, gonna have a look

#

There's probably also a BIS function for it or something

dull drum
#

Hi guys. How can I get some unique ID of exact spawned Object?

meager granite
#

netid?

faint oasis
#

@meager granite thx i think it's that but how to see the new function of dlc contact ?

high marsh
#

should have a new category for it under the function viewer

faint oasis
#

ok thx i will se it

high marsh
#

Yeah, it's A3_Enoch

faint oasis
#

@high marsh yes xD we have a function called "CBRN_Hose_Init"

dull drum
#

@meager granite yay! Thank you!

faint oasis
#

ok but how to run the function ?

#

[player] spawn BIS_fnc_CBRNHoseInit; but it doesn't work

meager granite
#

Its bin_fnc_CBRNHoseInit

#

For some reason

#

[player] call bin_fnc_CBRNHoseInit

#

Doesn't seem to be multiplayer-compatible either

faint oasis
#

oh ok it doesn't work in mp ?

#

and thx it work

meager granite
#

Check function source in functions viewer, its really simple

#

You could make it MP-compatible yourself with setObjectTextureGlobal

#

Though these hoses might appear visible when you drop the backpack on the ground but its lesser evil

faint oasis
#

yes i know but i need to recreate a new function

#

yes i think i will do that

tough abyss
#

Currently trying to make a guy talk with sound. Prepare for questions soon.

faint oasis
#

@meager granite i have copy all code of the function and i have change to settextureglobal and it work perfecly so thx you

#

called by [_unit] execVM

ornate sky
#

What's a good way to make a permanent text to show on screen?

#

Like a HUD, to show score, money, etc.

still forum
#

make a hug cutRsc thigny

ornate sky
#

hug?

#

I'm guessing I need to make a Dialog?

dull drum
#

@ornate sky just create a UI layer for your text myLayer1 = ["layernamethatfitsyou"] call BIS_fnc_rscLayer;

#

And then spawn some text to it: [ _mystring, 1, 1, 60, 0, 0, "layernamethatfitsyou" ] spawn BIS_fnc_dynamicText;

#

Function description will get you through the parameters of the function, they are mainly for text positioning, color and animation

ornate sky
#

how can I make sure that the text stays on the same place on every resolution?

dull drum
#

Test it resizing the game screen?

#

A question: how on Earth this piece of code

playerZeus =  getAssignedCuratorUnit z1;
playerZeus setVariable ["myDemons", [], true];

gets me an Error Error setvariable: Type String, expected Namespace,Object,Group,Display?

Like I can't declare that a variable stores an empty array? o_O
And when did [] become a string?

still forum
#

it reports left side

#

playerZeus is string

#

maybe getAssignedCuratorUnit now suddenly returns string instead of objNull if z1 is objNull or smth?

#

or you run in scheduled

#

Why does your global variable not have a tag

#

and can't it be local?

spark turret
#

any way to read if a unit completed its "domove" command? i want to disableai "path" upon reaching thier position

plain current
#

@spark turret if there is no command to check if the unit has reached its destination, why not just check if the unit is moving?

spark turret
#

was more looking for an eventhandler type thing that doesnt require a while look that checks

#

but i guess that would work too

dull drum
#

But z1 is 100% not objNull the script does tons of logic with it before these strings. @still forum

spark turret
#

even better, will use a small marker that checks if said unit is in it at the wanted desttination

dull drum
#

Could it be that getAssignedCuratorUnit returns string instead of Object?

plain current
#

@spark turret sure, that works

still forum
#

Use tags for global variables.

dull drum
#

Which tags? 😃

still forum
#

MYTAG_myVariable

spark turret
#

kinda dumb that "domove" exists but there is no way to check if a unit was assigned "domovev" or how far the unit is in completing its command

still forum
#

rok_playerZeus

plain current
#

@dull drum you thought about doing something like diag_log str playerZeus; or even better putting it in the watch field in the editor

still forum
#

make your variable names unique

dull drum
#

@plain current I actually did and got me 15:12:46 "Zeus player is 2_1378"

plain current
#

@spark turret just check the distance between the unit and the end point and compare it with the distance from start point to end point to get how much of the trip is completed

dull drum
#

Oh, thanks @still forum that will be handy not to mess with Arma list of vars, didn't think about it

#

Fixed with tag, but it is still a String. I wonder if it returns an object netId string instead of object itself

still forum
#

according to wiki it doesn't

#

maybe BI broke it

dull drum
#

That would be fun.

#

The thing is that this string does not look like a netId at all: 2_1424. It looks like some player ID. Which is a total mess because instead of getting a reference to the particular unit I'm getting a multiplayer ID of a person lol.

still forum
#

so it does actually return a string?

dull drum
#

It does.

still forum
#

If you call "str" on a object, it can also turn objects into strings

#

so are you 1000000% sure it's a string?

dull drum
#

Hmm, then - no.

still forum
#

When you execute getAssignedCuratorUnit z1 in debug console

#

what do you get back

#

or better yet typeName getAssignedCuratorUnit z1

dull drum
#

Just execute that without a diag_log string?

still forum
#

yes

#

in debug console

#

it shows you the result

dull drum
#

It gives me an Object, which is right. Let me try to assign a global var with array to it.

#

Strangely enough it also got me to set the empty array there. From the console. But from the sqf it still gets me a "String" error

still forum
#

my guess is that because you don't have a tag, and your variable is not unique. maybe some other mod/script is writing into same variable

#

or maybe the error is giving you the wrong line of code?

dull drum
#

But I've changed it and set the tag.

still forum
#

and the error is just nearby?

dull drum
#

That's possible.

#

I think I will get my black chicken cut it's throat and do some voodoo to know better.

#

Thanks for all the help, guys.

plain current
#

how would i detect if someone is using cheat scripts?

true tundra
#

you dont

winter rose
#

BE

real moat
#
[
    "ace_firedPlayer",
    {UTF_fnc_LogPlayerFired} // Even if contains nothing
] call CBA_fnc_localEvent;

Any idea what I'm doing wrong with this event handler?

#

It causes ace to spit out errors about undefined variables in functions I dont even call.

still forum
#

that's not a eventhandler

#

and that's not how you pass a function

real moat
#

Okay, listen, can you PLEASE help me

still forum
#

What's so hard with following a example

real moat
#

I have read the page

#

I have used the example

still forum
#

doesn't look like your code

#

You have used the "calling an event" example

#

why do you skip the "add eventhandler" example and jump to the "calling an event" example. While you are trying to add a eventhandler

#

it's even called fnc_addEventHandler

real moat
#

I was under the impression ace events were already "added" by the mod

still forum
#

they are

#

a handler is not a event

#

a eventhandler handles a event

#

it is not an event

#

and you yourself are speaking of adding a eventhandler the whole time

#

don't understand how you can think addEventHandler might be the wrong thing for adding a eventhandler

real moat
#

Thanks, man, that is exactly the kind of help I need.
I know you like to assume people know stuff and just link them documentation all the time.
That's cool, learn the hard way, put in the reading work and all that, but at what point do I have to beg you to give a guy a little guidance?

#

Apologies, but every time I come here, you treat me like shit, so perhaps you should avoid answering my questions in future.
Well, I mean, go for it, but if you're going to answer me with a URL all the time, Ill just have to return tomorrow to ask another question if I cant figure the documentation out myself. I'll just leave it at that mate, probably best you do my messages a fat skip or something, else you'll only frustrate yourself. Thanks.

plain current
#

@winter rose but cheaters bypass my battleye scripts.txt???

ruby breach
#

If they're bypassing BattlEye through some means, you're not really going to stop them

plain current
#

they're bypassing the scripts.txt filters from what i've heard

#

anything i can do about that? any detection method through script? can i disable cheat command?

dusk sage
#

If anyone would know something about this, wouldn't it be you?

plain current
#

@dusk sage i don't know shit

winter rose
#

@plain current your missions can use CfgDisabledCommands yes

plain current
#

ok what command i should disable?

winter rose
#

all the ones the clients do not remoteExec

#

the server is whitelisted

plain current
#

do i disable hint and systemChat because mission does not use them and they use animation notification system?

rancid pecan
#

hi how to disable function viewer ?

ruby breach
#

You would disable everything not used by your mission

#

I would assume your mission probably uses hint and/or systemChat

winter rose
#

you can disable everything but what a client should through remoteExec

plain current
#

@rancid pecan load up infistar to block fnc viewer

winter rose
#

if only the server remoteExecs, disable everything (but the BIS_fnc that are explained on the biki)

plain current
#

u know house is still my fav #1 tv series

#

i have disabled hint and systemchat and servercommand

#

is that enough to stop cheaters to do i need to block memory fnc?

winter rose
#

block everything *but* what your mission needs

plain current
#

how do i block fncs like server_exit? memory cheater told me he just call server_exit and server goes down

winter rose
#

which one?

#

wait a minute. I was thinking something else

plain current
#

he say hes just ran server_exit in memory and i can block it with remote exec filter file

still forum
#

I guess extDB or some crap?

spark turret
#

@real moat what exactly are you trying to do with the event handlers added by ace?

#

You are right ace adds event handlers, tho the Eventhandlers themselves have tio be added manually for each Client. So ti say the event fires but you have ti create the EH that reads em

still forum
#

"ace adds event handlers" no it doesn't

#

it fires events
Event != eventhandler
A event, will be handled by a eventhandler. They are different things

spark turret
#

Sorry you re right . It creates events, EH need to be added by the scripter.

#

"Multiple ppl are typing" oh shit lol

still forum
#

if you know how to script. these are eventhandlers:

fnc_fireEvent = {
  {call _x} foreach Eventhandlers
};

fnc_addEventhandler = {
  EventHandlers pushBack _this;
};

{handlecode} call fnc_addEventhandler;

Ace or whatever mod then calls fnc_fireEvent in it's code

tough abyss
#

Why not use bi scripted EHs?

spark turret
#

I guess its less about creating the event and more about reading when it happens?

still forum
#

because ace doesn't use BI scripted EH's

#

yes. you rarely create events

tough abyss
#

Why not

still forum
#

btw events are never "created" but.... semantics

#

because CBA events have been there before BI scripted events (I think) and also have builtin support for MP stuff and are probably also more efficient

spark turret
#

I was under the impressipn all "fired + x" events arent supported by cba ccording to theor page

still forum
#

they are XEH events

#

a different event system

spark turret
#

So cba events != xeh?

still forum
#

ye

#

and cba also has player events

#

which is yet another system

#

but all work kinda the same under the hood

spark turret
#

But now that we are talking about it, how would i create a server/local event? I see and know how ace does it but that id afaik a function called in the code when it executes, f.e.
'''Sqf
_doSomeCoolShit = xxy;
_createvent for xxy;
'''
Which doesnt mean i can add a specific event for something executed by a "foreign" script.
How do i add an event for somethigb i havent scripted/function called myself?

still forum
#

you don't create events

#

really

#

you add a eventhandler for some string

#

and when you fire a event, you just give it the name. And the system checks if there are any handlers for it

#

so if you fire event "bla bla bla" it will either execute all eventhandlers for "bla bla bla" that were added previously. Or it does nothing if there are no handlers

spark turret
#

Well the EH notices the event right? But how do i "create" the event it notices ?
Specifically can i check for stuff happening that i dont cause myself?

still forum
#

Let my build some analogy

spark turret
#

Good, my blood alcohol wont allow anything else.

still forum
#

You have a list of names, and phone numbers for each name.

When an event fires, it checks that list, searches for the name and calls all phone numbers that are listed on the name.

The list starts out empty.

#

If you add a eventhandler, it adds a phone number to the name of the handler

#

When the event fires, and there are no phone numbers on the name, then it doesn't call any numbers

#

same as when you add a eventhandler for a name, that is never checked by any event, your number will never be called

#

ACE itself says in their documentation "there are these names on my list that you can add your number to, to be called if something happens"

#

So if you want a new event/eventhandler combo, you just say "I now say "myEventhandlername" is a new name on the list that people can add their phone numbers to"

#

you just make up some name

#

or other example. Mailboxes.
The eventhandlers are people who check if their mailbox has any mail in it.
And the events just send mail to some mailbox.
If noone checks the mailbox, noone gets the mail.
If noone puts mail into your mailbox, you won't get any mail.

spark turret
#

Understood, tje event fires and all eventhandlers for that specific event fire too. Now the question is:
Can i "create" an event for a foreign script f.e. player selects a certain weapon
And will it fire always a player selectd that weapon no matter if by my script or not?

still forum
#

if someone is there to fire the event

#

then it will probably fire

#

if noone fires it, then not

#

CBA's playerEventhandlers do that. They check every frame if the current weapon changed, and fire a event if it does

#

if a weapon get's changed, even arma itself doesn't know who did it, so it can't say "I won't fire your handler"
all handlers to the event get called, always

drowsy axle
#

Is there a way to find an object's relpos from another object?

spark turret
#

Yes

drowsy axle
#

I'm trying to attachTo. without trial and error.

spark turret
#

Upvote me for most helpful andwer psl

#

Lol you re in for some fun

still forum
#

relativePosition=endPosition-startPosition

#

simple math

drowsy axle
#

oof

#

thank you very much

spark turret
#

@drowsy axle attachto is in my experience fucked up and not doinf what its supposed to. Its a very tidious way to get the right offset. I use a Testarea marker where i plac stuff at right offsrt in editor, read their pos, attach at 0.0.0 and read again to determine how far real offsrt needs to be. Z value returns bullshit and doesnt attach right tho

#

Not a pro tho 🤔

still forum
#

z value should be right if you use right position format

spark turret
#

Getpodasl before and after.

#

Then get difference in z value and attach select 2 + z diff. Well Sounds good doesnt work. Probably im doinf sth wrong

still forum
#

maybe getPositionWorld might be better

spark turret
#

Noted.

still forum
#

they might use different centers

spark turret
#

What center does attachto use?

still forum
#

¯_(ツ)_/¯

spark turret
#

Lol

#

Welcome to arna

#

Honestly its such a pain in your best space to determine the centers attachTo uses. Its never accurate and always only almsot works. Awful

drowsy axle
still forum
#

so they are under the truck? instead of above?

drowsy axle
#

Yes

spark turret
#

Will try, wont expect anything useful tho

drowsy axle
#

They're at Z 0

spark turret
#

Invert z value

#

Oh

winter rose
#

if you know, tell us so we can add the info to the biki

still forum
drowsy axle
#

Ah yeah

#

Might work better

still forum
#

@spark turret ah! getPosWorld wiki page says what the center difference is

#

I think attachTo also uses model center

#

also it's center not centre! Someone need fix critical bug in biki

#

we all die

#

call the macaronis

drowsy axle
still forum
#

quite a bit better 😄

#

not sure what else to do, seems only a couple cm off maybe?

still forum
#

oof

#

hmpf

spark turret
#

Not sure what to see in thaz pic

still forum
#

its only half as high as should be

drowsy axle
#

yup

still forum
#

do they float in air at the right position if you just don't attachTo?

drowsy axle
#

let me see

still forum
#

maybe editor places them too low by itself?

spark turret
#

Problem is every time i read offset placed in editor and attach by thst offst its.... off

#

Will try getposWorld

#

X and y offset work fine its only t

#

Z

drowsy axle
#

I've moved them higher in the editor

young current
#

You need worldToModel

drowsy axle
still forum
#

AH!

#

that was the command I was searching for

drowsy axle
#

which one?

still forum
spark turret
#

I highly doubt any posagl will give what we want

still forum
#

Keep in mind that it's world position is "AGL" and not world

spark turret
#

Bc diffrenxe in modelcenter = different posagl

still forum
#

... wow worldToModel doesnt take world position. GG

spark turret
#

Lel

still forum
#

worth a try

#

otherwise you can just manually convert posworld to agl

spark turret
#

Did i mention the b in arma is for bugfree,

drowsy axle
#

the truck blew up..

still forum
#

world should be ASL

spark turret
#

Hey who has the power to change the name of the fuu ction "currentwaypoint" to "indexCurrentwaypoint"?

#

Or do i need to Protest outside BI hq?

drowsy axle
#

thebuckfastwine made one in game...

#

BI HQ that is.

spark turret
#

Well bi hq it is

drowsy axle
#
_truckpos = worldToModel truck;
_crate1pos = worldToModel crate1;
_crate2pos = worldToModel crate2;
_relPos = _truckpos ASLToAGL _crate1pos;
crate1 attachTo [truck, _relPos];
_relPos = _truckpos ASLToAGL _crate2pos;
crate2 attachTo [truck, _relPos]; ``` Apparently the truck doesn't exist.
still forum
#

uh

#

it replaces vectorDiff

#

not the other thing

drowsy axle
#

oh

#

rip xD

still forum
#

that is clearly wrong syntax. it takes 2 arguments, you're giving it one

drowsy axle
#

ASLToAGL posASL you mean?

still forum
#

ASLToAGL getPosWorld truck

drowsy axle
#

Edited above.

spark turret
#

U sure you ha vw the crates?

still forum
#

uh...

#

no

#

you are doing basically the opposite of the right thing

#

as I said. worldToModel takes 2 arguments

drowsy axle
#

so the wrong thing? 😉

#

ahhh

#
_truckpos = worldToModel truck;
_crate1pos = worldToModel crate1;
_crate2pos = worldToModel crate2;
_relPos = _truckpos worldToModel position crate1;
crate1 attachTo [truck, _relPos];
_relPos = _truckpos worldToModel position crate2;
crate2 attachTo [truck, _relPos]; ``` like so?
spark turret
#

Pld use ''' sqf

#

No space

drowsy axle
#

Have done, did do?

spark turret
#

Maybe my phone aint showing it right idk. :)

still forum
#

"like so?" almost

#

now undo the wrong stuff you broke before

spark turret
#

Lol

drowsy axle
#

my bad: sqf _truckpos = getPosATL truck; _crate1pos = getPosATL crate1; _crate2pos = getPosATL crate2; _relPos = truck worldToModel position crate1; crate1 attachTo [truck, _relPos]; _relPos = truck worldToModel position crate2; crate2 attachTo [truck, _relPos];

still forum
#

one step too far

#

getPosWorld and ASLToAGL

drowsy axle
#

ugh rip

spark turret
#

Keep in mind getPosAtL is connected to center and ground below and will likey give bad values

drowsy axle
#

that was right? ASLToAGL (getPosWorld truck );

still forum
#

yes

drowsy axle
#
_truckpos = ASLToAGL (getPosWorld truck );
_crate1pos = ASLToAGL (getPosWorld crate1 );
_crate2pos = ASLToAGL (getPosWorld crate2 );
_relPos = truck worldToModel position crate1;
crate1 attachTo [truck, _relPos];
_relPos = truck worldToModel position crate2;
crate2 attachTo [truck, _relPos]; ```
still forum
#

where do the position crate1 come from all of the sudden?

drowsy axle
#

Example 2: _relPos = player worldToModel position car;

still forum
#

use _crate1pos

#

you already have that

drowsy axle
#

rip yea

still forum
#

and position returns wrong height

drowsy axle
#

hence my issue.

spark turret
#

It really botherd me that you define _truckpos but dont use is

drowsy axle
#

is?

still forum
#

to be fair it was used before

#

but not anymore

drowsy axle
#

I don't understand

still forum
#

_truckpos you don't use _truckpos anymore

#

you don't need it

drowsy axle
#

oh

#

just the: sqf _crate1pos = ASLToAGL (getPosWorld crate1 ); _crate2pos = ASLToAGL (getPosWorld crate2 ); _relPos = truck worldToModel _crate1pos; crate1 attachTo [truck, _relPos]; _relPos = truck worldToModel _crate2pos; crate2 attachTo [truck, _relPos]; I see now.

#

How do I params an array? ```sqf
EC_attachTo = {

params ["_object",["_arrayObjects"]];

{
    _objectpos = ASLToAGL (getPosWorld _x );
    _relPos = _object worldToModel _objectpos;
    _x attachTo [_object, _relPos];
} forEach _arrayObjects;

};```

still forum
#

just do everything normally

#

params works for any type

#

it doesn't care

drowsy axle
#

Okay.

#

so just: params ["_object","_arrayObjects"];

#

or: params ["_object",["_arrayObjects"]];

still forum
#

"just do everything normally"
so. "just"

drowsy axle
#

kk 😄

spark turret
#

Last oe doubles your array

still forum
#

tho I think both works

#

no it doesn't

#

not at all

#

wtf

spark turret
#

Whoops

#

Ill take that back

#

Now i take you figrured out how to place stuff at correcr offset @drowsy axle ?

still forum
#

yes. He posted screenshot of it working

spark turret
#

Good. Will steal and sell as my own. ...? Profit

drowsy axle
#

Yeah. I do things the "simple" way, then make it better.

#

it's now a function... yus

spark turret
#

Defintely needs biki entry fpr attachto if it works corrextly

drowsy axle
#

Excuse me sir. Do you want to attach these objects to that thing? just: call EC_fnc_attachTo 😉

still forum
#

Attaches object while keeping same absolute position
.. script

spark turret
#

Yes please

#

I long for that

still forum
#

Lou wanted something for wiki

#

now he has smth

drowsy axle
#

Does he?

#

Can I have "idea" credit?

still forum
#

someone wake up lou

drowsy axle
#

@winter rose ?

#

I think he has been abducted while playing a3.

#

Or, he got lost in the forest.

spark turret
#

Not an excuse

#

This is urgent

drowsy axle
#

is he the cba man?

spark turret
#

Like "storm area 51" urgent

drowsy axle
#

nah

#

if THAT was urgent. It wouldn't take three months,

still forum
#

Lou is the keeper of the biki :U

drowsy axle
#
CBA_fnc_attachTo = {
    params ["_object",["_arrayObjects"]];

    {
        _objectpos = ASLToAGL (getPosWorld _x );
        _relPos = _object worldToModel _objectpos;
        _x attachTo [_object, _relPos];
    } forEach _arrayObjects;
};``` my babies future looks bright?? 😉 😉
spark turret
#

Does it work tho?

drowsy axle
#

mh

#

Let me try 😛

spark turret
#

Lol

drowsy axle
#
EC_fnc_attachTo = {
    params ["_object","_arrayObjects"];
    {
        _objectpos = ASLToAGL (getPosWorld _x );
        _relPos = _object worldToModel _objectpos;
        _x attachTo [_object, _relPos];
    } forEach _arrayObjects;
};

[truck,[crate1,crate2]] call EC_fnc_attachTo;``` WORKS!
spark turret
#

Way to show off you can afford the new dlc

#

10/10 will steal function fpr own script

drowsy axle
#

aw

winter rose
#

@drowsy axle @spark turret I AM BACK

drowsy axle
#
EC_fnc_attachTo = {
    params ["_object","_arrayObjects"];
    {
        _objectpos = ASLToAGL (getPosWorld _x );
        _relPos = _object worldToModel _objectpos;
        _x attachTo [_object, _relPos];
    } forEach _arrayObjects;
};

[truck,[crate1,crate2,crate3,bike1]] call EC_fnc_attachTo;``` https://cdn.discordapp.com/attachments/601850288198123542/604441210471448589/unknown.png | https://cdn.discordapp.com/attachments/601850288198123542/604441398703423672/unknown.png All I need to do now is save the dir.
winter rose
#

what is it, mortals?

spark turret
#

You did good. Will mention you @drowsy axle

still forum
#

he found a way to do attachTo stuff well

#

wants example on attachto page

spark turret
#

I want too

still forum
#

for attaching object to vehicle and keeping same absolute position

spark turret
#

So idiots like me dont need to suffer

drowsy axle
#

same absolute direction soon™

#

like tbh it's simple..

#

I know i'm saying this now.

#

but like, when you think about it.

still forum
#

same position is also same direction 🤔

drowsy axle
#

nope

#

dir is it's facing.

winter rose
#

so wait what should I copy to the Biki 😄 gimme!

drowsy axle
#

Sure.

#

Let me put getDir and setDir.

spark turret
#

Dir isnt includef

drowsy axle
#

I know.. I'm putting it in now, and testing.

still forum
#

//attachTo while keeping same absolute position

_boxPos = ASLToAGL getPosWorld box1;
_relPos = truck1 worldToModel _boxPos;
box1 attachTo [truck1, _relPos];

drowsy axle
#

oi.

spark turret
#

Said the australian

drowsy axle
#

lol

#

Wait

#

the direction before and after attachto will be different.

#

Wouldn't I need the relative dir...

hollow thistle
still forum
#

silence

drowsy axle
#

from the pastDir to the currentDir, because, this: ```sqf
EC_fnc_attachTo = {
params ["_object","_arrayObjects"];
{
_azimuth = getDir _x;
_objectpos = ASLToAGL (getPosWorld _x );
_relPos = _object worldToModel _objectpos;
_x attachTo [_object, _relPos];
_x setDir _azimuth;
} forEach _arrayObjects;
};

[truck,[crate1,crate2,crate3,bike1]] call EC_fnc_attachTo;``` ain't working as intended. https://cdn.discordapp.com/attachments/601850288198123542/604443961913901060/unknown.png <- in game

still forum
#

oh for the direction stuff... yeah..

#

_obj1 attachTo [_obj2]; The function says that preserves the position

#

is that really all you needed to do??

still forum
#

If no offset is specified, the offset used will be the current relative positioning of objects against each other. welp

drowsy axle
#

oh

still forum
#

All the work was for nothing

drowsy axle
#

mh

#

I want my way to work. 😉

still forum
#

welp, turns out reading wiki pages helps sometimes, who would've thought

drowsy axle
#

The direction. It's changed in the attachTo.

#

Hahahahaha xD

#

Azimuth Directional Relativity would that be a thing?

winter rose
#

attachTo then setDir iirc yes, and relative to the object it is attached to

#

If no offset is specified, the offset used will be the current relative positioning of objects against each other. ah I could have told you that, this is how I put crates in the back of my trucks from Eden placement 😄

drowsy axle
#

So the bike starts at: Dir = 66.215

still forum
#

turns out reading biki makes things easier afterall. who would've thought ¯_(ツ)_/¯
I guess we should recommend people to read the wiki 🤔

drowsy axle
#

after attachTo ends at: Dir = 231.255

#

(231.255 + 66.215) - 360 = -62.53 is the minus counted in arma?

#

360 - (231.255 + 66.215) would be correct way.

#

BUT

#

I don't always know the numbers

still forum
#

Just rotate by 194.96 degrees

drowsy axle
#

How did you get that?

still forum
#

or just use the BIS function that already exists and already does it correctly

#

231.255 + x = 360 + 66.215

drowsy axle
#

uh

#
EC_fnc_attachTo = {
    params ["_object","_arrayObjects"];
    {
        [_x, _object] call BIS_fnc_attachToRelative
    } forEach _arrayObjects;
};

[truck,[crate1,crate2,crate3,bike1]] call EC_fnc_attachTo;``` works
#

Thanks @hollow thistle

spark turret
#

X is 194.894 hope i could help

still forum
#

no it's not...

plain urchin
#

anyone found any cool new stuff to play about with from the contact dlc?

#

about to hunt around in the configs and functions for new stuff rn

hearty plover
#

Hey guys, don't know why I am brain-farting on this.

#

I need to get all bluefor within X of a opfor unit.

#

a count of the blufor within X of a single opfor unit.

still forum
#

inAreaArray
allUnits select side==blufor
count

hearty plover
#

Checking the wiki for like a findWithin, or something.

#

inAreaArray?

#

Yeah that's the count, but what about the.

#

count if
distance from HVT < 10

still forum
#

inAreaArray does distance

hearty plover
#

Oh that's a function.

still forum
#

you can set center and radius

hearty plover
#

Let me go check that out, thanks.

still forum
#

alt syntax 3

#

as "positions" you give it array of all blufor units

#

then you get out all blufor units in range

hearty plover
#

Just what the dr ordered.

#

Thanks ded.

spark turret
#

@jay _enemies = allunits inareaarray _markeratOpfor select {side _x == blufor}
?

still forum
#

I think inAreaArray before filtering blufor might be more efficient yeah

#

I thought about doing blufor filter first

hearty plover
#

_enemies = allunits inareaarray _markeratOpfor select {side _x == blufor}

#

this is almost what I have

#

I am using the pos of the HVT opfor

#

I am about to test to see if it follows the HVT's pos tho.

still forum
#

if you want to count you can directly replace the select with count

hearty plover
#

Not sure how that will work without some lame loop.

#

Maybe a trigger area would be better, a trigger area that follows the HVT pos.

#

Since I need to to be checked all the time.

spark turret
#

Trigger areas suck

#

Markers are op

hearty plover
#

I am trying to start basic

#

if HVT team alive, fight, if dead, surrender.

#

Later I can get frisky with it.

#

Add something like, if team is dead, and no blufor in x radius, run random dir

spark turret
#

_numberTeamHVt = count (allunits inareaarray _hvtPosMarker select {_x side == side _HVT};

hearty plover
#

Yeah, then just chuck a isAlive check right

spark turret
#

if (_numberTeamHVT < _enemies) then {surrebder or sth}

#

Add more conditons into select via "&& alive _x" f.e.

hearty plover
#

Yeah

#

So, I am looking into createMarket

spark turret
#

Afaik you wont ve able to avoid a loop that checks.

hearty plover
#

Wondering, does the pos of the marker update with the unit if I pas a objec?

#

Ahh

#

How do I make it non blocking

#

Call it with spawn?

#

In the hvt init maybe

spark turret
#

What

hearty plover
#

Obviously I don't want my HVT loop taking up all of the mission right.

spark turret
#

Yes. Marker position is static tho. Dont know of you can atta h marker to a unit. Dont think its possible, might be wrong tho

hearty plover
#

This answers my question about how to include the loop without blocking the rest of the code from doing it's job.

spark turret
#

A loop checkign every 2 or 3 second in a 100m marker for hvt team and enemies is not at all performance intensive tho. So wont be proböem

hearty plover
#

Been a long time, I am too damn rusty

spark turret
#

.. why would you not run thaz loop in a scheduöed normal environment?

#

Just create an hvt_giveUp.sqf and execVm "yourfolder/hvr_giveup.sqf';
that script which includes the loop. Also put: "if !(isserver) exitwith {}; on top to avoid multi init in MP

hearty plover
#

Yeah.

#

I forgot about how that worked.

spark turret
#

Put "this execVM "yourfolder/hvt_giveup.sqf" in the hvts init in editor and in tje script run your loop.
Put a "sleep 2" thing in tje loop to avoid perfomance stuff anf you will be fine

#

Might put extra precautions like
'''Sqf
_this setvariable ["Jay_HVT_giveupscriptrunning",true,true];
If (_this getvariable "Jay_HVT_giveupscriptrunning",false]) exitwith {
_debug = "Hvt script run multiple times for thag unit";
diag_log _debug;
Hint _debug
}
'''

hearty plover
#

OKay cool

spark turret
#

That thing gibes the unit defined in this execVM the variable "jay_hvtwhazeber_alreadyrunning" = true and then checks for that variable, which id global (importna t for mp). If it notices _alreadyrunnign = true, it will ecit thaz script and leave a debug Message

#

Im drunk and will now sleep.

hearty plover
#

Later man

hearty plover
#

Hey

#

Can you do this in one line.

#
    _hvtGroupSize = count units group HVT;
    _hvtGuards = _hvtGroupSize - 1;
#

I would like to do _hvtGuards = count units group HVT - 1;

#

But I am getting a Error generic error in expression

ivory lake
#
_hvtGroupSize = (count units group HVT) - 1; 
hearty plover
#

Ahhh, kek.

#

Thanks

tough abyss
#

I have a mission with a p3d object that i want to create server side to any player see it. This object don't have a classname, how can i do that?

#

I can't find a way to do that.

#

If i use createSimpleObject, the path on server and on clients are different, so the object will only appears on server when i create then on server.

#

On clients the path is mpmissions\__CUR_MP.altis\models\helion4_ceil.p3d

#

on server the path is mpmissions\BRPVP.altis\models\helion4_ceil.p3d

#

Understand me?

ivory lake
high marsh
#

Doesn't seem like it. Maybe there is some global var for it? Google foo isn't giving anything.

tough abyss
#

@ivory lake thanks, but this does not work. Because the path returned in server is one and the path returned in clients is another, they are indeed different because in clients the mission is in the file __CUR_MP.altis.pbo and on server the mission is in the file BRPVP.altis.pbo.

#

Test his MISSION_ROOT on server and clients, they will be different.

#

@tough abyss why it doesn’t work?

#

You need different paths, no?

#

@tough abyss because when creating the object server side i need to use server side path, then the object is transmited to clients with that path, but since on clients the path is different, the object is not created client side.

#

It is not created because the path is invalid.

#

For clients.

#

Why would you send server path to client, mission root on client is different you need to calculate it in client

#

The engine sends, not me.

#

Use local flag and create it everywhere

#

Then manually sync if you need to

#

@tough abyss this makes things harder, but seens the only solution.

#

You are trying edge cases that is miracle even work and complaint it is hard? 😂

#

💩

#

Can't i create a classname for the p3d model in description.ext?

high marsh
#

No

tough abyss
#

No you can make mod

high marsh
#

Although if you ask ded, maybe.

tough abyss
#

Zed is ded

high marsh
#

:O

tough abyss
#

I have a solution

#

Name the mission server side as __CUR_MP.altis.pbo

high marsh
#

No

tough abyss
#

So server and client paths will be the same

high marsh
#

<- Uncultured

tough abyss
#

Try it @tough abyss

high marsh
#

I'm almost positive this would cause further conflictions.

spark turret
#

wondering if i can make AI change positon to middle/down when reloading. "reload" eh doesnt work as it fires too late and the unit will reload, THEN go down.

high marsh
#

Should yeah, but those are two seperate events. Might not be perfect.

spark turret
#

what is two different events?

high marsh
#

One for reload, one for changing to prone/crouch. One might take prescendce over the otjer, I dunno.

spark turret
#

no, just to be clear, i added this EH:

    if !(_unit getVariable ["IRON_EH_Reloading",false]) then {
        _unit setVariable ["IRON_EH_Reloading",true,true];
        _unit addEventHandler ["Reloaded", {
        params ["_unit", "_weapon", "_muzzle", "_newMagazine", "_oldMagazine"];
        _unit setUnitPos "down";
        hint str "RELOADING";
        }];
    };
tough abyss
#

EH is called reloadED

spark turret
#

ffs why wont it show as sqf

tough abyss
#

But there is muzzle EH Reload that fires before reloading

high marsh
spark turret
#

the EH does fire and work, but its to late uasually

#

ideally the AI would go prone BEFORE reloading

#

will look at the muzzle thing m242 suggested

high marsh
#

That's exactly what I was talking about.

#

Unless you want to handle reloading alltogether. Rather than by EH.

spark turret
#

do you know by chance the name of that muzlle EH?

how would i cahnge reloading altogether?

tough abyss
#

Reload

spark turret
#

uh .. so exactly the one i use which fires to late?

spark turret
#

ah found it

#

so i add this EH to the units weapn rather than the unit itself?

tough abyss
#

It is config eh you need to make a mod

spark turret
#

...

#

do weapons not have that event already and i can just read it ?

#

yep, EH "Reload" is not recognized. ffs

tough abyss
#

You can’t add eh to a muzzle by script

spark turret
#

well why not

#

i can get the muzzle and i can read events for that muzzle. thats how i understand it

tough abyss
#

Because muzzle is not an object

spark turret
#

ah

#

right, arma being wierd again with its structure. well then ill just live with AI happily standing in fire while reloading

tough abyss
#

Arma was always primary config driven and secondary script driven

spark turret
#

which makes sense often but i cant make a mod containing all weapons just to make AI duck when reloading

#

ah wait can i add the config EH for all class "rifles"?

tough abyss
#

Then you dont let AI auto reload instead force them to reload yourself

spark turret
#

interesting approach

#

how would i check for an emtpy gun? Fired EH that counts ammo in mag each shot?

#

sounds performance-y

tough abyss
#

Or you can watch ammo in FiredMan EH and act accordingly

spark turret
#

man every time i want to make super small improvements to AI i end up having to rip apart the vanilla one and disable 70% of it to overwrite with my own stuff

tough abyss
#

Performance? EH only triggered with each shot, unless you have thousands of AI firing full auto at the same time you should be ok

#

Hacking AI is like hacking UI both suck

#

Might as well write what you need from scratch or make a mod

spark turret
#

yeah

#

im working on a "AI defense line /trench" script where they leave the trench if they get hammered and its awful to get AI to actually DISengage

#

they dont know anything else then attacking.

spark turret
#

actually i dont even have to disable autoreload. i just add the EH on top, if it notices 0 shots, go prone. AI does the rest

still forum
#

@spark turret

_numberTeamHVt = count (allunits inareaarray _hvtPosMarker select {_x side == side _HVT};
I said half a dozen messages above that you can just replace the select with count, which will be more efficient.

@hearty plover

https://community.bistudio.com/wiki/Scheduler#Unscheduled_Environment
This answers my question about how to include the loop without blocking the rest of the code from doing it's job.
Uh? Unscheduled environment is exactly the wrong thing for that. Because it blocks everything till the code is done.

spark turret
#

i was drunk an didnt understand half of what you said 😃

spark turret
#

thanks @tough abyss my trench ai now ducks when reloading. did this:

_unit addEventHandler ["Fired", {
            params ["_unit", "_weapon", "_muzzle", "_mode", "_ammo", "_magazine", "_projectile", "_gunner"];
            if (_unit ammo _muzzle == 0) then {
                _this execVM "IRON\Debug\duck_and_reload.sqf";
            };
        }]; //for each trench guy
//---------in duck and realod .sqf:
params ["_unit", "_weapon", "_muzzle", "_mode", "_ammo", "_magazine", "_projectile", "_gunner"];

//--- read units up/down/etc
_pos = unitPos _unit;
hint str _this;
//---------------------------
_unit disableAI "path";
_unit enableReload false;
//Determine what to choose
if (_pos == "Down") then {};
if (_pos == "Middle") then {_unit setUnitPos "DOWN";};
if (_pos == "up") then {_unit setUnitPos "middle";};
if (_pos == "auto") then {_unit setUnitPos "middle";};
sleep 1;
reload _unit;
sleep ((random 2) + 3);
_unit setUnitPos _pos; //set old pos
#

works like a charm 😃

#

only issue is they bend over backwards in a funny way when in open fields but thats arma stuff

tough abyss
#

@tough abyss i created a mod and put my p3d on it, the mod have only this file.

#

once you made a mod, there is no way back, muahahaha

tough abyss
#

yes, i liked to do that, this open new possibilities

cold pebble
#

Whats the easiest way to get an array of all the names of the entries in a listbox in an array so I can compare them to a variable? 🤔

#

Currently thinking a for loop iterating and pushBack

tough abyss
#

no other way

#

have to loop over but then you can compare them at the same time no need to make array

cold pebble
#

Fair enough, cheers 👍

jagged elbow
#

Ive attempted to make some live feed cameras they work fine in single player but just show a black screen in multiplayer, i have this in my init.sqf: https://pastebin.com/j09QvHUu and this in the init field of a screen: this setObjectTextureGlobal [0, "#(argb,512,512,1)r2t(screen1,1)"];

#

anyone have any idea how to make this work on a dedicated server?

spark turret
#

init.sqf runs for server + each client so thats the first issue

#

dont know why the screen is black, but besides that you create a camera for each client + the server.

#

@jagged elbow

ornate sky
#

I need to run a forEach on an Array that may be empty [] at runtime (but not nil). Will this cause problems?

still forum
#

no

spark turret
#

foreach [] will do nothing.

#

run 0 times

ornate sky
#

exactly what I need, thanks

ornate sky
#

now, is there a way to get a distance to an object that is not model center?

#

eg. if a player is touching a vehicle that distance would be 0

#

rather than distance to the model center?

spark turret
#

yeah you can check for collisions

#

or you can tinker with boundingbox or boundingboxreal

ornate sky
#

Guess you can do (x distance y) - (sizeOf y classname)

#

close enough for my needs

wicked fulcrum
#

Hey There. I am new to scripting. Have some trouble figuring out what approach I can take for my problem. Been searching in here and on forums/web but haven't found any real answers.

So I run a function every 5 seconds that needs to find objects designated by Zeus as being "something". I can't change the class and use NearestEntities, as the objects can be moving cars, towers etc.

I have thought about making Zeus set a parameter/property on the objects and then find it that way, but that would require to poll all nearestEntities and then iterate through them, which is not a very good approach to run every 5 seconds.

My current approach is hardcoding the script to look for names like "something1", "something2" and check if they are null otherwise use them. This isn't great as it removes the dynamic I wanted to not be limited in number or specific names.

I have looked a bit in regards to use getMissionLayerEntities and see if Zeus can just add it to the right named layer and thus get the objects, but haven't had time to test that yet.

Ideally Zeus would select a unit, edit attributes and by a checkbox in a custom category select if this object should be a "something". A bit like ACE Arsenal. (Tried to find how they did it in their source, but couldn't locate that part)

Any ideas/thoughts/comments on how to approach this?

spark turret
#

you can check for part of the name being something. check f.e. for "something" and it will also recognize "something_0815"

#

what exactly are your intentions with that script? whats your goal

wicked fulcrum
#

oh interesting. I did not know it worked like that

spark turret
#

but checking everything in the mission every 5 seconds is... well

#

it works and i do it to for randomized militia equipemnt but its not ideal

wicked fulcrum
#

It is a script playing around with jamming/boosting and TFAR. So it runs locally on the players pc and checks if a "jammer" is in range of the player every 5 sec. Then calculates distance to jammer and check if any booster (ESM) is in range and it's effectiveness.

Ideally to enable our Zeus to play around with radio jamming etc.

spark turret
#

there already are existing very well working tfar jammers

#

which are zeus compatible. we used one just last week

wicked fulcrum
#

yeah. I see your point. Not ideal to check something every 5sec. However if talking less than like 10-15 items and I can obtain those objects in a efficient way I would see the impact minimized.

sturdy cape
#

i have an ( at least foe me ) interesting question.i want to gradually change the weather on an event ,not using forceweatherchange.i need the weather turn from totally sh+t to awesome in 120 seconds.well i found out i can return weather parameters but can i do something like this? ```sqf
_translation_base = overcast;
_foglevel = fog;
_rainLevel = rain;

50 setRain (_rainlevel - 0.05);;
120 setovercast (_translation_base - 0.05);
120 setfog (_foglevel - 0.05);
120 setwind 0.2;
120 setWindStr 0.2;
120 setWindforce 0.2; ```

wicked fulcrum
#

hmm. interesting. Googled around and didn't find any other than some old not-ideal scripts. Do they support ESM? So counter measures to jamming aka a teoretical booster that decrease the jamming efficency??

spark turret
#

why dont you turn the script around and run the check loop checking for players near the object instead of object near players?

#

allplayers is a smaller array than allvehicles so less perfomance impact

#

@sturdy cape just saw that the function already supports gradual weather change

sturdy cape
#

sounds just like what i am looking for

wicked fulcrum
#

hmm. I would still need to get the actual object. So whatever the Zeus selected to be the jammer should be obtained by the script.

sturdy cape
#

could you point me to that?

#

if theres an engine command i´d prefer that over my stuff

spark turret
#

you could do sth like:

_startWeatherChangetime = time;
(_startweatherchangetime + 120) setrain  0;
#

well your stuff already does change gradually so im not sure you even need it

sturdy cape
#

yeah its basically one step

spark turret
#

you define a time adn a value and it will smoothly transition from what the rain is now to what the rain will be at time x with value x

#

i guess what i wrote it obsolete. let me correct

sturdy cape
#

really that simple?`

#

i see,i just replace the time with time plus value

spark turret
#

its not. i just tested and it seems that weather is buggy

#

according to biki you need to use forceWeatherChange for immediate change otherwise server might overwrite the scripted weather values or ignore them

#

not sure at this point if gradually changing weather is possible

#

it does seem to work with the gradual change at least for the fog, altough slightly delayed

sturdy cape
#

that was the reason i started thinking about that

#

just force the change in small steps or something

#

-needs a for to step do then?

spark turret
#

dont recommend forceweatherchange in multiple small steps. it will a. not look smooth and b. biki warns about lag

#

just try the normal, built in gradual function and maybe @still forum knows more about it

sturdy cape
#

as far as i know the weather will then change only after 50 mins or so which is not what i am trying to do

#

its an emission event ,the blowout goes off and boom,fog rain and bad mood^^(works because forceweatherchange).then after 2 minutes the weather should be turned back to normal

spark turret
#

well you can go and the the for _i thing

sturdy cape
#

hmmm or do the killzoneKid thing

#
86400 setOvercast 1;
skipTime 24;

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

and playaround with skiptime,but for all my values?think thats too much

#

i am attemping to get a brainf+ck again with this i guess but what about that? opinions? ```sqf
_translation_base = overcast;
_foglevel = fog;
_rainLevel = rain;
_windArray = wind;
_windX = wind select 0;
_windY = wind select 1;

for "_i" from 1 to 120 step 10 do {
50 setRain (_rainlevel - 0.05);;
120 setovercast (_translation_base - 0.05);
120 setfog (_foglevel - 0.05);
120 setWind [(_windX - 0.05),(_windY - 0.05), true];
};```

keen tide
#

So if I wanted to make a npc move around in real life time how would I do that like by scripting it to move around?

young current
#

What does real life time mean?

keen tide
#

Like let say morning to the next morning at that time it will move around on the next morning if you get what I mean

#

Like it stay till 8am till the next 8 am by then it would have moved to a new location

young current
#

I guess there's many ways to do it. Some sort of looping script that loops through acceptable destinations in 12 hour interwall or some such.

keen tide
#

Is there all ready a looping script made

young current
#

Dunno. Perhaps.

spark turret
#

@keen tide do you want the Ai unit to actually move around in its village doing "real life stuff" or do you want to have it appear at different destinations when players enter the village according to the time of the day?

#

bc the second one is far easiert

keen tide
#

I want it to appear at different destinations when players enter the area according to the time of day lol so that away I want it to be for a drug dealer for arma 3 so that away cops can’t bust people for it and they have to rp to find it.

spark turret
#

well just make a list of the locations with the time when he is soupposed to be there and use that

#

_DealerSchedule = [[_bedroom,6],[_church,9],[_stripclub,15]];
if (round daytime etc etc etc

keen tide
#

-_- so your saying cause of my grammar I don’t have the skills wow judgmental much quicksilver

#

And ok I will thanks ironsight

spark turret
#

read the time, read from your array where he is supposed to be at, then spawn him at that location.

keen tide
#

Got u I’ll work on that later.

#

also thanks for your help

spark turret
#

i guess its for some altis life thing??

keen tide
#

kinda like that lol

still forum
#

"cops" "have to rp to find it"

spark turret
#

thats what the altis life is about. also of course screaming into your headset how you f..ed someones mom

keen tide
#

lol well im saving the scripts and ill work on it later and its not about experience when you have friends that know more then you that can help me out they just needed to know how to do it.

#

all ready have a friend my cuzion lol more then a friend

#

its much easier to just have family to do it lol