#arma3_scripting

1 messages ยท Page 680 of 1

wind hedge
#

players just avoid those locations but the mission requires them to navigate those locations and a form of flashlight during the day would be great

fair drum
#

maybe script a PPEffect that brightens everything on command when they are in the dark?

#

if nightvision doesn't apply to your scenario

wind hedge
#

I mean you can have very dark places during the day too...

fair drum
#

I don't think there are any naturally dark places on any arma 3 map come to think of it. They always have some skylights or small residual terrain lighting. even in the temples on apex

#

can you change the time of day to a daylight time that works with the light? then set your time scale down a ton so it stays in that same range for the mission?

cosmic lichen
#

setAperture works as well

cyan dust
#

Good day. A probably stupid question but, if I call

player remoteExec ["XXX_fnc_SomeFunction", 2];

from the client and on the server side I do have

XXX_fnc_SomeFunction =
{
  params ["_playerUnit"];
  ....some useful stuff to do with unit
}

this _playerUnit object that I will obtain on the server, will be the local unit corresponding to player that called it?

cosmic lichen
#

yes

cyan dust
#

meowsweats I need to refactor... a lot... Thanks @cosmic lichen

proven charm
#

what would be the best way to merge magazines array?

cosmic lichen
#

Merge how?

proven charm
#

like this: [["mag1",8],["mag1",4],["mag1",3],["mag2",8],["mag2",4]]

cosmic lichen
#

What does it return?

proven charm
#

merge the half empty mags to one

#

return?

cosmic lichen
#

ah

#

you mean like an ammo repack?

proven charm
#

yes

#

8 being max ammo per magazine in this example

cosmic lichen
#

Dunnno the most efficient way but you probably get the unique magazine classes and then loop over it.

proven charm
#

yeah was hoping some one had done this already

cosmic lichen
#

ACE has such a system

proven charm
#

I know but I need custom merge script

cosmic lichen
#

This one as well. You can download it and unpack the pbo and look at the code if you want

proven charm
#

ok thx not sure if this is what I'm looking for though

cyan dust
#

Has anyone faced this error with SQFLint?
SQFLint: Process crashed Error: spawn java ENOENT
I'm not sure what have changed since yesterday when it was working. I've built few android apks but don't remember anything to update during the process...

cosmic lichen
#

It crashed a few times for me today as well.

proven charm
cyan dust
cosmic lichen
#

Guess the update broke something

smoky rune
#

Is there any way to apply civilian behaviour from Civilian Presence module on unit/agent (for example, they're panicking and trying to find cover when firefight is near them)?

proven charm
#

why not use the module?

hushed tendon
#

There is an EH I believe for if a shot goes off by the unit. You can then change the units animation and assign a waypoint away from their location.

smoky rune
#

FiredNear?

hushed tendon
#

I think

smoky rune
#

and since it requires trigger to be turned off or on

#

i ended up with 100 triggers listening for their variables

#

and of course, it ate something about 20 fps on just idling

proven charm
smoky rune
#

but how can i set up it's parameters via script?

#

using agents, panicking etc

proven charm
#

should be possible..

#
_m1 = civModGroup createUnit ["ModuleCivilianPresenceSafeSpot_F", _pos, [], 0, "NONE"];
_m1 setVariable ["#capacity",3];
_m1 setVariable ["#usebuilding",true];
_m1 setVariable ["#terminal",false];
#

an example

smoky rune
#

hmmmm

proven charm
#
_m = civModGroup createUnit ["ModuleCivilianPresence_F", _pos, [], 0, "NONE"];
_m setVariable ["#area",[_pos,CIV_AREA_SIZE,CIV_AREA_SIZE,0,false,-1]];
_m setVariable ["#debug",DEBUG_CIVILIANS];

_m setVariable ["#useagents",true];
_m setVariable ["#usepanicmode",true];

_m setVariable ["#unitcount", ("MaxTownCivilians" call BIS_fnc_getParamValue) ];

_m setVariable ["#oncreated",onCivCreated];
_m setVariable ["#ondeleted",onCivDeleted];
little raptor
smoky rune
#

looks like it is possible

proven charm
#

hope that helps!

proven charm
smoky rune
little raptor
#

if yours works, it probably spawns the function instead of calling it

proven charm
little raptor
#

naturally it shouldn't. first it calls the function, then it sees your variables. so even if it does work for you, its parameters probably don't work

smoky rune
#

i'm trying to implement it atm, so i will let you know if the way from BIKI works at all

little raptor
#

the question is does GC8's one works

smoky rune
#

i found another example and it spawns the same way

#

looks like it is somewhat worked at least before

proven charm
#

hard to say because it's long time I wrote that code but I'm sure it worked to a point at least ๐Ÿ™‚

smoky rune
#

quick test

this code works

private _position = position player;
private _group = createGroup sideLogic;
private _safeSpotModule = _group createUnit ["ModuleCivilianPresenceSafeSpot_F", _position, [], 0, "NONE"]; 
systemChat str _safeSpotModule;
#

and this doesn't (systemChat doesn't show up)

private _group = createGroup sideLogic; 
private _safeSpotModule = "ModuleCivilianPresenceSafeSpot_F" createUnit [ 
 _position, 
 _group, 
 "this setVariable ['BIS_fnc_initModules_disableAutoActivation', false, true];" 
];
systemChat str _safeSpotModule;
#

i guess civilian presence modules are somewhat special

wicked roostBOT
#
How to use SQF syntax highlighting in Discord

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

// your code here
hint "good!";
proven charm
#

@smoky rune the syntax of createUnit which you are using doesnt return a variable

smoky rune
#

whoops

#
Nothing - This syntax does NOT return a unit reference! In order to reference this unit, you can use newUnit = this in the init statement.
If the target group is not local, the init script will only execute after a slight delay; see Killzone_Kid's note below for more information and issues about this syntax.
#

yeah, this one works, thank you guys for help

"ModuleCivilianPresenceSafeSpot_F" createUnit [ 
 _position, 
 _moduleGroup, 
 "this setVariable ['BIS_fnc_initModules_disableAutoActivation', false, true]; safeSpot = this;" 
];
little raptor
smoky rune
#

to be honest, no - i decided to do it BIKI way first

little raptor
smoky rune
#

setVariable?

little raptor
#

yes

smoky rune
#

doing it right now, soon will post results

#

looks like parameters doing it's job just fine, debug is there, 30 actors is there

#
private _marker = "marker_1";

private _moduleGroup = createGroup sideLogic;
private _position = getMarkerPos _marker;

"ModuleCivilianPresenceSafeSpot_F" createUnit [
    _position,
    _moduleGroup,
    "this setVariable ['BIS_fnc_initModules_disableAutoActivation', false, true]; presenceSafeSpot = this;"
];

presenceSafeSpot setVariable ["#capacity",5];
presenceSafeSpot setVariable ["#usebuilding",true];
presenceSafeSpot setVariable ["#terminal",false];

"ModuleCivilianPresenceUnit_F" createUnit [
    _position,
    _moduleGroup,
    "this setVariable ['BIS_fnc_initModules_disableAutoActivation', false, true];"
];

"ModuleCivilianPresence_F" createUnit [
    _position,
    _moduleGroup,
    "this setVariable ['BIS_fnc_initModules_disableAutoActivation', false, true]; presenceMain = this;"
];

presenceMain setVariable ["#area",[_position,1000,1000,0,true,-1]];
presenceMain setVariable ["#debug",true];
presenceMain setVariable ["#useagents",true];
presenceMain setVariable ["#usepanicmode",true];
presenceMain setVariable ["#unitcount",30];
smoky rune
#

how can i setup Code On Unit Created in script from main Civilian Presence Module?

#

nevermind, found it -#onCreated variable

dreamy kestrel
#

Q: when working with triggers... how do you delete them? deleteVehicle?

still forum
#

yes

brazen lagoon
#

dunno if this is the right place to ask this but uh - any idea where CF BAI went?

graceful kelp
#

can anyone give we some quick help to get this to work
_targPos = aimPos cursorObject
i want to make it _targPos = aimPos cursorObject modelToWorldWorld [0,0,-0.3];
but its giving me an error

copper raven
graceful kelp
#

ah thanks

dreamy kestrel
#

Q: about IED models, do they damage automatically on "deletion" ?

dreamy kestrel
little raptor
dreamy kestrel
#

so to sim an IED explosion, I need to spawn in an appropriate "explosion" effect?

dreamy kestrel
#

setDamage to the IED itself?

little raptor
#

yes

finite osprey
#

Hey guys, so I'm trying to add a 'mind control' power to the playable character in my new SP mission, and this is what I've come up with.

this addAction["Mind Control", { selectplayer Unit; [Playa, "STAND1", "ASIS"] call BIS_fnc_ambientAnim; Unit removeAction 0; sleep 30; selectplayer Playa; }, nil, 1, false, false, "", "true", 5, false, "", ""];
I place this in the "init" box of all the units i want the player to be able to control. It's a hassle to add this and name every single unit "Unit1, Unit2, Unit3 ... etc"
I had simply forgotten how to do this, i didn't write anything in arma for a while, and doing selectplayer this doesn't work

dreamy kestrel
finite osprey
#

The ambient anim is just so the "playa" (Player) unit doesnt fire on the controled unit

little raptor
finite osprey
#

A second unit, in this instance "Unit"

#

Is there a way to call a unit from its own Init box without naming each unit and yknow

little raptor
#

is unit the one you're adding the action to?

#

this

finite osprey
#

Doesnt work bc it is inside the addAction

little raptor
#

I know. I mean is this the same as unit?

finite osprey
#

Oh i can do this = _this and then carry it in the

#

I think, let me try

little raptor
finite osprey
#

no, no. That works, you dont get me, the part is that i cannot call the unit itself, the one that is carrying the code in its init, with this

