#arma3_scripting

1 messages Β· Page 704 of 1

undone flower
#

what does the second line do?

little raptor
silk ravine
#

@little raptor will waitUntil require me to spawn the code?

#

or does only sleep n; require spawned code?

little raptor
silk ravine
#

god fin damn it

little raptor
#

what's the problem?

copper raven
#

i wish waitUntil had some sort of limit in unscheduled, like while does πŸ˜„

silk ravine
#

Testing from the debug console right now while on dedicated

#

And it does what I need without the spawn

#

but I can not put it in the init of the player object because it will run the code before alive player

#

It needs to be inside the playerobjects init field

#

and wait until the player actually can see shit

little raptor
#

what are you trying to do anyway?

#

post the code

silk ravine
#

That is the code

#
this spawn { 
    waitUntil { alive _this }; 
    sleep 1;
    hint "did A"; 
    if (local _this && !isServer && hasInterface) then { 
        hint "did B";
        [true,true,true] call ACE_spectator_fnc_setSpectator; 
    }; 
};```
#

^that shit^
goes into playerobject init field

#

does not work on dedicated

#

I simply spawn without anything happening

little raptor
#

why do you put it in player init anyway?

#

just put it in initPlayerLocal.sqf

silk ravine
#

because I want it to be there

#

as it is only for specific slots and needs to be JIP compatible

fair drum
#

the faster you learn to do external scripts, the more likely you are to not lose all your crap when arma inevitably fails you.

silk ravine
#

In an easy way for people to understand as in, take this and paste it in the slots init

#

My missions are full of external scripts

undone flower
#
_x addEventHandler ["Killed", {castle sideChat (format ["Lost %1 to %2!", _unit, _killer])}]

so, how do I access the output of an EH? I'd like to announce in chat when a friendly is lost, and say who killed your ally. _unit, _killer just returns me "Lost any to any!"

silk ravine
#

I sort of have the feeling that spawned code within the init field kinda doesn't work, because it loads a weird screen in between slotting screen and map screen

#

pretty sure its the spec

#

so hard to see tho

fair drum
#

try using default spectator first to confirm your code works

#

did you define the other parameters for ace spectator?

silk ravine
#

wat?

fair drum
#

did you add sides for the spectator to view?

silk ravine
#

no

#

well... yes

#

sort of

fair drum
#
[[west], [east,civilian]] call ace_spectator_fnc_updateSides
#

0: Sides to add
1: Sides to remove

silk ravine
#

wait

#

no I didn't and I do not need to, it defaults to all

spark sun
fair drum
#

alright well let me do some testing to see if its something you're doing. standby

fair drum
silk ravine
fair drum
#

i just pasted it in with this as _unit and _unit = player and it works fine on my dedi

#

local debug

#
//if you want to use debug
_unit = player;

if (local _unit && isPlayer _unit && hasInterface && (!isServer)) then { 
 _unit spawn { 
  waitUntil {alive _this}; 
  [true, true, true] call ACE_spectator_fnc_setSpectator; 
 }; 
};
undone flower
silk ravine
#

okay, I will try it again @fair drum Thanks so much for your help sofar man!

spark sun
#

should be a good start

fair drum
#
this spawn {
    waitUntil {alive _this};
    sleep 3;
    if (local _this && isPlayer _this && hasInterface && (!isServer)) then {
            [true, true, true] call ACE_spectator_fnc_setSpectator;
    };
};
#

this gives you your intended results

#

just have to give ace more time to initialize

#

you can bump that sleep down over and over till it fails

silk ravine
#

The issue is, that I still do not know if the if condition was my mistake or that ace did init too early

fair drum
#

i think its ace inits because i ran into your issue when testing and all i did was add more time

silk ravine
#

then why didn't it work with my code that did include a sleep?

#

wrong if conditions?

fair drum
#

only thing possibly was that the not could have messed up. i keep my not isolated. but I think it just needs more time than 1 second

#

yeah its just the time. the condition is going to go through all the commands since they are nular and unary operators, then will do the logical operators.

silk ravine
#

insane

#

how the fuck was that not discovered by now

fair drum
#

you also don't need to check for hasInterface because that function already checks it

#

the delay for alive check is built in

#
// Delay if local player (must not be ACE_Player) does not exist
if (isNull player) exitWith {
    [
        { !isNull player },
        FUNC(setSpectator),
        _this
    ] call CBA_fnc_waitUntilAndExecute;
};
undone flower
little raptor
#

stop the swearing

silk ravine
#

Oh the one above that

#

I see

fair drum
#

and above that one too. no swearing in these channels

silk ravine
#

good christian scripting channel

little raptor
silk ravine
silk ravine
#

@fair drum IT WOOOOOOOOOORKKSSSSS πŸ₯²

somber radish
#

Anyone know if it is possible to create and delete a zeus module from script?

#

(Any tips are welcome)

silk ravine
#

Not sure what this would return tho

somber radish
#

I would have to create it first tho, how would I do that? without placing it in editor

silk ravine
#

uh...

#

assignCurator @somber radish

#

nope

#

Actually... yes. That should be it. player assignCurator and player unassignCurator

#

Do not even have to place a module manually

#

@somber radish

somber radish
#

Yeah

#

That assigns a pre-placed Zeus module to a player

#

But I need to create the module ingame

#

on the fly

#

Kinda like what is done using ```sqf
CreateVehicle

fair drum
#

are you using ace?

silk ravine
#

@somber radish
Curator modules to initialise properly, especially when setting allowed addons, need to be created before time > 0. It would be best to create as many curators as needed (playableSlotsNumber ?) in a preInit function.

  • By Larrow in BI Forums
fair drum
somber radish
fair drum
#

then no you can't

somber radish
#

😭

fair drum
#

just create the slots before hand and assign them as needed

somber radish
#

Oh well, thank u guys for the effort in helping out anyway

silk ravine
#

Well can't he simply take the code from ACE team, adjust it and preprocessfilelinenumbers it for own use?

fair drum
#

no, he can't. ace uses CBA macros and their own macros

silk ravine
#

right, cba, forgot that

somber radish
little raptor
somber radish
somber radish
little raptor
#

it's complicated meowsweats

somber radish
#

Any pages I could read up on?

little raptor
#

Β―_(ツ)_/Β―

somber radish
#

Niiice, I was googling like a madman and couldnt find it

little raptor
#

I'm not sure if there are any BIS functions for these, but:

_curator addCuratorAddons activatedAddons;
_curator addEventHandler ["CuratorObjectRegistered", {...}]; //set costs
[_curator, "object", ["UnitPos", "Rank", "Lock", "Damage", "Fuel", "RespawnVehicle", "RespawnPosition", "Exec"]] call BIS_fnc_setCuratorAttributes; //set attributes
....
//set owner
_curator setVariable ["Owner", getPlayerUID player, true];
player synchronizeObjectsAdd [_curator];
player assignCurator _curator;
#

something like that

little raptor
#

P.S: I'm not sure if what I said works in MP properly. I've only tried in SP

somber radish
# little raptor zeus module? I don't think so...
["BIS_fnc_moduleCurator: Owner","a3\modules_f_curator\curator\functions\fn_moduleCurator.sqf",true,114],
["BIS_fnc_moduleCurator: Owner","a3\modules_f_curator\curator\functions\fn_moduleCurator.sqf",true,114],
["BIS_fnc_moduleCurator: Owner","a3\modules_f_curator\curator\functions\fn_moduleCurator.sqf",true,114],
["BIS_fnc_moduleCurator: Owner","a3\modules_f_curator\curator\functions\fn_moduleCurator.sqf",true,114],
["BIS_fnc_moduleCurator: Owner","a3\modules_f_curator\curator\functions\fn_moduleCurator.sqf",true,114],
["BIS_fnc_moduleCurator: Owner","a3\modules_f_curator\curator\functions\fn_moduleCurator.sqf",true,114],
["BIS_fnc_moduleCurator: Owner","a3\modules_f_curator\curator\functions\fn_moduleCurator.sqf",true,114],
["BIS_fnc_moduleCurator: Owner","a3\modules_f_curator\curator\functions\fn_moduleCurator.sqf",true,114],
["BIS_fnc_moduleCurator: Owner","a3\modules_f_curator\curator\functions\fn_moduleCurator.sqf",true,114],
["BIS_fnc_moduleCurator: Owner","a3\modules_f_curator\curator\functions\fn_moduleCurator.sqf",true,114],
["BIS_fnc_moduleCurator: Owner","a3\modules_f_curator\curator\functions\fn_moduleCurator.sqf",true,114],
["BIS_fnc_moduleCurator: Owner","a3\modules_f_curator\curator\functions\fn_moduleCurator.sqf",true,114],
["HC\data\scripts\HC_local.sqf","A3\modules_f\HC\data\scripts\HC_local.sqf",true,158],

Getting one for each module placed

#

If is faster

#

yup

#

πŸ˜‰

