#arma3_scripting

1 messages · Page 517 of 1

high marsh
#

Ok, it works. But it's really goofy lol

#
#include "\a3\editor_f\Data\Scripts\dikCodes.h"
if(canSuspend) then
{
    offsetKeypress = 0;
    waitUntil{!isNull (findDisplay 46)};
    (findDisplay 46) displayAddEventHandler["KeyDown",
    {
        params["_display","_key","_shift","_ctrl","_alt"];
        _obj = attachedObjects player # 0;
        if(_shift) then
        {
            if(player call maas_fnc_isDragging) then
            {
                if(_key == DIK_EQUALS) then
                {
                    _obj setDir (getDir _obj - getDir player - 10);
                    true
                };
                if(_key == DIK_MINUS) then
                {
                    _obj setDir (getDir _obj - getDir player + 10);
                    true
                };
            };
        };
        if(_ctrl) then
        {
            if(player call maas_fnc_isDragging) then
            {
                _box = (attachedObjects player) # 0;
                _pos = getPosASL player vectorAdd(getPosASL _box vectorDiff getPosASL player);
                if(_key == DIK_EQUALS) then
                {
                    offSetKeyPress = offSetKeyPress + 1;
                    detach _obj;
                    _obj attachTo[player,[0,2,offSetKeyPress],"Spine3"];
                };
                if(_key == DIK_MINUS) then
                {
                    offSetKeyPress = offSetKeyPress - 1;
                    detach _obj;
                    _obj attachTo[player,[0,2,offsetKeyPress],"Spine3"];
                };
            };
        };
        false
    }];
};
robust hollow
#

probably dont need to detach it first, though i dont imagine it making much difference.

high marsh
#

Likely. Let me see

tough abyss
#

That's kind of janky the object is attached, fixed, there is no other way you can change its position. You need to use attachTo again. You don’t need to detach it though.

high marsh
#

Doesn't make it any less janky 😛

tough abyss
#

It does, you attach it to new offset. If you detach it in between then yeah, but if you don’t you are simply adjusting offset

high marsh
#

Yep.

next scaffold
#

Hey guys! I need to do a synced countdown. I guess that making the server calculate and publicVariable the current time to the players is the way to go, isn’t it?

#

The players would execute a script to display the time on screen but wouldn’t do any calculation

robust hollow
#

why not publicvariable the end time and everyone can count to it on their own?

#

counting isnt too hard 😃

next scaffold
#

Yeah, that’s what I’m currently doing but not all the players have the same time. I believe that’s because not everyone executes the counting at the same time?

#

Ike not everyone’s finish loading at the same time

robust hollow
#

wouldnt matter if the end time is synced. eg serverTime.

so on the server you would do

missionNameSpace setVariable ["myEndCountdownTick",serverTime + 60,true];

then clients would do something like

private _tick = missionNameSpace getvariable ["myEndCountdownTick",serverTime];
private _string = [_tick  - serverTime,"MM:SS"] call BIS_fnc_secondsToString;
// display _string somehow

and that way everyone has a synced countdown, no matter when they started

#

obviously that client snippet would be in aloop until the countdown is done but u see what im going for

next scaffold
#

I see, thank you!

#

When does server time start counting? As soon as the mission starts or when the server is initialized?

robust hollow
#

Returns the time since last server restart

next scaffold
#

Thank you, I’m gonna try this approach

next scaffold
#

yes, I believe you guys got me into the right path. I'll try to make it work and come back if I get stuck again. Thank you 😃

astral tendon
#
[[],PlayerPlayCutStart] remoteExec ["spawn",allplayers];

This is a curscene, it does not play to all players, some times one or two playes do not see the cutscene, I dont know why this unreliability happens.

#

Also, this is on a dedicated server.

robust hollow
#

target -2 instead

#

-2 is everyone but server

astral tendon
#

So, allplayers is unreliable?

robust hollow
#

if ur having issues then evidently yes it is.

#

-2 is the “right” way to target everyone but the server anyway

tough abyss
#

When you pass object as target like player for example, it will look for owner of the pc where object is local. But player joining the server is created on the server first before transferring ownership to user’s pc. So it is not that allplayers is unreliable it is this approach is. Why not do it the right way like Connor suggested, why reinvent the wheel?

astral tendon
#

So I know what is going on and avoid to do the same type of mistake depending on my next script.

tough abyss
#

Fair enough

thorn saffron
#

is it possible forcibly making player's head turn to look at a position. Like enable free look and make player look at a position. All using scripts

young current
#

afaik no

#

would require an animation to be played but that will not be exact

vague hull
#

@thorn saffron you can workaround by spawning a camera, switch view to it and turn it (if its about the view only)

thorn saffron
#

no, I wanted to script a way for player to follow the locked on target when in the plane, like you have in almost all of the normal flight sims. New camera would not do as it would either be janky or the MFD HUD wouldn't work

plain cliff
#

I'm observing that setPos does not work globally (i.e., called from server) on units inside a vehicle. Does that make sense to anyone?

#

I can get it to work if setPos is called locally, but API docs claim this is global. Just wanted to see if anyone else has seen this. Thanks

#

Sorry this is on dedicated server

still forum
#

units inside a vehicle?

#

They are in a vehicle. You have to get them out first

#

setting position might be global yes. But the moving out of vehicle part might not be

tough abyss
#

I am having some "fun" with getSuppression at the moment. I appreciate that it doesn't work with remote units but I also have a bunch of warnings about troops that are local and are still returning null for the call. Other than ensuring it isn't a player/HC and that it is local what else am I missing? It isn't just a blip either happens throughout the entire mission.

#

And I am removing dudes that are dead too.

ebon ridge
#