little raptor
#
params ["_target", "_caller", "_actionId", "_arguments"];
finite osprey
#

this addAction["Mind Control", { selectplayer _target; _target removeAction 0; sleep 30; selectplayer Playa; }, nil, 1, false, false, "", "true", 5, false, "", ""];
returns "undefined variable '_target'"

little raptor
#

you also have to switch camera

finite osprey
#

Yes, thank you

#

I didnt know you had to carry in the params

#

Thanks

buoyant hare
#

How can you get all the OPFOR groups in a trigger area?

units east inAreaArray thisTrigger;
``` returns all the OPFOR units, but I don't know how to get all the groups.
little raptor
buoyant hare
#

@little raptor cheers!

brazen lagoon
#

@little raptor what does that last line do? is it removing duplicates?

brazen lagoon
#

oh that's very nice, I'll have to tuck that one away

dreamy kestrel
#

hmm I am spawning in IED objects, but they are not firing events 'init', 'hit', etc.

dreamy kestrel
#

I must be missing something, I spawn in IED objects, i.e. "IEDUrbanBig_F", using createVehicle, but "init", "hit", events are not being raised. also, setting their _x setDamage 1 does not trigger any explosions.

little raptor
dreamy kestrel
#

besides the actual trigger event... but regardless, setting their damage to 1 does not cause any explosions.
other goals include "hitting" them, with HE, grenades, shells, sometimes also small arms. should all trigger a detonation.
then also being able to disarm via menu.

dreamy kestrel
#

and then they go boom nice

dreamy kestrel
#

huh so they start off created by classes like "IEDUrbanBig_F", but after being created, they end up like "IEDUrbanBig_Remote_Ammo".

fair drum
#

yes. i think @little raptor explained this to another person a few days ago. let me see if i can find it

dreamy kestrel
fair drum
dreamy kestrel
#

I guess_ "remote ammo"_ MO for use with cell phone triggers?

mortal latch
#

hey was asking about how to add a add a BIS_fnc_holdActionAdd to all players and was told to put it in an init.sqf but was having trouble figuring out if it should be in a init.sqf, initPlayerLocal.sqf, initPlayerServer.sqf, or initServer.sqf and what the differences are (i have read this https://community.bistudio.com/wiki/Event_Scripts#init.sqf)

#

also i was told to use addaction but thats not an option for what im trying to do

fair drum
#

you can do it multiple ways. did you ever figure out if the clients could see your variable?

mortal latch
#

see thats the weird thing i can find what changes the variable and what checks for when the variable is changed but i dont see where the variable is created

fair drum
#

to answer your direct question between the inits...

init.sqf is going to fire on all machines. So say you have a createUnit or other global effect command in there and say you have 60 players on a hosted non dedicated server. You will get a total of 60 units created as each computer fires that createUnit when they join.

initServer.sqf is only run on the server machine whether it be a dedicated server, or a hosted server machine.

initPlayerLocal.sqf is run on each client individually when they join the mission. if you put a global effect command such as the above, you will end up with the same duplication issue as people join. Keep things local commands here.

initPlayerServer.sqf is something that runs on the server, when someone joins the game. Use this for things like... collecting data on players server side. (but you shouldn't be using this one anyways)

mortal latch
#

well i want the mission to work on both dedicated and locally hosted server so i shouldn't use init.sqf right?

fair drum
#

all of them will fire if they are all provided

#

so it doesn't really matter. just know your initialization order

mortal latch
#

well just for this specific task

fair drum
#

me personally? I would just keep it in initServer and remoteExec it with JIP

mortal latch
#

jip is join in progress right?

fair drum
#

yes. use the variable of the object instead of this though

mortal latch
#

ya already fixed that

fair drum
#

still need to figure out your condition though which was your issue

mortal latch
#

so i would use the initPlayerLocal.sqf and put something along the lines of this ["_player", "_didJIP"];

fair drum
#

nope, look at remote exec JIP section

mortal latch
#

Wait is this condition thing a if (!isServer) then {}; that i need to add around my script

fair drum
#

if its in initServer you dont need it

#

since its only gonna fire on the server anyways

mortal latch
#

Ok im confused is my problem in my remote execute or is there something more basic

fair drum
#

repost it

mortal latch
#
[  
 crate,  
 "Load Crate In Blackfish",  
 "\a3\ui_f\data\IGUI\Cfg\holdactions\holdAction_loadDevice_ca.paa",  
 "\a3\ui_f\data\IGUI\Cfg\holdactions\holdAction_loadDevice_ca.paa",  
 "triggerActivated trg1",  
 "triggerActivated trg1",  
 {},  
 {},  
 {missionNamespace setvariable ["var_crate",true,true]}, 
 {},  
 [],  
 7,  
 10,  
 true,  
 false    
] remoteExec ["BIS_fnc_holdActionAdd", 0, crate]; 
fair drum
#

ah yes so this one was determined that it was your condition that was the problem right?

#

instead of using triggerActivated, set a variable to true in the trigger, make it public and then use that

mortal latch
#

So i need to make another variable?

fair drum
#

so your trigger onActivation box would be something like... startAction = true and then your condition in this action would be:

"!(isNil 'startAction')"

or if the trigger is set to evaluate on server only...

startAction = true;
publicVariable "startAction";

and
"!(isNil 'startAction')" for the action

#

also instead of using 0 for the remoteExec, use [0, -2] select isDedicated

mortal latch
#

@severe ravine

#

Bringing a friend lol

#

Ya i figured that the entirety of my remoteExec is wrong

fair drum
#

its not that its wrong, its that if you are on a dedicated server, there is no need to add the action to the object since the server has no interface

mortal latch
#

i do want it to work on both locally hosted servers and dedicated server just to clarify

fair drum
#

which that will do. the syntax is

[false, true] select (condition)

so if isDedicated returns false, then 0 is selected. if true, then -2 is selected

mortal latch
#

ahhhh

#

cool

#

remoteExec ["BIS_fnc_holdActionAdd", [0, -2] select isDedicated]; so that overall

#

looks weird

dreamy kestrel
#

got a peculiar issue... function can be invoked after I log in, and the effect, an action menu item, is installed.
prior to that during pre/post-init phases, the function is being called, but is failing to install the action menu item.

dreamy kestrel
#

verified the condition callback is running as expected, and should be returning true, but it is not showing the action

dreamy kestrel
#

I thought that too, tested isnull player is false.

#

but it is an action condition, eventually it should see the condition true, verified that in the debugger watch

#

if I "reinstall" the player action then it "works". really bizarre.

little raptor
split notch
#

question, trying to get it so that if i spawn in a Box_NATO_Ammo_F it gives me an ammo crate

#

kp_objectsinits.sqf i added this:


   [
        ["Box_NATO_Ammo_F"],
        {[_this] execVM "scripts\ammoboxes\Crate1.sqf";}
    ]

Then in the crate1.sqf I added this

if (! isServer) exitWith {};

_crate = _this select 0;

clearMagazineCargo _crate;
clearWeaponCargo _crate;
clearItemCargoGlobal _crate;

_crate addWeaponCargoGlobal ["arifle_MX_F", 50]; 

then i added "Box_NATO_Ammo_F" to the build menu
but when i build it, it spawns the crate and its empty, ideas?

winter rose
versed widget
#

is there a script to make ai mount NVGs only when they have to use them ? :3

winter rose
versed widget
#

can you give me the script ?

winter rose
#

you can script it with while, waitUntil, and linkItem/unlinkItem ๐Ÿ™‚

while { true } do
{
  waitUntil { sleep 60; sunOrMoon > 0.25 };
  { _x unlinkItem "NVGoggles" } forEach (units west);
  waitUntil { sleep 60; sunOrMoon < 0.25 };
  { _x linkItem "NVGoggles" } forEach (units west);
};
```this would add/remove all NVGs for west units
#

@versed widget โ†‘

copper raven
#

allUnits select west does that exist? ๐Ÿค” i think you meant units west meowsweats

winter rose
#

yes ๐Ÿ˜„

#

fixeded @copper raven, thank you for being my code reviewer ๐Ÿ˜„

cosmic lichen
#

Fixed only once

versed widget
#

the first one should also be units west right ?

cosmic lichen
#

yes

#

Lou is being sloppy ๐Ÿ˜„

#

above one should also be >=

winter rose
cosmic lichen
#

yeah, but AirShark did ๐Ÿ™‚

winter rose
#

nononononono notlikemeow

#

it's Friday okay?

cosmic lichen
#

That's true.

versed widget
#

im getting generic error after the second sunormoon

copper raven
#

unscheduled?

winter rose
#

if you run this from the console, use [] spawn { /* place code here */ };

copper raven
versed widget
#

after adding []spawn i had the code excuted but not functional meowhuh

winter rose
#

it takes 60s before doing anything

#

it checks every 60s if the sun is off or not (it could even check a longer time)

versed widget
#

yeah i didnt wait enough i guess, i thought speeding the game to x4 would help what the hell i was thinking :p

winter rose
#

well, it should

#

Change the waiting time for the testing time, then set it to whatever is best for you

versed widget
#

so the time acceleration does effect the sleep command ๐Ÿ˜ฎ

winter rose
#

yes

versed widget
#

how can i change west to all units i tried west && east and it doesnt seems to work

copper raven
#

allUnits ...?

winter rose
#

allUnits but this will also include civilians @versed widget

#

you could dosqf (units west + units east)

versed widget
#

yeah thank you guys ๐Ÿ˜Š

versed widget
#

how do i implement that script to a config , shall i add cfg weapons and add NVG category im terrible at config level ๐Ÿ˜ฃ

winter rose
fair drum
versed widget
winter rose
#

so you want to make a mod, just for this to happen
well the script might be slightly poor for that then