winter rose
#
call {
  if (_something) exitWith { /* some code */ };
  if (_somethingElse) exitWith { /* some other code */ };
};
```this ↑ is faster πŸ˜‰
somber radish
#

↑ he is the boss

#

πŸ˜‰

undone flower
#

I want to make a function that uses sleep. do I have to call it from a script?

winter rose
viral birch
#

Does anyone know if it's possible to force a client's FSAA to Disabled?

viral birch
#

I figured 😦 Was worth a shot to ask though.

#

Any suggestions for how to mitigate the new AMD driver/foilage issue for people then?

#

It's most likely just a waiting game until AMD fixes their shit in a future patch, but hoping there's something server owners can do to combat it

winter rose
#

that's a user-side error, not a game server one

viral birch
#

I know, but if people are using/abusing it, it allows them to see people that they shouldn't no?

winter rose
#

still

viral birch
#

or are people still hidden even though the foilage is not displayed?

winter rose
#

nope, I don't think they are

viral birch
#

πŸ€·β€β™‚οΈ Worth a shot anyway, thanks for the info again.

winter rose
#

play VR missions until it's fixed 😬

#

but yeah, AMD screwed big time

little raptor
undone flower
#

automatically ban AMD users :^)

brazen lagoon
#

How do I set up a vehicle so that it can take damage but never explode/be destroyed?

#

I assume this is something on the handle damage event handler

winter rose
brazen lagoon
#

gotcha

jovial steeple
#

Can anyone help me attach a camera to a missile? Currently trying to use camCreate and attachTo.

brazen lagoon
#

@winter rose did this, didn't seem to work: sqf this addEventHandler ["HandleDamage", { params ["_unit", "_selection", "_damage", "_source", "_projectile", "_hitIndex", "_instigator", "_hitPoint"]; if (_damage > 0.9) exitWith { 0.9; }; _damage; }];

winter rose
brazen lagoon
#

ah

wind hedge
fossil peak
#

Is there a way to add an action to an object only for specific players, I wanna make a tp available to only marksman in the team so that the rifleman don't get a bunch of dmr's from the marksman cache

#

but like on an object and not present all the time for that specific group

#

if anyone has an answer pls ping me I'm off to bed

winter rose
little raptor
winter rose
little raptor
#

Only add the action on that unit's machine

little raptor
#

Looks old tho meowsweats

#

Does it still apply?

winter rose
#

one way to find out! πŸ˜„

#

people asking about that had the issue IIRC, but it is still a good thing to try an if exitWith in e.g a HandleDamage

#

so we can "still in 2.06" mark the note

little raptor
#

it doesn't make sense tho. exitWith is almost literally call {} breakOut "scope"

#

or maybe it works like apply? πŸ€”

fossil peak
#

To that units machine?

#

Well like obviously I could do that. Doesn't mean the players would actually follow that lol

little raptor
#

I would say if it doesn't work it is the apply thing

little raptor
#

Like rearm, inventory, etc.?

fossil peak
#

Doing a simple teleporter script on a tent with no doors so that people with the machine Gunner role for example can have the action to scroll wheel on it and hit "enter tent" and then teleported inside tent where there's a cache of weapons. This would use the addAction function

#

I don't know how I'd specify in the addAction function that only certain players can see it

little raptor
#

Ok then use remoteExec

fossil peak
#

How does remote exec help with that?

little raptor
#

And you can also modify the addAction's condition

little raptor
#

They're only visible on the PC where the action was added

fossil peak
#

The action is just added in the init of the tent

#

It's worked on servers before

#

For me

#

And other players

little raptor
#

That's why

fossil peak
#

So how would I go about doing a local execution. I'm not like a master coder lol

little raptor
#

Depends. Can the player's role change during mission? (Like that marksman thing you said)

winter rose
fossil peak
#

Nah they can't change

#

I can literally just give a variable to each person of each class

#

There are only a few of each type

little raptor
fossil peak
#

Okay what I have right now is the basic way where it's like addAction name, runsqf;

#

How do I add the condition to that

little raptor
#
_this in [unit1, unit2, unit3]
little raptor
fossil peak
#

Like I see that theres a condition in there that's possible but don't I then have to include a ton of other stuff in front of it

#

To actually just get a condition

little raptor
winter rose
#

ah yeah, mayhaps
I don't know if it is an unscheduled/return value code synchro thingy

fossil peak
#

So just to get a condition I need the bloody argument priority hide show and shortcut

little raptor
fossil peak
#

Aight

#

Thanks

elder sail
#

I've been playing around with the radio commands and have one that calls a script to replace the players' gear as a test. After testing I noticed when it's used it'll run the script for all players rather than the person who called it. Is there a way to make it run locally for the player that calls it?

willow hound
#

Triggers make me angry 😠

#

Triggers are already entirely local. The way you describe it it appears Arma synchronises the radio activation across all clients.

elder sail
#

That would make sense, it only became an issue after running the script through the radio

willow hound
#

I don't see a way to solve this problem right now. Each client has its own trigger that then fires at the same time as the other client's triggers, there's no remote execution involved, every client resolves the On Activation code locally. I don't see a way to get the original source that made the radio input.

elder sail
#

I appreciate you looking into it. Been spending a lot of quality google time without success myself. Thinking I'm just gonna have to bite the bullet and learn how to make a gui menu

#

Thanks for the help though

willow hound
#

Is addAction not an option for your use case?

elder sail
#

I was doing everything with addaction for a while but I've got a few "abilities" id like to give players and they were cluttering up the scroll menu/making selecting the desired option difficult

#

That's why I was gonna move them to radio commands, but evidently that wasn't a good idea

#

Might just make a single addaction entry that opens up a submenu for the others

digital rover
#

Why not use the roleDescription in the condition? condition: sqf "'marksman' in toLower (roleDescription player)"

digital rover
#

hm

#

yea

#

could use classnames?

#

My unit uses the correct classes for all our units, makes life simple.

winter rose
#

the thing is: what makes a marksman or a sniper? the rifle, the outfit, the starting slot?

digital rover
#

Actually I don't think role description is localised, as it's a property of a unit in Eden and not the config or anything

still forum
#

and objNull == objNull always returns false, and will return true once player is !null

#

Why would anyone do that tho :u
player==player established itself as "the standard" back in Arma 2. Even though its somewhat stupid and there are better solutions

winter rose
#

even I used it, and isNull exists for a long time so I don't get where the hype came from!

still forum
#

yes and no. If the unit is local to you, local will be true.
For units placed in editor, local is usually only true for the script that runs on serverside.
It could be a AI posessing the unit too, which would make it !null

little raptor
winter rose
#

correc'

still forum
#

If the side is west then no. Because you do 4x if, 4x then, 4x playerSide, 4x isEqualTo.
Wheras the switch will just jump out at case east

Also if you want know performance of scripts, you can always just check in debug console.

if then -> 0.0028ms
switch -> 0.0016ms

still forum
still forum
#

that is probably the best, according to wiki

still forum
#

0.0013ms

winter rose
#

supah importanter!!1!

#

but the most important:

#

πŸ˜‰

little raptor
#

I just tested and it is true

still forum
#

If I knew I'd have already answered

little raptor
#

but makes no sense

little raptor
winter rose
little raptor
#

KK is scarier than Dedmen! πŸ˜„

#

not gonna ping him! meowsweats

winter rose
#

but Dedmen is a giant orange fox!!

willow hound
little raptor
winter rose
#

fight talk then πŸ˜„

little raptor
willow hound
idle jungle
#

If I put name setPos[getPos x]; in a onPlayerRespawn.sqf

When that specific player respawns will he teleport to x position?

#

Name being variable name

little raptor
#

no

idle jungle
#

Ah trying to make specific respawn points for specific units

#
 { case "zulu": { player setPosATL getmarkerpos "respawn2"; };```

Would that be it? Sorry for format  on mobile
winter rose
#
player setPosATL getMarkerPos "respawn2";
idle jungle
#

Edited message

fallow quarry
#
if (!isNull playerUAV) exitWith {
    player groupChat "You already have a UAV";
    //--- Disable targetting.
    {(gunner playerUAV) disableAI _x} forEach ["TARGET","AUTOTARGET"];
};

if (!isNull playerUAV) then {if (!alive playerUAV) then {playerUAV = objNull}};

_uav = createVehicle ["MQ9PredatorB",getPos player, [], 0, "FLY"];
_uav removeWeapon "HellfireLauncher";
playerUAV = _uav;
processInitCommands;

_group = createGroup west;
_driver = _group createUnit ["USMC_Soldier",getPos _uav, [], 0, "FORM"];
_driver moveInDriver _uav;

_gunner = _group createUnit ["USMC_Soldier",getPos _uav, [], 0, "FORM"];
_gunner MoveInGunner _uav;

uavmodule synchronizeObjectsAdd [uavterminal, playerUAV, player]; 
#

this is what i am using

#

uavmodule is added by the mission editor

#

just as uavterminal

#

on a dedicated server, UAV action is missing from the terminal, however it is spawned and all variables are assigned

silk ravine
# still forum yes and no. If the unit is local to you, local will be true. For units placed in...

So basically it still does what I need it to do.
When its editor placed and is AI and I call a server script asking if the unit is local and its not a HC it will return true, but it won't return true but false if the same script is called severside and the same unit has been slotted with a player. Because now the object is local to the connected client with hasInterface? Therefore the serverside script asking if local returns false.
If called locally by the onPlayerRespawn it will return true because obviously its local.
Locality make brain go poof

silk ravine
tame axle
#

Hi all. How can i get a satchel or explosive charge to activate a trigger when they blow up?

winter rose
tame axle
#