I'm thinking about AI driving, particularly in regards to convoys and would like to try and work out the state of the art as it currently is. I have been doing some research, trying vanilla convoy, devas' script, looking at how ALiVE implemented them, looking at VCOM driving AI (doesn't seem better than the AI, worse in a lot of cases, and too many can openers anyway).
The main problems I have noted with vanilla convoy are:

  • some vehicles will just stop (a nudge script is fixing these a lot of the time after a while)
  • obstacles can cause vehicles to take different routes from each other (not great for convoy aesthetics)
  • bridges, sometimes vehicles will mess them up, sometimes not (nudge helps here)
  • speed: need to limit it to an arbitrary low number to keep the convoy together (35kph is working okay)

I had an idea for using setDriveOnPath to try and force better cohesion and pathing. Has it been done? I'm thinking one could sample the lead vehicles position and then feed it into setDriveOnPath for follow vehicles to get good cohesion, then constantly update speed limit like devas' script attempts to do. Also I think one could generate hierarchical nav graph from roads and use A* + setDriveOnPath, plus some real time adjustment using look-ahead down the route to avoid collisions. Anyone have any thoughts or experience with this?

astral tendon
#

Do anyone know how to force to close ACE arsenal?

still forum
#

close the display

astral tendon
#

How?

still forum
astral tendon
#

What is hes code?

still forum
cursive whale
#

@ebon ridge No relevant experience to offer but that all sounds very sensible. Big fan of the idea of doing offline indexing of map data (i.e. road nodes) to save on in-game scripting (ideally a fallback script would always be available for maps which haven't been indexed).

astral tendon
#

@still forum Thanks

#

@still forum was that jojo reference?

ebon ridge
#

@cursive whale Yeah I guess it is going to be slow to generate that graph!

still forum
#

no that was not a reference

modest temple
#

this addAction["Firing position 6 Targets","popup.sqf",[[tar1_13,tar2_13,tar1_14,tar2_14,tar1_15,tar2_15], 0,1,true]];

this doesnt work in a dedicated server, how should i chance it?

high marsh
#

How are we supposed to know why if we don't know what popup.sqf contains?

modest temple
#

im just asking how i add that action so it works globally

#

i didnt realize you need to know the contents of the script

high marsh
#

No, this refers to the unit in your inot field. Not all players

modest temple
#

so will just replacing this with "player" work?

still forum
#

what is "this" ?

#

scripts in init field are executed for each player

tough abyss
#

This action is already added globally if you put it in unit init

high marsh
#

@still forum I assume this is to keep locality in check? Same args and everything?

lean estuary
#

I remember there was a way to set the source of damage to a specific player (FE: Create a scripted explosion that gives a "player x killed player x message"). Can anyone point me towards the method for that?

tough abyss
#

setShotParents probably

digital hollow
#

_BruceWayne setShotParents true;

still forum
#

@high marsh what talkin bout

high marsh
#

scripts in init field are executed for each player

#

I'm not sure why this is the case.

tough abyss
#

Because this is how init works

high marsh
#

but whhyyy.

still forum
#

because u fuq

high marsh
#

oh.

still forum
#

don't ask such stopid question

high marsh
#

I have worse questions to ask dedmen. Trust me.

still forum
#

do it then

high marsh
#

where are all the zombies

still forum
#

dead

#

obviously

high marsh
#

🤔

tough abyss
#

Because you want unit to be inited the same everywhere on every client

high marsh
#

Yes, that's what I was saying

west grove
#

not sure if this is the right place here, but i'll try anyway... with "cutrsc ["RscMissionEnd","plain"];" i'm showing the "mission completed" text on screen... is there anyway for me to edit said text "on the fly" / viascript?

#

or do i have to create a new rsc?

young current
#

I would say no that rsc is not made dynamic

#

so yes you would have to create something that for example could read some dynamic value

west grove
#

well if i have to create my own rsc, then i don't have to make it dynamic. i just thought about reusing the existing one

#

tried putting that stuff in description.ext already, but then i'm getting problems with inheriting, which is quite annoying

young current
#

I dont think you can just plop it down like that

#

you have to understand how it works

west grove
#

yes, that's the problem :p

#

i find it hard to find good info about it, because i'm not even sure what exactly i'm looking for

young current
#

you have hard time finding info about them because not much is written about it

west grove
#

not written or is written?

young current
#

yes 😄

#

😛

west grove
#

this rsc stuff is so annoying

#

how the hell do i inherit from that. i'm sure it was possible to do in description.ext?

#

throws me error about missing duration, which ofc is not there.. but shouldn't it take it from the top class?

young current
#

whats so special about that particular screen that you want to use it?

#

perhaps you must recreate it from scratch

west grove
#

that's it -- i don't want to recreate it from scratch :p

young current
#

quite often in Arma,what you want and what you must do, do not mix

west grove
#

i want the mission end effect without actually ending the mission. i figured the easiest way to do would be to just rip the effect out of the function and do my own crap with it. turns out it isn't as easy as i thought.. as always

young current
#

so far that has always been the case I've noticed

west grove
#

i mean, ripping the effect out is easy, but now replacing the text... ugh

#

but that reminds me of something

#

we can adjust the text via cfgdebriefing

#

so what if i go that far.. and then just cut out the mission end part of the script

#

i will try this

young current
#

dunno sounds messy

#

then that same text will be there when the mission really ends

west grove
#

it won't end like that

#

and i can use a different "ending"

#

i mean, even right now you can define like.. 10 different endings and then chose from them

west grove
#

doesn't seem to work. i probably do something wrong

#

welp, i tried

spark turret
#

got a question, is it possible to make an attached unit rotate freely?

#

without the unit being in a turret or sth. just attach it to the vehicle and it turns and fires as normal.

spark dew
#

I'm trying to have some events kick off when players attempt to open a locked door on a shack. The variable "shack" refers to the building in question.
inGameUISetEventHandler ["Action", ' _target = _this select 0; if (_target == shack) then { hint "locked..."; remoteExec ["shackActions",0,true]; } '];
This code works perfectly. The "shackActions" function gets called when someone tries to open the door, but does not get called for any other actions anybody does to any other object that isn't the shack, which is great. My problem is this; while it all works perfectly, players still get this error when using the door:
'|#| _target = _this select 0; if (_ta...' Error Type String, expected Bool
Any ideas on what's going on here? I've been beating my head against cryptic message for too long...

robust hollow
#

the action function is meant to return a bool i think. all the wiki examples do.

#

true blocks the action, false lets it run.

#

urs says its a string because remoteexec returns a string

#
inGameUISetEventHandler ["Action", '
    _target = _this select 0;
    if (_target == shack) then {
        hint "locked...";
        remoteExec ["shackActions",0,true];
    };
    false
'];

try false on the end like this

#

If EH function returns true, performed action is overridden.

spark dew
#

Ah, I'll give it a go. I always forget about sqf's returning the last value ><

#

yep, that solved it. Thanks @robust hollow !
Side question, not so urgent since I am now working 100%.... I tried replacing _target = _this select 0; with params [_target];, but that failed because instead of being the target of the action, _target was set to "any". Any clue why that would be? It was just confusing me all the more...

robust hollow
#

ur using _target in the params array before _target is set.
you want: params ["_target"];

spark dew
#

< thanks again, clearly I have not had enough coffee.

keen bough
#

I am missing an example. How do i get the vehicles AND positions with inAreaArray? Currently i detect only the vehicles with this:

_landVehGar = vehicles inAreaArray landGarage select {_x isKindOf "LandVehicle"};
robust hollow
#
_landVehGar = vehicles inAreaArray landGarage select {_x isKindOf "LandVehicle"} apply {[_x,getPosASL _x]};
keen bough
#

would be neat if that example would be on/in the wiki page @robust hollow and thanks for the help

robust hollow
#

it isnt really an example for inAreaArray. inAreaArray returns an array and/or position depending on what you give it, this is more an example on how to use apply.

keen bough
#

oh. Yeah, but it states "and/or" in inAreaArray. Which implies for me i can geet both informations at the same time. Else i would get only one thing, which then must be "get positons or types/things in area"

Righty?

robust hollow
#
[player,getpos otherPlayer] inareaarray "somewhere"; // returns [player object, position of other player] (assuming they are both in the area)

it will return an object if you gave it an object to check, it will return a position if you gave it a position to check.

keen bough
#

So, actually i can achieve the same result with apply and inareaarray?

robust hollow
#

you can achieve the result you're after with apply, yes.

keen bough
#

Let me see if i write it correctly with the wikihelp

#

<sighs> i cant get it which i do use {} or [] or ()....

_landVehicleArray = [vehicles, positions] inAreaArray landGarage select {isKindOf "LandVehicle"};
robust hollow
#

the snippet i posted is what u want?? returns the vehicles that are in the area, selects the land vehicles and then puts them in an array with their position.

keen bough
#

Yes, with the apply. But if you tell me it works the same as with inAreaArray only too, i want, of course, to work it out with that (as well). I am learning it all, and knowing as much as possible is key to everything, i guess.

robust hollow
#

checking a vehicle and then its position with inAreaArray is completely pointless. the vehicle is in the area, the position will be too but no sense in checking both because it is a waste of time.

keen bough
#

Now i have different informations. Can i get both position and vehicles that are kindOf within the one line command or not? Am i forced to use apply?

robust hollow
#

the information is the same. if you give inAreaArray a list of objects and positions it will return the objects and positions that are in the area. You don't need to use apply however if you want to do it all in one line apply is what I'd recommend.

keen bough
#

But does it work as well with "isKindOf" because i get an empty variable if i use my current version line of code.

#

I am highly unsure where to put () [] {} because everytime i script something its completely different, it seems, when i use different commands and/or functions.

#
test = [vehicles, positions] inAreaArray landGarage select {_x isKindOf "LandVehicle"};
robust hollow
keen bough
#

It works like a charm but it does not solve the thing i want to know.

#

If something is possible with A and B, but i learn only B, how am i supposed to come up with a solution if B does not work sometime?

robust hollow
#

I am highly unsure where to put () [] {} because everytime i script something its completely different
[] and {} depend on the command, the wiki will tell you how to use them. () is for grouping statements. what else do u want to know?

tough abyss
#

I suggest you use entities command with type filter and plug resulting array into inareaarray

keen bough
#

Doesnt help really. The main problem is that there is no full tutorial on scripting. If i am lucky i find the correct snipped somehow somewhere. But most explanations on the wiki are very rudimentary and often only with 1 thing/object in mind.

Every tutorial starts from scratch and end after a couple of videos -.-

#

I mean i got everything to work so far ^^ but its horrible the way i have to do it.

robust hollow
#

there is no full tutorial because how you use commands depends on what you're trying to achieve. the wiki tells you how to use them and anything you're unsure of you can ask.

keen bough
#

Yeah, but i ask a lot and can work with the help here. But, i thought i could learn with the wiki and tutorials without annyoing people all the freaking time about every little thing like "Did i write this correct? Why is this not working"

I think i made a little progress in learning but a basic introduction to most things would be a good thing. Because with a better example than most on wiki are helping me more (most thing i learned from someone, not the wiki)

robust hollow
#

this channel is made for people to ask Did i write this correct? Why is this not working

keen bough
#

Yeh, but i have the feeling i wont learn much if i get presented the solution. Sure, i go throught he solution and figure out why it works... But i came here an awful lot. I am feeling that somehow people could think like "You should already know this already ... tzk"

tough abyss
#

Everyone went through that, sqf has steep learning curve

grizzled spindle
#

Welcome to SQF

spark turret
#

@tough abyss its an exponential learning curve. first 2 days you Learn a ton, after that you learn less and less and it gets frustrating fast lol

halcyon creek
#

Any clue where im going wrong here?

#
waitUntil {sleep2; {alive _x}count _targets==0};```
#

Giving me an error saying missing ; have tried it multiple different ways but still returns the error

#

however when I have done it a different script it works

slim oyster
#
waitUntil {sleep 2; _targets findIf {alive _x} == -1};``` ?
halcyon creek
#

Cant hurt to try it

#

Nope same thing

#

Its the line above thats causing the error I believe, I just dont know what it is

robust hollow
#

should send the error message

halcyon creek
#

It is states the error is

waitUntil...'
Error Missing ;```
robust hollow
#

is that the exact error in the rpt? i feel like there would be more to it 🤔

halcyon creek
#

The only other thing thats on the error message is the file directory for the SQF

robust hollow
#

whats the line before _targets

halcyon creek
#

and Error Line 25

#
obj7 = player createSimpleTask ["Qualify on the Rifle Range"];

// Give Weapons and Move to Range
titleCut ["", "BLACK OUT", 1];
sleep 2;
removeAllWeapons player;
player addWeapon "UK3CB_BAF_NLAW_Launcher";
player addAction ["Get NLAW","NLAWRe.sqf"];

player setPos (getPos NLAWpos);
player setDir 210;
titleCut ["", "BLACK IN", 2];

sleep 2;
hint "Setting up the Range";
sleep 2;
hint "Prepare to Fire";
sleep 5;

hint "Use the NLAW To Distroy All The Armoured Targets";
sleep 4;
hint "Use the scope and find your target, press T to get the correct range before firing"

_targets=[NLAW1, NLAW2, NLAW3];
waitUntil {sleep1; {alive _x}count _targets==-1};

NLAWIns sideRadio "nice";
["TaskSucceeded",["","Qualify on the NLAW Range"]] call BIS_fnc_showNotification;
obj7 setTaskState "SUCCEEDED";
 
 else {sniperINS sideRadio "testfail"; hint "You Failed the test. See the NLAW Range Master to try again.";};
nopop=FALSE;

// Remove Weapons
titleCut ["", "BLACK OUT", 1];
sleep 2;
removeAllWeapons player;
player removeAction ["Get NLAW","NLAWRe.sqf"];
titleCut ["", "BLACK IN", 2];```
#

Thats the Entire script

robust hollow
#
hint "Use the scope and find your target, press T to get the correct range before firing" // <-- no semicolon

_targets=[NLAW1, NLAW2, NLAW3];
waitUntil {sleep1; {alive _x}count _targets==-1};
// ^^ sleep1 will error
halcyon creek
#

so remove sleep 1?

robust hollow
#

no you just add a space between sleep and 1

#

that count wont be true either because the lowest it can be is 0

halcyon creek
#

Ah thought I had changed that back

robust hollow
#

also you have
else {sniperINS sideRadio "testfail";
but none of this is in an if statement so else makes no sense?

#

not that u need an if to use else but the point is thats not used correctly anyway

halcyon creek
#

What would you suggest to change that?

robust hollow
#

what is it supposed to do?

#

also side note, ur using removeAction wrong at the bottom

halcyon creek
#

So if the 3 Targets are destroyed, within a certain time it completes the task, if the 3 targets aren't destroyed it plays the other message

robust hollow
#

is this more what you're after?
https://gist.github.com/ConnorAU/3154f846fa3465f21ae4f2b1227752ff

take note of:
L9 - addAction index is assigned to variable so it can be removed later
L24-30 - waituntil waits until all targets are dead OR the time has run out
L32-39 - if statement doing what it needs to depending on if the targets are dead
L47 - action index variable is used to remove the action from L9

halcyon creek
#

Looks like it might be, Ill give it a test in the morning 😃

#

Thanks for all your help

exotic tinsel
#

i am having a hard time finding something on the net that tells me how to spawn an ai mortar team in. i know how to make them fire just not how to spawn in the unit with script. can anyone help?

astral dawn
#

createGroup, createUnit ?

#

then moveInTurret

exotic tinsel
#

omg im dumb. thank you so much. @astral dawn

silk tulip
#

can somebody do a simple script modification for me?

robust hollow
#

depends what this modification is

silk tulip
#

@robust hollow change this revive script to allow revives with a medkit or first aid kit

#

only allows first aid kits rn

wary vine
#

quick question, whats the best way of using ctrl create when allowing the dialog to be moved with movingEnable = 1;

#
       (ctrlPosition _control) params ["_this_x", "_this_y"];

        (missionNamespace getVariable ["lega_xphone_originalPosition", []]) params ["_original_background_x", "_original_background_y"];
        
        (ctrlPosition (XPHONECTRL(1))) params ["_background_x", "_background_y"]; 

        private _positions = [];

        [
            [_background_x, _original_background_x],
            [_background_y, _original_background_y]
        ] apply {
            _x params [
                "_current", "_original"
            ];

            diag_log _x;
            private _difference = 0;

            if !(_current isEqualTo _original) then {  
                _difference = _original - _current;
                diag_log _difference;
            };

            _positions pushBack _difference;
        };

        if !(_positions isEqualTo []) then {
            _control ctrlSetPosition [
                (_this_x - (_positions select 0)),
                (_this_y - (_positions select 1))
            ];
        };  
``` is what I have come up with, and seems to work, just whether there is a way without this little workaround
sudden yacht
#

General Question here, but is it possible to set the position of a module through a scripting command?

tough abyss
#

module is logic it normally doesn't matter where it is at. You can set position like with any other unit, but what for?

halcyon creek
#

2 questions here, How would I assign an objective with a notification through scripts?

sudden yacht
#

Hint "My Objective.";

halcyon creek
#

and also how would I be able to get a script to check if a player has gone through a trigger zone, Trying to do a Timed shoothouse style thing, I figure that diag_ticktime is the best way for it

#

Wouldnt that just give a hint? rather than using something like call BIS_fnc_showNotification that actually shows the propper notification?

sudden yacht
#

Yeah i believe that would be a better way.

radiant egret
#

for the easier ways use 2 poles, start and end combined with while, ^ shoothouse

halcyon creek
#

@radiant egret what do you mean by poles?

#

And can this be done in a script?

radiant egret
#

flag poles or any other object

#

anything can be done via script

tough abyss
#
[west,["task2"],["Good luck finding this cookie","Find Cookie","cookiemarker2"],objNull,1,3,true] call BIS_fnc_taskCreate
``` from https://community.bistudio.com/wiki/BIS_fnc_taskCreate
halcyon creek
#

The thing I have with this is the objectives or tasks rather are defined somewhere else as simple tasks somewhere else, its just assigning them that happens in the seperate scripts

tough abyss
#

I didnt understand any of that, but ok

halcyon creek
#

Okay for example. the tasks are set up like this in the Briefing

 
    Obj0 setSimpleTaskDescription["Task Description"];

    Obj0 setSimpleTaskDestination (getMarkerPos "TASK1");
    
    player setCurrentTask Obj0; ```
#

that repeats from Tasks 0 - 7 and at each task theres a seperate script

#

that they complete whatever task it is, and at the end of the script it says
player setCurrentTask Obj1;

#

Or whatever the correct number is for the next task, Now this works completely fine, it assigns the next task like it needs to

#

But I would like it to play the task assigned notification

tough abyss
#

Why not use tasks framework for that?

halcyon creek
#

Because I wasnt sure how to if im honest, it works for the completed tasks, I have used it for the completed tasks

#
obj1 setTaskState "SUCCEEDED";}
player setCurrentTask Obj2;```
#

But I dont know how to call the notification for the last line there

#

Would it be like ["TaskSucceeded",["","TASK NAME"]] call BIS_fnc_showNotification; obj1 setTaskState "SUCCEEDED";} player setCurrentTask Obj2; ["TaskAssigned",["","TASK NAME 2"]] call BIS_fnc_showNotification;

tough abyss
#

I thought that it was pretty clear from tasks framework page:

[west,["task2"],["Good luck finding this cookie","Find Cookie","cookiemarker2"],objNull,1,3,true] call BIS_fnc_taskCreate ;
["task2","CANCELED", true] call BIS_fnc_taskSetState;

shows notification when you change state

#

But if you are hellbent on using BIS_fnc_showNotification then sorry, can't help

halcyon creek
#

alright, Thanks anyway

nocturne basalt
#

Hi guys. I have a question regarding mass on vehicles thats killed. In my case, I dont wanna use a wreck model, but performing some death animation when its killed. The vehicle seems to loose its mass when killed, because I can walk straight through it afterwards. I've also tried using setMass.

Is there a way around this? I'd like to avoid spawning some external object to create collision

#

PM: collision works for physX objects, but not for infantry

tough abyss
#

I got to the bottom of my getSuppression question which is basically why is it null for an AI unit. Turns out that units spawned in after mission start with scripting (not Zeus) return null until such time as they are shot at. So null is a normal return and to be expected as part of the functions (undocumented) signature currently. Might be a useful note on the community wiki because it is a bit of a gotcha. It is also potentially a bug.

#

@nocturne basalt it is not mass, it is likely that simulation is disabled in it

#

the functions (undocumented) signature huh?

#

So if unit is not supressed the return value of suppression is 0? What is wrong with it and why it needs to be documented? @tough abyss

#

A unit that is there at the beginning of the mission or spawned with Zeus will have an initial value of 0 and then vary 0-1 as expected. A unit spawned via scripting will have an initial value of null and once shot at will then vary from 0-1 as expected.

#

null you mean the command returns nothing as in nil?

#

Yep. According to the docs it should only do that on players. I suspected it might also do that on remote units as well but I just changed around to make it always local.

nocturne basalt
#

@tough abyss what do you mean simulation is disabled? does its simulation change once its killed somehow?

tough abyss
#

some objects after they got killed get their simulation disabled immediately or after some time, and become walk through

nocturne basalt
#

ah I c. maybe it has to do with saving resources.

tough abyss
#

I mean really the collision is responsible for walk through, but when engine disables simulation it normally includes collision too

nocturne basalt
#

hm yeah.. ordinary wrecks have collision, but they are simpler objects arent they...

#

hmmm any suggestion what I have to do here?

tough abyss
#

depends, you could spawn wrecks that are normal objects

nocturne basalt
#

hm ok

#

oooo maybe I can use this command

tough abyss
#

worlks with PhysX

nocturne basalt
#

oh damn. seems I have to specify the object it can collide with. I would ofc let it collide with everything

tough abyss
#

Yeah just tested on the fallen fence, you need to replace it with simpleobject nothing works

nocturne basalt
#

hmm. well... at least physX collision and fire geometry works

#

can still use it as cover

minor lance
#

Hello!

polar gull
#

Hey guys, so I really wanna learn scripting, I've spent a few hours reading up on the wiki during quiet times at work 😛

For me to learn it, it would be writing the script and doing it within the editor. My question is, what is simple to make, but a good one in order to learn scripting, good practices and stuff

minor lance
#

Any one knows if i can insert a Radar into a control in a dialog?

tough abyss
#

you can probably move original dialog if you can get reference but it most likely engine driven so probably no

#

what is simple to make start with making a script that throws all players on the server 100 meters up and then kills them

polar gull
#

ok haha

#

when you say kills them, you mean instantly? or when they hit the ground?

tough abyss
#

the world is your oyster

polar gull
#

Ok, gonna give it a whirl! Thank you

tall dock
#

A short question: I'm currently using
addMissionEventHandler ["EntityKilled", { [_this] remoteExec ["d_fnc_someFunction", 2]; }];
in my mission. But somehow, when I try to get the sides of the returned killer or the killed entity, its always read as "CIV".
(When I try a hint side player in the debug console ingame, it shows "WEST", the eventhandler will always return "CIV" for everything)
If doing the same thing with a "Killed" eventhandler on the same killed units, the sides are returned correctly.
Am I missing something here?

robust hollow
#

try getting the side of the killers group

#

im not sure why that would happen, but getting the group side instead seems to work for people.

tough abyss
#

[_this] remoteExec ["d_fnc_someFunction", 2]; why??? Use if (isServer) then {[_this] spawn d_fnc_someFunction}; instead

#

or if you add missionEH on the server only you dont even need to do that, just straight execution

tall dock
#

Yes, you are absolutely right, thats how it was before I fiddled with my code for the last 2 hours trying to find the problem. And @robust hollow just fixed it for me. Thank you so much! ❤

#

Sometimes its just the little kinks in the scripting language of Arma ^^

plain cliff
#

Any suggestions on how to detect if briefing is over for a player in SP?

spark turret
#

Player moves out of the briefing room which is inside a trigger?

#

as soon as thisList = 0 you know the player is done.

plain cliff
#

I was referring to the briefing map before the mission starts. Analogous to getClientState, but that doesn't work for SP.

#

Something like getClientState == "BRIEFING READ" but for SP

burnt cobalt
#

There might be a slicker version around but maybe a waituntil with a mix of ‚alive player‘ / ‚!isnull findDisplay 46 and ‚visiblemap‘

tough abyss
#

How can you check the terrain at a certain position, like how ACE's E-tools only let you build trenches on dirt?

tough abyss
#

How can I find the "script_component.hpp" on there? I don't want to be reliant on ACE

robust hollow
#

you go into the folder and open script_component.hpp?

tough abyss
#

Didn't see it

robust hollow
#

you do now though?

tough abyss
#

oh in the Functions folder ok

tough abyss
#

I'm trying to get the nearest Chemlight when dropped, and then delete it, but when I do
nearestObject [player,"Chemlight_green"]; it keeps returning <NULL-object>

robust hollow
#

dropped as in thrown or moved from inventory to ground?

tough abyss
#

inventory to ground

robust hollow
#

that wont work then because moving items to the ground puts them in a GroundWeaponHolder

tough abyss
#

Ohhh yeah, so I have to search the GroundWeaponHolder?

robust hollow
tough abyss
#

I'm using the Put event already but couldn't figure out how to delete that specific item

#

I'm using the code you helped me with for a different thing the other day

_value = "Chemlight_green";//_this select 0;
{
_x addEventHandler ["Put", format["['%1',getPos(_this#0), _this select 2, _this select 0] execVM 'placeSeed.sqf';",_value]];
} forEach allPlayers;
#

wait, can I just delete the GroundWeaponHolder itself/

robust hollow
#

yea, but if there are any other items in the container they will be deleted too

tough abyss
#

Yeah, that's sort of a problem

#

I guess I can just delete that type of item, it's a placeholder anyway

robust hollow
#

it may be the way you have to go, i assumed there was a removeItemCargo command but apparently not 😦

tough abyss
#

Know how I could freeze a player in place while they do an animation? I found disableUserInput but I'm sure that's not local right?

robust hollow
#

attach them to another object. ambientAnim uses a game logic for that.

#

disableUserInput is local

tough abyss
#

ambientAnimation doesn't work on players does it?

robust hollow
#

idk, my point is it creates a game logic on the unit's position and attaches the unit to it so they dont move around. atleast i think thats why 🤷

tough abyss
#

makes sense

#

can you create a GameLogic with createVehicle?

robust hollow
#

no. Cannot be used to create objects of type "Logic", use createUnit command for that.

tough abyss
#

Used one of those invisible helipads because why not

#

Alright, I have a bunch of plants growing. Every X seconds the objects swap to the next growth phase model or whatever. Are a bunch of waitUntil {time > time + growthcycle }; going to destroy a server?

#

I figured it would be better to have the server check every X minutes/hours whatever and do the growth cycle on the appropriate plants

#

Trying to figure out the best way to do this

robust hollow
#

a few shouldnt hurt, though assuming growthcycle is always the same number, that waituntil will never be true.

tough abyss
#

it's not the same number, there are like 3 or 4 stages of growthcycle

#

concept works in single player just fine, I'm wondering how to make it viable for an Exile server or something like that

#

What I have is the plants run a script that has those waitUntils to swap the objects for the next one

ruby breach
#

To clarify a touch, unless growthcycle is negative that will never exit

tough abyss
#
_startGrowingTime = time;
_growthPeriod = 30;
_growCycle1 = _startGrowingTime + _growthPeriod;
_growCycle2 = _growCycle1 + _growthPeriod;
_growCycle3 = _growCycle2 + _growthPeriod;
_growCycle4 = _growCycle3 + _growthPeriod;

waitUntil {time > _growCycle1};
``` seems to be working
robust hollow
#

yea, thats not what the original snippet showed 😦

ruby breach
#

That’s not what you posted before

tough abyss
#

Oh my bad lol

#

Anyway, how horrible would it be to have like 100 instances of these plants growing on a server?

#

Is there a more efficient way to do it?

robust hollow
#

as in a hundred different spawns? would not advise that.

tough abyss
#

Yeah, I'm shooting for the worst case scenario

#

The script is just createVehicle then delete the old object repeated a few times per seed planted

robust hollow
#

you could store ur plants in an array with some other info like [[plant,next update time,current phase],[plant,next update time,current phase]] and cycle through that every so often. that way u only have one spawn

tough abyss
#

Like just one array for the whole server?

robust hollow
#

yea

#

if ur using cba you could use the perframe handler to wait x seconds before going to the next phase in the cycle

tough abyss
#

I'm not using CBA yet but no reason not to

#

is that better than doing waitUntils?

#

I'm assuming waitUntils run every second or frame

robust hollow
#

its unscheduled so if you like unscheduled scripts then yea its better.

#

waituntil runs on almost every frame

tough abyss
#

yeesh

robust hollow
#

depends how slow ur game is running

tough abyss
#

Oh, so they're low priority then?

robust hollow
#

thats the case for any spawned script though.

#

as in if you have 1000 spawned scripts and are playing on 5 fps its very likely some scripts could go a few frames without resuming.

sudden yacht
#

Hello all, was looking to get all terrain objects of a specific type within a radius around the player and give them an addaction. Code with example would be greatly appretiated.

tough abyss
#

Right

robust hollow
#

@sudden yacht pretty sure you cant use addAction on terrain objects. next best scripted alternative might be to add the action to the player with a condition checking the target type or model.

sudden yacht
#

@robust hollow how would i best use that with say nearest building command?

robust hollow
sudden yacht
#

@robust hollow i can never seem to get the ace setdamage command to work correctly.

robust hollow
#

well i'd recommend reading the function to see what you're doing wrong. i have never used ace so am not familiar with how it works.

tough abyss
#

I'm a little unsure of how to set this up to iterate through every different plant's cycle

params ["_growthFactor"];
_growPos = getPos _seed;
_startGrowingTime = time;
_growthPeriod = 30 * _growthFactor;
_growCycle1 = _startGrowingTime + _growthPeriod;
_growCycle2 = _growCycle1 + _growthPeriod;
_growCycle3 = _growCycle2 + _growthPeriod;
_growCycle4 = _growCycle3 + _growthPeriod;
growing = true;

while {growing} do {

//_thisPlantArray = [_typedropped, _seedPos, currentgrowthcycle;
{
    switch (_x select 0) do {
        _objectArray = [];
        //set plants to spawn for different seeds
        case "Chemlight_green": {_objectArray = ["Land_Can_Rusty_F","Land_BakedBeans_F","Land_Can_Rusty_F","Land_FlowerPot_01_Flower_F"];    };

    };
    
} forEach AllPlantedItems;

};
#

AllPlantedItems is an array of _thisPlantArray = [_typedropped, _seedPos, currentgrowthcycle];

robust hollow
#

you need a sleep in that while loop, also if this is mean to be for exile you should tag your variables to avoid conflicts with other mods.

tough abyss
#

This is the original way:

waitUntil {time > _growCycle1};
deleteVehicle _seed;
_seed = "Land_Can_Rusty_F" createVehicle _growPos;
_seed setPos _growPos;
#

just add a sleep X in there?

robust hollow
#

yea. if its a system where new seeds can be planted at any time then you will want a short sleep.

tough abyss
#

Right makes sense

#

But how do I orchestrate the individual growth cycles? It seems like if I use waitUntil, they're all going to wait for each other, or is that incorrect?

robust hollow
#
tag_growing = true;

while {tag_growing} do {
    {
        _x params ["_type","_pos","_tick","_stage"];
        if (diag_tickTime >= _tick) then {
            _x set [3,_stage + 1];

            // do stuff 

            _x set [2,diag_tickTime + (5*_stage)]; // some value based off the growing _stage

            // if this item is finished the last stage
            if (_stage == 5) then {
                tag_growingPlants set [_forEachIndex,0];
            };
        };
    } forEach tag_growingPlants;    
    tag_growingPlants = tag_growingPlants - [0]; // delete completed elements
    uisleep 1;
};

i mean something like this so you can perform actions for individual seeds based off their growing stage. you would have a separate function to add new seeds to the array.

#

you dont have to use that setup exactly, but thats the concept

tough abyss
#

Here's what I came up before I saw that ^

FARMAgrowing = true;

while {FARMAgrowing} do {
sleep 15 * _growthFactor; //set higher for servers

//_thisPlantArray = [_typedropped, _seedPos, currentgrowthcycle, timePlanted;
{
    _growCycle = [_this select 3, _this select 3 + _growthPeriod, _this select 3 + (_growthPeriod * 2),_this select 3 + (_growthPeriod * 3),_this select 3 + (_growthPeriod * 4) ];
    //set plants to spawn for different seeds
    switch (_x select 0) do {
        _objectArray = [];
        case "Chemlight_green": {_objectArray = ["Land_Can_Rusty_F","Land_BakedBeans_F","Land_Can_Rusty_F","Land_FlowerPot_01_Flower_F"];    };

    };
    //cycle growth
    _currentGrowthCycle = _x select 2;
    if (_currentGrowthCycle == 4) exitWith {};
    waitUntil {time > (_currentGrowthCycle select _X + 1};
    deleteVehicle _x;
    _currentGrowthCycle createVehicle _x select 1;
    _x set [_x select 0, _x select 1, _x select 2 + 1, _x select 3];
    
} forEach AllPlantedItems;

};
robust hollow
#

yea, try again using my snippet because that will not work how you want it to

tough abyss
#

haha ok

#

the _tick time, should that be the time the thing was originally planted?

robust hollow
#

no, as you see in my example, it defines when the next stage should execute so you dont suspend your loop with waitUntil

tough abyss
#

So the only variables that need to be passed are the type and position then?

robust hollow
#

yea. your add function would really only need to be
tag_growingPlants pushback [_type,_pos,diag_tickTime,0];

tough abyss
#

If I'm packaging this as a mod, where do I want to store the big array of planted things?

robust hollow
#

somewhere in the mod?

tough abyss
#

XEHpreInit?

#

Oh wait nevermind

tough abyss
#

Getting |#| createVehicle - 4 elements provided, 3 expected on this

AllPlantedItems = [];
publicVariable "AllPlantedItems";
params ["_growthFactor"];
_growthPeriod = 30 * _growthFactor;

FARMAgrowing = true;

while {FARMAgrowing} do {
    {
        _x params ["_type","_pos","_tick","_stage"];
        if (diag_tickTime >= _tick) then {
            _x set [3,_stage + 1];
            
            _objectArray = [];
            switch (_x select 0) do {
            
            case "Chemlight_green": {_objectArray = ["Land_Can_Rusty_F","Land_BakedBeans_F","Land_Can_Rusty_F","Land_FlowerPot_01_Flower_F"];    };
            
            };
            
            deleteVehicle nearestObject [_pos,_objectArray select _stage];
            (_objectArray select _stage) createVehicle _x select 1;
                        
            _x set [2,diag_tickTime + (_growthFactor * _stage)]; // some value based off the growing _stage

            // if this item is finished the last stage
            if (_stage == 5) then {
                AllPlantedItems set [_forEachIndex,0];
            };
        };
    } forEach AllPlantedItems;    
    AllPlantedItems = AllPlantedItems - [0]; // delete completed elements
    uisleep 1;
};
#

I did notice my deleteVehicle should be select -1

robust hollow
#

tried this?
(_objectArray select _stage) createVehicle (_x select 1);

_x has 4 elements so that error would suggests its reading that line like this:
((_objectArray select _stage) createVehicle _x) select 1;

#

or better still, using the _pos var set in params

tough abyss
#

I'm getting "array, expected number" on _stage I believe:

deleteVehicle nearestObject [_pos,_objectArray select _stage];
(_objectArray select _stage + 1) createVehicle (_pos);
robust hollow
#

show complete error from logs

tough abyss
#

deleteVehicle nearestObject [_pos,_objectArray select >
 1:21:27   Error position: <nearestObject [_pos,_objectArray select >
 1:21:27   Error Type Array, expected Number
 1:21:27 File C:\Users\Owner\Documents\Arma 3 - Other Profiles\Axebeard\missions\_FARMA3.Malden\FARMA\plantGrow.sqf, line 22
 1:21:32 Error in expression <ehicle nearestObject [_pos,_objectArray select _stage];
(_objectArray select _st>
 1:21:32   Error position: <select _stage];
(_objectArray select _st>
 1:21:32   Error Zero divisor
 1:21:32 File C:\Users\Owner\Documents\Arma 3 - Other Profiles\Axebeard\missions\_FARMA3.Malden\FARMA\plantGrow.sqf, line 22
#

Is it because _stage is never initially set to 0 or something?

robust hollow
#

if ur adding to the array like i showed you then it should be set to 0

still forum
#

deleteVehicle nearestObject wat?

tough abyss
#

Wait, no I set it to 0

still forum
#

Ah. I understand. Parenthesis would make it more readable

tough abyss
#
AllPlantedItems pushback [_typedropped,_seedPos,diag_tickTime,0];
#

So what's the deal then?

robust hollow
#

Error Zero divisor

#

ur selecting an index outside of the array legnth

tough abyss
#

I have 4 objects in that array, plus the initial object (outside of the array)

robust hollow
#

_stage is selecting the 5th index (4) then ?

tough abyss
#

did I misspell chemlight?

#

Chemlight_green

robust hollow
#

or true, could be the empty array

#

that middle section should be something more like this

private _objectArray = switch _type do {
    case "Chemlight_green": {["Land_Can_Rusty_F","Land_BakedBeans_F","Land_Can_Rusty_F","Land_FlowerPot_01_Flower_F"]};
    default {[]};
};

if (count _objectArray > 0) then {
    deleteVehicle nearestObject[_pos,_objectArray select _stage];
    private _nextObject = _objectArray param [_stage + 1,""];
    if (_nextObject != "") then {
        _nextObject createVehicle _pos;
    };
};
tough abyss
#
_seed = ["Chemlight_green"];
...
if !(_typedropped in _seed) exitWith {};
...
AllPlantedItems pushback [_typedropped,_seedPos,diag_tickTime,0];
publicVariable "AllPlantedItems";
...
_objectArray = [];
switch (_x select 0) do {
            
case "Chemlight_green": {_objectArray = ["Land_Can_Rusty_F","Land_BakedBeans_F","Land_Can_Rusty_F","Land_FlowerPot_01_Flower_F"];    };
#

still giving me errors on line 22 delete nearestObject

#
1:34:17 Error in expression < _objectArray > 0) then {
deleteVehicle nearestObject[_pos,_objectArray select _>
 1:34:17   Error position: <nearestObject[_pos,_objectArray select _>
 1:34:17   Error Type Array, expected Number
 1:34:17 File C:\Users\Owner\Documents\Arma 3 - Other Profiles\Axebeard\missions\_FARMA3.Malden\FARMA\plantGrow.sqf, line 22
 1:34:21 Error in expression <Vehicle nearestObject[_pos,_objectArray select _stage];
private _nextObject = _o>
 1:34:21   Error position: <select _stage];
private _nextObject = _o>
 1:34:21   Error Zero divisor
 1:34:21 File C:\Users\Owner\Documents\Arma 3 - Other Profiles\Axebeard\missions\_FARMA3.Malden\FARMA\plantGrow.sqf, line 22

robust hollow
#
if (count _objectArray > 0) then {
    private _currentObject = _objectArray param [_stage,""];
    if (_currentObject != "") then {
        deleteVehicle nearestObject[_pos,_currentObject];
        private _nextObject = _objectArray param [_stage + 1,""];
        if (_nextObject != "") then {
            _nextObject createVehicle _pos;
        };
    };
};

🤷

winter rose
tough abyss
#

yes?

robust hollow
#

he has the syntax fine, just selecting an index higher than the array length

tough abyss
#

what's the line to log a specific variable?

robust hollow
#

diag_log _variable;

tough abyss
#

Figure out the issue, the _stage is looping instantly basically

robust hollow
#

you probably want the initial stage to be -1 then

tough abyss
#

that didn't help

#
_x params ["_type","_pos","_tick","_stage"];
        if (diag_tickTime >= _tick) then {
#

I think _tick needs to be _GrowthTime or whatever

robust hollow
#

the name of it doesnt matter. it just marks the time when the seed moves onto the next stage

tough abyss
#

it's just the initial time

robust hollow
#

hmm?

tough abyss
#

when planting the seed:

AllPlantedItems pushback [_typedropped,_seedPos,diag_tickTime,0];
robust hollow
#

yea. it is then updated at the end of every stage with the new tick for the next stage

tough abyss
#

I'm not seeing where that happens in there

AllPlantedItems = [];
publicVariable "AllPlantedItems";
//params ["_growthFactor"];
_growthFactor = 1;
_growthPeriod = 30 * _growthFactor;

FARMAgrowing = true;

while {FARMAgrowing} do {
    {
        _x params ["_type","_pos","_tick","_stage"];
        if (diag_tickTime >= _tick) then {
            _x set [3,_stage + 1];
            
            private _objectArray = switch _type do {
            
            case "Chemlight_green": {["Land_Can_Rusty_F","Land_BakedBeans_F","Land_Can_Rusty_F","Land_FlowerPot_01_Flower_F"]};
            default {[]};
            };
            diag_log format ["%1 %2 %3 %4", _type, _pos, _tick, _stage];
            if (count _objectArray > 0) then {
            deleteVehicle nearestObject[_pos,(_objectArray select _stage)];
            private _nextObject = _objectArray param [_stage + 1,""];
            if (_nextObject != "") then {
                _nextObject createVehicle _pos;
            };
            };            
            _x set [2,diag_tickTime + (_growthPeriod * _stage)]; // some value based off the growing _stage

            // if this item is finished the last stage
            if (_stage == 5) then {
                AllPlantedItems set [_forEachIndex,0];
            };
        };
    } forEach AllPlantedItems;    
    AllPlantedItems = AllPlantedItems - [0]; // delete completed elements
    publicVariable "AllPlantedItems";
    uisleep 1;
};
robust hollow
#

_x set [2,diag_tickTime + (_growthPeriod * _stage)];

tough abyss
#

I'm only see _tick once in there though

robust hollow
#

you will want to increase the sleep if you're broadcasting that array

#

yea, _tick is _x select 2.

tough abyss
#

Oh ok

robust hollow
#

it sets 2 for the next loop

tough abyss
#

Okay, so no errors, it's going through the stages but not changing the Vehicles

#

no deleting or creating

tough abyss
#

wait, why would I want to use diag_tickTime rather than time for this?

robust hollow
#

use whichever you prefer. i use diag_tickTime out of habit.
When simulation is interrupted, time freezes, but not diag_tickTime.

tough abyss
#

can I just swap diag_tickTime with time?

robust hollow
#

yea

winter rose
#

if you setAccTime 0 in the game, simulation is paused. uiSleep makes sure "IRL time" happened

tough abyss
#

Yeah, I don't want things happening while the game is paused...

#

speaking of which, swapping diag_tickTime with time seems to never update or something

tough abyss
#

@sudden yacht this question was already asked here and I gave code example, just look through the posts if you can be bothered

lean estuary
#

Is there any way to run a keydown eventhandler in the arma 3 main menu using a addon?

tough abyss
#

Add it to the menu display or control whichever works

lean estuary
#

I tried that but it doesn't seem to work

tough abyss
#

How did you try?

lean estuary
#

(findDisplay 0) displayAddEventHandler

#

I assume 0 was the main menu right?

tough abyss
#

Did you use "onKeyDown"?

lean estuary
#

i used KeyDown

tough abyss
#

Lemmie try

lean estuary
#

thank you

cursive whale
#

anyone know if it's possible to address the commandbar (squad ai icons) as a GUI/IGUI control? been enumerating various displays and controls but starting to think it must be an 'engine special'

tough abyss
#

There are script command to duplicate its functionality @cursive whale

cursive whale
#

should've said, i'd like to be able to toggle its visibility

tough abyss
#

Tried showHUD?

cursive whale
#

hah, lol, so easy, thanks

tough abyss
#

@lean estuary works, not sure why you have problems

lean estuary
#

@tough abyss Can you give me your exact code if you dont mind please.

tough abyss
#
finddisplay 0 displayAddEventHandler ["keydown", {diag_log "works"; false}]
high marsh
#
waitUntil{!isNull findDisplay 0};

?

frigid raven
#

there is no such thing like an event being triggered when a marker inner area is being entered by a unit eh?

tough abyss
#

trigger only

high marsh
#

what about inArea?

signal swallow
#

hey, i want to make an selectable automated message p to p for life server, new to sc and open to any source and help, thx!

high marsh
#

"selectable" ?

signal swallow
#

i mean it will take active users from server and list it to select

#

online*

tough abyss
#

"list it to select"?

signal swallow
#

you can imagine it like an ordinary pm system but it'll just send auto message to selected person. i thought i was open enough 😄

#

i'm done with gui, just stuck in this part. maybe it's too easy for you guys but im a beginner and tryn' learn

frigid raven
#

@high marsh inArea might work but I had to recheck at every frame for markers while triggers have their own event callbacks

high marsh
#

No? Why tf would you have to check every frame?

#

a while loop wouldn't even be every frame.

frigid raven
#

ok I correct myself to 5secs

#

to calm the situation

tough abyss
#

@signal swallow make function that will display a message when you call it with message as argument. remoteExec this function from sender’s computer passing receiver as target

high marsh
#

listbox with allPlayers?

signal swallow
#

yes

#

@tough abyss i'll try

high marsh
#

@frigid raven This would have little impact:

0 spawn
{
    while{alive player} do
    {
        if(player inArea "MKR_ONE") then
        {
            /*
                Code
            */
        };
    sleep 5;
    };
};
#

Plus, triggers are ugly. 😃

frigid raven
#

🤔 hm

#

what about having this as CBA addPerFrameHandler ?

high marsh
#

....you don't need the precision of every frame.

frigid raven
#

Still I feel better if this code would run every 5sec rather then in a while loop

high marsh
#

Addd suspension!

tough abyss
#

Plus, triggers are ugly Triggers are beautiful and your code will just eat CPU for no reason

high marsh
#

Triggers are the ugly step child.

tough abyss
#

clogging scheduler with while true loops is the sign of noobness

#

Is there something obvious I'm missing here?

AllPlantedItems = [];
publicVariable "AllPlantedItems";
defaultPlantObject = "Land_Ketchup_01_F";
publicVariable "defaultPlantObject";

//params ["_growthFactor"];
_growthFactor = 1;
_growthPeriod = 10 * _growthFactor;

FARMAgrowing = true;

while {FARMAgrowing} do {
    {
        _x params ["_type","_pos","_tick","_stage"];
        if (time  >= _tick) then {
            _x set [3,_stage + 1];
            
            private _objectArray = switch _type do {
            
            case "Chemlight_green": {["Land_Can_Rusty_F","Land_BakedBeans_F","Land_TinContainer_F","Land_FlowerPot_01_Flower_F"]};
            default {[]};
            };
            diag_log format ["Growing %1 %2 %3 %4", _type, _pos, _tick, _stage];
                        
            if ((count _objectArray > 0) && (_stage > 0)) then {
                _toDel = defaultPlantObject;
                switch (_stage) do {
                case 1: {_toDel = defaultPlantObject;};
                case 2: {_toDel = _objectArray select 0;};
                case 3: {_toDel = _objectArray select 1;};
                case 4: {_toDel = _objectArray select 2;};
                };
                
                deleteVehicle nearestObject[_pos,_toDel];
                
                private _nextObject = _objectArray param [_stage -1,""];
                diag_log format ["replacing %1 with %2", _toDel, _nextObject];
                _obj = _nextObject createVehicle _pos;
                _obj setPos _pos;
                
                if (_stage == 4) then {AllPlantedItems set [_forEachIndex,0];};
            };
            _x set [2, (time  + _growthPeriod)]; // the next plant update
        };
        
    } forEach AllPlantedItems;    
    AllPlantedItems = AllPlantedItems - [0]; // delete completed elements
    publicVariable "AllPlantedItems";
    sleep 1;
};
#

Some of these things are getting the same _tick somehow

13:35:15 "Planting Chemlight_green [3075.15,6796.75,0] 14.956 0"
13:35:19 "Planting Chemlight_green [3075.15,6796.75,0] 25.338 1"
13:35:19 "replacing Land_Ketchup_01_F with Land_Can_Rusty_F"
13:35:19 "Planting Chemlight_green [3075.15,6796.75,0] 25.338 2"
13:35:19 "replacing Land_Can_Rusty_F with Land_BakedBeans_F"
13:35:24 "Planting Chemlight_green [3075.15,6796.75,0] 35.571 3"
13:35:24 "replacing Land_BakedBeans_F with Land_TinContainer_F"
13:35:24 "Planting Chemlight_green [3075.15,6796.75,0] 35.571 4"
13:35:24 "replacing Land_TinContainer_F with Land_FlowerPot_01_Flower_F"
frigid raven
#

You people are so full of hate

high marsh
#

And running a check on every frame is any better?

frigid raven
#

every 5 secs

#

high marsh
#

It would be the same thing as adding suspension to the script for 5 seconds.

frigid raven
#

I won't reinvent the wheel

#

because I already did 👓

tough abyss
#

And running a check on every frame is any better? Depends on what you are checking

high marsh
#

Yes of course, if it's something that's being rendered or drawn. But to check if the player is inside a marker? No.

tough abyss
#

the trigger is naturally designed just for that

frigid raven
#

Please don't mind if I won't join the discussion since I lack on experience here

#

and am way too handsome to get into an argument

high marsh
#

The triggers are designed for area based activation and execution sure. But that doesn't make them elegant. I see nearly zero difference between the two, except one is cleaner and more accessible than the other.

frigid raven
#

being cleaner and more accessible actually does mean more elegant

high marsh
#

SQF Script - > More accessible, I don't want to be reviewing some other mission just to be digging through dozens of random triggers

astral dawn
#

triggered

tough abyss
#

Apart from that your 5 second check is not guaranteed with spawned loop as it could be 5 min check easily

astral dawn
#

you can optimize your check depending on maximum speed of the unit that activates your 'area presense event' and the amount of error you are OK to get

high marsh
#

5 min check if the scheduler is packed yes.

astral dawn
#

well if someone has put a ton of rubbish into scheduler then yes

tough abyss
#

Ever tried to use spawn to open parachute for falling player?

high marsh
#

Being that, this could be a client script and seperate from other crap running on server. Then it should have nearly no effect on time

frigid raven
#

Can I convert private _onActivation = {hint "I am awesome code"} into a string somehow - bekorse the trigger statement function only accepts stupid strings as code (so not elegant)

astral dawn
#

so the idea is like this:
maximum speed of your unit is, let's say, 10 m/s. You query the check every 10 seconds. So the maximum possible error is... 100 meters. Probably ok for a kilometer-sized area, right?

high marsh
#
private _onActivation = "hint 'I am awesome code' ";
#

call compile to execute

astral dawn
#

then... you can increase/decrease poll frequency depending on the distance to the closest unit from the border... because if the closest one is 10km away then he won't be there for 1 minute?

high marsh
#

singular or double quotes will escape the string

#

Sparker, you'll probably get now "Too many checks, too slow"

tough abyss
#

You can @frigid raven but you might need to remove {} later

astral dawn
#

I will use the cba's 'wait until and then run in unscheduled' and everyone will be happy xD

high marsh
#

¯_(ツ)_/¯

#

Why would you leave the brackets if you can just compile the code as a string?

astral dawn
#

no it's not many checks really, 'get the minimum distance from center of area to any unit' iterates through all units so it's not bad

tough abyss
#

You don’t you get them if you str code

high marsh
#

compiled code?

tough abyss
#

The code code

high marsh
#

That's really raw

#

@astral dawn I still prefer the idea of a local check instead of going through each unit and keeping track the distance between.

astral dawn
#

yeah it's fine if it's only for players 👍

high marsh
#

AI even then? >:-0

astral dawn
#

if every AI has his own computer? 🤔

high marsh
#

🤔 last time I checked it was hive mind

#

the AI are dispatch

tough abyss
#

Soon @astral dawn

astral dawn
#

Will I need a separate arma license for every AI unit?

tough abyss
#

It will buy its own licence

high marsh
#

AI rights 2025?

astral dawn
#

Universal Declaration of Arma Bot Rights

high marsh
#

We first teach them how to navigate walls. Then they get the right to vote.

astral dawn
#

Basic test would be a desert map with a single stone

tough abyss
#

AI pride 🏳️‍🌈

astral dawn
#

It's like the cat and a box test, cat will always want to occupy the box

tough abyss
#

or cat and cucumber

nocturne basalt
#

Hi guys. Im having a really weird problem with a script activated by the killed eventhandler. Its kinda hard to explain in words, so I made a short video. Hope someone knows whats going on here 😓

astral dawn
#

so you attach objects, then delete the base object?

nocturne basalt
#

yes

astral dawn
#

maybe try to detach first?

nocturne basalt
#

I can, but then the pieces fly off violently since it collides with the existing vehicles geo physx

astral dawn
#

maybe give it a push or torque with one of the physx commands as well?

#

hmm... disableCollisionWith should idsable collision with two physx objects (never tried)

nocturne basalt
#

if I let them detach by themselves they usually only reacts with eachother, and gives a more natural "fall apart" look

#

yeah I actiually tried that, but didnt help. the main vehicle is still there until I switch view :\

#

its like Schrödinger's cat in arma -_-

astral dawn
#

I have recently observed that wheels start rotating on a flipped APC if you shoot a gun near it 🙄 so I'm not surprised

nocturne basalt
#

haha thats weird

astral dawn
#

and... setPos commands? did you try them?

nocturne basalt
#

you mean just move the other parts around instead of attaching?

astral dawn
#

no i mean after detachment try to wreck setPosWorld (getPosWorld wreck)

nocturne basalt
#

just to check if its still there you mean? I know its there cause its still burning. and the pieces are not falling off

#

and its not a wreck either

#

not using a wreck lod for this

astral dawn
#

no, i mean the pieces. You detach the pieces and try to set their pos to their current pos to kick the physics calculations?

#

idk why it doesn't calculate physics until you switch view, maybe it just needs a kick or something like that

nocturne basalt
#

yeah ok I can try that. detach them and keep them from flying of by using setPos

#

the nice thing about using attach in this case is that you remove collision while they're attached

astral dawn
#

hmm wait, so you want them to fall apart or not?

nocturne basalt
#

yeah I do, but only after the vehicle is deleted

#

I dont want them to react with its physX

#

I want them to spawn in the exact place as the vehicle to make it look seamless

astral dawn
#

maybe you can show the code and someone can see some mistake there?

nocturne basalt
#

ok sec

#

oh!! I just found something. the same error doesnt happen if I kill it will some other vehicle

astral dawn
#

I like how it looks 👍

nocturne basalt
#

anyway, here's my script

spark turret
#

looks very nice

#

needs an emperor class titan

astral dawn
#

hmm allright
maybe you can try to setPosWorld, setVectorDirAndUp instead of attachTo and then deleteVehicle

#

you attach to [0, 0, 0] right? should be easy I think, means it needs no model space -> world space coordinate conversion

nocturne basalt
#

I would have to move the pieces outside the boundry of the vehicle then

young current
astral dawn
#

why would you? you don;t seem to do it here

nocturne basalt
#

_upper_body attachTo [_v, [0,0,0], "attach_upper_body"];

#

attached to a memorypoint

astral dawn
#

ah yes

nocturne basalt
#

to get it in the correct place

#

or it will look weird

spark turret
#

@young current lmao Killer of worlds and frames. awesome

young current
#

dunno its pretty simple command wise.

#

dont really see why it would kill frames

#

but remains to be seen

tough abyss
#

@nocturne basalt you need to create and position parts in killed event handler so that everything is in unscheduled

nocturne basalt
#

but I am?
class Eventhandlers: Eventhandlers {
killed = "_this execVM '\WHwalkers\warhound\scripts\killed_mars_pattern.sqf';";
};

tough abyss
#

Would help if you have memory point on each part of the original body that would indicate direction the parts face so that you can get vector towards it and use it when positioning parts

#

no you are not you are launching scheduled script

nocturne basalt
#

ah. would you use remoteExec instead? can you explain why?

#

I do have mempoints from the original vehicle

#

attach_upper_body
attach_hip
etc

tough abyss
#

remoteexec? don't think so unless you want somehow to handle it on the server only

#

attach_upper_body this is the point of attachement, the joint?

nocturne basalt
#

oh ok. sry Im not too experienced with scripting for multiplayer. I find it really hard. how would you launch it unschedueled?

#

yeah its the point of attachment

tough abyss
#

but you also need direction. I assume you are not going to have them standing still, but moving so when they get hit they can be oriented randomly this is why you need direction of parts

nocturne basalt
#

hm no they are oriented the correct way already. for some reason they get the oposite direction at first. that why I use _upper_body setDir 180;

#

they will move on their own, since they are reacting to eachothers physX lods

tough abyss
#

I dont think you understand what I mean

nocturne basalt
#

hm no I dont :\

#

what do you need direction for in this case?

tough abyss
#

when you replace body with the sum of parts you want the parts to be at the same position and same orientation

#

position you have

nocturne basalt
#

yes

tough abyss
#

orientation you dont

nocturne basalt
#

hm but I do :\ they will spawn the same orientation the vehicle had when destroyed

tough abyss
#

but how do you read this orientation?

#

i dont see it in your script

nocturne basalt
#

when attaching something, they are by default attached in the same orientation as the vehicle are they not?

tough abyss
#

does your model move legs?

nocturne basalt
#

yeah it walks

tough abyss
#

so when it takes a step it raises leg?

#

what if it is destroyed at this moment when the leg is raised and under an angle how do you place your leg part at exactly the same orientation?

nocturne basalt
#

ah I dont worry about that.

#

they are just spawned in the position as if it was standing still

#

dont think its too noticable

#

here you see it works when killing it with another vehicle

tough abyss
#

it is standing still of course you wont notice

#

it is standing in default position

#

what if you kill the running one

#

i bet you will see some strange straighten up move like that switchMove does to reset animation

#

anyway dont let me stop you, it looks great

nocturne basalt
#

it will be covered up with smoke and explosive effects. I dont worry about it. its not the main issue here

tough abyss
#

what i said like switchMove ""

nocturne basalt
#

@young current suggested I use legs from a man class to achieve a ragdoll effect instead. I may go down that road later

tough abyss
#

Oh, I see, you think you can rig it like a man? maybe

nocturne basalt
#

not the mech itself, only the legs flying off

#

would make them look not so static on death

young current
#

well the whole mech could in theory be a "man"

nocturne basalt
#

yeah I know 😛

tough abyss
#

yeah and fold like a ragdoll instead of flying off

young current
#

indeed

#

or fall off

#

like mondkalbs block man demonstrates

tough abyss
#

You could still have dismemberment animation for larger hits

nocturne basalt
#

I dont wanna keep going deeper into the rabbithole

#

Im deep enough as it is

#

would never be able to get out xD

#

and Im planning on releasing this by the end of the month

tough abyss
#

What would have worked is if it would ragdoll when killed but then explode with secondary explosion and fly apart

#

and Im planning on releasing this by the end of the month Yeah do that I have an idea how to make it work the way you want to

#

it has to be secondary explosion

#

the first explosion is missile hit but then if it is moving you have to wait until the animation phase is the default position then make secondary explosion and take it apart

nocturne basalt
#

I was thinking of spawning a bomb there too, just to push it apart

#

but it seems the parts are glued on till I switch views

tough abyss
#

if it is stationary you could wait random amount of time and make secondary explosion to tear it apart

nocturne basalt
#

tried it. tried using sleep

#

its like the old vehicle is there still

tough abyss
#

no sleep should be unscheduled

nocturne basalt
#

and all the parts are still attached

#

hm I dont follow :\

young current
#

@nocturne basalt have you tested it in MP?

nocturne basalt
#

no not yet.. that woould be next after I solve this issue

tough abyss
#

you make it wait in scheduled

young current
#

as it might be some sort of simulation issue with the view

#

it might not be an issue in MP where the simulation runs on the server

nocturne basalt
#

hm yeah maybe^^ gonna launch my local dedicated server and try it

tough abyss
#

does moveTime work with it?

#

does it return changing animation time?

nocturne basalt
#

yeah I can fetch animationPhase values if I want

#

moveTime?

tough abyss
#

phase is fine too

#

movetime is time of the animation goes from 0 to length of animation

nocturne basalt
#

right

#

but Im not using any animations in this script. would mean tranfering the state of the animation to the parts Im attaching?

#

could do that

tough abyss
#

no to catch when it is in default position

#

I can totally see it having separate dismemberment explosion independent of the missile hit explosion

nocturne basalt
#

that will only make it look better right? it will not fix my problem?

tough abyss
#

this way you can have several missiles hitting it before legs fly apart

#

your problem is no problem, you are doing something weird which you do not show us

nocturne basalt
#

well I showed you the script, and how I call it?

tough abyss
#

nah that wouldnt do it

#

It could be something to do with model/vehicle config maybe

nocturne basalt
#

was thinking it could have something to do with what lod Im using when using the optics

#

but that dont explain why the same thing happens in 3rd person

tough abyss
#

try it in mp doesnt have to be dedicated just launch mp preview from eden

#

this will show if this is simulation pausing related

#

oh and while at it, while in preview execute this systemchat str diag_activeScripts

nocturne basalt
#

ok, so I found something really weird. if I change to the driver seat first and move the vehicle a little, then move back to the gunner seat. everything works fine

#

in SP, MP, and as client on a dedicated server

#

could it be that the simulation is not activated until some physX vehicle moves on the server?

#

if thats the case, I guess this isnt really a problem. previously I said it works when killed with another vehicle. maybe the engine needs to be on?

tough abyss
#

yeah physx vehicles have/had rest state, but this should not be happening, maybe you inherited from wrong class or didnt set some param

nocturne basalt
#

hm

#

dont think Im having a problem with my inheritance. its the same Im using for lots of other stuff, including the vehicle it worked with

tough abyss
nocturne basalt
#

ok ty

tough abyss
#

I remember a raised physx vehicle would be entering rest state and it would not fall down until you shoot it with rifle. but that was awhile ago and I have never seen this again, I guess BI tweaked something

#

no idea why this would happen to you. If you shoot the walker before entering, would it not freeze?

nocturne basalt
#

didnt work..

#

now it seems I have another issue.. when playing on a dedicated server, the killed script doesnt seem to trigger at all

#

I just realized.. Im not using the MPKilled eventhandler

#

is that called in the same way as killed?

#

killed = "_this execVM '\WHwalkers\warhound\scripts\killed_mars_pattern.sqf';";

#

like this:
mpkilled = "_this execVM '\WHwalkers\warhound\scripts\killed_mars_pattern.sqf';";

tough abyss
#

Is this the right syntax?

[
"AB_FARMA",
"SLIDER",
["Growth factor", "Multiplier for length of grow cycles"],
"FARMA",
[0.01, 5, 1, 2],
true,
    {
        params [_value];
        {
        _x addEventHandler ["Put",[_value,getPos(_this#0), _this select 2, _this select 0] execVM 'FARMA\placeSeed.sqf';];
        } forEach allPlayers;
        [_value]execVM "FARMA\plantGrow.sqf";
    }
] call cba_settings_fnc_init;
robust hollow
#

no

tough abyss
#
{
        params [_value];
        {
        _x addEventHandler ["Put",{[_value,getPos(_this#0), _this select 2, _this select 0] execVM "FARMA\placeSeed.sqf";}];
        } forEach allPlayers;
        [_value]execVM "FARMA\plantGrow.sqf";
    }
robust hollow
#

you seriously need to start reading the wiki, it shows the syntax so you dont need to ask. ur addEventHandler code isnt in code or string.

#

_value cant be read from the event code like that

#

we have been through all this no more than a week ago

tough abyss
#

Yeah but when I went from using a string to a number it doesn't work with the original script you helped me with

robust hollow
#

that doesnt mean it can read _value now

tough abyss
#

This gives me "string not number" errors

true,
    {
        params ["_value"];
        {
        _x addEventHandler ["Put", format["['%1',getPos(_this#0), _this select 2, _this select 0] execVM 'FARMA\placeSeed.sqf';",_value]];
        } forEach allPlayers;
        [_value]execVM "FARMA\plantGrow.sqf";
    }
] call cba_settings_fnc_init;
robust hollow
#

you still need to format the event code

#

yea, if ur value isnt a string remove the quotes '%1' -> %1. simple.

tough abyss
#

Ok

#

Is there any way to test a mod without restarting Arma entirely?

robust hollow
#

use filepatching and recompile functions maybe. personally if it doesnt need to be in a mod i will make it as a mission in the editor first

tough abyss
#

Yeah that's what I was doing until I started adding custom models, I read you HAVE to compile them as a mod or they won't show

robust hollow
#

you can create objects with createSimpleObject but they are fully static.

tough abyss
#

But I'd have to pack them into my mod first though, right?

#

I have no problem creating the object in game, it's the iterating through them in-game to see if they look right and all that's a slooooooow process

robust hollow
#

no. you just create the object using the filepath to the .p3d. this way even mission files can use custom static models (though it tends to lead to generic "you kicked from server" issues).

#

as far as testing goes it might be faster for u

#

iterating through them in-game to see if they look right and all that's a slooooooow process what, seeing them or the actual script being suspended for a while?

tough abyss
#

Having to restart the game I meant

robust hollow
#

mmhm, well like i said. filepatching is one option, another is to do ur scripts in the editor so you only need to reload the mission not ur game.

tough abyss
#

Okay, I didn't realize you could spawn the models in game if they weren't included in a mod. Guess that info I read was pretty old

tough abyss
#

I should probably be using createSimpleObject for these plants then, rather than createVehicle?

robust hollow
#

if theyre just static objects it would be more performance friendly

tough abyss
#

Ok, that's what I thought. Can they accept addActions or anything like that or no?

robust hollow
#

no

tough abyss
#

Ok, got it.

#

Can they be deleted?

robust hollow
#

yea

tough abyss
#

@nocturne basalt I doubt it, mpeventhandlers are global, config event handlers are local

#

How do you know it doesnt fire at all?

tough abyss
#

Any idea why one (1) string isn't found in a container of ~50 localised ones? I'm creating several areas and tried doing:

//middle of stringtable.xml
<Container name="Station">
    <Key ID="STR_Station_1">
        <Original>Station 1</Original>
    </Key>
            
    <Key ID="STR_Station_2">
        <Original>Station 2</Original>
    </Key>
    
    <Key ID="STR_Station_3">
        <Original>Station 3</Original>
    </Key>
 etc 
etc

Everything works other than "STR_Station_1" can't be localised :/ "STR_Station_2" returns "Station 2" and so on it's only station 1 that won't work. I'm using the same way to create the markers for all stations in a loop and station 1 is called third in that loop.

robust hollow
#

either ur script isnt actually using STR_Station_1 or the issue is elsewhere in the stringtable. that snippet is fine.

tough abyss
#

I'm 99% sure it's an issue somewhere in my spaghetti. Just thought if anyone else had this issue before and knew about common problems that'd cause it.

robust hollow
#

I'd assume most common problem is just a mistake in the stringtable.

tough abyss
#

Welp. Thanks for helping though 😃

tough abyss
#

idk how but it seems like the stringtable simply wouldn't update. Restarting the game wasn't enough. My hard drive hit a wall recently so that might be why but I tried a few things aaand chkdsk seems to have fixed it?

tough abyss
#

is there a way to get the ground texture at a pos?

robust hollow
#

kind of but not really. in CfgSurfaces it gives a partial filename for the texture of that surface, but not a full path.
getText(configFile >> "CfgSurfaces" >> _surface >> "files")

tough abyss
#

so not enough to get do a setObjectTextureGlobal with on an object with?

robust hollow
#

no

#

you could write up all the filepaths urself though

#

something like this

private _image = switch _surface do {
    case "Surface1":{"path\to\image1.paa"};
    case "Surface2":{"path\to\image2.paa"};
    case "Surface3":{"path\to\image3.paa"};
    default {""};
};```
tough abyss
#

where can I find the full paths though?

robust hollow
#

all the images are in arma's pbo files. if you have arma unpacked somewhere you can just search the folders for the partial filename.

tough abyss
#

gotcha

nocturne basalt
#

@tough abyss cause the pieces doesnt spawn, and my vehicle isnt deleted. can you show me an exampe on how to run this schedueled?

tough abyss
#

Put diag_log call in event handler and see if it logs something, script not doing what you expect it to do doesn’t mean EH is not firing

still forum
nocturne basalt
#

@tough abyss I found something!
I was using this in my turret:
LODTurnedIn = 1100;
LODTurnedOut = 1100;
LODOpticsIn = 1000;
LODOpticsOut = 1000;

#

tried commenting that out and using the same setup as the slammer

#

LODTurnedIn = 1100;
LODOpticsIn = 0;

#

now it works!

#

gonna investigate further on why this happens

tough abyss
#

what values does vanilla config have for similar setup?

#

where is a mod dependency added?

still forum
#

More details? What do you mean?

tough abyss
#

I made a mod that uses CBA, but I'm not sure where to add the dependency. If I load the mod without it, the game crashes.

still forum
tough abyss
#

that's enough to go off of, thanks

#

Apparently I already had it set to CBA, but it doesn't automatically ask me if I want to load CBA when I load my mod

still forum
#

Arma tells you at game start that a mod is missing

#

Arma launcher doesn't know what's inside your mod

#

Arma launcher only detects dependencies on workshop items

tough abyss
#

That's sort of what I assumed, ok

nocturne basalt
#

@tough abyss
the slammer has this:
LODTurnedIn = 1100;
LODOpticsIn = 0;

still forum
#

@slate palm #rules stop the spam/cross-posting.
Also no advertising here. Please delete that message

#

Never even streamed Arma.

nocturne basalt
#

@tough abyss the slammer has 1 pilot view and 2x cargo views ...

#

is that how tanks were done after the dlc?

tough abyss
#

I know literally 0.0001 about this shit. Did BI not provide a huge sample pack of vehicles and weapons and what not for modders to copy?

nocturne basalt
#

yeah but those are very outdated. using them dont work very well since the tank dlc

still forum
#

Arma3Samples yes

#

it is illegal to debinarize models yes

spark turret
#

the debinarizer was made fir fixing shitty mods not ripping protected stuff

still forum
#

fixing shitty mods == ripping protected stuff.

spark turret
#

but im sure most modders will give away their models if you ask nice and promise not to sell it as your own

#

i disagree. fixing an error in a config is something completely different that using models you dont have permission to use

#

afterall the mod stays the same.

still forum
#

you don't need a model debinarizer for a config patch

spark turret
#

or whatever mistake you are fixing

#

i also dont think its illegal to use it for personal purpose. just dont upload it anywhere

still forum
#

#rules
3) Discussions about copy protection or copying, backing-up, hacking, cracking or reverse engineering of any of BI's products or the products of any other developer will not be tolerated and such discussions will be deleted immediately.
I'd suggest to stop now ^^

nocturne basalt
#

ok

spark turret
#

Oppresion

#

lol

still forum
#

Stories from dedmens PMs

Arma life developer

Developer: Please help me with performance problems, here is a captureFrame log.
Dedmen: Why are there 400 callExtension calls to extDB with the same function?
Developer: Here see code

if (_queryResult isEqualTo "[3]") then {
    for "_i" from 0 to 1 step 0 do {
        if !(_queryResult isEqualTo "[3]") exitWith {};
        _queryResult = "extDB3" callExtension format ["4:%1", _key];
    };
};

for step 0 loop in unscheduled.

Dedmen: This is absolutely retarded code, which idiot wrote that?
Developer: Altis Life Framework from Tonic: https://github.com/AsYetUntitled/Framework/blob/master/life_server/Functions/MySQL/fn_asyncCall.sqf
Dedmen: https://i.imgur.com/YAGpXPd.png

fluid pier
#

well from what i know there is no framework that is "legit" other then tonics unless i am out of touch(havent done a3l in 2 years)

tough abyss
#

Many horrors await those that venture into the dark depths of other peoples code.

fluid pier
#

As a programmer must code you see even if its your own is viewed as "horrible" there is always a better way, its just how your applying it, i have seen a loop go through 10000 objects just to check if they are alive and to update the. in the end no matter how much you use OOP principles you will always have unefficent code

tough abyss
#

It might be one of many explanations of why alive doesn't run very well.

still forum
#

Alive is heavily influenced by the compile memory leak

#

but TheNightstalk3r cleaned that up

queen cargo
#

@fluid pier OOP is not the solution to performance
or has anything to do with performance at all

#

@still forum that code is horrifying
thanks for nightmares

fluid pier
#

no but using the principles can be

#

If you have a sword that has health data

#

that takes up data

#

etc

still forum
#

I mentioned my intercept_db to him, it would solve all the problems, but migrating from extDB to something else is probably too much work. Especially when you actually wrote none of the database interaction code

queen cargo
#

do not get me started on why OOP is most of the time a horrible idea simply because the "principles" sell a lie

  • there is ton of stuff out there telling you just that
astral dawn
#

what's better than OOP then in your opinion?

queen cargo
#

clean OOP is impossible to do, the way OOP is usually done is literally "i got theese random data parts and want some methods sticking to it" and later just "adding" stuff to random objects, etc.

fluid pier
#

X39 what do you code...

astral dawn
#

well it's better than having myStruct {int a; char b;} then pass it around as struct pointers to your functions 🙄

#

i'm pretty much learning C++ now, but the amount of abstraction it can add to code is kinda insane to me sometimes

queen cargo
#

@astral dawn OOP is a tool in your basket, not more
utilize it well and be done with it

but do not hold it up and call "my hammer is the solution for everything because i tell you so"

#

C++ is not object oriented
it is C with classes

astral dawn
#

oh... allright 😄

fluid pier
#

ehh.. in gaming you will more then likely see OOP design stuctures etc

#

i cant talk about some of what i have been shown at uni due to NDAS

#

But most funcitons and classes do one thing

#

So your health function should just handle health

#

and not drawing the uio

queen cargo
#

dude ... whoever told you OOP is the solution is a gigantic liar and you should avoid him at all cost
OOP is a tool, thats all
and most of the time, the tool is more distraction then useful

#

as stuff like "we god a health method that handles stuff" sounds nice

#

but to stick to your example:

fluid pier
#

Ok again i have no idea where you have got this from

#

or where you have this opinion

#

but either its uneducated or you code something different

queen cargo
#

and this is where you st*u or can come up with reasons why OOP is such a great thing and the best for everything
with proper arguments

fluid pier
#

Right so if i have a player

#

OOP is good as i can just go

#

Player.health = 100

#

and i can do that per player

#

so each player has there own health

queen cargo
#

and you are already not talking about OOP but rather about data structures

fluid pier
#

No this is oop

queen cargo
#

it is not

fluid pier
#

It is...

#

Its a class

#

called player

queen cargo
#

take a dictionary, can do the same

fluid pier
#

with a player object has

queen cargo
#

and now let me reuse your words: "but either its uneducated or" you just got lied to all the time

fluid pier
#

really do not know where you learnt this

#

cause the whole point of oop is so you can do player.health

queen cargo
#

in python, json etc. you have dictionaries that can be accessed with dots
foo.bar --> foo["bar"]
the same applies to literally what you showed
OOP principles are not syntax bound

fluid pier
#

or player. health = enemy .health

#

Ok so if I have transformation

#

AS a base class

#

all objects contain transformation

#

if i remove transformation all objects break

#

so if i add the transformation component

#

i can transform my object

#

all the code and data is there

queen cargo
#

component so you talk about component based programming

#

not OOP

fluid pier
#

Right but its the same with objects

#

orintend

#

i can say an object has a player class

#

that means it has all the code for the player

#

input

#

etc

#

im just going to let you read up on it

queen cargo
#

i will stop talking with you right here ...
partially because i got better things to do
partially because this would go on endless ammounts of time without any progress on your side

fluid pier
#

Or your just wrong...

#

also python is oop

#

must languages are

tough abyss
#

You have some research to be doing, properties is not what OOP is about, those existed well before OOP arrived and continue to do so in purely functional languages. Would you like some book recommendations?

queen cargo
#

don't feed the trolls @tough abyss

tough abyss
#

Just backing you up in what is a ridiculous conversation in the hope to make it productive.

#

returns to my not OOP code that uses properties.

brave jungle
#

Kinda forgot,

    ["_someVar1", "ADefaultVal"], 
    ["_SomeVar2", "AnotehrDefaultVal", "ExpectedDataType"]
];```Right?
tough abyss
queen cargo
#

and yes, it is correct

brave jungle
#

oh yeah 😂

#

Been doing config stuff, ditched the poorly documented wiki for a while, needed a script and forgot it's more helpful for scripting

#

ah well, cheers lads

tough abyss
#

@brave jungle your code is wrong, expecteddatatypes is an array not string

queen cargo
#

@brave jungle why poorly documented?

tough abyss
#

The Config stuff is far from all you need to know, it regularly doesn't sufficient say what certain properties do. I am not saying it should be but it isn't where I would go to work out how to configure something, I would go look at a mod that does it already.

brave jungle
#

Thanks M242, saw that one too while on the wiki 😉

#

I started to use the wiki to learn modding properly, as candle said, I just went for looking at existing mods and asking questions in #arma3_config instead.
I learn better by just expanding existing stuff that i've made/know, rather than reading a wiki, but that's just me 😃

oblique vale
#

Is there a way to force a car crash with AI?

still forum
#

setPos two cars into eachother and they will explode. Then tell your players it was a car crash

#

I don't think you can command the AI to crash into eachother

digital jacinth
#

record the ai movement and play it back

oblique vale
#

I was thinking about an ambush for a convoy (with a damage Event Handler to avoid the explosion). Was thinking about recording AI movement already, but I guess it doesn't fit the dynamic situation. Might do it as Zeus then.

astral dawn
#

ask it to drive somewhere, generally they crash very often

#

sometimes when you kill driver while car is moving, his steering wheel will be locked at one of the extreme positions 🤔 you could simulate driver's heart attack maybe?

#

didn't try it myself

oblique vale
#

Ah I will try that, but I guess it will avoid obstacles (like other vics), will give it a try

astral dawn
#

no with this one it won't care about obstacles AFAIK (not like it does usually ..... xD)

oblique vale
#

Okay setDriveOnPath kinda works, but it brakes ~20m in front of the vic and then decides to slowly accelerate into it.

digital jacinth
#

for the last part use setVelocityModelSpace

#

MAKE it fly into it

oblique vale
#

Yep giving it a good push in the end

tall dock
#

A rather specific question:
If I kill an enemy vehicle that has been abandoned by its crew in the last 30 seconds or so, an eventhandler "handlescore " will show me that Arma itself gave me 3 points for killing the vehicle, but at the same time, if I try to check if that vehicle was an enemy in a missioneventhandler "EntityKilled" via side group _vehicle I'll get "UnknownSide" or side _vehicle I'll get "CIV".
There has to be another way to determine if that empty vehicle was in fact an enemy, right? Since the "handlescore" EH somehow knew?

tough abyss
#

Does the vehicle belong to enemy faction?

tall dock
#

Yes, does the EH "handlescore" check for factions as well?
If so, is there a way to determine the side of a faction, if something like that is even possible?

radiant egret
still forum
#

Available since 1.91.145286

radiant egret
#

ah, is the "first person" bug fixed too in 1.91 ?

oblique vale
#

@tall dock: getNumber(configFile >> "CfgVehicles" >> typeOf(_object) >> "side");

tall dock
#

I'll try that

#

Worked, thanks. That should do the trick.

tough abyss
#

You can just use faction command I suppose @tall dock

#

You can save variable with last occupant side on vehicle

tall dock
#

Yeah I'd like to do that, but getting the side from the vehicles config and then use BIS_fnc_sideType worked for me.
Or is there another BIS function to get the side of a faction?

tough abyss
#

And then cancel negative score if you destroy vehicle of own side but that was in enemy possession

rugged tangle
#

Is it good practice to do example_variable = nil; when you are 100 % sure the variable is something you won't need anymore? Or is this just a waste of time

#

Specifically for global variables

sturdy cape
#

most of the time you set vars to nil when you plan on repeatedly using them.like when you do a building system and have "isBuilding = true;" and you stop building and dont want stuff regarding building to be shown you set it to nil when the building process is finished.depends on usage

still forum
#

It's useful, but not much. You reduce the memory usage by a couple dozen bytes if you set the var to nil

frigid raven
#
 1780413: <no shape>
#

as trigger id

#

does no shape kinda imply that it won't be "triggering" ?

still forum
#

no shape means it doesn't have a shape

#

aka a 3d model

#

which is true for triggers, you don't see them floating in the sky

frigid raven
#

ok but the triggerism should still work the - aye

tough abyss
#

example_variable = nil,nil,nil; just to be sure

winter rose
#

in uppercase to be really sure

#
for "_i" from 0 to 10000 do { _myVar = NIL; };```
tough abyss
#

Or if you really want example_variable = ++nil;

lean estuary
#

How do you get the direction of a object relative to the player?

tough abyss
#

object getRelDir player

#

or player getRelDir object whatever works for you

queen cargo
#

@tough abyss why yu tri tu fuul poeple

tough abyss
#

_i = 10; ++_i returns 10

#

this is why you cannot have ++ operator

#

or --

frigid raven
#
    _desertionTrigger setTriggerStatements ["this",
                                            _onActivation call coopr_fnc_codeAsString,
                                            _onDeactivation call coopr_fnc_codeAsString];

Given this trigger I see the execution of the _onActivation function but not of the onDeactivation.
Biki says

Trigger condition has to return Boolean . true will activate the trigger, false will deactivate it (only if activation is set to repeat).

Does mean that I have to make condition return false and only then onDeactivation will be called? If yes - how can I simply can make it return false if an entity leaves the trigger area?

if (this) then { true } else { false }

Is surely not working right?

#

PS: This is the activation defintion for the trigger

    _desertionTrigger setTriggerActivation ["WEST", "PRESENT", true];
#

I thought this will have this condition in it somehow? Since it reads to me "if a WEST entity is PRESENT then go apeshit"

robust hollow
#

if (this) then { true } else { false }
is the same as
this

frigid raven
#

yea thought so too

#

but as I said onDeactivation is not being called

#

that's why I am asking if I am missing anything here

robust hollow
#

mm, i cant really help on that cause i dont use triggers. I just did a quick test using ur activation snippet and it works for me with a single blufor unit. if more than one are in the trigger it only deactivates once all units have left.

tough abyss
#

Log this and see if it changes to false fist

queen cargo
#

@tough abyss nah ... ++ being + + has nothing to do why we cannot have a ++ operator
otherwise, >> would be > > always

tough abyss
#

Trying to use createSimpleObject but it only accepts posASL, I'm having trouble getting the ASL position 1 meter ahead of the player

queen cargo
tough abyss
#

You can’t have greater > greater > it is error

queen cargo
#

CONFIG >> CONFIG != CONFIG > > CONFIG

#

>> is a separate operator

#

from >

#

same could be done with ++ but it would not make much sense

tough abyss
#

You can have chained + but cannot chain >, not the same thing

queen cargo
#

but it would not work the way one wold expect

tough abyss
#

What interpreter is supposed to do with ++? Treat it as unary ++ or 2 unary + chained together? How do you resolve this ambiguity?

queen cargo
#

the same way you do with >> vs >

tough abyss
#

You cannot chain >

#

Therefore >> is ok no umbiguity

queen cargo
#

uhm ... serious question: are you playing stupid right now?

#

if it was after your saying, >> would be assumed to be two > by the sqf lexer

tough abyss
#

Seriously considering to never talking to you again

queen cargo
#

if you want to enable ++, you just tell the lexer that such a thing exists

#

++ currently gets chained as:

Unary +
    Unary +
        ...```
#

the moment you add a ++ command, it would be:

Unary ++
    ...```
tough abyss
#

And you cannot chain unary + any more after that

#

Pre and post, they both have their place.

queen cargo
#

it does not makes any sense right now, it will not in the future
do the same in eg. c/c++, you will end up with same "issues"

#
int a = 0;
int b = -i;
int c = --i;```
#

all have different meaning

#

same would apply to SQF

tough abyss
#

This doesn't seem extremely accurate, it spawns every 2 meters off and doesn't always respect the direction either

_holder1 = "Land_HelipadEmpty_F" createVehicle (player getRelPos [0.5,0]); 
seedPos = getPosASL _holder1;
_seedSite = createSimpleObject ["FARMA\Objects\corn_4.p3d", seedPos];
queen cargo
robust hollow
#

the helipad or the seed?

tough abyss
#

Hard to say since the helipad is invisible

robust hollow
#

im gonna assume helipad. use the alt syntax of createVehicle

tough abyss
#

the seed definitely spawns 2 meters away in a quasi random direction

robust hollow
#

with special type "CAN_COLLIDE"

vagrant lotus
#

@everyone

robust hollow
#

also ur position needs to be positionWorld not positionASL because ur using the model path instead of a class

vagrant lotus
#

Got em

tough abyss
#

It really doesn’t matter that you can do it by altering existing functionality because it doesn’t make much sense to chain unary + No one will do it.

queen cargo
#

what the hell you then try to argue??!!??

tough abyss
#

When I said you can’t have I meant in the game not in sqf-VM

queen cargo
#

neither was i talking about SQF-VM

tough abyss
#

That did it, thanks Connor

#

What were you talking then?

queen cargo
#

you can have ++ but it will not work the way one expects
the "chaining" possibility is more by accident then on purpose

#

that is the literal thing i said when i mentioned you

#

and you started arguing about "but no you cannot because chaining +"

tough abyss
#

Reread what you said, it looks like you were implying we could have had it in the game. If you meant something else, then I misunderstood you

queen cargo
#
nah ... ++ being + + has nothing to do why we cannot have a ++ operator
otherwise, >> would be > > always``` ???????
#

has nothing to do why we cannot have a ++ operator

#

++ being + +

tough abyss
#

Why we cannot have? We - arma users?

queen cargo
#

because it would have to be implemented at the same level as = is
not as unary command

#

the way you could have it as unary command, would be ++ STRING

#

but not ++ variable

tough abyss
#

Maybe

queen cargo
#

not maybe, yes

#

it is as i said

#

problem arises due to this:

_code = {0};
_value = 0 call _code;
++_value; // Theoretical ++ unary operator
diag_log (0 call _code); // 1```
Alternative Problem
```sqf
_a = 0;
_b = _a;
++_b; // Theoretical ++ unary operator
diag_log _a; // 1```
tough abyss
#

Looking at deleting a simple object by it's model, would I need to create an array of nearby simple objects and then like delete the closest that matches the modelInfo or something? The example assumes you created the object from a vehicle and not just the model's path

allSimpleObjects ["Box_NATO_Equip_F", "Land_CampingChair_V2_F"];
robust hollow
#

you could save the object when you create it so you dont need to search for it later

#

would be easier imo