versed widget
#

why poor ?

winter rose
#

because no matter what, NVGs would appear
even on units which don't have one (e.g resistance)
and also, locality (Multiplayer) issues

versed widget
#

i see than maybe the solution is to move it to the vest but than i wonder what would happen if the vest is already full, btw i just want it on singleplayer

dreamy kestrel
#

Q: can you not add action menus to mine objects?

warm hedge
#

Like disable demine actions? Suppose no

dreamy kestrel
#

i.e. disarm, yes

warm hedge
#

Or, you probably can do a workaround like hide the mine itself and make dummy object

dreamy kestrel
#

like a proxy object, huh that might be interesting. trying this, does not seem to add any menu:

[
    _target
    , "STR_KPLIB_RESOURCES_ACTION_DISARM_IED"
    , [
        { _this call KPLIB_fnc_ieds_onDisarm; }
        , []
        , -603
        , true
        , true
        , ""
        , "
            alive _target
                && alive _this
                && _this isEqualTo vehicle _this
        "
        , KPLIB_param_ieds_disarmRange
    ]
] remoteExecCall ["KPLIB_fnc_common_addAction", 0, _target];
#

yeah I was trying to retrace my steps. created initially using createVehicle but it's not a mine. but I did have the menu then. when I used createMine, no such luck...

dreamy kestrel
#

the alternative is that I try to flip the table on the mine+player action menu; action goes on player, conditioned on being nearby the mine, etc.

winter rose
fair drum
split notch
#

@winter rose i love you

#

it worked

little raptor
#

You can selectPlayer them first

#

then switch back to your own player

split notch
#

one more question, is it possitlbe to use the same crate for different contents?

fair drum
#

sure

#

what exactly do you want to do?

split notch
#

so in liberation you have a build menu, i want to be able to build crates with different missiles all using the Box_NATO_WpsLaunch_F crate

little raptor
#

selectPlayer as I said meowsweats

split notch
#

but one will have stinger rounds, the other iwll have maaws rounds, etc

past wagon
#

yo its karmakut lol

fair drum
#

its how you can basically use the same script a lot of different ways

little raptor
#
old_player = player;

selectPlayer _unit;

["Open", true] call BIS_fnc_arsenal;
_time = time + 30;
_arsenal = displayNull;
waitUntil {
    _arsenal = uiNamespace getVariable ["RscDisplayArsenal", displayNull];
    time > _time || !isNull _arsenal
};

_arsenal displayAddEventHandler ["unload", {
    selectPlayer old_player;
    old_player = nil;
}];

isNil {
    if (isNull _arsenal && !isNil "old_player") then {
        selectPlayer old_player;
        old_player = nil;
    };
};
split notch
#

@fair drum thanks i'll try it out!

#

yeah now i'm getting out of my depth

#

๐Ÿ˜†

fair drum
split notch
#

so in the init

#

i would put, [crateObject1, "stinger"] call TAG_Function

#

correct?

#

with crateobject being the class name

#

and stinger being what kind of crate i want to call?

fair drum
#

ok so lets start here. how far do you want to go understanding this stuff? or do you want a quick fix.

split notch
#

i want to understand it enough so that i can make more custom crates in the future

little raptor
#

@fair drum better use addMagazineCargo for mags. (not addItemCargo)

fair drum
#

okay so. lets move away from using init boxes in the editor for starters. do you know how to define a function or what a function is or their setup?

split notch
#

lol i just started like yesterday picking at and reverse engineering the liberation code

#

only reason why i'm using the object init

#

so no i don't hahah

dreamy kestrel
#

this is funny, you cannot set variables on mine objects either... LOL

winter rose
#

This command does not work with CfgAmmo or CfgNonAIVehicles objects, like bullets, mines or butterflies.
don't mines count as "ammo"?

dreamy kestrel
#

I could be wrong, I'll verify. really I am trying to avoid passing mine objects up and down the wire if at all possible.

#

but maybe that is a non issue

fair drum
# split notch so no i don't hahah

so lets make a function. lets call it going shopping. we go shopping a lot during our lifetime right? so it should be something we commit to memory so we don't have to think about how to go shopping every time. that would be a function. something that is stored that you run many times and you want to recall it quickly. but what do we want to go shopping for? well, how about apples and pears? those would be the arguments to a function that tell what you want to do. so now you are in the store (or inside the function), you know you want to buy apples and pears. but we don't want to buy any apple or pear, lets buy ones that are healthy looking. we can now write in our shopping function a few if statements like, if pear then, if healthy then, put in basket. that would be a parameter.

dreamy kestrel
#

you cannot (set variables on mines)... at least not directly.

dreamy kestrel
fair drum
# split notch so no i don't hahah

so if we look at the code provided, you see on line 6, there is the params command. this pulls in the arguments to the function and puts them under the variables, _crate and _type. in the order given to the function

split notch
#

ok

#

kind of understand

winter rose
fair drum
#

the difference between using a function vs a script is that every time you call a script, then computer has to "relearn" the entire script once called. a function gets stored so you can quickly reference it over and over

fair drum
# split notch kind of understand

so you know how you can store things in variables? such as _foodType = apple, well you can also store functions in variables but we use a {} for it.

TAG_Shopping = { /*function here*/ };

it will only be run when you call that function later

or you can define the function in the CfgFunctions in description.ext

little raptor
winter rose
#

magic

little raptor
#

oh, right. I used an array and passed the parameters there:

projectiles = [];
...
projectiles pushBack [_projectile,...];

something like that

fair drum
# split notch ok

so this would be an example of that in simple terms.
#arma3_scripting message

hyp_addThings = {

    params ["_a", "_b"];

    private _return = _a + _b;

    _return;
};

private _endingResult = [2, 2] call hyp_addThings;

_endingResult //returns 4
split notch
#

brain slightly overloading at this point

#

LOLO

#

i think i understand

#

yea i think i understand that code

fair drum
#

so we need to define that function, cause all we have is an .sqf file atm and the game doesn't know about it

#

do you have a description.ext file in your mission folder?

split notch
#

yes i do

fair drum
#

so make a functions folder in the root of the mission. and inside of it, place the .sqf code that I made you and name it fn_crateCustomization

#
%Root%
mission.sqm
description.ext
functions
  fn_crateCustomization.sqf
split notch
#

done

fair drum
#

now we go to the description.ext which is the file that basically tells the game how to run your mission and what to include background wise.

class CfgFunctions
{
    class Karma
    {
        class functions
        {
            file = "functions";
            class crateCustomization {};
        };
    };
};

This searches the functions folder and looks for every file named fn_something.sqf in this case, we define crateCustomization so its going to look for fn_crateCustomization

split notch
#

what is class Karma

#

here

fair drum
#

anything you want. that would be the TAG

split notch
#

and what is the tag

#

just the categorizor?

fair drum
#

when this is defined and compiled, it will display as Karma_fnc_crateCustomization and thats what you would call

split notch
#

ok

#

i'll use kc

#

if that works?

fair drum
#

people use the scenario tag, sometimes short parts of their name, like I sometimes use HYP so all my functions start with HYP_fnc_blahblahblah

#

bohemia uses BIS

split notch
#

ok

#

makes sense

#

yea i'll use kc

fair drum
#

kp uses kp

#

and thats it for defining. the game now knows that file exists and will load it into memory as a function at the mission start

split notch
#

ok

#
class CfgFunctions
{
    class kc
    {
        class functions
        {
            file = "functions";
            class crateCustomization {};
        };
    };
};
copper raven
#

it should be 3 to 5 chars per standards ๐Ÿ˜‰

fair drum
#

and you can stack functions there too.

class CfgFunctions
{
    class Karma
    {
        class functions
        {
            file = "functions";
            class crateCustomization {};
            class function1 {};
            class function2 {};
            class ect {};
        };
    };
};
#

and they will all be defined as long as they are in the functions folder with the name fn_nameHere

#

did you customize the function file how you wanted it yet?

split notch
#

no

#

i'm assuming i need to replace stinger class with the class name of the missile right

#

and then the ammount right

fair drum
#

yes class name and then how many you want added

#

delete the others in the array if you don't need them

split notch
#

ok sec

#

will send you

fair drum
#

do you understand what the switch do is doing in this case. its looking at the variable _type and going if (_type == "stinger") then {} or if (_type == "mawws") then {}

#

and selecting the appropriate route

split notch
#

right

fair drum
#

and _type is whatever string we gave it in the arguments. if that string doesn't match anything, it heads down the default path which basically does nothing

split notch
#

ok almost done

#
/*
Called by example:
[crateObject1, "stinger"] call TAG_Function
*/

params [
    ["_crate", objNull, [objNull]],
    ["_type", "", [""]]
];

if !(isServer) exitWith {};

if (isNull _crate) exitWith {
    diag_log "No valid object given to the function";
};

clearWeaponCargoGlobal _crate;
clearMagazineCargoGlobal _crate;
clearBackpackCargoGlobal _crate;
clearItemCargoGlobal _crate;