Well, want to be able to place it from a player.

wind hedge
#

For some reason I cannot post SQF code... the server rejects it with "Your message could not be delivered" message even thou I have 200 characters left to spare and I am not quoting anyone... why is that?

winter rose
#

your free support trial has expired πŸ˜„

wind hedge
winter rose
#

```sqf

this is a test

// test

hint "test";
```

try this?

wind hedge
#

Perhaps it was too long? Even thou it said I had characters to spare

winter rose
#

so you can

and since the Discord limit is 2k chars, yeah… post a link instead thank you πŸ‘€

wind hedge
winter rose
#

sqfbin

wind hedge
#

Ok so according to what Lou said, and KK wrote years ago on the wiki and Dedmen failed to comment on and therefore almost confirmed it... this code wouldn't work right on an EH: https://sqfbin.com/izobamumocuziyotuxav

#

I am asking because I've seen ExitWith being used in LOTS of mods and by very experienced modders/coders too... so all those mods and scripts are broken and they don't even know about it...

#

I could warn a few of them so they can change their EHs

winter rose
#

see exitWith's page on th wiki yeah

#

and no need to post all this to ask a question about exitWith, plz simplify πŸ˜…

winter rose
wind hedge
#

And the poor guy doesn't know that exitWith is broken inside EHs

winter rose
#

well now he knows, because you pinged him

thank you, really! we can't have fun anymore…

wind hedge
winter rose
#

exitWith

wind hedge
winter rose
wind hedge
copper raven
#
// do this in some init field
TAG_sideSwitchMap = [west, east, resistance, civilian] createHashMapFromArray [{"west"}, {"east"}, {"resistance"}, {"civilian"}];

call (TAG_sideSwitchMap getOrDefault [playerSide, {"default"}])

constant time πŸ˜„ and fastest

winter rose
#

createHashMapFromArray [{"west"}, {"east"}, {"resistance"}, {"civilian"}];
what

#

oh. secondary syntax.

#

don't mind me

tired delta
#

Hello guys, i got a problem with passing an argument to antoher script. I want to pass an Object identified by its "VehicleVarname" to a script. I tryed it with "call" but i get the error "Error Call: Type string, expected code". Im using this code to identify the object and pass it to another file.

[_vendor] call "myScript.sqf";```
patent lava
#

note that call and execVM behave differently: when calling "call" the script will wait until the script you are calling is complete, that's not the case with execVM, which will execute the script and proceeds to the next line while the script you execVM'ed could still be running

tired delta
#

ahh i see thank you i will try it

#

@patent lava It worked! Thank you ❀️

tired delta
#

@patent lava im having a problem im using a function for that because im doing somthing for an altis life server. execVM dose only work for calling files by thier names. What can i do else to make it work?

digital jacinth
patent lava
#

with this method you can define .sqf files as functions, and then you can either use the call or spawn function

#

lets say you have a file named "fn_myScript.sqf" and you define it following the linked page

#

you can call it this way:

[player] call MYTAG_fnc_myScript;
// or
[player] spawn MYTAG_fnc_myScript;
tired delta
#

@patent lava can i use it also like this?
_vendor call life_fnc_myfunction

#

because i need the vendor with is an object to be transferd into the other script

patent lava
#

yes, thats what the argument array is for

still forum
#

Anyone need a setVelocity with more than 5km/s speed?

cosmic lichen
#

We need at least 299.792.458 km/s πŸ˜›

cosmic lichen
little raptor
#

oh Km/s?

#

I don't think so

#

I thought you said per hour

still forum
#

I'm applying the same limit this as setPos has

little raptor
#

good

still forum
#

And i also fixed the memory leak/game crash when you go out of bounds so far (which is the reason for what the setPos limit was introduced)
so technically we don't need that anymore buuuuuuut

little raptor
still forum
#

Same kind of limit

little raptor
#

ok

#

Well even 5 km/s is absurdly large for a game engine like Arma

#

So I'd say it's good

fossil peak
#

Okay I must be stupid or something but why isn't this working.

this addaction ["Rifleman and medic tent","Riflemantele.sqf",this in [team1, team2, team3, medic1, medic2, medic3]];

Its supposed to only add that action to a tent for the players that have those variables on their player character so that other players can't use it. The code is just placed in the init of the tent. When I tested it it still added the action to everyone that wanted to interact with it

#

I tried using _this but it was complaining that its a local variable in global space

winter rose
#
this addaction [
  "Rifleman and medic tent", // name: OK
  "Riflemantele.sqf", // script: OK
  this in [team1, team2, team3, medic1, medic2, medic3] // boolean: WRONG
];
fossil peak
#

I've looked at it, I'm pretty bad at coding and it hurts my brain to read lol everything I've made so far is so bodged

winter rose
#

the simplest way would be to use```sqf
if (player in [team1, team2, team3, medic1, medic2, medic3]) then
{
this addaction [
"Rifleman and medic tent",
"Riflemantele.sqf"
];
};

fossil peak
#

thanks for the help though

supple matrix
#

Is there a reason why would anybody do:
call {[params] call SomeFunction};
instead of just:
[params] call SomeFunction;
in vehicle's INIT field in mission?

winter rose
supple matrix
#

btw. just out of curiosity, what was that issue?

copper raven
#

the top level scope of an init had some extra linting stuff

winter rose
#

the init field could not have any value, e.g [] spawn {}; returns the spawn handle
so you had to do an awful 0 = [] spawn {};

copper raven
#

its just nonsense, thats the easiest way to describe it πŸ˜„

#

because call {[] spawn {}} worked fine, though it still returned a script handle

supple matrix
#

πŸ™‚ this rings a bell now

undone flower
#

is there an EH that fires when a vehicle weapon/magazine runs out of ammo?

past gazelle
#

How can I make a trigger to determine if a specific vehicle enters an area? (Not a type of vehicle, by the variable name is fine)

#

Would that have to be game logic?

#

(player needs to deliver truck to specific location)

undone flower
past gazelle
#

Ah! Right, not player...Gotcha!

winter rose
#

yep
use the "fire" EH and check if the mag still has something

undone flower
tired delta
#

Hello its me again. I managed to get my script working but when i use it on my dedicated server the "#particlesource" is not emmiting particels. Dose someone know what im doing wrong?
The Code:

    ["_nObject",objNull,[objNull]]

];
_pos = getPos _nObject;
    _smoke = "#particlesource" createVehiclelocal _pos;
    _smoke setParticleParams [
        ["\A3\Data_F\ParticleEffects\Universal\Universal", 16, 7, 16, 1], "", "Billboard",
        1, 8, [0, 0, 0], [0, 0, 2.5], 0, 10, 7.9, 0.066, [2, 6, 12],
        [[0, 0, 0, 0], [0.05, 0.05, 0.05, 1], [0.05, 0.05, 0.05, 1], [0.05, 0.05, 0.05, 1], [0.1, 0.1, 0.1, 0.5], [0.125, 0.125, 0.125, 0]],
        [0.25], 1, 0, "", "", _smoke];
    _smoke setParticleRandom [0, [0.25, 0.25, 0], [0.2, 0.2, 0], 0, 0.25, [0, 0, 0, 0.1], 0, 0];
    _smoke setDropInterval 0.1;
    _smoke attachTo [_nObject, [0,0,0]];