switch _type do {

    case "stinger" : { //Cases are CASE SENSITIVE!!

        private _itemCount = [ // [Class, Number to add]
            ["rhs_fim92_mag", 5]
        ];

        _itemCount apply {
            _x params ["_item", "_count"];

            _crate addItemCargoGlobal [_item, _count];
        };
    };

    case "mawws" : {

        private _itemCount = [
            ["MRAWS_HEAT_F", 5]
        ];

        _itemCount apply {
            _x params ["_item", "_count"];

            _crate addItemCargoGlobal [_item, _count];
        };
    };

    case "javelin" : {

        private _itemCount = [
            ["rhs_fgm_148_magazine_at", 5]
        ];

        _itemCount apply {
            _x params ["_item", "_count"];

            _crate addItemCargoGlobal [_item, _count];
        };
    };    

    default {
        diag_log "No case match found";
    };
};```
fair drum
#

!code

wicked roostBOT
#
How to use SQF syntax highlighting in Discord

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

// your code here
hint "good!";
fair drum
#

yup looks good. now just remember how you call it. the cases are case sensitive. create your box in the editor, start the mission, and test it out by calling it in debug

split notch
#

so heres the thing right

#

the case doesn't start in mission

#

i spawn it in mid game

#

thats why i use the objinit

#

right

fair drum
#

using kp's stuff already?

split notch
#

yea

#

i would build it in game

fair drum
#

so are you modifying kp liberation for your own, or are you doing something completely different and just going off of kp's stuff to learn

split notch
#

modifying kp lib

fair drum
#

ok so you haven't modified any kp files yet? or have you found the file that they use for their build menu and have begun adding things to it

split notch
#

yeah i have

#

so here

#

heres one thing i've done right

split notch
#

i added the box nato ammo to the build menu

#

then every time i build it

#

it spawns mags

#

i want to do the same thing with the missiles

#

but use the same crate model

#

for the 3x types of missiles

fair drum
#

okay, let me check their github to see what else they reference in their code real quick

split notch
#

kp_objectsinits.sqf

fair drum
#

oh its missing the s on objects. give me a sec to read

#

and which build menu function are you referencing?

fair drum
#

so heres the catch so far. if you do it down the objInit route, its very similar to CBA's object init function. you aren't going to have a way to define WHICH _type you want since its going to be the same every time. randomized, yes you can do that. what I need to find now is the function that is executed when the build menu item is selected.

#

is there a very similar crate to the crate you want to use?

split notch
#

you know how ace has

#

oh you mean specific class name?

#

yeah so thats the crude way right

#

i use a different crate for each missile crate right

#

i guess i can do that

fair drum
#

yes in order to implement into their system. remember, working with someone elses code, isn't always the best way as you have to learn TO code, as well as THEIR code.

split notch
#

params ["_crate"];
clearMagazineCargoGlobal _crate;  
clearItemCargoGlobal _crate;  
clearBackpackCargoGlobal _crate;  
clearWeaponCargoGlobal _crate;  

_crate addItemCargoGlobal ["rhs_mag_30Rnd_556x45_M855A1_EPM_Tracer_Red", 30];
_crate addItemCargoGlobal ["rhsusf_200rnd_556x45_mixed_box", 30];
_crate addItemCargoGlobal ["rhsusf_100Rnd_764x51_m62_tracer", 30];
_crate allowDamage false;
#

can i change _crate to anything?

#

is that just a name?

fair drum
#

_crate is the param, its being pulled in from the arguement. where did you find that?

split notch
#

this is my custom ammo crate

#
    // Custom Ammoboxes
    [
        ["Box_NATO_Ammo_F"],
        {[_this] execVM "scripts\ammoboxes\Crate1.sqf";}
    ]
fair drum
#

oh. no, modifying your code won't fix your problem

split notch
#

thats in the kp object init

#

and then i have Box_Nato_ammo_f in the build menu

#

so i just do the same thing

#

but add different crates

#

right?

#

and 3 more sqf files

#

1 for each missile crate

#

right?

fair drum
#

yes. whats stopping you from making a crate with all 3 sets of items in it? like a missile crate?

split notch
#

balance

#

like gameplay balance

#

i mean i guess i could

#

there might be waste though

#

if the players only want jav missiles

#

they'd have to buy the crate that gives them all 3

#

jav stinger maaws

#

right?

fair drum
#

so doing it with three classes would be...

[
    ["class1"],
    {[_this, "stinger"] call karma_fnc_crateCustomization}
],
[
    ["class2"],
    {[_this, "mawws"] call karma_fnc_crateCustomization}
],
[
    ["class3"],
    {[_this, "javalin"] call karma_fnc_crateCustomization}
]
split notch
#

right but then when i build that one crate

#

how does it know which one to build

fluid wolf
#

Anyone know if there is a way to allow players to use flashlights in midday? I'm doing a foggy mission and want to use lights to improve visability for players so they can see each other better.

fair drum
fluid wolf
#

Aww, that's a shame.

fair drum
split notch
#

all i'm doing in the build menu

#

is putting the class name

#

of the crate itself

fair drum
#

ooooooh so now I see how kp does it then. they are using config defined crate inventories and just creating the crate itself. try just adding the 3 crate classes and their costs. Then add the above objinit to start

split notch
#

well kp has 0 of these

#

hahah

#

they dont' have any crates

fair drum
#

add the 3 crate classes to the build menu, then do the above objinit that i posted a few lines up

#

if their system works by just creating the class, the function we wrote should overwrite it and clear everything out of it anyways

split notch
#

ok

#

so

split notch
fair drum
#

yes

#

pick whichever look similar but kp doesn't already use to make it easy

placid trellis
#

Is there a way to get an object's armor value
Like

if ( getArmor (headgear player) > 0 ) then { hint "you have a helmet" };
fair drum
split notch
#

i think

#

karma_fnc_crateCustomization

fair drum
#

yeah thats not allowed. we have to add your function under the already added cfg functions

split notch
#

i'm so confused now lol

#

starting from 0

#

i have


    // Custom Missile/Ammo createSimpleObject

    [
        ["Box_IND_WpsLaunch_F"],
        {[_this, "stinger"] call karma_fnc_crateCustomization}
    ],

    [
        ["Box_NATO_wpsLaunch_F"],
        {[_this, "mawws"] call karma_fnc_crateCustomization}
    ],

    [
        ["Box_EAF_WpsLaunch_F"],
        {[_this, "javalin"] call karma_fnc_crateCustomization}
    ],



#

wait

#

sorry

#

right

#

then put karma_fnc_cratecustomization in the functions folder right

little raptor
#

@placid trellis for example:

getNumber(configFile >> "CfgWeapons" >> headgear _unit >> "ItemInfo" >> "HitpointsProtectionInfo" >> "Head" >> "armor")
fair drum
placid trellis
fair drum
#

i just copied it, and added your function to the top

split notch
#

ok

#

so just add lines 1-8

#

to top

#

which file is this?

#

cfgfunctions add 1-8

#

rgr

fair drum
# split notch to top

yes, but change your karma_fnc_crateCustomization to KC_fnc_crateCustomization in the file with your crate class names

split notch
#

ok

#

and then add the 3 class names to the build list

fair drum
#

yes and the costs

split notch
#

ok

#

is it possible to change the name of those items

#

because they'll just show up as = weapons crate NATO

#

instead of Javelin crate

little raptor
split notch
#

no

#

in the menu that i build it from

fair drum
#

i think he means the UI. which i haven't even gotten into kp's UI yet

split notch
#

xD

little raptor
#

yeah no it reads it from the config

split notch
#

so like here

#

i couldn' just at the top add Javeline_Missile_Crate="box class name"

fair drum
#

no

split notch
#

my brain

little raptor
#

if you want to change the name you'll have to create a new crate (in config)

split notch
#

is going to explode

fair drum
#

lol. you decided to jump head first into a pretty complex mission written by like 6 people. its expected

split notch
#

ok

#

basically

#

you know the ace_box_82mm crates

#

i want to create more of those

#

with custom contents

#

using the launcher model

fair drum
#

now you are looking into modding. you can't just edit configs willy nilly with .sqf. and modding is complex in a whole different way. what i think you should do is leave it as is with the names as is, and just let your players know that they are custom and what they are. i'm sure you understand the cost of learning something complex for a small detail

split notch
#

thats fair

#

lol

fair drum
#

that they might not even "really" appriciate if you did it right

split notch
#

well

#

i have left a smarter man

#

thank you all

#

i will test what we have rn

#

lol

fair drum
#

test it. see if it works. pm me if you want to learn anything new (and you should start with stuff you create yourself next time so you don't have to learn someone elses stuff lol, start small)

fair drum
dreamy kestrel
#

Q: about road width... is that between beginPos and endPos? or "side to side"?

mortal latch
# fair drum Sorry. Went to bed. That looks fine, you'd add the jip tag after as well

np, so what ive got now is

[
 crate, 
 "Load Crate In Blackfish", 
 "\a3\ui_f\data\IGUI\Cfg\holdactions\holdAction_loadDevice_ca.paa", 
 "\a3\ui_f\data\IGUI\Cfg\holdactions\holdAction_loadDevice_ca.paa", 
 "triggerActivated trg1", 
 "triggerActivated trg1", 
 {}, 
 {}, 
 {missionNamespace setvariable ["var_crate",true,true]},  
 {}, 
 [], 
 7, 
 10, 
 true, 
 false 
] remoteExec ["BIS_fnc_holdActionAdd", [0, -2] select isDedicated, true]; 

still isnt showing up ive got it in the init.sqf rn but ive realized that that is no different than having it in the objects init field

dreamy kestrel
#

hmm I will need to verify that... I look at width and use it to inform around a point randomly between begin+end... maybe those segments are longer than I thought, or I should just take begin or end point if I want IED on the road itself.

copper raven
fair drum
fair drum
mortal latch
#

cuz i dont know better

#

oof get to work changing that stuff too

copper raven
#

its a perfect fit for local execution in some init file for every client, especially that it's jipped

mortal latch
#

Just to clarify the action will only be used once in the mission and is non repeatable

fair drum
mortal latch
#

I mean i am just looking for the easiest solution but i probably should learn how to use the remoteexec function

copper raven
#

you tell every client to add the action for every client if that makes sense, it's a mess(what you have right now)

small fox
#

how would I force AI to turn on their NVGs turning day time?

mortal latch
copper raven
#

yea

fair drum
#

ideally yes

copper raven
#

that'd be the most optimal solution

small fox
#

doesnt work

fair drum
#

might just be an AI thing then. why do you want them on during the day?

small fox
#

taking a photo with AI nvgs on then gonna edit it into night during post

fair drum
#

hopefully it doesn't make it too hard in post

#

oooooor i have an idea

mortal latch
# copper raven that'd be the most optimal solution

ok but i should still change the triggerActivated trg1 to a (missionNamespace getVariable ["var",false]) in the hold action and add a missionNamespace setvariable ["var_",true,true] to the inside of the trigger

small fox
#

i'm trying to do this with script

fair drum
#

take all the units, make them switchable, disable all of their AI, switch to each unit and turn their nvg on, then disable their simulation when you leave

#

ghetto but might work

small fox
#

elaborate on what you mean by switchable and disabling their ai?

#

also i'm fairly certain that there's a way of doing this with a script just really hard to find it

copper raven
finite imp
#

Good Evening Gents,

I'm having trouble executing a script globally. I downloaded a ready-to-use script from the workshop and implemented it as stated, and the script itself is working flawlessly, except that its not running on all the clients on a dedicated server. The script states that it must run globally to work for everyone.

Currently, the code that has to be executed is this

[EMP, EMP_Range, true, true, 0] execvm "AL_emp\emp_starter.sqf";

I put that line of code into a hold action, and of course it is not working. If I run that line of code via ZEN's code executor for example, its working, because it propagates globally.

I thought about putting that line into an sqf and remoteExec'ing that sqf, but is this a viable option? Is there an easier solution?

TL;DR: Looking for a way to run that line of code mentioned on every client (including JIP) via HoldAction. ExecVM is not working for some reason. Any idea why and how to fix that?

Cheers!

fair drum
sterile arch
#

hello how do i get a plane (AI) to get shot down, then have the pilot eject and then get captured?

finite imp
fair drum
# sterile arch hello how do i get a plane (AI) to get shot down, then have the pilot eject and ...

have it fly into an area trigger, trigger sets off an eject/getout action, set the damage of the vehicle to 1 to destroy it, then do a waituntil condition that has the unit's height return true when the unit's height is < 5, after that setcaptive to true

https://community.bistudio.com/wiki/action
https://community.bistudio.com/wiki/setDamage
https://community.bistudio.com/wiki/waitUntil
https://community.bistudio.com/wiki/getPos
https://community.bistudio.com/wiki/setCaptive

#

might want to make the unit invulnerable too so he doesn't die on the way down or by the explosion

sterile arch
#

ok thank you

fluid wolf
#

...just because its important, does anyone know if unit playback works in multiplayer? EG pre-pathing a jet to fly low across an area, or does it desync and crash shit

mortal latch
fair drum
fluid wolf
#

...shooty shooty?

#

as in it shooting or shooting at it

fair drum
#

if you ever wanted a unit or vehicle to play a recorded fire command

fluid wolf
#

OH that, yea I'm not using that

fair drum
#

if its just movement, you're good

fluid wolf
#

I'm jtus using movement

#

Fantastic. Good to know I'm not about ot crash servers

fair drum
sterile arch
#

do you have an example? sorry still a noob

mortal latch
#

kk and should i preface it with a if (!isServer) then {};

fair drum
fair drum
sterile arch
#

ok

#

take your time

fair drum
# sterile arch ok

put this in its own .sqf file, name it something:

params ["_unit"];

private _vehicle = vehicle _unit;

_unit action ["getOut", _vehicle];
_unit allowDamage false;
_vehicle setDamage 1;

private _parachute = createVehicle ["Steerable_Parachute_F", [0,0,0], [], 0, "NONE"];
private _unitPos = getPosATL _unit;

_parachute setPosATL _unitPos;
_unit moveInDriver _parachute;

waitUntil {
    (getPos _unit # 2) < 3
};

_unit action ["getOut", _parachute];
_unit allowDamage true;
_unit setCaptive true;
_unit action ["Surrender", _unit];

sleep 3;
deleteVehicle _parachute;

in the onActivation box of the trigger put:
[pilotVariableHere] execVM "scriptFileLocationHere.sqf"

#

set the trigger activation to whatever you want. say.. opfor present, and fly the plane through it.

#

oops. forgot to make it parachute, one sec

copper raven
#

on activation fires on every machine right? ๐Ÿค”

#

so i assume unit will be local to the server, means you should tick server only or whatever its called in trigger settings, dont want every machine running that code

mortal latch
#

!code

wicked roostBOT
#
How to use SQF syntax highlighting in Discord

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

// your code here
hint "good!";
mortal latch
#

K have this in my initplayerlocal

[ 
 crate, 
 "Load Crate In Blackfish", 
 "\a3\ui_f\data\IGUI\Cfg\holdactions\holdAction_loadDevice_ca.paa", 
 "\a3\ui_f\data\IGUI\Cfg\holdactions\holdAction_loadDevice_ca.paa", 
 "missionNamespace getVariable 'var_trg1'", 
 "missionNamespace getVariable 'var_trg1'", 
 {}, 
 {}, 
 {missionNamespace setvariable ["var_crate",true,true]},  
 {}, 
 [], 
 7, 
 10, 
 true, 
 false 
]remoteExec ["BIS_fnc_holdActionAdd", [0, -2] select isDedicated, true]; 

tried to get rid of the

remoteExec ["BIS_fnc_holdActionAdd", [0, -2] select isDedicated, true]; 

at the end but then the whole thing just stopped working even in single player
as it stands it works fine in single player but doesn't show up for players on a dedicated server not sure where to go from here

#

and i know the initplayerlocal is working properly because other stuff in the initplayerlocal are working fine (BIS_fnc_dynamicGroups)

little raptor
#

missionNamespace getVariable 'var_trg1'

#

is that variable public?

mortal latch
#

@copper raven and @fair drum told me to put it in initplayerlocal

#

and it should be public

#
var_trg1 = nil; 
publicVariable "var_trg1";
fair drum
#

Without remoteexec

mortal latch
#

put that in the init field of my missions so i think it should work to make the variable public

#

so like this?

[ 
 crate, 
 "Load Crate In Blackfish", 
 "\a3\ui_f\data\IGUI\Cfg\holdactions\holdAction_loadDevice_ca.paa", 
 "\a3\ui_f\data\IGUI\Cfg\holdactions\holdAction_loadDevice_ca.paa", 
 "missionNamespace getVariable 'var_trg1'", 
 "missionNamespace getVariable 'var_trg1'", 
 {}, 
 {}, 
 {missionNamespace setvariable ["var_crate",true,true]},  
 {}, 
 [], 
 7, 
 10, 
 true, 
 false 
]
fair drum
#

[all that] call bis_fnc_holdactionadd

little raptor
mortal latch
#

is it in the wrong spot or is my syntax wrong

mortal latch
little raptor
# mortal latch is it in the wrong spot or is my syntax wrong
[ 
 crate, 
 "Load Crate In Blackfish", 
 "\a3\ui_f\data\IGUI\Cfg\holdactions\holdAction_loadDevice_ca.paa", 
 "\a3\ui_f\data\IGUI\Cfg\holdactions\holdAction_loadDevice_ca.paa", 
 "missionNamespace getVariable 'var_trg1'", 
 "missionNamespace getVariable 'var_trg1'", 
 {}, 
 {}, 
 {missionNamespace setvariable ["var_crate",true,true]},  
 {}, 
 [], 
 7, 
 10, 
 true, 
 false 
] call BIS_fnc_holdActionAdd;
copper raven
mortal latch
#

heh

#

fuck thats funny

#

just realized what i did there

copper raven
mortal latch
#

not sure was fine before hand where it was just defining itself when its state changed but figured it couldn't hurt to double up

copper raven
#

where do you modify the value of it? (besides that nil stuff)

mortal latch
#

in a trigger

copper raven
#

how exactly?

mortal latch
#

was told to create a variable instead of using triggeractivated

#

missionNamespace setvariable ["var_trg1",true]

#

^in the onactivation zone of a trigger

copper raven
#

change nil to false, and remove the pvar

mortal latch
#

no its in the init field of the mission

copper raven
#

what init field

#

object init?

mortal latch
#

the one under attributes, general in the editor which i assume is functionally identical to the init.sqf

copper raven
#

put this in initPlayerLocal

amb_showAction = false;
amb_actionCompleted = false;

[ 
 crate, 
 "Load Crate In Blackfish", 
 "\a3\ui_f\data\IGUI\Cfg\holdactions\holdAction_loadDevice_ca.paa", 
 "\a3\ui_f\data\IGUI\Cfg\holdactions\holdAction_loadDevice_ca.paa", 
 "amb_showAction", 
 "amb_showAction", 
 {}, 
 {}, 
 {missionNamespace setvariable ["amb_actionCompleted",true,true]},  
 {}, 
 [], 
 7, 
 10, 
 true, 
 false 
] call BIS_fnc_holdActionAdd;

then rely on amb_actionCompleted for the status, get used to using proper tags, var_ is whatever i guess, still better to use something more unique

#

in your trigger, amb_showAction = true, now not sure if you need to broadcast it or not, not sure if on activation fields run on every machine

mortal latch
#

well the trigger is only evaluated on the server

copper raven
#

did you tick the server only box?

mortal latch
#

YA

copper raven
#

well then broadcast it

mortal latch
#

?

#

assume I'm 5

fair drum
#

PublicVariable "stringOfVariable"

copper raven
#

setvariable is probably faster

fair drum
#

So publicVariable "amb_showAction"

#

Setvariable functions the same for the public.

mortal latch
#

right but in the initplayerlocal?

copper raven
#

no

#

in your server only trigger

mortal latch
#

kk

copper raven
#

set the variable to true, and call publicvariable

#

in that order

#

not the other way around

mortal latch
#

yay

fair drum
#

language before the bot gets you

mortal latch
#

so there is a difference in defining variables in different places?

fair drum
#

(hes idle, delete it quickly)

mortal latch
#

lame

fair drum
#

yes there is. for example mp game security, you'd ideally have two of the same variable, one in the server's localnamespace, and then another in missionnamespace. for variables you want players not to be able to mess with, you use server's localnamespace. then when you want to broadcast it, you copy it into missionnamespace then make that global, but still use localnamespace in the end

mortal latch
#

ohhh ok can see the reason for that but dont think i would ever need to use it

fair drum
#

its mainly for big missions on public servers. i use it on my pvp gamemode to help prevent tampering since its on public servers. other games like KOTH just use an off site storage that can't be tampered with and just call stuff in from there

mortal latch
#

@fair drum @austere nimbus @little raptor thanks for the help guys

pulsar bluff
#

theres very little need for that sort of security anymore

#

maybe only 20-30 servers running 4-5 different modes with decent population need to bother

hallow depot
#

Hello! I I'm in need of help, I've created a MP mission and placed objects in the editor and then grabbed them with BIS_fnc_objectsGrabber and then placed the code in my .sqf and running it wirh BIS_fnc_objectsMapper. But when the 2nd person joins everything blows up. keep in mind that I am a beginner to scripting and trying to learn. Is there a way to run the script from only one player? I guess that when the 2nd person joins every item adds in again and thats why it blows up?

hallow depot
#

So where do I place this "start = call (compileFinal preprocessFileLineNumbers "composition\startPosition.sqf");"?

winter rose
#

initServer.sqf?

hallow depot
#

Ok, thank you. Can I just call the script as it is or do I need something else?

#

I just copied everything as it is from the init.sqf to initServer.sqf, but it still blows up when the 2nd player joins

cosmic lichen
hallow depot
#

Thank you, I dont think I really understand it, how and where can I use this?

#

instead of "compileFinal"?

copper raven
#

read the description

hallow depot
#

I've done that, sorry but I don't understand

copper raven
#
Result:
0.0747 ms

Cycles:
10000/10000

Code:
compileScript ["initPlayerLocal.sqf"];
Result:
0.0503 ms

Cycles:
10000/10000

Code:
compile preprocessFileLineNumbers "initPlayerLocal.sqf"

if you aren't loading bytecode, compile preprocessFileLineNumbers is the way to go imo, the .sqfc lookup does add a decent overhead

hallow depot
#

Thank you! I think I've solved it, I added "if (!isMultiplayer) exitWith {};" in my initServer.sqf.

#

It's not blowing up now at least when the 2nd player is joining

young talon
#

guys how to add parachute in arsenal can someone help me pls

little raptor
drifting portal
#

!code

wicked roostBOT
#
How to use SQF syntax highlighting in Discord

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

// your code here
hint "good!";
drifting portal
#

I'm having a minor issue that is blocking everything's flow here:
I'm broadcasting voice messages through sideRadio, but when I reach the sixth message (mes6) it finishes playing the message, but never stop broadcasting (you can still hear arma 3 sideRadio static in the background, and for that reason when I try to play the seventh message or any incoming messages, it doesn't play, because broadcasting message 6 continues, is there a reason why that happens?

Digger sideRadio "mes4";
sleep 4;
Digger sideRadio "mes5";
sleep 4;
Digger sideRadio "mes6";
sleep 4;

Digger is the entity the message is broadcasted from, simulation disabled and entity is hidden, and damage is disabled in case that affects anything.

#

mes.ogg is the file extension

#

in case anyone is wondering

winter rose
still forum
valid abyss
#

Hello, earlier today i was messing around with the grad persistence script when i noticed that my game started to get slower, pausing was slower, switching from one tab to another in the editor was slower and when i checked my profile namespace it said it was 988kb. How do i fix this?

cosmic lichen
#
  1. Edit your profile var file manuall
  2. Used Terras Editing Extension or 3den Enhanced to edit the vars with the Variable Viewer
  3. use profileNamespace and allVariables commands to edit it via script
#

but 988kb isn't that big I think. I got 500 and have no issues

#

I would make a backup of the file and delete the original one to test if your issue is solved, first.

valid abyss
#

so copy the var file, delete it and then paste it back in?

cosmic lichen
#

delete it, start the game

#

see if it is faster

valid abyss
#

But wouldn't that delete all of my variables?

cosmic lichen
#

that's why you do a back up first of the original file

valid abyss
#

Alright il try that now

#

Yes this worked

#

@cosmic lichen What do i do now?

winter rose
#

use the old file again, then

Use Terra's Editing Extension or 3den Enhanced to edit the vars with the Variable Viewer

cosmic lichen
#
  1. Edit your profile var file manually
  2. Used Terras Editing Extension or 3den Enhanced to edit the vars with the Variable Viewer
  3. use profileNamespace and allVariables commands to edit it via script
valid abyss
#

Ok thank you

cosmic lichen
valid abyss
livid wraith
#

how would one go about adding an action that is available when controlling a UAV ?

valid abyss
#

@cosmic lichen ?

winter rose
#

if you have hundreds of them, I would recommend using a tool

valid abyss
#

What tool should i use?

winter rose
valid abyss
#

How many variables would i delete and how would i delete them?

winter rose
#

all the ones you don't recognise/don't use

#

how would i delete them
using the tools

cyan dust
#

Good day. Does anyone have experience in parsing DB (MySQL) response with SQF? It must be something with how it returns CHAR values - parseSimpleArray just breaks with "Generic error in expression"

valid abyss
#

I've gone through the variables and deleted 1/3 of them but its still slow, would it be ok to just delete the profile namespace and get a new one?

little raptor
#

what you should've done is temporarily delete the profilenamespace and run the game to see if that's the issue at all.

#

not delete variables one by one

valid abyss
#

I have done that

little raptor
#

so does it fix the issue?

valid abyss
#

yes

little raptor
#

then just delete it. you'll lose some settings tho

valid abyss
#

What settings?

little raptor
#

not your game keybinds (but CBA keybinds will be lost)

little raptor
valid abyss
#

Alright thank you

#

Should i export my mod settings before deleting?

little raptor
#

maybe.

dreamy kestrel
#

Q: about triggers, are there BIS functions supporting this, I wonder?

willow hound
#

Supporting what?

vast sand
#

Anything you can do with a trigger you can do with scripting. It isn't very easy sometimes though.

spark sun
#

A: yes.

spark turret
#

hey i wanna add zeus(curator) to a player in a MP mission through command line. what do i have to do? can only find the assign curator command, but i dont know the reference to the zeus module

willow hound
#

Create the module on the fly. Just don't forget to clean up when it's no longer needed.

dreamy kestrel
#

hmm perhaps a different question, when you configure trigger activation by to west or blufor, let's say, i.e. "WEST", does that include anything west? i.e. units, players or otherwise, vehicles, etc?

willow hound
#

Units and players for sure, vehicles you'll have to test a bit, I don't know for sure.

little raptor
#

vehicles too. but not sure about empty vehicles (I think they only count as civilian?)

fair drum
#

i thought its sideUnknown

#

or actually

#

I think its sideEmpty

dreamy kestrel
#

all good to know, thanks for the feedback

sacred slate
#

can i exec a sqf via radio call, like "0" custom?

fair drum
#

yes using a trigger

sacred slate
#

do you have additional syntax for google?

fair drum
#

in your onActivation do:

[] execVM "scriptnameandlocationhere.sqf"
sacred slate
#

oke thx. never seen yet radio triggers. thats quite fun

drifting portal
#
[[0,0,0], 0, "RHS_M2A3", groupname] call BIS_fnc_spawnVehicle;

is there a way to assign this vehicle a variable name? (so that I can setDamage for example)

fair drum
drifting portal
#

[createdVehicle, crew, group]

#

you mean this right?

fair drum
#
private _vehicleReturn = [[0,0,0], 0, "RHS_M2A3", groupName] call BIS_fnc_spawnVehicle;
private _vehicle = _vehicleReturn select 0;
drifting portal
#

yeah got it from the wiki lol

#

thanks

#

but

#

I will make it global

#

its possible right?

#
private _vehicleReturn = [[0,0,0], 0, "RHS_M2A3", groupName] call BIS_fnc_spawnVehicle;
thename = _vehicleReturn select 0;
#

like this

fair drum
#

yup

drifting portal
#

thanks

#

when I do thename setDamage 1;

#

its not exploding

#

hmm

dreamy kestrel
#

@drifting portal what isn't exploding? pretty sure that's an animation/effect. simply setting damage does not do that.

drifting portal
#

like its not getting damaged

#

I still can get in it

#

while it should be dead

fair drum
#

post the whole thing you have...

drifting portal
#

!code

wicked roostBOT
#
How to use SQF syntax highlighting in Discord

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

// your code here
hint "good!";
drifting portal
#
private _vehicleReturn = [[0,0,0], 0, "RHS_M2A3", groupName] call BIS_fnc_spawnVehicle;
thename = _vehicleReturn select 0;
sleep 4;
thename setDamage 1;
fair drum
#

are you in a scheduled environment?

drifting portal
#

not sure what that means

#

lol

fair drum
#

are you calling this script or spawning it...

drifting portal
#

Debug console

fair drum
#

so calling it. you can't do that in default arma debug without spawning the code first

dreamy kestrel
#

and define "doing nothing". like I said, I think "explosions" are animations, you have to script those separately. could be wrong though.

drifting portal
fair drum
#

no, just spawn it. also, you know you are creating that vehicle at map origin which is usually water right?

drifting portal
#

yes

#

I'm there

#

its not an ocean in this case

fair drum
#

okay. well you need to spawn it

drifting portal
#

I did

fair drum
#
[] spawn {
  //all the code
};
dreamy kestrel
#

and you're sure you have the model class name correct? test isNull (_vehicleReturn#0) for instance

dreamy kestrel
#

Q: re: triggers, setTriggerStatements versus setTriggerActivation, are these both alternate ways of "triggering" the thing?

fair drum
#

why are you even going there? he already successfully spawns the vehicle. the problem is that hes using sleep in a unscheduled environment

winter rose
#

Since it gets created, I assume so

dreamy kestrel
drifting portal
#

thanks

dreamy kestrel
# drifting portal works now

log would be interesting to review; might have been tripped up over sleep in the debugger, perhaps. versus spawning.

dreamy kestrel
fair drum
#

what did you put as the condition? your question reads... incomplete

#

oh i see what you are asking

#

if your trigger activation is set to bluefor, and your triggerstatement is this, then when a blufor unit enters, it becomes true. just like using a trigger from the editor

dreamy kestrel
#

@fair drum well, from other contexts, when I think trigger condition, literally is just that, returns a flag or some status, the condition, whereby the trigger is raised. in this context, I am uncertain about that.

#

in this case I suppose these are the 'callbacks', literally "wax on" or "wax off", as the examples suggest.

fair drum
#

you're overthinking it

dreamy kestrel
#

maybe... so ... setTriggerActivation (i.e. trigger happens, or ceases to happen), setTriggerStatements (i.e. in response to Activation)

fair drum
#

setTriggerActivation what is being detected to make this become true
setTriggerStatements condition what its going to take for the whole trigger to be true

the triggerstatements don't have to follow the activation at all. you can literally throw something in there that has nothing to do with the trigger area if you want.

dreamy kestrel
#

ah I see, so you can return "this", but does not have to be that.

fair drum
#

correct. you can do whatever you want

dreamy kestrel
fair drum
#

have you ever used a trigger in the editor before? it works exactly like that

undone dew
#

how would i go about setting off a trigger when a vehicle is repaired? For like a repair task. I don't see any eventhandlers for vehicle repair

undone dew
#

ok

fair drum
#

why not just set the trigger condition to check the current health of the vehicle with damage (0-1) and when it reaches a threshhold, it fires?

undone dew
#

how would i write that exactly, the example they have on the GetDammage command is:

private _damage = getDammage player;
#

but how do i use that as a condition brain fizzles

fair drum
undone dew
#

ahh so just like ```sqf
(damage engineer_sq_jeep1) > 0.3