diag_log "Smokeisda";
sleep 19;
deleteVehicle _smoke;```
undone flower
winter rose
#

nah

#

because you break execution after only checking if the magazine is 0
I don't think you can fire more than once per frame πŸ˜›

winter rose
hexed crown
#

As long as your gun fire rate isn't greater than your fps*60. 180 per minute at least. Don't know why you would ever willingly play ARMA with only 30fps.

winter rose
#

even if it were, an ammo check is not much

hexed crown
#

Just a single var check per frame. < The thousands of lines of codes that are regularly executed every frame.
I don't know, it might be too intensive.

#

lol

undone flower
#

how do I refer to the event handler object? I use _this?

winter rose
#

no

little raptor
winter rose
#

there is a doc, read it indeed πŸ˜‰

undone flower
#

I did this... like, yesterday 🧠 redchain

winter rose
hushed tendon
#

I'm trying to make a basic fortification system kinda like ACEX fortify and Plank but I'm not sure how I should update the preview object to be in front of the player. I have functions to update the dir, pos, etc but I'm not sure how I should keep calling those without killing frames.

little raptor
#

but you won't be killing frames if you do the manual way properly

#

I don't know why you want "functions to update the dir, pos,"

#

just use modelToWorldVisualWorld and vectorModelToWorldVisual

hushed tendon
little raptor
#
  • AGLtoASL
#

if on terrain

#

otherwise use getPos

hushed tendon
little raptor
#

eachFrame EH is better

#

but create the preview object locally

hushed tendon
little raptor
#

yes

hushed tendon
#

Now I just got to wrap my head around how I'm going to order this

winter rose
#

properly

#

easy!

hushed tendon
#

You guys know a good planner website that has those automated shapes and arrows so you can see the flow of things?

little raptor
#

also FSM Editor 🀣

little raptor
still forum
hushed tendon
cold mica
undone flower
undone flower
# winter rose because you break execution after only checking if the magazine is 0 I don't thi...

ok, so, since the vehicle has multiple magazines, I need to keep track of them efficiently. the event handler is set and working. I've tried using someAmmo, but it also takes into consideration vehicle countermeasures. it would only fire the condition after I've spent all the ammunition including the countermeasure magazine, which is something I don't want happening. the script must check if any of the magazines is empty (magazinesAmmo?) and the magazine that is empty, disregarding the others.

winter rose
#

someAmmo is not to be used in that case

#

and all you need to do is check if the currently fired magazine is empty
because a magazine cannot evaporate and empty by itself πŸ™ƒ

undone flower
#

will think of a way to do this without being more inefficient than bogo sort

winter rose
#

the "Fired" EH provides weapon and muzzle
you can do something with that and ammo I guess

undone flower
winter rose
#

most likely.
what are you trying to do?

undone flower
winter rose
#

https://community.bistudio.com/wiki/setAmmo

If you try to set more ammo than the magazine can hold, it will be clipped at default magazine capacity

if you want to do an unlimited ammo, just do a setAmmo on every shot

winter rose
undone flower
undone flower
#

it's infinite ammo, but you must reload

winter rose
#

"cooldown", not really reload right?

undone flower
winter rose
#

also, inserting a fresh new ammo is doable

#

grab the mag class, insert in weapon, ready

undone flower
winter rose
#

yep
and instead of toying with setAmmo, you can simply slap a new mag

#

see addPrimaryWeaponItem

undone flower
hushed tendon
#

I'm trying to return _fortID from WAG_fnc_createFortification to use in WAG_fnc_startFortPlacement for [_player, _fortID] spawn WAG_fnc_updateFortPlacement; but I'm getting an undefined variable error. Anyone know what's up?

WAG_fnc_startFortPlacement = {
    _player = (_this select 0);
    _fortArray = (_this select 1);

    if ((_player getVariable ["WAG_object_placementState", STATE_PLACEMENT_INIT]) != STATE_PLACEMENT_IN_PROGRESS) then {
        removeAllActions _player;
        _player setVariable ["WAG_object_placementState", STATE_PLACEMENT_IN_PROGRESS, false];
        [_player, _fortArray] call WAG_fnc_setFortVariables;
        [_player] call WAG_fnc_createFortification;
        //[_unit] call plank_deploy_fnc_addPlacementActions;
        [_player, _fortID] spawn WAG_fnc_updateFortPlacement;
    };
};

WAG_fnc_createFortification = {
    _player = (_this select 0);

    private _fortClassname = _player getVariable ["WAG_fortClassname", objNull];
    private _fortID = createVehicle [_fortClassname, [0,0,0], [], 0, "NONE"];
    [_player, _fortID] call WAG_fnc_setFortDirection;
    [_player, _fortID] call WAG_fnc_setFortPosition;

    _fortID;
};
robust tiger
little raptor
#

also you can't return anything from a spawned code

#

it simply gives you the handle to the spawn

#

oh nvm

#

you're calling it

hushed tendon
#

yeah

hushed tendon
little raptor
#

createVehicleLocal doesn't have such syntax

hushed tendon
#

dang

undone flower
winter rose
#

won't

#

but you can addMagazine / addMagazineTurret etc

if you want to cover both, maybe your previous version is better (or you could check if one is human, etc)

supple matrix
#

How to open/close the cabin door on Caesar BTT using a script?

supple matrix
# winter rose try `animateDoor`

i tried animate, animateDoor, animateSource, all with various sources like door_l, door_r, door_l_open, door_r_open, and even cabin just in case, but nothing works.

supple matrix
tired delta
#

Hey Guys its me again. I still got the Problem that the "#particlesource" dose not emit particles on my dedicated server. My script works on singelplayer (editor).
Here is what i did:
Im calling the script via remoteExec like this:
[_nObject] remoteExec ["life_fnc_myParticleFunction", 0];
The code of the Partikelscript looks like this:

    ["_nObject",objNull,[objNull]]

];
diag_log "Script called";
_pos = getPos _nObject;
private _smoke = "#particlesource" createVehiclelocal _pos;
    _smoke setParticleParams [
        ["\A3\Data_F\ParticleEffects\Universal\Universal", 16, 7, 16, 1], "", "Billboard",
        1, 8, [0, 0, 0], [0, 0, 2.5], 0, 10, 7.9, 0.066, [2, 6, 12],
        [[0, 0, 0, 0], [0.05, 0.05, 0.05, 1], [0.05, 0.05, 0.05, 1], [0.05, 0.05, 0.05, 1], [0.1, 0.1, 0.1, 0.5], [0.125, 0.125, 0.125, 0]],
        [0.25], 1, 0, "", "", _smoke];
    _smoke setParticleRandom [0, [0.25, 0.25, 0], [0.2, 0.2, 0], 0, 0.25, [0, 0, 0, 0.1], 0, 0];
    _smoke setDropInterval 0.1;
    _smoke attachTo [_nObject, [0,0,0]];
diag_log "smoke spawned";
sleep 19;
deleteVehicle _smoke;```
The script gets executed and i can tell that by the diag_log in the scripts that is beein outputed.

Oh and when i do swap the _smoke part with a smoke grenade like this:
```_smoke = "SmokeShellRed" createVehicleLocal _pos;```
The grenade spawns even wtih the throwing sound but dose not emit smoke, just the object is getting spawned and attached there.
supple matrix
brittle harness
#

privateο»Ώ _dummy = selectRandom thisList spawn
{ ο»Ώ
private _grp = group pc1;
privatο»Ώe _wp = _grp addWaypoint [position _this, 0];
_grp setCurrentWaypoint _wp;
waitUntil
{
sleep 2;
_wp seο»ΏtWaypointPosition [position _this, 0];
not alive pc1 or not alive _this
};
};

fair drum
#

I have been pinged?

supple matrix
# tired delta Hey Guys its me again. I still got the Problem that the "#particlesource" dose n...

One more thing... i recall i had to attach the particle emitter to player, or to player's vehicle if the player was in one, otherwise there was some problem and i think the problem was that the particles weren't showing.

I even had to use GetInMan/GetOutMan eventhandler for every player, where i would keep reattaching the emitter to (vehicle player).
EDIT: that probably had to do something with the particle emitter getting left behind at the spot where player entered vehicle, so i had to reattach the emitter to the vehicle, and then obviously back to player if player exited the vehicle.

fossil peak
#

it doesn't say

supple matrix
tired delta
#

@supple matrix thank you 4 your reply ❀️ but there must be another way or something im missing because it works when i use it on the editor and i got it to work on the server but i lost the progress and i dont know how i did it 😦

tired delta
supple matrix
#

What is the _nObject?

undone flower
supple matrix
tired delta
#

do i need the parameter part then?

#

i mean Parms in my script thats getting called

supple matrix
#

You mean the param? that is for convenience, you can keep that.
Anyway, sorry, i was mistaken, i think you are passing the object to remex just fine, i just got confused πŸ™‚

#

Does the nObject exist on the client? isn't it something local to somebody else existing on some other machine only? (like something created with a create...Local command?)

tired delta
supple matrix
#

@tired delta did you try writing _pos to the diag log?
...just to see where that particle emitter really gets created

tired delta
#

yes and i get a pos out of it πŸ˜„

supple matrix
#

and the position is not somewhere far away from your player? or under the terrain?

tired delta
#

no because when i cahnge the code to spawn a smokegernade and attach it to it , it spawns and gets atteched

#

@supple matrix its just strange that the particle dont emit

cunning oriole
tired delta
#

oh sorry πŸ˜„ by called i mean that the script gets executed

cunning oriole
#

yhyh, just making sure we are not missing something obvious πŸ™‚

tired delta
#

thank you πŸ˜„

cunning oriole
#

Have you check your server rpt to see if throwing any errors, i dont rlly see why it would be but just in case?

tired delta
#

i did but no errors on server or client

#

i think im missing somthing but i dont know what. I wrote earlier that i made it work in an early stage but lost the Progress and now im struggling to find out how to fix it

hushed tendon
#

I'm trying to set the _fort object to be in front of the player (as done in modelToWorld) but I'm also trying to make the object snap to the surface below it so that way I can move the object to be on the surface of buildings. I've tried a lot of stuff but I can't seem to get it to work.

_player = (_this select 0);
_fort = (_this select 1);

private _newPostion = _player modelToWorld [0, (_player getVariable "WAG_fortDist"), 0];
_fort setPos _newPostion;
brazen lagoon
undone flower
#
/*
Infinite ammo for vehicles.
A cooldown at the end keeps vehicles from spamming weapons endlessly (needs to be implemented)
*/


{

_x addEventHandler ["Fired", {

    params ["_unit", "_weapon", "_muzzle", "_mode", "_ammo", "_magazine"];
        
        if ((_unit ammo _muzzle) == 0) then {

            // _unit setAmmo [_muzzle, 3000]; // works but has issues.

            _unit addMagazine (currentMagazine (vehicle _unit)); // limited (something wrong with the condition?)
            
            reload _unit;

        }; //end if


    }]; //end EH

} forEach vehicles;