fair drum
#

you would just do

damage vehicleName <= 0.1; //or whatever you want

in the condition box of the trigger

#

remember, higher the number the more damage. you want it on repairs, so do the opposite

undone dew
#

OH

#

that makes sense

#

hmm i have ```sqf
damage engineer_sq_jeep1 <= 0.5

#

vehicle is set to 15% health, its not firing the trigger i don't think

fair drum
#

try setting trigger activation to "anything"

undone dew
#

still not firing

#

i have a hint that should activate to test

fair drum
#

try forcing the vehicle hp with setdamage. if it works, it probably means that you need to use hitpoint damage or something that the in game repair does

#

also, 15% health wouldn't fire that trigger, because its 'opposite'

#

you want anything > than 50% health

undone dew
#

ok yea thats the issue, setdamage worked

fair drum
#

15% hp would be a value of 0.85

undone dew
#

15% is what it starts with, when it gets repaired it should go past 50% right?

#

i tried setting it to 0.7 as well and no difference

fair drum
#

i think the repair works on individual hitpoints then where the individual parts get repaired to 0.25 if non engineer

undone dew
#

so i'd need to use a loop with that i'm thinking

fair drum
#

the trigger itself acts like a loop

#

let me test something

#

okay yes, damage isn't effected by a repair. it just repairs the individual pieces.

#
[0.6,0.6,0.6,0.6,0.6,0.6,0.6,0.6,0.6,0.6,0.6,0.6,0.6,0.6,0.6,0.6,0.6,0.6,0.6,0.6,0.6,0.6,0.6,0.6,0.6,0.6,0.6,0.6,0.6,0.6,0.6,0.6,0.6,0.6,0.6,0.6,0.6,0.6,0.6,0.6]

this is the array of all the parts of a APC after its been repaired from 16% hp (damage of 0.837154). Damage was unchanged. Individual parts changed to 0.6

drifting portal
#
{ 
dostop this;
} forEach units east;

would this work? (apply for each eastern unit)

fair drum
#

and it would be

doStop _x
drifting portal
#
(allUnits select {doStop _x == east})

?

fair drum
#
{ doStop _x } forEach (allUnits select {side _x == east})
//or
(allUnits select {side _x == east}) apply { doStop _x };
drifting portal
#

oh alright

#

a quick question

fair drum
#

actually its just because of your good ol this. forEach uses the magic variable _x

fair drum
#

but yes, your units east would work

#

i just like using select cause usually i have more conditions than just the side

little raptor
undone dew
#

ah hell i still can't get this repair task to work. I have two triggers, one that fires on Anybody with this code: ```sqf
engineer_sp_jeep1_dmg = engineer_sq_jeep1 getHitPointDamage "hitEngine";

engineer_sp_jeep1_dmgvar = if (engineer_sp_jeep1_dmg <= 0.5) then { true }

#

and then another trigger that waits for engineer_sp_jeep1_dmgvar to be true and is synced to a task state module

little raptor
#

I have two triggers
wat?
just use a loop like I said

undone dew
#

i'm not familiar with using loops lol

#

and someone said the trigger acts like a loop (but im not sure how exactly)

little raptor
#

they ARE loops

undone dew
#

ok

little raptor
#

and then another trigger that waits for engineer_sp_jeep1_dmgvar to be true and is synced to a task state module
use it in there

engineer_sq_jeep1 getHitPointDamage "hitEngine" <= 0.5

that should be your activation condition (trigger has to be set to "Activation None")

undone dew
#

OH that's what i was having trouble with, i thought i had to use getHitPointDamage to fill a variable and then check for that

#

still not working, maybe i should try to get damage from something other than the engine?

little raptor
undone dew
#

yeh

little raptor
#

what was wrong with getDammage again?

undone dew
#

the vanilla toolkit repair only repairs hitpoints, not total health apparently

#

so it only sets all the vehicle parts to 60%

fair drum
little raptor
undone dew
#

wait wait wait i think i might've caught it, it's 0.6 but it's reversed like you said so it's only 40%