/*
Issue: only resupplies the last weapon of a kind fired. If a vehicle has two or more identical weapons (share ammo and weapon slot) only the last weapon that fires will be resupplied. take two rocket pods as an example. both are fired at once. The counter reaches 0, the script resupplies but only one of the pods (last fired) is resupplied.

Issue: only works on the last magazine spent. A tank cannon has three magazines: HE, HEAT and AP. If one of those magazines are spent, nothing happens. this happens because the condition (ammo muzzle == 0) is only considered 0 (empty) when there are no more magazines, as observed: when there's magazines left and one magazine has been just spent, the ammo counter does not reach '0', but instead counts the ammo on the new loaded magazine.
*/

If someone knows an approach to the issues above, please contact meee

tender fossil
#

What are people's tricks to shorten the iteration cycle when you're developing an UI or scripting something (including a multiplayer mission)? Any ways to do hot reloads of the edited files or something like that?

past gazelle
#

I think if you use execvm which calls the sqf directly you can hot edit the file...but I've never tried it...

#

I've been thinking the same thing lately...

somber radish
#

(No idea if I explained that correctly)

bitter stone
#

Hi all. Unsure if this is the correct # to put it in, but happy to be redirected if not.

I'm making a couple of derivative Ammo Boxes from Base Game, changing the displayName and tweaking maximumLoad slightly. I'd like to have the new displayName from the config (e.g. "My special ammo box 1" & "Not so special ammo box 2") display on screen when you're looking at it, similar to when player names display. I'm at a loss as to how to do this though - whether it be a tag inside the config.cpp of the mod, or it needs to be an EH of some kind, though I've scoured that list as well and can't find something that's appropriate.

Does anyone have a suggestion on how to do this?

brazen lagoon
brazen lagoon
#

Is there any way to script it so that tasks don't show up everywhere? like only show tasks within a few km

copper raven
copper raven
copper raven
bitter stone
little raptor
#

Why do you use currentMagazine?

little raptor
winter rose
little raptor
#

oh meowsweats

#

but anyway as sharp said, it's a bit of a hassle to do in MP

#

not sure if BIS_fnc_recompile does that automatically πŸ€”

winter rose
#

remoteExec it πŸ˜„

#

I believe it to be local, and in a way I hope it is

little raptor
#

the function is changed locally tho meowsweats

copper raven
#

nothing happens if you remote exec it, the source files on the client are still the old ones

winter rose
#

I mean, remoteExec the recompile function to recompile everywhere

digital rover
#

I'd like to simulate a laggy, desynced, low fps server for bug testing. Any ideas how to do that?

winter rose
#

run it on Windows 95

#

…or run a VM with limited resources, network-limited with a low setting

digital rover
#

I tried to get Win95 running in a VM but it doesn't work πŸ˜‚

#

VM server isn't a bad idea

winter rose
#

you can attribute CPU, RAM & network in a VM

digital rover
#

Yea that'll work I think

#

I've not used virtual box in about 10 years, this'll be fun

copper raven
hushed tendon
# copper raven you mean snap to terrain?

No. I have the object in front of the player at a certain height and from there I’m trying to make the object go down until it hits a surface (terrain or building)

winter rose
#

snap to surface then

hushed tendon
winter rose
#

lineIntersects then setPosASL?

hushed tendon
#

Alright

hushed tendon
winter rose
#

IDK, the wiki does

hushed tendon
#

I guess I’ll just have to guess then but it seems like it

#

Considering it says right below it
"See also: modelToWorld, worldToModel, modelToWorldVisual..."

little raptor
winter rose
#

don't guess, read

little raptor
#

setPos
Sets object position to format PositionATL (over terrain) or PositionASL (over sea).

#

this is completely wrong

winter rose
#

Fix it then πŸ˜„

hushed tendon
#

Well it seemed to work so I kinda didn’t bother looking at what it took in meowsweats

winter rose
#

yeah, it works in that case

little raptor
#

as I said before it's neither AGL nor AGLS

#

actually it's both...

#

Β―_(ツ)_/Β―

winter rose
#

yeah, but I don't have anything with what to replace it, so I am not just deleting the description, I need a replacement

little raptor
#

Sets object position to a format that is sometimes AGL and sometimes AGLS! 🀣

winter rose
#

if you want to make a small paragraph in the notes I can link to it in the description

hushed tendon
#

You guys know where I messed up here?

private _begPosASL = AGLToASL (_player modelToWorld [0, (_player getVariable "WAG_fortDist"), 0]); //Object pos without checking for surface
private _endPosASL = _begPosASL;
_endPosASL set [2, 0]; //Getting same pos as object but setting Z axis to 0 to get the furthest position below object

_intersections = lineIntersectsSurfaces [_begPosASL, _endPosASL, _fort, objNull, true, 1]; //Ignores the object
_newPos = (_intersections select 0); //Getting the position of the first surface below the object
_fort setPos _newPos; //Sets object to the surface below it hopefully
winter rose
#

why not using modelToWorldVisualWorld directly

winter rose
hushed tendon
winter rose
#

why ask me…

#

the
wiki

hushed tendon
#

Well it finally works. Ty Lou

winter rose
#

why thank me…
πŸ˜„

little raptor
#

wrong

#

_intersections is an array of arrays, in format [intersectPos,....]

#

It may be empty.
the correct way is:

_newPos = _intersections param [0, [_begPosASL]] select 0;
#

_fort setPos _newPos;

#

wrong

#

_newPos is ASL

#

stop using setPos for the love of god notlikemeowcry

#

and I don't mean just here

#

forever

hushed tendon
undone flower
# little raptor Why do you use currentMagazine?

oh yeah I forgot to remove that. it was an workaround to an issue I had. I had params set up like ["_unit", "_weapon", "_muzzle", "_magazine"], and when I added _magazine it would say magazine not found... I printed _magazine with a hint and its returns was "burst", "manual", etc. same as _mode. I thought: the _magazine param occupies index 3, same as _mode if I didn't erase what I didn't want to use. so, _magazine is actually a renamed _mode in this case. I didn't know the params worked such way.

little raptor
#
[1,2,3] params ["_var1", "_var2", "_var3"];
#

when the left argument is omitted, it's simply _this

params [...];
//is the same as
_this params [...];
undone flower
#

fixed that. now to fix the real enigmatic issues

undone flower
little raptor
#

not sure about the first one

undone flower
digital rover
#

Anyone got a reliable hack for getting selectPlayer to actually be reliable in MP? Seems to mess up and fail to transfer locality sometimes, or something like that, I'm not 100% sure what the issue is but it ends up with the player in an uncontrollable unit

I'm thinking pfh that is something like (pseudo code as I'm on mobile)

if !(local _unit) then { 
[_unit, clientOwner] remoteExec [setOwner, 2]
} else {
selectPlayer _unit
_pfh call removeperframehandler
}

But I'm not sure I'm barking up the wrong tree with what the actual issue is

#

Must not contain group switching :/

little raptor
digital rover
#

The issue being selectPlayer often seems to put the camera where it needs to be, but not pass over control when used in multiplayer

little raptor
#

often seems
when do you execute it?

digital rover
#

Except it's not really reproducible and although I think it's a locality issue, I'm not 100%

#

What do you mean when?

little raptor
digital rover
#

Unscheduled function call mid mission

#

Super frustrating bug as it works most of the time, except sometimes it completely borks character controls

So I'm looking for a dumb hack that makes sure that selectPlayer actually does what it says on the tin.

#

And brute forcing the locality transfer is one idea, wondering if people have anything better from having this issue before.

little raptor
little raptor
digital rover
#

"all sorts of problems" and "some time" are such useless terms that it's hard to tell.

The problem occurs when switching to an already existing unit, however earlier in the script I temporarily switch player to a new agent inside of 1 frame, but the player doesn't need to control it so it's fine if that isn't perfect.

And besides, I actually encounter this issue in Zeus sometimes too. When remote controlling units the control is never transferred, but then also switching back to Zeus the player character is now uncontrollable. Zeus uses remoteControl but the issue is identical, so I don't think it's the mentioned wiki issue.

#

Which circles me back to thinking that the locality fails to transfer properly, or there is some deeper issue.

#

Super frustrating all around as it works fine in a testing environment, such as an unstressed server with one or two players.

somber radish
#

I activate the function using a keyDown eventhandler

digital rover
#

Have you found no way to fix the unit itself?

digital rover
#

dig more digging, it's not a locality problem

#

it's some other issue not easily fixed via script πŸ™ƒ

undone flower
#

how do I select a value from a bi-dimensional array?

digital rover
#

(_array select 0) select 0 ?
or _array#0#0

somber radish
#

tried using remoteControl

#

It seems that there is some data lost when playing on mp

#

some variable or somethign

#

If I knew what then the fix would be easy

undone flower
#

is there a way to force an unit to use/reload a certain magazine?

#

loadMagazine, I suppose?

digital rover
#

loadMagazine is for vehicles, I'm not sure if you can do it for units

digital rover
#

except I can't reproduce it on my own server in vanilla!

frail flume
#

Ok spent today struggling with some scripting (im not anygood at it) and what seemed like It should be really easy has led me around in circles, Basically I have done most of an intro script and need to add an image to it at the top then its done but looking at stuff has sent me around in circles. I have it so it blacks the screen at start puts my text up then fades back in etc, but need an image displayed on the top centre of the screen whilst this is happening? if anyone is around to help it would be appreciated.

undone flower
little raptor
#

you can also play the reload animation if you care

#

but there is no actual magazine animations

#