#

so it's NOT going to cross 0.5

little raptor
undone dew
#

that fixed it!

#

awesomee thank you

fair drum
undone dew
#

yeah it still tricked me lmao

#

thanks a ton

sleek dove
#

Hey there. Im making a Sector Control mission. How can I set up 3D icons like A,B,C,D and so on?

sleek dove
#

@fair drum Has this changed over the years? I see in the old videos and documentation for this that there is 3D markers for each site. Now it seems its been replaced with this

#

oh I cant paste pictures

#

the orange marker showing the active assignment

#

And only one assignment can be visible on the screen at a time?

dreamy kestrel
#

can a trigger OBJECT be attached to a MINE?

winter rose
#

I would sayโ€ฆ yes? But try, to be sure

dreamy kestrel
#

yeah, figured I should ask. since cannot set variables, is not an 'object' per se, it is a question mark

winter rose
#

it is an object, but a very simple one

fair drum
#

I've said that one before ๐Ÿ˜‰

dreamy kestrel
#

then I have the question, how does the trigger, area, etc, apply? to each attached object as its origin?

winter rose
#

sorry, what?

frosty cairn
#

hey guys, I need a small bit of help.
Im trying to define the caller of an addaction script, what's the command for me to define it?

fair drum
#

the addaction command automatically defines it with the params provided on the addaction wiki

#

params ["_target", "_caller", etc etc]

frosty cairn
#

ah, don't i have to change what "_caller" means?

#

or does it automatically recognize it

fair drum
#

you can if you want, it just has to be at index 1

frosty cairn
#

copy.

fair drum
#

you just include that params line from the wiki page

#

and use _caller from there and you'll be fine

dreamy kestrel
# winter rose sorry, what?

hmm well trying to avoid multiple triggers piling up; if I can apply the trigger dimensions using the attached object(s) as the source...

frosty cairn
#

params ["_target", "this select 1", etc etc]
Like this or...?

dreamy kestrel
#

maybe I have that confused with something like a logic?

fair drum
frosty cairn
#

okay, and i put that before the script itself right?

fair drum
#
["apples", "oranges"] call {
    params ["_item1", "_item2"];

    _item1  //returns "apples"
    _item2 // returns "oranges"
};
#

you put that in the code block at the start

frosty cairn
#

as in:
o1 addAction [ "<t color='#00FF00'>What's their goal?", { params ["_target", "_caller", "_actionId", "_arguments"]; [] execVM "chat\chat_astra_goal.sqf"; }, nil, 0.5, false, true, "", "true", 3, false, "", "" ]; ?

fair drum
#

ewww that format, but yes essentially

#

but are you going to use _caller at all?

frosty cairn
#

well i want _caller to be a player that called the addAction

fair drum
#

it will be.

frosty cairn
#

ah, so i don't have to change anything?

fair drum
#

_target is your o1

#

nope you don't you just have to include that params line which you did

frosty cairn
#

okay, cheers mate

fair drum
grizzled lagoon
#

Hello, I am trying to replace the sound of the kalxon in game, but I can not recover the sound for the delete is this possible?

fair drum
#

kalxon... interesting word for horn. gonna add that to the bank. your second statement doesn't make sense to me though

grizzled lagoon
#

Yes sorry horn

fair drum
#

i'm trying to understand what you want. "but I can not recover the sound for the delete is this possible?" this gets me confused on what you want

grizzled lagoon
#

I am looking for how to recover the sound to delete it, after research on the wiki I did not find anything is what it is possible and do you have the solution?