just the hands moving

undone flower
# little raptor do it manually

my infinite ammo script works very well if there's a reloadtime in the weapon's cfg. I gave a infantrymen one magazine to work with, and fired 300 bullets like he was full of ammo, with reloads every 30 rounds. the problem (I think beyond my reach) is when there's no reloadtime defined or it is 0. happens most of the time with weapons that aren't supposed to have any spare magazines. they reload instantly and consequently fire the next shot very fast in the case of missile launchers or an infinite hail of bullets in the case of cannons and machineguns

somber radish
undone flower
#

anyone knows a way to return an array of only ground vehicles? non-dynamic loadout vehicles would be an even better return

copper raven
#

vehicles select {getPylonMagazines _x isEqualTo []} the dynamic loadout part is a guess

#

actually wait, are there even any ground vehicles with dynamic loadouts?

#

that might be enough, edited

undone flower
copper raven
#

to return an array of only ground vehicles

undone flower
#

was talking about the "non dynamic loadout" vehicles part :P

digital rover
undone flower
copper raven
#

yeah, incase it doesn't, the next option is looking up config, that will 100% be right

digital rover
#

that is what isKindOf does

copper raven
#

yeah but there isn't a class that all dynamic loadout vehicles inherit

#

i guess you can do !("dynamicLoadout" in typeOf _x)

winter rose
#

but then that's classname-based, and mods may not follow that format πŸ˜”

copper raven
#

!isClass (configOf _x >> "Components" >> "TransportPylonsComponent")

undone flower
#
} forEach vehicles |!|select {getPylonMagazines _x isEqualTo []};
```  I'm getting type number, expected array in this syntax bleh
copper raven
#

or count (configOf _x >> "Components" >> "TransportPylonsComponent" >> "Pylons") > 0

#

yea because you have a precedence issue

#

(({...} forEach vehicles) select {getPylonMagazines _x isEqualTo []}) is the precedence

sharp grotto
#

Does it make sense or provides any advantage (speed/execution time) if you define the player once _playerObject = player; and then use _playerObject ~Command~ instead of repeatedly doingplayer ~Command~
(inside a script/function)

winter rose
#

I don't think so, but… an engine dev might help here to make it certain
anyway, the gain would be negligible at best

little raptor
#

the gain would be negligible at best

#

and yes

winter rose
#

you think a local var faster than a command? (or maybe you know though)

little raptor
#

it is

winter rose
#

okido, kewl!

#

not opti worthy but still cool

little raptor
#

based on my test just now:

player
```->0.00077 ms
```sqf
_this
```->0.00048 ms
#

like ~0.0002-3 ms faster meowsweats

#

if you use it like a few thousand times in a script it is worth it

#

otherwise no

winter rose
#

if the assignation itself does not counter that 🀣

little raptor
#

also if the local variable is not private I'm expecting it to be slower maybe

winter rose
#
private _value = player; // 500ms :D
sharp grotto
#

thanks guys πŸ‘Œ

little raptor
sharp grotto
undone flower
#

how'd you all put a sleep instruction in an EH?

little raptor
undone flower
# little raptor spawn

aight. I'd need to spawn a function and execute the code I want there, correct? I'd like to use the params the EH gives in the function

little raptor
#

just use:

_this spawn fnc
undone flower
little raptor
#

what is "EH's output"?!

undone flower
#

the param stuff

little raptor
#

yes

undone flower
#

I'll see how it works

digital rover
ornate marsh
#

trying to get a image from my mission folder into this command, however it doesn't seem to work. The img folder is in my mission folder:

vultureIcon = addMissionEventHandler ["draw3d", 
{
    _pos = player getPos [10, 0] vectorAdd [0,0,2];
    _k = 8 / (player distance _pos);
    drawIcon3D 
    [
        "img\vultureaidlogo.paa", 
        [-1,-1,-1,-1], 
        vulture,
        1 * _k, 
        1 * _k, 
        0, 
        "", 
        0, 
        0.04 * _k, 
        "RobotoCondensed",
        "center", 
        false, 
        0.005 * _k,  
        -0.05 * _k
    ]; 
}];
little raptor
#

also path to the icon must be absolute in the case of missions

digital rover
ornate marsh
little raptor
little raptor
frail flume
#

Problem solved my friend who codes managed to help me through the final bits!

ornate marsh
#

oh right, thought that was white, my mistake

tough abyss
#

anyone free i need some assistance on adding a range to my add action im struggling to understand it. Don't send me the wiki i been using it and still don't understand it.

little raptor
#

also plz use syntax highlighting

wicked roostBOT
#
How to use SQF syntax highlighting in Discord

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

// your code here
hint "good!";
tough abyss
#

Trying to convert this

this addAction["<t color='#FF0000'>Cadet</t>", {player execVM "Cadetloadout.sqf"}];

To

this addAction
[
    "Cadet",    // title
    {
        params ["_target", "player", "_actionId", "Cadetloadout.sqf"]; // script
    },
    nil,        // arguments
    1.5,        // priority
    true,        // showWindow
    true,        // hideOnUse
    "",            // shortcut
    "true",     // condition
    50,            // radius
    false,        // unconscious
    "",            // selection
    ""            // memoryPoint
];
little raptor
tough abyss
#

no... Im trying to add a range to this script

this addAction["<t color='#FF0000'>Cadet</t>", {player execVM "Cadetloadout.sqf"}];
little raptor
#

just fill in the other arguments till you get to the range

#
this addAction["<t color='#FF0000'>Cadet</t>", {player execVM "Cadetloadout.sqf"}, nil, 1.5, true, true, "", "true", 10];
#

10m range

tough abyss
#

ok so wiki just got me confused when I saw this

this addAction
[
    "title",    // title
    {
        params ["_target", "_caller", "_actionId", "_arguments"]; // script
    },
    nil,        // arguments
    1.5,        // priority
    true,        // showWindow
    true,        // hideOnUse
    "",            // shortcut
    "true",     // condition
    50,            // radius
    false,        // unconscious
    "",            // selection
    ""            // memoryPoint
];
little raptor
tough abyss
#

Yeah I can see that im still very new to scripting. But thank you for your help

little raptor
#

np

tender fossil
#

Thanks for the tips regarding shortening the iteration cycle @somber radish @brazen lagoon @copper raven @little raptor ! πŸ™‚

brazen lagoon
#

np, best of luck!

undone flower
#

I've done great progress on my infinite ammo script. It works for infantry and land vehicles. for vehicles with dynamic loadouts it uses a separate script. Now I just need to add a cooldown and we're all set

brazen lagoon
#

anyone have any ideas on making it possible to walk around a moving vehicle?

#

I wanna make a bus that you can walk around

#

worst case I can just make it possible to shoot from but the ideal is having it be walkable

tender fossil
brazen lagoon
#

that's what I was thinking but someone's made an add-on that lets you walk around choppers

#

gonna take a look at it and see what it does

fair drum
brazen lagoon
#

wonder how this works

undone flower
#

anyone has a clue how to detect if a weapon in a vehicle is dynamic loadout?

ripe sapphire
#
_camera = "camera" camcreate [0,0,0];
_camera cameraeffect ["internal", "back"];
showCinemaBorder true;



;comment "19:56:37";
_camera camPreparePos [3001.66,2937.74,46.1979];
_camera camSetDir ([3001.66,2937.74,46.1979] vectorFromTo (getpos nik));

_camera camPrepareFOV 0.25;
_camera camCommitPrepared 0;


_camera camPrepareFOV 0.1;
_camera camCommitPrepared 10;
#

yo bros im trying to get camera to zoom

#

but i want the transition to be 10 seconds, however with this script it zooms in immediately?

warm hedge
#

There's no sleep between two camPrepareFOV's

ripe sapphire
#
_camera camPrepareFOV 0.25;
_camera camCommitPrepared 0;

sleep 1;
_camera camPrepareFOV 0.1;
_camera camCommitPrepared 10;
#

still same result, instant zoom

warm hedge
#

How did you run the code?

ripe sapphire
#

scheduled

#

with execvm

warm hedge
#

Oh wait, I think I misread that

#

when do you want to make zoom smoothly?

ripe sapphire
#

immediately after camera created

warm hedge
#

0.25 to 0.1?

ripe sapphire
#

yes

warm hedge
#

Tried to use camSetXXX than camPrepareXXX?

ripe sapphire
#
_camera camPreparePos [3001.66,2937.74,46.1979]; 
_camera camSetDir ([3001.66,2937.74,46.1979] vectorFromTo (getpos nik)); 
_camera camPrepareFOV 0.25; 
_camera camCommitPrepared 0; 

_camera camPreparePos [3002.66,2937.74,46.1979];
_camera camPrepareFOV 0.1; 
_camera camCommitPrepared 10;

this moves the camera smoothly for 10 seconds, but fov zoom is still instant

#

yea i tried camset but same result, let me try again

#
_camera camSetFOV 0.1; 
_camera camCommit 5;

instant zoom still

warm hedge
#

If you do like, 1 to 0.1 FOV, what it looks?

ripe sapphire
#

still instant

warm hedge
#

Hmm πŸ€”

ripe sapphire
drifting sky
#

Does anybody know why I can't modify the already existing entries in cfgRecoils? Arma2:OA.

trim sentinel
#

radio addAction [ "turn on radio", {
radio say3D [ "Chatter4"]
} ];

#

The action exists when i look at the radio but is giving me an error saying that Chatter4 does not exsit

#

The sound name in the player in eden is Chatter 4 so i have tried that and Chatter4 and both give the same error and will not play the sounds

warm hedge
#

Name != className. Most of scripts needs className which is internal name declared in-game. What is the Chatter4? Did you defined it in Description.ext?

trim sentinel
#

class name isnt needed the script works fine but it is telling me chatter4 does not exist

#

when in sounds i can see it clearly

trim sentinel
#

im trying to play the sound from a radio object so idk what i would use classname for anyways

winter rose
#

what about you give us details so maybe we can find out and explain to you what's wrong?

copper raven
trim sentinel
#

{N > Chatter 1
C > Chatter1 <--
F > \addons\music\Chatter1.ogg } This is the sound name
Variable name for the radio is radio
radio addAction [ "turn radio on", {
radio say3D ["Chatter1"]
] };

Error states "Sound Chatter1 is not found"
it is from a mod I can get the sound to play with triggers using playSound "Chatter1" and it works fine,

versed widget
#

does iskindof "Boat" ever exists ?

cosmic lichen
#

Check if Chatter1 exists in CfgMusic or CfgSounds

copper raven
trim sentinel
#

do i need to do playMusic?

#

am I stupid?

winter rose
# trim sentinel am I stupid?

no, but the config might be "too short range" and only work with playSound
unless you are talking about a MP thing where others don't hear it

#

if playSound "Chatter1" works, something say3D "Chatter1" should work

trim sentinel
#

ok so this works
radio addAction [ "turn on radio", {
playMusic "Chatter1"
} ];

#

but its not 3D so its not playing from the radio

#

is there a playMusic3D?

warm hedge
#

Music is not a sound

#

There's no way to play a music in 3D space

trim sentinel
#

Can I take the file and make it a sound?

warm hedge
#

Yes. But I have no idea what is your goal so can't say how

trim sentinel
#

I just want the radio to play Chatter 1 as a 3d sound

winter rose
tender fossil
#

How can I avoid this while testing my changes?
12:03:26 Flushing file C:\Users\Net_2\AppData\Local\Arma 3\MPMissionsCache\__cur_mp.pbo not possible - still open

winter rose
#

do you save as MP then test or do you play MP from Eden?

#

(also not really scripting ^^)

tender fossil
#

I have directory symlink from my git repo folder to the MPMissions folder of Arma 3 Server folder, as I thought I could edit the files while playing the mission (but save the changes only after closing the local server)

winter rose
#

maybe use filepatching?

tender fossil
#

Now, when I save the changes after closing the local dedi server, I get that error after relaunching the server and trying to join ingame

#

Hmm, will test

#

@winter rose Still the same error

winter rose
#

then dunno

tender fossil
#

Does everyone else really shut down their game and relaunch it every time they add a missing character to a script?

winter rose
#

they usually check the script works in Eden ^^

#

using a dedi is only the last step to check locality issues

tender fossil
#

So I need to debug the same script in multiple phases because of the game not being able to hot reload a mission file? (Not even an actual hot reload since I close and relaunch the server in between)

#

-.-

#

Maybe I'm a spoiled kid but... ugh

#

I need that Dedmen version of the "Morickyyy....!" meme again πŸ˜„

winter rose
#

closing the server should release the pbo at least, if it doesn't, something is wrong or you are running yet another instance

tender fossil
#

It does release it. Or at least I assume so, because I can save the changes I made to the mission files after closing the server

#

So Windows releases the file lock at least

#

But the game keeps insisting that it can't change the __cur_mp.pbo for some reason

#

I assume it flushes/refreshes the file only if the mission pbo or folder name changes, which makes me think why

winter rose
#

I don't know your setup, anyway you can make a .bat deleting that file if everything else fails

tender fossil
#

I can't, because __cur_mp.pbo is reserved by the actual game instance

#

(Tried that already πŸ˜„ )

winter rose
#

…so you restart that game instance

trim sentinel
#

I got it to work i took the music from the mod and added a sounds folder to my missions in my profile

tender fossil
#

Unless the code controlling that is written in some really hacky way, it should be relatively simple process to force it to flush it every time unless the compiled PBO checksum is the same

upbeat quartz
#

Hello, is it possible to stop a sound after having started it with an "addAction"? I have tried several options but none of them actually work.

#
    {    
        playSound "alarm_on";  
    }   
];  
 