fair drum
#

are you using playSound? say3d? playSound3d?

#

how are you creating the sound

#

or are you just trying to mute the horn

grizzled lagoon
#

This is the basic sound of the horn, so I think it's a say3d

#

Yes mute the horn for play other sound

fair drum
#

but how are YOU creating the sound. it shouldn't be think, you should know, you wrote it lol

#

oh i see. you just want to mute the game's normal horn

grizzled lagoon
#

Yes i just want mute the sound of horn for after playsound other sound

fair drum
#

i'm not sure if you can easily. a couple ideas come to mind with fadeSound and some player left click event handlers, but its gonna be muted even for a new sound to take its place... would have to think about it

grizzled lagoon
#

the problem with fadesound is for add the other sound after, i must wait. I have look handlers : SoundPlayed but is not detect

untold sequoia
#

Hi guys ๐Ÿ˜„
I'm making a rescue mission where, before the rescue, the operators have to get informations from some audio tracks (audio already recorded by me and already insert inside the mission as sound). Do you know how to let the audio start using an hold action? (the audio should be a 3d audio as only the operators close to the console can hear it and it should be repeatable everytime they use the hold action)... Could you help me? What should I use?

fair drum
untold sequoia
fair drum
untold sequoia
grizzled lagoon
fair drum
weak lily
#

Hello all! Im having a bit of an issue understanding a specific set up in scripting and init. Im fairly new to all this and im not even sure what the problem is or where to begin troubleshooting. Im attempting to integrate the Gruppe-Addler money and buy menu scripts into my server, but i cant seem to get the buymenu addaction init to work. Im not even sure if this is the right place to get help with that

fair drum
#

well we can help you with general scripting and teach you, but I don't want to have to learn someone else's code. I'm guessing this is for life?

weak lily
#

Its for a PMC server im running. I want to pay my guys for operations and let them buy gear and weapons for future ops

#

I was able to get the money menu to run, but i dont understand how to get the other to run

fair drum
#

point me to some githubs you are using

weak lily
#

Ive also been in contact with the original creator but replies are few and far between

#

this is the github for the buy menu

fair drum
#

his tutorial looks pretty dang good. whats tripping you up?

weak lily
#

I have no idea of the lingo or how to troubleshoot

#

Its all very confusing ๐Ÿ˜…

fair drum
#

well forget that script for now and lets get you understanding what it is you are looking at. are you prepared to read?

weak lily
#

I am

fair drum
#

kk making some linkys

weak lily
#

thank you

weak lily
#

Thanks very much ill read through this tonight

mortal latch
#

Hey so was having trouble with this the other day and yall helped me get it working
This is in the initplayerlocal and works great except it doesnt work for JIP

var_trg1 = false;
var_assault = false;

[ 
 computer, 
 "Begin Assault", 
 "\a3\ui_f\data\IGUI\Cfg\holdactions\holdAction_connect_ca.paa", 
 "\a3\ui_f\data\IGUI\Cfg\holdactions\holdAction_connect_ca.paa", 
 "var_trg1", 
 "var_trg1", 
 {}, 
 {}, 
 {missionNamespace setvariable ["var_assault",true,true]},  
 {}, 
 [], 
 5, 
 10, 
 true, 
 false 
]call BIS_fnc_holdActionAdd;

do i need to change call to remoteExecCall so i get access to the JIP parameters?
i had been using remoteExec earlier and that was what had been causing my problem if i understand properly

fair drum
#

initPlayerLocal is fired when a player starts the mission anyways giving you that "JIP" you are looking for. Its most likely because they don't see var_trg1.

#

which was the issue last time, and its still probably an issue this time. show me where you are setting var_trg1

mortal latch
#

when it is innitaly defined or when it is changed?

fair drum
#

well if you see up at the top of your script

#

every time a player joins, its gonna set var_trg1 to false

mortal latch
#

right

fair drum
#

so if the trigger already occurred, the init is going to overwrite it

#

you still doing something like:

var_trg1 = true;
publicVariable "var_trg1";
#

?

mortal latch
#

no thats not the problem even if they join after the mission is started but before the var is changed it wont show up

fair drum
#

before the var is set to true?

mortal latch
#

yes

#

and just to clarify this is whats in the trigger's onactivation field

var_trg1 = true;
PublicVariable "var_trg1";
fair drum
#

you got your server up and anyone can join? no mods that I can easily pop in and track some stuff? i think thats the easiest way instead of dealing with this over chat. its most likely a variable problem as it always has been.

mortal latch
#

its not without mods
you know what give me a sec

#

wait a sec

mortal latch
#

should PublicVariable be publicVariable

fair drum
#

doesn't matter

copper raven
mortal latch
#

I dont have them set previously should I?

fair drum
#

you do though. line 1 of your initPlayerLocal defines the variable

copper raven
#

if isNil "var_trg1" then { var_trg1 = false }

#

this way you won't overwrite jip value(if it was broadcasted)

little raptor
copper raven
#

useless overhead

#

especially in condition code

little raptor
little raptor
copper raven
#

i prefer saving every bit of runtime where possible, so it's preference i guess

vast sand
#

low level language vs high level language prime example right here

mortal latch
#

ya sorry could have sworn that when we tested it both ways last night it didnt work either way cuz i thought this could be a problem but just retested it and it works as long as the variable hasn't been changed yet

#

so i guess i just need to go with the nil thing

little raptor
dreamy kestrel
#

what is a typical unit running speed in Arma?

fair drum
#

I think around 5

#

No probably like 3.3

#

Takes about 5 min to run 1k

#

If you are using Leo's dev tools just set the units speed under the watch list and pin it. It will track it on the side of the screen.

dreamy kestrel
#

Q: what is player action ["TouchOff", player]; actually doing? i.e. we _ied setDamage 1, correct? we need to animate players with TouchOff?

dreamy kestrel
fair drum
#

you can do those actions with a unit that is invisible in the middle of nowhere if you want

violet gull
#

Which script command is used to find the offsets of an object in relation to another? (Not the position on the map, but the offset like [ 1.4, 12, 0 ])

dreamy kestrel
violet gull
#

@little raptor Can you give me an example how to use vectorDiff to get the offset position of an object in relation to another? I made a composition of objects in a house that I want to extract the offsets for each so I can spawn the objects and set their positon, such as:

_chair setPos (_house modelToWorld [3.456 , 1.4 , 0.008]);
little raptor
#

let's say the house is the reference

violet gull
#

I'm trying to use the house as a reference

wanton forge
#

Is there a system to play a sound away from the player?

violet gull
#

@wanton forge say3D , playSound3D, say, say2D, playSound

little raptor
#

good.
then do this:

_relativePositions = _furniture apply {
  [typeOf _x, _house worldToModel ASLtoAGL getPosASL _x, _house vectorWorldToModel vectorDir _x, _house vectorWorldToModel vectorUp _x]
};

to translate:

{
  _x params ["_type", "_pos", "_dir", "_up"];
  _furniture = createVehicle [_type, [0,0,0]];
  _furniture setPosASL (_house modelToWorldWorld _pos);
  _furniture setVectorDirAndUp [_house vectorModelToWorld _dir, _house vectorModelToWorld _up];
} forEach _relativePositions;
violet gull
#

3D sounds are played at a distance and audible within a range, so if you want to have a radio playing use playSound3D or say3D. To end the sound abruptly, delete the object.

#

Perfect, just what I needed. I love you and your developer mod, you animal.

little raptor
#

meow

vast sand
# little raptor wtf are you talking about?

With low level languages programming style is usually centered around optimization because that code is likely going to be called upon fairly often or you aren't going to have a good processor to run it. With high level languages the code doesn't usually run that much so how quickly and easily you can do it is the main concern. So your argument was essentially what a low level vs high level programmer would argue about.

dreamy kestrel
#

I am confused... I have a trigger condition that I am 99.997% certain should be returning true right. why am I not seeing the activated callback log anything?

cosmic lichen
#

Because it's not 100%๐Ÿ˜„

dreamy kestrel
#

@cosmic lichen well yes, I always leave a little room for self correction ๐Ÿ˜‰
Logs:

23:26:32 [KP LIBERATION] [19868.1] [IEDS] [fn_ieds_onTriggerBigCondition] Fini: [_actual, _chance, _runningThreshold, _runningCount, _rollingCount, _trackedCount]: [0.844325,1,0,1,0,0]

Code:

((_rollingCount + _trackedCount) > 0 || _runningCount >= _runningThreshold) && _actual <= _chance;
#

condition should be met, true if I am doing the math correctly; yet I see no activation callback.

fair drum
#

is that all your whole condition?

cosmic lichen
#

Should work. But it's 5.30 here so no guarantee ๐Ÿคฃ

dreamy kestrel
#

much appreciated on all counts

dreamy kestrel
#

well, not "all" the code, but the code that matters, and is logged, contributing to the condition

cosmic lichen
#

What happens if you just set the condition to true?

#

Does it work as expected then?

dreamy kestrel
#

I could try that

cosmic lichen
#

You should

dreamy kestrel
#

no effect I see no activation callback

#

oh I see, obvious answer, typo in the func

cosmic lichen
#

๐Ÿคฃ

dreamy kestrel
#

I fine tuned the conditions to debug it, it works fantastically. walking, slow walking, no boom, running fast running boom. also,

[] spawn {
while {true} do {
sleep 0.5;
systemChat format ['running: %1', abs speed player];
};
}
little raptor
#
player addEventHandler ["AnimStateChanged", {
  params ["", "_anim"];
  _speeds = ["stp", "wlk", "tac", "spr", "run", "eva"];
  _speedsStr = ["Stopped", "Walking", "Tactical", "Running", "Running", "Sprinting"];
  systemChat (_speedsStr select (_speeds find (_anim select [9,3])));
}]