alarm addAction ["<t color='#8B0000'>[DESACTIVATE ALARM]</t>",    
    {    
        ???
    }    
];```
winter rose
tender fossil
#

It could be fixed though given that the issue is so simple to fix as I mentioned above, no?

#

(Filing a bug report just in case)

winter rose
#

let's build a car to see if the battery works fine

#

the proper way is:
save as (MP) mission
take the pbo
put it on the server
restart the server
test

#

anything else is cheap workaround

tender fossil
#

That all adds (unnecessary if you ask me) steps and time to the iteration cycle

winter rose
#

Therefore, debug your scripts and make your system work in Eden Editor

#

the dedi server thing is overkill to test scripting, like, really

tender fossil
#

I understand it if it's hard to fix (which makes me wonder how is it implemented), but if it's such a trivial-ish thing to fix, I just don't get it why couldn't it be fixed.

When it comes to the dedi server, why wouldn't I want to test directly in production-like environment if I had the option? Could see right away if there's something wrong.

Anyways, my blood pressure is starting to rise to a level that I'd need to take another pill soon, so I'll just head to the FT to grumble there about the issue meowtrash

winter rose
#

why wouldn't I want to test directly in production environment if I had the option?

…you're not a dev, are you? πŸ˜„

basically: debug script = singleplayer editor, even a VR world
debug mission & systems = singleplayer editor
debug locality = dedi + 2 players

here you are taking the hard road and say "why is it hard?"
so no, I am not helping you hurting yourself :D stop what you are doing and take even less steps by using the editor directly, period

tender fossil
winter rose
#

then you don't know what to fix
"how to eat an elephant?" "one bite at a time"

tender fossil
winter rose
#

check your module that is wrong
fix it
retry
fix the other thing from the other part that is wrong

trying to fix everything at once = big fail

tender fossil
#

Yes, no no for fixing everything at once

#

What I mean that – and I don't know about others in this case – that it adds to my mental workload at least to have to debug in phases like that. I already have my tiny brain working at full capacity trying to create something new

#

The more I have to think about debugging process itself, the less I'm able to focus to actual development. So kind of process optimization

winter rose
#

so you overload yourself with ALL the problems at once…?
protip, don't πŸ˜‰ go layer after layer

#

being able to say "I trust my script, I know it is not what is failing here" is good to have - then you can blame locality or Bohemia

mental wren
#

why wouldn't I want to test directly in production environment
yikes

tender fossil
#

I wouldn't fix all problems at once, but I'd like to just go through them one by one, testing in between each change, regardless whether the bug would be caused by locality, misspelling etc

tender fossil
upbeat quartz
winter rose
#

and what have you tried?

upbeat quartz
#

@winter rose _source = playSound "AlarmCar"; _source spawn { sleep 1.2; deleteVehicle _this; };

mental wren
#

you can add new missions to a dedi server without restart, just can't modify running missions

#

if you are a dev, and you know a tiny bit of js, could use something like fsevents to do it all

tender fossil
tender fossil
mental wren
#

yeee, my entire arma server infrastructure runs on javascript kek automation helps. But tbh, it's like Lou said, just build everything without worrying about locality, then at least you got a working SP mission

#

Then make it MP compatible

#

Then worry about HCs KEKW

still forum
past gazelle
#

I'm trying to use sqf TruckName lockCargo [ something , true]; to lock the rear of a zamtac truck but I'm not understanding what index means or how to find out which indexes are which...

#

I want the driver/front passenger to be usable but the rear of the truck to not...

copper raven
tender fossil
#

Because filepatching alone didn't work

copper raven
still forum
past gazelle
#

Ahh I got it!

#

you can't pass an array to lockCargo, you have to do the command separately for positions 1-14 or whatever is in config viewer...

winter rose
#

good thing the wiki explains it all πŸ˜‰

copper raven
#

or if you have like one position that you want to keep open, run the first syntax, then unlock the x one via alternative

little raptor
little raptor
little raptor
vague geode
#

Does anyone know a way to remove the pause between different arguments of the RadioProtocol?

I am asking because I would like to make a unit say "Fox Two" when firing e.g. a BIM-9X but when I use the kbTell together with the RadioProtocol the unit says "Fox ||<one second pause>|| Two" which sounds like the unit had a microsleep half way through the radio message...

ripe sapphire
little raptor
#

didn't test. but I never use the prepare version of cam commands (due to issues I had with them in the past)

ripe sapphire
#

Hmmm, im gonna need someone else to verify in game whether the command is broken or its just my wrong scripting

winter rose
little raptor
#

Because iirc Fox is a unit name

#

So you would experience the same thing if you tried "Miller Two"

low sierra
#

If i use hundreds of spawns from time to time, but they last for just a fraction of second, more or less, this can hurt performance in general when no spawn is running? I heard they cause problems after they finish because they are not fully cleared after all. This is true?

winter rose
#

no, they are cleared

#

but using hundreds of spawns seems like a bad design (from the little I hear)

low sierra
#

Sadlly the code have problems when running in unscheduled mode.

#

With only ONE spawn it takes too much time.

#

May be with more spawns it goes faster.

#

But if they get cleared, a feel happy. Thanks!

little raptor
#

but they slow down the scheduler

#

in other words, other scripts take longer to complete

winter rose
copper raven
#

in other words dont use spawn

#

and scheduled code in general πŸ˜„

winter rose
#

don't abuse spawn πŸ˜›

proper sail
#

while true Zpng

winter rose
#

while true do spawn while true

low sierra
#
for "_i1" from 1 to 10000 do {
    for "_i2" from 1 to 10000 do {
        0 spawn {uiSleep 1000;};
    };
};
#

Run in unscheduled πŸ˜„

#

I will se what happens with fps.

proper sail
#

your game will stop working

#

you can probably only move if you do that, the rest will be kinda stuck

low sierra
still forum
little raptor
still forum
#

But for that you really need couple 10k spawned scripts

winter rose
#

aka sorting β†’ 3ms reached β†’ failed β†’ sorting β†’ …

still forum
#

yea

#

Ah no, actually its clamped to 0.5ms at minimum.
So you'll get 0.5ms of scripts at least.
But thats still essentially dead

crude vigil
#

Yep, now it makes more sense.

storm arch
#

Anyone know if there is a command which grabs the steam id of a player?

copper raven
#

getPlayerUID

storm arch
#

thanks

tough abyss
#

has any one made a way where you load a kit on addaction, and anytime you die you respawn with the kit you loaded from when activating that script so you dont have to go back and fourth?

little raptor
hushed tendon
#

When using BIS_fnc_objectsGrabber/BIS_fnc_objectsMapper can you disable the objects simulation so they don't go flying everywhere when you create them?

winter rose
#

does the function return created objects?

hushed tendon
#

BIS_fnc_objectsMapper seems to return an array of objects so should I run a foreach on the object array and do

_x enableSimulationGlobal false;
winter rose
#

well… yes?

hushed tendon
storm arch
#

When using "call", does it loop?

winter rose
#

wat

storm arch
#

wrong page

#

thanks

undone flower
#

what classes can I use with isKindOf? I'm looking for something like "Aerial vehicle"

little raptor
#

if it doesn't match, it goes up the hierarchy tree until it finds a match

undone flower
#

would "Air" work?

#

I guess it would

little raptor
#

I think so yes

little raptor
copper raven
#

look at parent classes

#

you can use those

undone flower
little raptor
#

look at parents

undone flower
little raptor
#

yes

undone flower
#

pls share immediately

little raptor
#

no

#

πŸ˜›

undone flower
winter rose
fallow quarry
#

any way how to disable markers while operating arma 2 uav? The uav seems to mark everyone on the map

little raptor
trim sentinel
#

How can i get a trigger to play 2 one after the other sounds right now they are just playing over each other, im using say3D

ripe sapphire
#

sometimes you want camera to zoom without it tracking a target

winter rose
ripe sapphire
winter rose
#

worth a ticket, unlikely to happen but why not

ripe sapphire
#

yea exactly what i was thinking xD

chilly bronze
#

is it possible to check the status on a stacked event handler? ie, see that it has been deleted?

ripe sapphire
#

but maybe fixed in arma4? Based

chilly bronze
#

or, is it possible to get a local variable from inside an event handler and view it?

chilly bronze
#

so, if i wanted to wait until an event handler/stacked event handler is finished running (i.e. it deletes itself after finishing execution), how would you suggest doing that? you have the ID of the event handler, but I can't seem to find any functions to check if the event handler still exists

#

i was looking at scriptDone, but that takes a script handle, while stackedEventHandler's handles are just strings

little raptor
#

just use _thisEventHandler magic variable from inside the EH to delete itself

little raptor
#

that would nullify the whole point of event handlers

#

instead, you do whatever you want to do when the EH executes

#

(from within the EH code itself)

little raptor
#

they don't need a handle

digital rover
little raptor
#

*pointless hack

#

since what they're doing is wrong in the first place

chilly bronze
#

maybe it would help if i explained what im trying to do. I'm trying to use onEachFrame, but from what I can tell you can't pass local variables to that, which leaves me with a bunch of global variables that I don't want to be public, so I'm using the onEachFrame stacked event handler since you can pass local variables to that and keep everything private and secure. I was waiting until the execution inside the onEachFrame finishes, then continuing to the next element in my forEach loop. So, I want to wait until the event handler finishes its forEachFrame loop and deletes itself before I continue.

little raptor
#

ummm, why?

digital rover
#

???

#

don't use onEachFrame

little raptor
#

I mean why do you use an eachFrame loop like that?

digital rover
#

you can pass params to an event handler that way.

chilly bronze
#

im using setVelocityTransformation, which requires onEachFrame to linear interpolate between one position to another. I'm trying to move away from onEachFrame to using an event handler, so that I can pass private variables.

#

But as I said, I need to wait until the linear interpolation from one position to the next is finished until I can move on to the next position

digital rover
#

yeah, use an eachFrame addMissionEventHandler. You can self-remove an event handler using _thisEventHandler

chilly bronze
#

yea, i've gotten that far, but now how do I check if the event handler still exists?

little raptor
#

it's not as bad as it sounds

#

if you do it right

digital rover
#

you could use setVariable on the object itself. When initialising the eachFrame:

_object setVariable ["TAG_hasMyEH",true];
when you conditionally self-remove the EH inside the EH:
_object setVariable ["TAG_hasMyEH",false];

little raptor
#

they're always incremented

#

and never decremented when you delete them

#

also mind you you can only go up to ~16 M

#

because of floating point accuracy.
after that EH deletions are hit-or-miss (you could even end up deleting other people's EHs)

chilly bronze
#

i would only be making ~3-4 event handlers

#

when you pass a variable to an event handler, does it make a copy of that variable or is it a direct reference?

digital rover
#

arrays are references, primitives like strings and numbers are effectively copies.

little raptor
#

every variable in sqf is a reference

#

but only arrays and hashmaps have commands that allow the reference to be modified

digital rover
#

there, clarified πŸ˜‚

chilly bronze
#

so if I passed an object to an event handler, then used setVariable inside the EH, would I be able to getVariable outside the EH?

digital rover
#

yes.

#

which is why the above setVariable would be useful.

chilly bronze
#

that worked, thanks. there's probably a better way but for now it's better than what was used before

digital rover
#

the setVariable method is the second best way of making sure you don't have 2 loops doing the same thing at once.

#

the first being make it impossible to create 2 in the first place, but that isn't always an option

digital vine
#

Looking for some help, to create a Zeus Module via Function.

The blackbox of doom is telling me I have an error in line 8 of the function, where it does not seem able to pick up the position data, could anyone have a gander and point me in the right direction.

Happy for someone to sit down and show me the error of my ways if easier as I'm a complete novice to this side of the ArmA world πŸ™‚

This is the Function

_logic = _this param [0,objNull,[objNull]]; 
_units = _this param [1,[],[[]]];
_activated = _this param [2,true,[true]]; 

if (_activated) then {
    [] spawn {
             
    _pos = getPos _logic;
    if !(isnull (attachedto _logic)) then {_pos = getposatl (attachedto _logic);};
    _dir = _logic getvariable ["dir",random 360];
    _h = _pos param [2,0]; 
    _h = _h + 75; 
    _pos set [2, _h]; 
    _box = "B_CargoNet_01_ammo_F" createVehicle [0,0,0]; 
    _box setPosATL _pos;  
 
    parachute_1 = "B_parachute_02_f" createVehicle [0,0,0]; 
    parachute_1 setPosASL (getPosASL _box); 
    _box attachTo [parachute_1, [0,0,0]]; 
 
    clearItemCargoGlobal _box; 
    clearWeaponCargoGlobal _box; 
    clearMagazineCargoGlobal _box; 
 
    { 
    _box addMagazineCargoGlobal [primaryWeaponMagazine _x select 0, 5];  
    } forEach allPlayers; 
 
    _smoke = "SmokeShellOrange" createVehicle [0,0,0]; 
    _smoke attachTo [_box, [0,0,0]]; 
};
};
true
little raptor
digital vine
digital vine
#

and apologies for config, thought it might help for troubleshooting

ripe sapphire
#
if (_activated) then {
    [_logic, _units, _activated] spawn {
    
    params [_logic, _units, _activated]
little raptor
#

wat?

#

just use _this spawn

ripe sapphire
#

no? lmao

#

oh right

little raptor
#

and you don't need the rest in here

#

also your params is wrong

undone flower
#

anyone knows how to force the reload of a vehicle turret?

digital vine
#

my params?

little raptor
#

@digital vine ```sqf
_activated = _this param [2,true,[true]];

if (_activated) then {
_this spawn {
params ["_logic", "_units"];
};
};

little raptor
ripe sapphire
#

yea need string right

little raptor
#

exocet's

undone flower
digital vine
#

Thanks!

little raptor
#

it doesn't work like pressing R

#

also not sure if it works on vehicles? πŸ€”

undone flower
#

if they can't reload, it adds a magazine and performs the reload command

little raptor
#

I've only tested units

undone flower