#arma3_scripting

1 messages ยท Page 296 of 1

polar folio
#

the flamethrower will most likely be scripted in its bahavior. so what you could do is find out how it works and then apply that to the m113 weapon, which would be an m2 or something?

#

not the easiest task though. but depending on how clean the flamethrower code is set up it might be as easy as applying a "fired" EH to the vehicle's weapon and run a function that already exists from there.

late gull
#

guys, is there anyway to get task position?

#
// something like:
_tsk = currentTask (driver (vehicle player));
_pos = getPos _tsk;
hint format["%1",_pos];
late gull
#

@tough abyss maybe, but what if i dont want to use the name, just the current task assingned

tough abyss
#

taskDestination currentTask player

late gull
#

ohh, ok the second one will be

#

ty man

tough abyss
#

Np ๐Ÿ˜ƒ

dry egret
#

anyone here know the cutText comman well

#

im having a bit of an issue with it atm

#

0 CutText ["","Black OUT", 0.1];

#

this gives the effect i want but i want it to fade back in later

#

using 0 CutText ["","Black IN", 0.1];

#

does not work

#

i figured since its all on the same layer that it would fade the screen back in but it does not seem to work that way

dry egret
#

i figured out what was going on

#

those are the different effects

little eagle
#

btw, I wouldn't use numbers like that as layers. You probably break something by accident by using layer 0

dry egret
#

the problem was, when using the effect "black out" i was un-able to brink back the picture

#

you can use layers 0 to 99

#

what was happening is on the bottome layer i used black out

#

and then i tried to overwrite that layer with a new effect

#

to black in

#

problem was it was not overwriting the old effect

#

the way i solved it was by using cutFadOut

#

so after the title screens show i cut the bottom layer compleatly

#

another un-documented change to arma lol

#

never had to do that before as it used to work with just overwriting the existing layer

vital onyx
#

Hey guys, any reliable way to get unique weapon id? besides weaponstate

#

for example the weapon in crate

little eagle
dry egret
#

@little eagle yes that command is documented, but bis removing the overwriting title effects on the same layer is not

#

i only noticed it when i opened up an old mission ware i used the same effect sequence and it no longer worked

little eagle
#

But overwriting the previous layer with the same id is the whole point of the layer stuff in the first place

#

That and sorting them on top of another

dry egret
#

you use to be able to overwrite the same layer with different effects but with the way "black out" nad "black in" now work, its no longer possable to do it in the same layer space, ex.. "black out" screen for 20 seconds and "black in" the same layer after the duration you wanted the screen to be "blacked out" < this does not function like this anymore from what i have been testing. Its a nice change but its something that should be noted on the wiki what the layer chaged actualy did. Their is a change noted on it but not how it changed its function

little eagle
#

Pretty sure you could never do that.

dry egret
#

you used to be able to but that was back around 2014 when i was last messing with the system

little eagle
#

I think you're misremembering.

#

You can maybe do it by using sleep

dry egret
#

what you men like

0 CutText ["","Black out", 3];
sleep 15;
0 CutText ["","Black in", 3];

#

cause that what i was doing and the screen would never come back lol

#

acts like the system noticed layer 0 already had an effect on it and moved the new one to layer 1

#

This gave me the effect i was going for so no worries ๐Ÿ˜
0 CutText ["","Black OUT", 0.1];
sleep 15;
0 cutFadeout 1;

#

though i would like to see some tutorials on the new splended camera and how to record inputed motions so they can be played back via script at some point lol

#

this way we can pull off complex cutscene with moving shots

little eagle
#

Again, don't use layer 0

rotund cypress
#

Hey guys, is there any way to parse chat from in-game? Like parse chat to another ctrl?

little eagle
#

ctrlText probably, but the display has no idd and I see no controls in config either, so it's either tricky or impossible.

halcyon crypt
#

Hmm I want to believe that someone did something with the chat in A2(:OA)

dusk sage
#

From SQF? No, not possible IIRC

#

As in, no event, etc

#

You could monitor when they open the chat box, and capture the text though @rotund cypress

indigo snow
#

I remembered this

little eagle
#
// init.sqf
["cba_events_chatMessageSent", {
    params ["_message"];

    hint _message;
}] call CBA_fnc_addEventHandler;
halcyon crypt
#

yet another undocumented CBA thing ๐Ÿ˜›

#

well it is kinda but the only google hit for that event is a PR

still forum
#

It's only about a month old :u

little eagle
#

Dunno if it should be considered API. I use it for internal stuff.

#

And the event only really fires if you enter the message. Not when anyone else does it or when it's done by command.

#

So it's not really as useful outside of what I'm doing with it.

rotund cypress
#

Alright hmm

little eagle
#

How many years before there is a fileExists command?

thin pine
#

Maybe around the time you'll be able to generate files through script without needing a dll extension

vital onyx
#

Has someone an experience to align Structured Text font size with display resolution, even on the same screen ratio I get very different result on different resolutions

#

say on 1776*1000 I need to set picture size to 10
on FullHD I need to set it to 15

plucky beacon
#

Is there a way to open someone's briefing tab on the map forcefully?

#

I know you can open the map forcefully but I want it to open in the "Briefing" section

plucky beacon
#

TFW you find shotguns_ca.paa in the ui files

#

hello darkness my old friend

compact galleon
plucky beacon
#

wow

#

I wish I had that

compact galleon
#

Hot DAYUM the debugger adds a LOT of overhead

No debugger attached: 5.5445ms.
Debugger attached: 245.4253ms.```
plucky beacon
#

It's debugging!

snow raft
#

If I have something like this _hList= _pos nearObjects ["House",_distance];
Can I refer to the house with _house=_X; ?

halcyon crypt
#

if you forEach _hList then yes

#
{
    private _house = _x;
} forEach (_pos nearObjects ["House",_distance]);
snow raft
#

so typeOf _house in foo wont give back buildings in _hList. I cant just use the class "house"?

halcyon crypt
#

no clue what you mean ยฏ_(ใƒ„)_/ยฏ

snow raft
#

one sec

#
                        
        {
    _house=_X;

    if (!(typeOf _house in _exclusionList)) 
            then {foo}```
#

why the heck does this work?

little eagle
#

_exclusionList undfined=

#

?

snow raft
#

Is defined

little eagle
#

Also, the curly bracket are all over the place

snow raft
#

yes thats is the thing I think, I think I have to do some research on "private"

#

ok thats not it

halcyon crypt
#

the _x needs to be lowercase

#

oh wait, SQF isn't case sensitive is it? ๐Ÿ˜›

snow raft
#

What does it even mean if you put something in {} with not arg whatsoever

halcyon crypt
#

"with not arg whatsoever", you're kinda talking gibberish

#

as in hard to understand

snow raft
#

bad englisch and I have no idea how to explain better sry^^

little eagle
#

best is to show the whole code with all variables.

#

Also idk about actual programmers here, but foo an bar does nothing for me when trying to understand code.

#

It confuses me more....

#
private _var = 1;

systemChat str [_var]; // [1]

// use private
call {
    private _var = 2;
    systemChat str _var; // [2]
};

systemChat str [_var]; // [1]

// no private
call {
    _var = 3;
    systemChat str _var; // [3]
};

systemChat str [_var]; // [3]
snow raft
#
                        
        {
    _house=_X;

    if (!(typeOf _house in _exclusionList)) 
            then {

        
 for "_n" from 0 to 50 do {
 
    _buildingPos=_house buildingpos _n;
        if (str _buildingPos == "[0,0,0]") exitwith {};
                    
                if (_probability > random 100) 
                    then {
                null=[_buildingPos,_showLoot] execVM "spawnloot.sqf";
                        };    
                    };
                };                
    }foreach _hList;``` 
Loot spawn script I found on YT to learn a bit. The whole code after _house = _X is one bracket.
#

as far as I can see, been writing with standard editor^^

little eagle
#

_exclusionList is still undefined

halcyon crypt
#

well whoever wrote that shouldn't have ๐Ÿ˜›

snow raft
#

is defined doesnt matter for that bit of code

#

yes but it works D:

little eagle
#

If it works, then what is the problem?

snow raft
#

Just dont get why he can use _house when that was never defined with the actual housList

#

or is he using the class "house" and not the variable?

little eagle
#

_house is defined:

#

_house=_X;

snow raft
#

yes but they are in hList. So what does _X mean?

#

_X is not defined

little eagle
#

_x is a magic variable in the forEach scope

#

forEach is a loop that iterates through an array (here: _hlist)

#

And _x is the current array element of the iteration.

#

_forEachIndex is the position of the current element in the array. Another magic variable

snow raft
#

so everthing is in the forEach Scope and he is going through them with _X and saving in _house from hList?

little eagle
snow raft
#

thank you very much !

tough abyss
#

Does anyone know here can I find info about CBA's QUOTE(), COMPILE_FILE(), PREP(), FUNC(), QGVAR(), etc. stuff?

dusk sage
stray kindle
#

I'm quite sure @little eagle knows nothing about CBA ๐Ÿ˜‰

tough abyss
#

Thanks @dusk sage.

little eagle
#

Don't look too deep into this. There's a lot of ooold stuff that is no longer really needed in A3.

#

Like two thirds are just bwc.

#

With one half of that being used nowhere anymore.

nocturne iron
#

The styles stuff and functions documentation is a good habit though

little eagle
#

Oh, I meant the script_macros_common.hpp, not the ACE doc.

nocturne iron
#

Oh haha

little eagle
#

I don't like the ACE function headers. Too much ASCII art

tough abyss
#

Thanks @little eagle. Can those be used in .cpp files as well?

little eagle
#

Most of them.

tough abyss
#

Cool.

nocturne iron
#

I generally use a shroter version of them

#

pretty much identical to the BIS style

#

only for more complex functions though, small ones are generally two liner descriptions

little eagle
#
/*
 * Author: commy2
 * Get the config path of a vehicles turret.
 *
 * Arguments:
 * 0: Vehicle Config <CONFIG>
 * 1: Turret indecies <ARRAY>
 *
 * Return Value:
 * Turret config <CONFIG>
 *
 * Public: Yes
 */

vs.

/* ----------------------------------------------------------------------------
Function: CBA_fnc_getTurret

Description:
    A function used to find out which config turret is turretpath.

Parameters:
    _vehicle    - Vehicle or vehicle class name <STRING, OBJECT>
    _turretPath - Turret path <ARRAY>

Example:
    (begin example)
    _config = [vehicle player, [0]] call CBA_fnc_getTurret
    (end)

Returns:
    Turret Config entry

Author:
    Sickboy, commy2
---------------------------------------------------------------------------- */
#

CBA looks cleaner to me.

dusk sage
#
//Author: commy2 Description: Does stuff
#

sorted

little eagle
#

// by commy2

dusk sage
#

๐Ÿ‘

rugged basalt
#

CBA is a blessing from the god itself

#

it contains so many useful functions

peak plover
#
//player call forks_are_weird;
//proves to the target that forks are weird

I always wanted to make pretty comments

rugged basalt
#

should be integrated into engine if you ask me

peak plover
#

True that

rugged basalt
#

it's like SKSE for Skyrim

#

Bethesda still don't want to integrate it but everyone uses SKSE

#

same for BI

peak plover
#

CBA_A3 is like CBA A2 is to arma 2

rugged basalt
#

yup

#

im a bit dissapointed about testing of new CBA releases

#

last time they broke critical functions like Patrol/attack/defend and almost every mission was broke

little eagle
#

๐Ÿ˜ฆ

rugged basalt
#

4 days for fix lol

peak plover
#

Haha, the real test starts when the update goes public ๐Ÿ˜„

rugged basalt
#

1 line of code

#

they added unit tests for that function now

#

so shouldnt break in future

little eagle
#

Wouldn't be a problem if Steam didn't force anyone to update or had any kind of version control.

rugged basalt
#

yup

little eagle
#

Not really a problem of CBA, more like of Steam tbh.

rugged basalt
#

but as steam do they should be testing more carefully

#

nvm. It's fixed now

peak plover
#

Steam workshop has it's problems

rugged basalt
#

btw

#

is publishing mission steam workshop a big problem or it's easy to do it?

peak plover
#

Ez pz

rugged basalt
#

nice

#

I think I'll publish my work in this week

#

19 COOP RHS+ACE

#

scripted events in bases. When enemy detects you then you need to kill radiooperator before he goes to the radio and call for reinforcements

#

blow up fuel station to make armored vehicles run from town of your target to fuel base

#

I think it's not bad but users will verify

#

it's my first mission

#

random garrisons and random patrols + random location of ISIS leader

#

should be replayable

peak plover
#

ISIS?

#

Isn't fighting isis anti-sematic?

rugged basalt
#

yeah it's in takistan

#

why?

peak plover
#

I don't know why would it be?

rugged basalt
#

what's anti-sematic because I can't find the right definition

peak plover
#

It's nothing. It's a joke

#

It's only purpose is to confuse you

tough abyss
#

Is this the A3 equivalent of deleting system32? ```SQF
[] spawn {
while {true} do {
if (!isNull objectParent player) then {
detach player;
};
};
};

rugged basalt
#

sorry if I didn't recognize your joke ๐Ÿ˜‰ Im not a native speaker and I could not understand some specific jokes

peak plover
#
disableUserInput true

@tough abyss Keep it simple.

little eagle
#
_a = {call _a};
isNil _a;
rugged basalt
#

disableUserBreathing true

#

have fun

#

a simple and elegant solution for users who writes negative comments on your workshop pages

little eagle
#

Eh, negative of comments are fine, but the misinformation spread is unbearable.

rugged basalt
#

Just look at the Red Hammer conversion for ARMA 3

#

tons of comments of crybabies "Its too hard BUEEEEEE"

#

it was hard in original OFP

little eagle
#

Also every update people complaining about that they get signature mismatches when trying to connect to a server that didn't patch yet.

rugged basalt
#

why it should be easier here

little eagle
#

"test your shit, signature mismatch, please patch"

peak plover
#

ugh, disgusting

halcyon crypt
#

would be nice if steam workshop would introduce branches and/or versioning

tough abyss
#

Dont get to happy you might have to wait awhile before it hits stable branch

peak plover
#

I'm more excited about

enableEnvironment [ambientLife, ambientSound]         (Since Arma 3 v1.67)
#

Fuck those rabbits. I want sheep and goats

#

I really hope project orange is an animal enhancement expansion

#

Why stop at goats?

#

There are many wonderful animals that crave includement to the ArmA series

#

Dogs, foxes, coyotes, frogs, cranes. I wonder if they went to real life altis and saw a bunch of rabbits and snakes and were like : "Wildlife - Check"

peak plover
#

Yeah, no women, wtf? Women DLC when?

#

I don't see the point of having 3 rabbits hopping around when you could have women and foxes running around...

arctic igloo
#

who needs women when you ahve goats to fuck

peak plover
#

It's not about the fuck. It's about something to distract the player and to give more immersion

#

Having the only thing that moves on your screen be an enemy is boring

arctic igloo
#

oh we were talking about arma, nvm

peak plover
#

Having to check again to see what it was, to identify the target and make sure it was not a goat a civilian or a woman is what arma is really about

little eagle
#

rabbits and snakes are pretty pointless when they aren't even synched over the network.

#

Sure, more network traffic, but now 20 connected clients calculate their own 5 rabbits.

#

It's more load overall, feels like a waste

still forum
#

Rabbit's AI crap is almost 4ms per Frame. Which can't really be disabled till 1.68 without sacrificing environmental sounds
so that waste is literally a couple fps

little eagle
#

How the fuck did they manage 4ms/frame?

jade abyss
#

All of the Animations.

#

Pathfinding

#

checking for Snakes

#

run from snakes

#

dig holes (3 of the 4ms)

still forum
#

Rabbits run from snakes?

little eagle
#

But you don't need to do that every frame.

jade abyss
#

no, that was a joke ^^

still forum
#

You're wrong commy! That totally needs to be done every frame. We want the Rabbits to be smooth.... Before we cook them

little eagle
#

I should fix that shit.

jade abyss
#

You won't.

still forum
#

Yeah :3 Disable all the Rabbit FSM's ๐Ÿ˜„ and break the Animal scripts

jade abyss
#

Basicly, the Hare/rabbit/Snake needs NOTHING, except: Move from A to B. No Sensors, no targeting, nutting

little eagle
#

You can do a lot of shit in way less than 4ms/frame.

#

The first thing to fix is the amount of these beasts

#

Also delete fish entirely. No one dives anyway.

#

Or at least make it a mission setting to have them.

peak plover
#

How do I disable the animals without a config edit? How do I disable with config edit?

willow basin
#

Never have seen any animals in my mission... nor fishes

still forum
peak plover
#

Not yet, I'm looking for alternatives

jade abyss
#

there are non

tough abyss
#

Why bother just wait for arma update for the command.

willow basin
#

There is... I managed to do this xD but hell can't find it in my code

tough abyss
#

You can also override the animals defines in the map config. But that requires an addon. Think Exile uses that method

peak plover
#

Oh my god

#

ITS 1 SCRIPT PER ANIMAL WITH LOOPS INSIDE OF IT

#

and yeah, they have to run fast, because "reactions"

#

It uses nearObjects

still forum
#

the animal script isn't even the problem

peak plover
#

linke 384

#

disgusting

still forum
#

that's a script VM with realitvly low load. compared to the AI calculations

peak plover
#

Man, for every animal you have one of these. So if you have 10 animals. It's already 10 loops

jade abyss
#

and?

peak plover
#

Considering that there are 30 players, this would mean 300 loops in total

#

What a waste

#

Those loops could have been used for something better.

still forum
#

10 mostly sleeping scripVM loops

peak plover
#

The energy wasted to run those loops is bad for the enivronment

jade abyss
#

Just because its a loop, it doesn't mean its bad oO

peak plover
#

We would keep the planet green if we run 1 loop on the server

still forum
#

30 players means 10 loops per player computer

peak plover
#

Exactly

jade abyss
#

And?

peak plover
#

Power draw from computer without animals > 200W. With Animals >201 W

#

x 30

jade abyss
#

๐Ÿคฆ

peak plover
#

haha ๐Ÿ˜„

still forum
#

none on the Server I'd guess. Because server doesn't have Animals. The script load is completly negligible. stop focusing on that ^^ scripts are maybe 0.2ms a frame. where the AI calculations are 3-5ms

peak plover
#

My point is they are not syncronized. "See that rabbit?" - "what? Lay off the morphine!"

still forum
#

We do that quite often in my group ๐Ÿ˜„ The "You got too much morphine" thingy ๐Ÿ˜„

peak plover
#

Man, I usually have like 100 AI active. Having 10 animals added to that is like nothing...

#

Also they would reduce the load from players, even if slightly

#

Not like servers run slow nowadays anyway. HC gets a decent FPS with the ai and server is left to do nothing, checks the tasks every few seconds and that's it.

willow basin
#

I'm scared of AI. Keeping it on an absolutly minimum ^

peak plover
#

Haha, why is that?

willow basin
#

Still from A2 times. Once we removed the AI and all the Groups they've created we got massive performance improvements and finally got rid of the crow-bug

#

They weren't working well anyways when too many players went on

weak obsidian
#

Remove all the sealife and replace with a coastal patrol boat

peak plover
#

Remove all sealife and replace with those enormous submarines

weak obsidian
#

[3:35 PM] commy2: Also delete fish entirely. No one dives anyway.

#

#sotrue

little eagle
#

Remove all sea life and replace it with ten more snakes.

peak plover
#

They should make fully physical snakes using the rope physics. Also give the new snakes collision and sophisticated social simulation.

little eagle
#

ROPEX SNAKES

#

YES

peak plover
#

@tough abyss from 25 to 111 ๐Ÿค”

#
enableEnvironment true

Current FPS 82

enableEnvironment false

Current FPS 92

#

Sweet.

#

around 1.3 MS

#

Or just have 1 script that managest all of them

#

I don't see how that would not work

#

createUnit on them?

#

createAgent. Isn't this more hard on the frames?

little eagle
#

I guess 10 agents could be more expensive than one group with 10 units.

#

Depends on what you do with them too.

tough abyss
#

What are even agents?

little eagle
#

ai without group

tough abyss
#

I'm guessing a single independent AI unit doesn't count - since it has it's own group, correct?

little eagle
#

A single unit is still inside a group.

#

A group consisting of one unit.

tough abyss
#

Can an agent join a group, though?

little eagle
#

I'm not sure, maybe.

#

It's mainly meant for animals, which obviously don't want to be in groups.

tough abyss
#

Can you imagine being in a squad of actual snakes in an MGS themed mission?

open vigil
#

Would those be solid snakes? ๐Ÿ˜‰

little eagle
#

๐Ÿคฆ

jade abyss
#

๐Ÿคฆ

tough abyss
#

๐Ÿคฆ

open vigil
#

Everyone's a critic ๐Ÿ˜ƒ

naive fractal
#

Can you do conditional checks within switch case matches within SQF?

little eagle
#

uhm

#
private _n = random 3;

switch (true) do {
    case (_n < 1): {...};
    case (_n < 2): {...};
    default {};
};
#

Like this?

pliant stream
#

^ SQF's ghetto if-elseif-else

little eagle
#

Well it's a normal switch

naive fractal
#

That's pretty much it, can you not do a switch statement on the variable and conditionally check it within the cases?

little eagle
#

" conditionally check it " ?

naive fractal
#

switch (_n) do { case (_n < 1): {...}; default {}; };

#

for example, instead of switching on true

pliant stream
#

normal switch is ```CPP
enum class foo
{
foo_0,
foo_1,
};

void bar(foo foo)
{
switch (foo)
{
case ::foo::foo_0:
break;
case ::foo::foo_1:
break;
default:
}
}``` the sqf switch is a monstrosity

little eagle
#

No, Bose, that would make no sense

#

< reports a boolean and _n has to be a number. That would never match in your example

#

That is pretty much the same thing, Untelo. Stop being so picky

pliant stream
#
switch (foo) do
{
    case 0: {};
    case 1: {};
    default {};
};``` would be similar, but sqf switch cases are evaluated at runtime
#

which is what allows you to do the SQF switch (true) {...}

little eagle
#

The only real thing that's missing is break. You basically always exit the do scope if the case matches, but I wonder if you can explicitly work around this with scopeName on the do-block and using that breakTo.

naive fractal
#

Roger, I derped pretty hard there. Was considering case checking on the return value of the condition, and not matching against the integral data type of the switch statement itself. You've presented a solid working way for me, thank you.

pliant stream
#

what exactly is it that you're trying to do

naive fractal
#

Cut downing if-else chains ;)

pliant stream
#

then the switch (true) { case foo: {}; case bar: {}; default {}; }; is probably the way to go

naive fractal
#

Yeah, it is. Cheers guys.

pliant stream
#

unless you're doing something like SQF switch (some_number) do { case 0: {}; case 1: {}; case 2: {}; case 3: {}; };and want the best performance in which case a jump table would be better

jade abyss
#

iirc several IFs are still faster than Switch.

pliant stream
#

i can't speak to that, but switch might be more readable

#

and performance isn't always critical

little eagle
#

Stop using foo and bar.

pliant stream
#

why

jade abyss
#

its foobar!

naive fractal
#

I'm not too concerned about execution on this, it's run once. It's a polling system with a min required players that's different with lower player counts, which then changes to a general majority check over a certain threshold.

little eagle
#

Dscha is right for once.

jade abyss
#

fuuu bar

little eagle
#

It confuses more than it helps.

pliant stream
#

whats confusing about it

little eagle
#

Use actual examples

pliant stream
#

like what

jade abyss
#

Yep. Helps more.

little eagle
#

This is why I hate programers.

jade abyss
#

Like Commys example

pliant stream
#

this is why i hate scriptkiddies

jade abyss
#

with Number etc

#

Oh boy

#

Long Story short: Beginners understands it better, when you give them a "usable" example.

naive fractal
#

I didn't mean to start anything guys, I just wanted to avoid finding out the hard way about SQF specific caveats.

jade abyss
#

Oh, you are still here? ๐Ÿ˜„

little eagle
#

Don't worry about it.

pliant stream
#
switch (1 + floor ((((toArray animationState player) select 5) - 100) / 5)) do
{
    case 1:
    {
        systemchat "standing";
    };
    
    case 2:
    {
        systemchat "kneeling";
    };
    
    case 3:
    {
        systemchat "prone";
    };
};```
#

there's a real example

#

is it better now?

jade abyss
#

๐Ÿ™„

little eagle
#

You could've used stance player and the strings that reports, but it's still better than foo bar.

pliant stream
#

no stance in A2 though, that's why i why went with this one

little eagle
#

No one cares about A2.

jade abyss
little eagle
#

โ˜

pliant stream
#

i do, but that's beside the point. the discussion was about the switch which hasn't changed since A2 and the example i gave was real either way. i was just informing you on why i went with this example instead of the stance thing: because i'm more familiar with A2 than A3

little eagle
#

Ah. I thought you chose a weird expression like (1 + floor ((((toArray animationState player) select 5) - 100) / 5)) to prove some kind of point or something.

pliant stream
#

no it works perfectly in A2

jade abyss
#

The Discussion was: Read/Usability/Understandability VS. CoderStuff that Scripting won't understand properly, since they (mostly) have no clue what to do with "foo" and "bar"

pliant stream
#

well, i guess we'll just have to agree to disagree. i think an example should be as simple as possible. foo and bar are just placeholder names for variables. if the newbie asks, they're easily explained. and if the newbie still doesn't get it after the explanation... well, let's face it maybe they're not cut out for it anyway

little eagle
#

Yeah. So many possibilities to choose from. Virtually infinite examples of code that could be presented, but no: Let's make up new words that should never be used in real code anyway.
All that did was bring people to actually use foo and bar in finished code. lol
Programers.

dry egret
#

how do i determin when a lamps light bulb is shot out?

#

been trying to use _damage = getDammage light!;

dry egret
#

thanks commy2 ๐Ÿ˜ƒ

jade abyss
pliant stream
#

hey i didn't come up with foo and bar, they've been used for over 50 years so i think they're pretty well established

jade abyss
#

Over 50? ๐Ÿ˜„

little eagle
#

Fact: The older something is, the more likely it is to be wrong.

#

No one cares about the origin of it, or if programmers use it. It's still dumb.

#

ยฏ_(ใƒ„)_/ยฏ

halcyon crypt
dry egret
#

how do i pull out the hitPoint names on objects? not sure if im reading the object config file correctly

jade abyss
little eagle
#

It's a new question with an old answer.

jade abyss
#

Lifer!

little eagle
#

What?

jade abyss
#

C&Per! Lifer!

little eagle
#

xD wtf?

jade abyss
#

My Text = My IP = You lifer! C&Per!

#

๐Ÿ˜„

#

waiting for a friend to play some Wildlands, i am bored ๐Ÿ˜„

compact galleon
#

@little eagle This is why I hate programers.The prejudice is strong...

little eagle
#

It's no longer prejudice at this point.

compact galleon
#

They were first used in 1965

#

Commonly accepted? The words have been used a lot since the 60s and 70s, and are still used

#

I don't know a programmer who hasn't used them one way or another

little eagle
#

Tell them to stop.

compact galleon
#

@open vigil They're placeholders or example names, not actual names..

thick oar
#

(1 + floor ((((toArray animationState player) select 5) - 100) / 5))

Jeebus, this is exotic. ๐Ÿ˜ฎ

#

On the general topic of tracking anims: Please never never never never never never compare to or use the string of the animation classname.

#

Instead, go by params inside this class, namely actions=; which points at cfgSomeMoves\Actions\<actionMap>

#

In this action map you'll find upDegree=;. This is where it all is decided. This integer tells AI and engine/anim system what stance/weapon combo you are currently in.

little eagle
#

Good to know.

#

Always wondered how that worked.

thick oar
#

upDegrees are engine specific. One cannot add new ones.

#

And adding new ones in the engine is huge PITA

#

Oh, and while at it:

switchMove is bad. Never use this.

compact galleon
#

@open vigil They're not used for complex examples. They used for some examples when it makes sense to not spend a lot of time making up names for variables. Eg. if someone asks how to output text, eg.

void foo(char* bar)
{
    printf("%s", bar);
}```
thick oar
#

It doesnt even synch over MP

#

switchAction and switchMove are way cooler. ๐Ÿ˜ƒ

compact galleon
#

How is that in any way relevant to whether programmers use foo and bar or not?

thick oar
#

All other problems were already sloved. So this one was on top of the backlog...

indigo snow
#

it would be nice if the topic was arma scripting so Mondkalbs nice explanation wouldnt get drowned out by noise.

thick oar
#

Time to get out of here before godwin's law strikes.

open vigil
#

Nah. I apologise for interrupting.

little eagle
#

Informaticians are basically Hitler.

plucky beacon
#

So setpos has to be local to the object it's moving huh

little eagle
#

Not according to the wiki.

#

Arguments Global
Arguments of these scripting commands don't have to be local to the client the command is executed on.

#

I would use "machine" instead of "client", because it also applies to the "server" as well.

plucky beacon
#

But when i terminal setpos _pos it doesn't move unless its a server or global execute in the debug

little eagle
#

terminal variable defined on your machine?

compact galleon
#

@plucky beacon Well, setPos at least used to have to be executed where the unit is local.

little eagle
#

Wiki doesn't say so.

compact galleon
#

@little eagle No shit.

plucky beacon
#

whoah

#

in any case

#

terminal is an object in the map so yes

#

I'll just run a remoteexec

plucky beacon
#

Probably a similar issue to the setdir

little eagle
#

Did you disable the simulation or something like that?

plucky beacon
#

nope

#

This command has local effect, but some simulation types do synchronise their changes over the network whilst others do not.

#

some simulation types?

little eagle
#

Where does it say that?

plucky beacon
#

what's that mean

#

Additonal information

little eagle
#

Since ArmA 1.08 and later the command is global for every object again.

plucky beacon
#

the object I am moving is a static object if that has anything to do with it

little eagle
#

simulation is a property of every CfgVehicles / CfgAmmo / CfgNonAiVehicle class and defines the behavior of the object.

plucky beacon
#

it's not an object with physics

little eagle
#

tankX, carX, bullet, house

plucky beacon
#

I guess it would qualify as "house" then?

little eagle
#
getText (cursorObject call CBA_fnc_getObjectConfig >> "simulation")
dry egret
#

need a bit of help understanding arrays in arma

plucky beacon
#

I'm guessing you looked at the wiki page then?

dry egret
#

yeah

plucky beacon
#

what's the trouble

dry egret
#

i understand array in c++ but the way arma does things is a bit strange

little eagle
#

i understand X in c++ but the way arma does things is a bit strange

#

the way arma does things is a bit strange

thick oar
#

Step 1 complete. ๐Ÿ˜ƒ

plucky beacon
#

>arma==strange

dry egret
#

lol

#

so true

plucky beacon
#

is there something you're trying to do that isn't acting how you expect?

pliant stream
#

arma arrays are more like std::vector than c++ arrays

dry egret
#

im creating an array for each of the light lamps in the mission
lightArray_1 = [bulb_1,bulb_2];

#

and im trying to store the current states of each hitpoint in the array

plucky beacon
#

so you want a multidimensional array?

pliant stream
#

you mean a jagged array?

little eagle
#

Use a second array.

plucky beacon
#

you can also use arrays in arrays granted I haven't tried that but wiki says

dry egret
#

well the problem im having is i cant get the data from getHitpoint to store in the array

little eagle
#

How so?

#
lightArray_1 = [bulb_1,bulb_2];
lightArray_2 = lightArray_1 apply {getAllHitPointsDamage _x select 0};
dry egret
#

the lamp has 4 hitpoints and i want to store each of the hitpoints in each part of an array

#

so i need an array that can hold it but i dont know how to do that

little eagle
#

I posted it.

dry egret
#

if lightArray_1 is created as an empty array will arma auto create each selection? cause i cant defind it like array[3] = {}

little eagle
dry egret
#

no

little eagle
#

What do you mean by "auto create each selection"?

dry egret
#

defining an array = [] < is an empty set array in arma

little eagle
#

Yes.

dry egret
#

but how many selects are inside it

little eagle
#

zero

dry egret
#

in c++ you define a array[3] = {} and this will give you an array with 4 selects to store data inside, how do i do this in arma lol

little eagle
#

You can put as many elements inside the array as you wish.

plucky beacon
#

if I have an object with a holdaction, and I attatch it to another object, will it retain it's individual action commands

little eagle
#

The limit is 10 million minus one.

plucky beacon
#

Imma test this

dry egret
#

how do i make one with 4 elaments then

little eagle
#

my_array = [];
my_array resize 4;

dry egret
#

ahhh

indigo snow
#

you dont need to explicitly define the size before adding elements to it

little eagle
#

^

#

There is not much point.

indigo snow
#

it also automatically resizes when you remove elements

dry egret
#

thats nifty

little eagle
#

It's a scripting language, not a programming language.

dry egret
#

main reason its causeing me trouble lol

little eagle
#

You're overthinking it.

dry egret
#

lmao

indigo snow
#

arma doesnt really care about what you do with its variables. no strict types etc.

little eagle
#

Doesn't mean you should do that though.

dry egret
#

would i be able to get away with doing
lightArray_1 = [];
lightArray_2 = lightArray_1 apply {light1 getAllHitPointsDamage _x select 0};

indigo snow
#

no

#

because the first array is empty

#

you need to fill it with lamp objects like commy showed you

little eagle
#

You would end up with two empty arrays.

dry egret
#

oh ok

little eagle
#

Also
light1 getAllHitPointsDamage _x
is wrong

dry egret
#

then how do i define what object i want to pull from then

little eagle
#

How to retrieve the object reference of some map preplaced lamps?

dry egret
#

no

#

the lamps im working with are named in the editor for my FOB

#

say light_1

little eagle
#

lightArray_1 = [light_1];

dry egret
#

/facepalm

little eagle
#

lol

#

I said you are overthinking this.

dry egret
#

basicaly what im doing is having a enemy FOB that has outword facing lights, when bluefor is detected the lights turn on and base alarm goes off, what im trying to account for is if the player has covertly shot out the lights before being detected. this way when the player is detected if light_1_hitpoint damage is > 0.91 then the lights are cosidered shot out and the script will not turn the light on when the base is on alert

#

only way i know of setting lights to on/off is by damage states of the bulbs

#

it should give players bit of a surprise ๐Ÿ˜ƒ

jade abyss
#

@dry egret Forget almost EVERYTHING you know from ANY other Coding/Scripting Language.

little eagle
#
My_fnc_checklights = {
    private _kaput = false;

    {
        if (selectMax (getAllHitPointsDamage select 2) isEqualTo 1) exitWith {
            _kaput = true;
        };
    } forEach _this;

    _kaput
};
 lightArray_1 call My_fnc_checklights // false or true
jade abyss
#

*kaputt

little eagle
#

Probably something like this,

jade abyss
#
My_fnc_checklightArray_1 =
{
    private _kaputt = false;

    {
        if (selectMax (getAllHitPointsDamage select 2) > 0.91) exitWith
        {
            _kaputt = true;
        };
    } forEach _this;

    _kaputt
};```
little eagle
#

oops, forgot to rename the function.

dry egret
#

so its best to do what im attempting to do through a function?

indigo snow
#

if you use it more than once > you put it in a function (generally)

dry egret
#

got some reading up to do to even know how to use that code lol

#

i have not gotten into using function in arma yet...

compact galleon
#

@dry egret Well, they're just a code block. It's not technically called a function until it's defined in CfgFunctions

#

In either case, whether defined there or not, they're called the same way, through call

#

argument call codeblock

#

Defining them in CfgFunctions is not necessary, but does come with some advantages

little eagle
#

I always found that to be overkill for missions.

#

CfgFunctions is pretty clunky.

#

You don't even get the benefits of having the functions be precompiled and cached at game start.

#

So what's the point.

compact galleon
#

@little eagle Well, if nothing else, it allows circular dependencies automatically, and it allows you to view your mission functions in the function viewer

little eagle
#

yay

compact galleon
#

and then of course, there's preInit, postInit and preStart

little eagle
#

Sure.

dry egret
#

ok, so from what im reading i need to put that function in the description.ext under class CfgFunction correct?

#

and i should call it by trigger detected for onActivation lamp_1 call My_fnc_checklights

nocturne iron
#

You can also just do what dscha said, it's quite a bit quicker

dry egret
#

< didnt understand what he was saying to do exactly

nocturne iron
#

All inputs should be in array format, ie [parameter 1, parameter 2]

#

Write your code

#

Put these brackets {}; around it

#

And name it by using fnc_nameoffunction = {codeblock}

dry egret
#

then does that just go into the init.sqf so i can call it later then?

nocturne iron
#

You can also 'functionise' sqf files by using fnc_nameoffunction = compile preprocesslinefilenumbers "Pathtoscript.sqf";

#

Yep!

dry egret
#

/facepalm < was looking on the wiki about functions

little eagle
#

๐Ÿ˜

dry egret
#

im getting there commy2

#

painfuly slow but ill get there lol

nocturne iron
#

CfgFunctions iirc is more of a campaign thing to make your pbos a bit smaller

jade abyss
#

oO

#

Not realy

#

It's just a better way of having your stuff sorted.

#

CfgFunctions does more or less the same as compile preprocesslinefilenumbers "bla.sqf"; just in a more elegant way.

polar folio
#

elegant is kind of subjective though. i only use CfgFunctions in missions to force myself to keep things some what organised. those one liner solutions will just amplify my bad habits ๐Ÿ˜„

tough abyss
#

could anyone tell me what the oposite of getPosVisual is?

#

like there is no setPosVisual

little eagle
#

There is none. You cannot set the position in render scope.

tough abyss
#

hmm

polar folio
#

that'd be crazy ๐Ÿ˜„ maybe useful for crazy arma hacks

little eagle
#

Yeah, it makes no sense.

tough abyss
#

and is getPos* supposed to be grab 0,0,0 pos of a model?

polar folio
#

-Visual stuff is for when simulation position and rendered model position differ

little eagle
#

getPos uses x and y from the model center, but z is the distance from the models lowest point in the roadway LOD to the first object with the highest point in the pathway LOD below it or, if there is no object below it the terrain height when on land, or the height of the waves on sea.

#

It's called AGLS

#

"above gorund level surface"

#

getPosVisual does the same, but in render scope instead of simulation scope. The position is updated more frequently there to get smooth movements, but the object isn't really "there" if you understand.

tough abyss
#

my problem is i getPosATL from a mine which is below the surface ans setPosATL a object to it, the setPosed model is at the very bottom of the mine even tho the mines 0,0,0 is at the fuze

#

i used to just setPosATL[x,y,0] but i realized that this wont work in buildings so i try to solve that now

little eagle
#

I'd use ASL and if the object you're placing is too deep, just add some constant to the z axis.

crude plank
#

I like c#

little eagle
#

Did I scare you?

crude plank
#

Me?

little eagle
#

That comment seemed so random.

crude plank
#

C# is a programming language

little eagle
#

True. I heard that too.

#

Can confirm.

crude plank
#

Is it pssible to script a frog sound instead of gatling gun sound?

little eagle
#

Replace the sound the gatling makes with a frog?

jade abyss
#

Instead = Yes, ScriptOnly = Nope.

#

config.cpp

little eagle
#

Not with scripting alone I'm afraid. You'll need to edit some configs.

#

config.cpp means you need to make an @Addon.

crude plank
#

C++ cool

little eagle
#

It's not really C++. It's just looks like it and uses some basic stuff from it. .cpp probably because the syntax highlighting works for it.

tough abyss
#

@little eagle sadly that isn't dynamic and it should work with any mine...

#

i just don't understand why it would grab that position

little eagle
#

Well. What object are you attaching?

tough abyss
#

trappwires or other stuff

#

and not attaching, just spawning

little eagle
#

I think you'll need some ray casting I'm afraid.

tough abyss
#

feck

little eagle
#

And the biggest problem with that in your case is, that these don't work under ground.

tough abyss
#

well i just want to have the 0,0,0 point of the mine model

#

that should be at the perfect surface height

#

and your explenation of getPos* doesn't explain why it grabs the wrong position, or i didn't understand it ๐Ÿ˜„

little eagle
#

If you want to get the ASL position not from z being the lowest point in the roadway LOD, but model center, then you can use getPosWorld.

tough abyss
#

hm that's worth a shot!

little eagle
#

PosWorld is basically a subset of ASL where you just use z from the model center instead.

#

But I doubt that the model center necessarily is at the terrain level for mines.

#

No idea though.

#

Never implemented a mine.

tough abyss
#

โค

#

works perfectly!

little eagle
#

Another mystery solved.

#

If only someone would solve my Arma problems.

crude plank
#

Cpp is the file name for c ++

little eagle
#

And it also is for Arma config files, which are not the same as C++ files.

crude plank
#

What

little eagle
#

There is no C++ in Arma, unless you make .dll's and .so's and use them via the callExtension command from SQF.

crude plank
#

That is c++

#

I looked at the code

#

Do you even know c++?

little eagle
#

There is not much you can do with those though since you can only pass strings and report strings via callExtension.

#

I'm learning it I guess.

crude plank
#

That is still c++

little eagle
#

What is?

tough abyss
#

are there any drawbacks using setPosWorld?

#

like it would be the most logical for me to just use it all the time now

little eagle
#

It's faster than ASL

jade abyss
#

world is faster.

tough abyss
#

i always think in this 0,0,0 position

little eagle
#

It's the simplest of all position commands.

crude plank
#

Cpp is thee fike exstenstion for c++ and the config.cpp is the same as c++ in the code

tough abyss
#

well bye bye ATL here you come World :3

jade abyss
#

@crude plank Forget everything you know about other Languages, when it comes to SQF.

crude plank
#

What?

#

Sqf?

#

Script config file?

compact galleon
#

Status Quo Function

little eagle
#

There are script files .sqf

#

And config files .cpp

#

No "script config files"

dry egret
#

ok need some help getting stuff to work on a dedicated server

#

trying to get the command setSlingLoad to work

#

using a trigger to call boatRelease.sqf

crude plank
#

I found the proof that "For those involved with computer programming, the concepts of classes, inheritance and overriding should be familiar. As implemented in the coding of the configuration files in VBS3 the structure is similar to that found in C++ but without multiple inheritances."

#

That was taken by bisimulation

#

Site

dry egret
#

sling_1 = ch1 setSlingLoad objNull;

dry egret
#

but the chopper is not detaching

compact galleon
#

@crude plank What's your point?

crude plank
#

Config.cpp is based on c++

compact galleon
#

No?

crude plank
#

Look at the website

jade abyss
#

Not here.

compact galleon
#

It's like saying a Boing 747 is based on a Ferrari, because they have similarities

little eagle
#

It is based on it I guess in that you can use the C++ syntax highlighting and everything will look right.

#

That's it.

crude plank
#

๐Ÿ˜‘

dusk sage
#

@crude plank Just because it uses somewhat similar syntax and style, does not make it C++. As for the extension, you could also rename a .txt file to .cpp, that doesn't make the text inside of it valid C++.

dry egret
#

im calling a script via a trigger on activation nul = [] execVM "spectre\intro\boatdrop.sqf"; inside that script im using

_sling_1 = ch1 setSlingLoad objNull;

but when on a dedicated server the chopper fails to detach the sling?

is this the propper way of going it on dedicated?
if (isServer) then {
_sling_1 = ch1 setSlingLoad objNull;
};

to get it to work?

compact galleon
#

@dry egret The wiki doesn't say what the behaviour is in multiplayer. Could be that the chopper has to be local, or both the chopper and cargo has to be local. I guess you'd have to experiment

dry egret
#

it works in hosted sessions just fine lol. i had the debug running on the server and tried it but it didnt work reguardless of what i executed it on. Thinkig im doing something wrong

compact galleon
#

@dry egret Works in hosted sessions?

dry egret
#

in the editor when running it from play from MP

#

thats a local hosted session

#

having issues when running this on the dedicated server exe

compact galleon
#

Then when doesn't it work?

dry egret
#

on the dedicated server

compact galleon
#

How is ch1 spawned?

dry egret
#

placed in editor at start

#

its named ch1

compact galleon
#

Who's piloting it?

dry egret
#

AI

#

players are in the cargo while the chopper has a boat sling loaded under it

compact galleon
#

Is it placed in the editor with AI in it?

dry egret
#

in the choppers init i use ch1 setSlingLoad boat_1;

#

yes

#

the players are riding in back

#

and the chopper is set on waypoints to the drop location

#

once it gets to the location players are transfered to the boats and the chopper unhooks from the boats

#

but on the dedicated the choppers will not release for some reason

compact galleon
#

Okay, I think I see the problem

#

When you host, are you placed as driver in the boat?

little eagle
#

๐Ÿฟ

dry egret
#

you get transfered to the boat and placed in cargo of the boat

#

then players can take the driver slot

compact galleon
#

What's your unhook code? verbatim

crude plank
#

Use waypoints

dry egret
#

sleep 3;
ch2 forcespeed 5;
sleep 0.5;
ch2 forcespeed 3;
sleep 0.5;
ch2 forcespeed 1;
ch1 flyinHeight 9;
ch2 flyinHeight 9;
sleep 8;
_sling_1 = ch1 setSlingLoad objNull;
sleep 0.35;
_sling_2 = ch2 setSlingLoad objNull;

sleep 0.3;
ch1 flyinHeight 15;
ch2 flyinHeight 15;

compact galleon
#

If people become driver before the server unhooks, the server might not be able to unhook the boat (granted the command demands locality)

#

@dry egret Where is that executed from?

dry egret
#

a trigger with 0 = [] execVM "dropBoat.sqf"

compact galleon
#

on act?

dry egret
#

yep nul = [] execVM "spectre\intro\boatdrop.sqf";

#

during the test the second boat didnt have anybody in it and it did not release either

compact galleon
#

Is it set to "Server Only"?

dry egret
#

the trigger... no

compact galleon
#

good

#

well, that's weird then

#

mind sending me the mission?

dry egret
#

sure

#

you want me to make one so you dont need the mods

plush cargo
#

When using if statements, and have a lot to check for , is there a limit to how many conditions I can/should put in one?

compact galleon
#

@plush cargo Not. But you might want to use lazy evaluation

plush cargo
#

Im not sure what that is :/

compact galleon
#

@plush cargo It's an optimization. If you do just if (alive enemy1 && alive enemy2) then it'll check if enemy2 is alive, even if the check for alive enemy1 failed. Which is unnecessary

#

If you do, if (alive enemy1 && {alive enemy2}) then, the alive enemy2 will not be evaluated if alive enemy1 returned false

dry egret
#

their is just the intro sequence i built

#

needs ace mod

compact galleon
#

Computational wise, the first is equivalent to sqf _alive1 = alive enemy1; _alive2 = alive enemy2; if (_alive1 && _alive2) then { };

And the second (lazy evaluation) is equivalent to

if (alive enemy1) then
{
    if (alive enemy2) then
    {
    };
};```
plush cargo
#

ahh ok cool

#

thought I was being slick getting all this shit to work in one statement lol

compact galleon
#

@dry egret What is it using from ACE?

plush cargo
#
            if     
                (((_boatMpIndex isEqualTo 1) &&
                ((_dirDiff >90)&&(_dirDiff <270))) 
            || 
                ((_boatMpIndex isEqualTo 0) && 
                ((_dirDiff < 270) && (_dirDiff >90)))) 
            then 
dry egret
#

right now nothing for that one but since i have it loaded it forces the mission to required addons

#

i use ace a lot in the full mission

compact galleon
#

@plush cargo Most other languages support lazy evaluation on "regular" && operations, etc. But SQF being a pure expression language, does not, and has to use code blocks

#

@plush cargo Yea, that'll evaluate everything, whether everything before it failed to return true, adding unneccessary overhead. And in most languages, that's not a problem since they support lazy evaluation just like that.

#

But if you put right hand side operands inside {}, you'll get lazy evaluation

#

I mean, unless you do some really computational expensive shit in them over and over, I wouldn't bother changing them to lazy

#

@dry egret If it doesn't actually use anything from ACE, I can just strip the requirement

#

@dry egret Hmm, can you resave the mission with "Binarize Mission File" unticked?

dry egret
#

yep

compact galleon
#

unless it'll allow me to load it without the addons, so I can resave it myself

#

hang no

plush cargo
#

there is a dock with a mem point in the water on each side, and each boat has a mem point on the sides of ship, it compares the distances and mem points to find the correct way to turn and park https://www.youtube.com/watch?v=_O1IdyLcuZo

#

so it only runs the if statement when player decides to tie up

compact galleon
#

@dry egret Nope, won't allow me to even load it

compact galleon
#

unless I can hack the binarized file

dry egret
#

thats one you change

compact galleon
#

thx

dry egret
#

np

#

not sure what i did wrong though in the scripts for it not to work. normaly i can get away with stuff by running things from triggers on dedicated but this has me stumped

#

even tried putting the if (isServer) {code} to see if that worked but it did not

#

maybe i need to call the script file via bis_fnc_mp?

compact galleon
#

@dry egret Should not matter

#

You're executing it in a trigger, which will execute it on all machines

#

if (isServer) would just ensure it only ran on the server

dry egret
#

it works in the editor and play testing by MP from editor but not dedicated...

#

im not great at arma scripting lol

compact galleon
#

hmm, you're right. it doesn't work

#

maybe the boat somehow switches ownership to the player on dedicated

#

Hang on

#

it even returns false

dry egret
#

?

compact galleon
#

What's the variable name of the boat?

dry egret
#

ab1

#

the chopper is ch1

compact galleon
#

I know

#

just needed the boat

dry egret
#

ahh ok

compact galleon
#

I have a feeling it may be broken altogether on dedicated

#

Because even if I empty the boat, it won't drop

#

I can't make it sling load another object either

nocturne iron
#

@dry egret this isn't relevant to getting your script to work but you should develop missions without ACE on and/or save your missions as unbinarized sqm's to save yourself a headache later when you forget it needs ACE or you need to remove the dependency

compact galleon
#

@dry egret How are you attaching the boats at the beginning, though?

#

That's using setSlingLoad too, isn't it?

dry egret
#

through the choppers init

#

yes

#

ch1 setSlingLoad ab1 from the choppers init

#

thanks for the tip @nocturne iron

compact galleon
#

I'll try something

dry egret
#

this issue and one other are the only ones i have left to solve for the mission lol

#

the other is just how to spawn vehicle on dedicated and set waypoint

nocturne iron
#

No worries

dry egret
#

i should be able to figure this stuff out but damn i feel stupid sometimes when it comes to coding in arma lol

nocturne iron
#

You'll lose many a project to mod deprecation so it's never a bad idea to ensure you can sub out mod objects

dry egret
#

i plan on just making missions that require my own mods in the future but having ace mod and alive are so much fun to work in

nocturne iron
#

awesome

#

what mods do you have at the moment?

dry egret
#

for this mission it runs on cba, ace, alive, eden_objects, plp containers, arp2.

nocturne iron
#

noice

dry egret
#

im working with the arp2 creator to get the mod fixed and to get the object configs up to current arma.

#

so no more laders\ out of scope lol

#

commy2 helped me a ton getting to the point ware i can bring items into arma from blender.

nocturne iron
#

Awesome

#

i just stick to eden and 'alright' texture jobs :p

dry egret
#

making a bunch of intel items you can place via eden so the players can place that eden placed object into inventory

compact galleon
#

@dry egret I tried changing the mission to never putting anyone in the boat, and it still doesn't work

#

The only conclusion I can draw, is that the command is broken on dedicated

dry egret
#

just my luck

compact galleon
#

I'll try making a completely empty mission with just loading and unloading the sling, and see if I can reproduce it

dry egret
#

maybe Dwarden can get it fixed if its broken

nocturne iron
#

If you do that, I might need to use your mod haha

dry egret
#

i made intel items like HDD that players can pick up off the ground

#

i just use a trigger to check if its in inventory at the end of the mission to see if the objective was completed

jade abyss
#
if("itemClassName" in magazines player)then{MyVar = true};```
dry egret
#

@compact galleon i dont see how the command is broken since people use slingLoad on dedicated servers all the time lol

jade abyss
#

+no need for a placed trigger.

dry egret
#

but i dont think anybody has tried to use it like i am lol

#

@jade abyss dont you need to run it from a trigger condition field so it constantly checks or runs the check at the end of the objective or mission

#

like having a sandbox type mission ala insurgency and bring item back to base and when in trigger zone complete objective?

jade abyss
#

Trigger -> Checking every 0.5s, is that rly needed?

#

If not ->

while{true}do
{
     sleep 5;
     if(MyVar)then{hint "end"};
};```
dry egret
#

hmmm

jade abyss
#

You wanna check if someone in an Area?
-> InArea

compact galleon
#

uh.. well, if he's using a trigger, it's probably because he's checking if they've reached the extraction point

jade abyss
compact galleon
#

then doing the check when it activates

jade abyss
#

Doesn't change the fact, that inArea would be better.

#

The Trigger still checks. No matter if someone is in the Zone or not.

#

Might not be a Prob with small/tiny missions, but still a bad habbit, wich shouldn't be done this way, especialy when someone is just learning ๐Ÿ˜‰

compact galleon
#

Triggers don't add anywhere near enough overhead to warrant writing a script instead everytime you want to check if someone's reached a point

dry egret
#

how do you format that code in discord?

compact galleon
#

@dry egret ```sqf
code```

#

` not '

dry egret
#

such fail lmao

compact galleon
#

and first line must be sqf

#

else, there'll be no highlighting

jade abyss
#

FUUUUUUUUUUUUUU DISCORD

#

wut

compact galleon
#

eeeh

jade abyss
#

fu discord

compact galleon
#

@dry egret You can also use a single ` for single line code like `code here`

jade abyss
#

code here

dry egret
#

aghhh just give me html lol

#

hate markdown

thin pine
#

markdown ftw

dry egret
#

can never get markdown to ever work

thin pine
#

i actually prefer bbcode but thats kinda goin offtopic

compact galleon
#

@dry egret It's still `, not ' or ยด

thin pine
#

do ``` not '''

compact galleon
#

On Nordic keyboards, it's Shift + |

thin pine
#

on US layout keyboards its the button above tab (tilde/grave key)

jade abyss
#

ew, who is using US layout?

thin pine
#

hator

jade abyss
#

I mean... they switch Y and Z

#

That can't be good

#

๐Ÿ˜„

dry egret
#

it the damn tilda key lol

thin pine
#

US layout can be qwerty?? what you on about

dry egret
#
if (isServer) then {
endTimeVar = false;
    extractChopper_1 = [[getMarkerPos "extractionSpawn_1" select 0, getMarkerPos "extractionSpawn_1" select 1], 0, "B_Heli_Transport_03_F", WEST] call Bis_fnc_spawnvehicle;
    Raider_1 = extractChopper_1 select 2;
    RaiderChopper_1 = extractChopper_1 select 0;


//Extraction Waypoints

    _wp = Raider_1 addWaypoint [wp_POS, 0];
    _wp setWaypointType 'MOVE';
    _wp setWaypointSpeed "FULL";

    _wp1 = Raider_1 addWaypoint [position ab1, 1];
    [Raider_1, 2] waypointAttachVehicle vehicle ab1;
    _wp1 setWaypointType 'MOVE';
    _wp1 setWaypointSpeed "FULL";

};
compact galleon
#

Isn't US always QWERTY?

dry egret
#

\0/

compact galleon
#

Only german is QWERTZ

thin pine
#

only ze deutsch use qwertz amirite

compact galleon
thin pine
#

btw Spiegel, is that code just for testing or do u need halp?

dry egret
#

thats my second issue

jade abyss
#

qwertz = Best

dry egret
#

getting createVehicle to work on dedicated

thin pine
#

I liked you Dscha....but now...

jade abyss
#

๐Ÿ˜‰

dry egret
#

lol

compact galleon
#

only thing worse than QWERTZ is french AWERTY

thin pine
#

monsieur Spiegel, I assume le functione BIS_fnc_spawnVehicle ist global jaja, so what seems to be the problem? does it not spawn?

compact galleon
#

A and Q switched. W and Z switched. And M is right of L

dry egret
#

doesnt spawn the chopper

compact galleon
jade abyss
#

Oh, baguette baguette.

#

Le Frog omelett de fromage

thin pine
#

does it spawn ze choppah in SP monsieur Spiegel

jade abyss
#

*madame

thin pine
#

c'est une madame? excusez moi

jade abyss
#

Gesundheit

thin pine
#

danke

jade abyss
#

btw. n8 ^^

dry egret
#

no on dedicated

thin pine
#

gn8

jade abyss
#

o7

thin pine
#

have you tested it on SP tho Spiegel

dry egret
#

works great in SP

#

just need a verson of it to work on dedicated

#

< bi wiki new homepage

thin pine
#

when you test it on ze dedi, where are you executing this code? in a trigger?

dry egret
#

trigger

#

think i may be using the wrong command for MP on dedicated

thin pine
#

isServer returns true on dedicated servers as well

#

you could explicitly target the dedi by doing: isDedicated but there's no real difference

#

what is the trigger condition btw?

dry egret
#

when bluefore present

thin pine
#

I'll have a test on my dedi - the thought of bis_fnc_spawnVehicle not working on a dedicated server seems very odd

dry egret
#

i think its me that the issue lol

compact galleon
#

@dry egret Alright, I've confirmed that setSlingLoad is indeed broken on dedicated. I made a very simple mission with a player on the ground, an AI controlled helicopter in the air, and an empty boat. And then on init, the server calls setSlingLoad to attach it, which works. But it cannot detach it

#

Uuuhhh

#

Nevermind

#

Typo

dry egret
#

?

#

if you get it to work can you send me the file

compact galleon
#

I'm testing on an empty mission

#

but it's working

#

I was just mistyping a var

dry egret
#

on dedicated?

compact galleon
#

yesd

#

But let me test a theory

dry egret
#

please send me that file

#

i may be doing something wrong

#

i may be able to adapt it for my mission or tract whats causing it to not work

compact galleon
#

Well, I tried spamming setSlingLoad objNull in the console in your mission, and nothing

#

There we go

#

My theory was right

dry egret
#

whats that

compact galleon
#

You need to make sure only the server attaches it

#

if you let it run on everyone's machines, it becomes undetachable

#

eg.

#

Undetachable: 0 = chopper setSlingLoad boat
Detachable: if (isServer) then { chopper setSlingLoad boat }

#

The problem lies in the attachment, not detachment

dry egret
#

so if i put that in my init.sqf and then call the detach the way i was it will work?

compact galleon
#

If you just change how you ATTACH, to just do it on the server, it should work fine

dry egret
#

ill give it a go

#

kinda of a nice way to start a mission no?

compact galleon
#

@dry egret Well, it's not original ๐Ÿ˜›

thin pine
#

Spiegel, I tested your isServer code on my dedi. I however used the debug console to execute the code on the server. The chopper spawned all nice n dandy

dry egret
#

i have not seen anyone do it for a coop mission before lol

thin pine
#

I recommend going over your trigger again making sure it'll get triggered on the server.

dry egret
#

should i set the trigger to server only then

compact galleon
#

@dry egret Just tested on your mission. Still fails..

#

hmpf

#

nvm

#

I actually made a mistake. Let me test again

dry egret
#

ok

vital onyx
#

@compact galleon there is more neat lazy evaluation syntax

if ( (_cond1) && {_cond2}) then {};

_cond2 is not evluated, if _cond1 returns false

compact galleon
#

@vital onyx Huh? That's exactly what I posted

dry egret
#

@compact galleon
if (isServer) then { sling_1 = ch1 setSlingLoad ab1; }

is this how your attaching

compact galleon
#

yup and now it works

vital onyx
#

@compact galleon no
if you use bool && bool both expressions are evaluated

compact galleon
#

@vital onyx That's what I said...

vital onyx
#

but if you use bool && {code} - this is classic lazy eval

compact galleon
#

you need to do bool&&{bool} to get lazy

#

I said: "MulleDK19 - Today at 12:07 AM
@plush cargo It's an optimization. If you do just if (alive enemy1 && alive enemy2) then it'll check if enemy2 is alive, even if the check for alive enemy1 failed. Which is unnecessary(edited)
If you do, if (alive enemy1 && {alive enemy2}) then, the alive enemy2 will not be evaluated if alive enemy1 returned false"

queen cargo
#

technically ...
bool && { bool && { bool && { bool } } }

vital onyx
#

alive enemy2 returns bool, not code

#

is it not a lazy computation

compact galleon
#

THAT'S WHAT I'M SAYING

#

READ

vital onyx
#

earlier you have posted nested if

compact galleon
#

Last paragraph of my quote

#

@vital onyx That was to explain what it is equivalent to

#

lazy evaluation

vital onyx
#

then make it clear with proper code highlight

compact galleon
#

It was clear to everyone else

vital onyx
#

now I see what you meant, but that was hard to read :)

dry egret
#

@compact galleon thank you so much... its WORKS ๐Ÿ˜‚

vital onyx
#

please do not consider it as an offense, very tired to make a cluster of Arma 3 servers coding

dry egret
#

@thin pine im calling the script via trigger onActivation

cutSceneExtractSeq = [] execVM "scripts\cutSceneExtraction.sqf";
#
extractChopper_1 = [];


if (isServer) then {
endTimeVar = false;
    extractChopper_1 = [[getMarkerPos "extractionSpawn_1" select 0, getMarkerPos "extractionSpawn_1" select 1], 0, "B_Heli_Transport_03_F", WEST] call Bis_fnc_spawnvehicle;
    Raider_1 = extractChopper_1 select 2;
    RaiderChopper_1 = extractChopper_1 select 0;


//Extraction Waypoints

    _wp = Raider_1 addWaypoint [wp_POS, 0];
    _wp setWaypointType 'MOVE';
    _wp setWaypointSpeed "FULL";

    _wp1 = Raider_1 addWaypoint [position ab1, 1];
    [Raider_1, 2] waypointAttachVehicle vehicle ab1;
    _wp1 setWaypointType 'MOVE';
    _wp1 setWaypointSpeed "FULL";

};
thin pine
#

oh so its an execVM huh

dry egret
#

yeah, it hadels all of the code for the cutscene

#

im guessing this is not the correct way of doing it

thin pine
#

are you sure wp_pos and ab1 variables are defined? Make sure there arent any errors, check the server log

dry egret
#

yes

#

they are the boats and a invisable helipad in the map

thin pine
#

also its a better habit to first check if(isServer) and then { execVM } - that saves clients from having to preprocess compile and call the sqf file. (Not that it's very intensive in this case, but its a good habit)

#

double check for errors. I'd also recommend debugging your code by adding diag_logs

#

both in the trigger activation (if possible) and in the sqf to see where the code may possibly end - or to see if the activation code is triggered at all

#

diag_log output is readable in the .rpt file as you may know

#

im off to bed, best of luck ^^

compact galleon
dry egret
#

is it really a but or just me being bad at arma coding lol

compact galleon
#

It's a bug

dry egret
#

ahh ok

compact galleon
#

And only on dedicated servers

dry egret
#

@compact galleon you mind helping me with the spawn vehicle problem if you have time?

compact galleon
#

@dry egret I'd just use the createVehicle and createVehicleCrew commands

plush cargo
#

@compact galleon rewriting rn thanks for the help!

dry egret
#

stupid question, when creating a group inside if (isServer)

whats the difference between _crew1 = createGroup west; and crew1 = createGroup west;

#

im looking at what the _ serves since its a local variable

opaque topaz
#

_ would make the variable local to the scope

dry egret
#

oh so it would be local to only the server then

opaque topaz
#

No to the scope

#

If you want a variable local to the server create a global variable on the server

dry egret
#

meaning only accessable by server

opaque topaz
#

Yes

plucky beacon
#

is there a way to make a diffrent 3rd person camera without using an addon

#

i.e. some way of making a camera but retaining control of the unit

compact galleon
#

@dry egret _crew1 is a local variable, crew1 is a global variable

#

crew1 will be accessable from everywhere, eg. in other scripts, after the point it's been initialized

#

_crew1 is only available to the scope itself, and any child scopes

#
if (alive player) then
{
    _bla = "Hello World";
    hint _bla;
    // _bla runs out of scope here.
};

hint _bla; // Error. _bla not defined.```
#
_bla = nil; // _bla declared here, available to this scope and child scopes.
if (alive player) then
{
    _bla = "Hello World";
    hint _bla;
};

hint _bla; // undefined if player was dead.
// _bla runs out of scope here.```
dry egret
#

ahh ok

#

so since i want to create a vehicle on the server and attach a camera to it later on in the script i need it to be global since the vehicle is actualy created from inside isServer {scope}

#

or make a global variable that stores is say raiderChopper = _chopperFrame

#

they way i have something i can talk to?

plucky beacon
#

Almost sounded like what I asked about

dry egret
#

what im doing is creating a chopper on a dedicated server and making a camera attached to it for cenematics

#

i think the choppers has been created correctly this whole time but i think what was heppening is the camera is not being created correctly

#
_Raider_1 = [];
_extractChopper_1 = [];

if (isServer) then {
    _Raider_1 = createGroup WEST;
    _extractChopper_1 = [getMarkerPos "extractionSpawn_1", 0, "B_Heli_Transport_03_F", _Raider_1] call BIS_fnc_spawnVehicle;


//Extraction Waypoints

    _wp = _Raider_1 addWaypoint [wp_POS, 0];
    _wp setWaypointType 'MOVE';
    _wp setWaypointSpeed "FULL";

    _wp1 = _Raider_1 addWaypoint [position ab1, 1];
    [_Raider_1, 2] waypointAttachVehicle vehicle ab1;
    _wp1 setWaypointType 'MOVE';
    _wp1 setWaypointSpeed "FULL";

};

revised code

#

i think what i need to do to get the cenematics to work is create the camera on the server as well since i originaly had it outside of the isServer code block

compact galleon
#

@dry egret You only need it to be global if you need to access it from a different script

dry egret
#

hmm

#

about to test it on a dedicated to see if the chooper spawns

compact galleon
#

Eg. the names you give vehicles and units are global variables that you can access from anywhere

dry egret
#

well i know the chopper spawns now lol

plush cargo
#
        /*
            Author: Soolie
            Description: Returns closest/furthest memory point, distance from object and world location
            Paramaters: [Object,[Target Object,Array of Memory Points],Bool - True for closest, false for furthest]
            Returns: [Memory Point name, Distance from Object, Memory point world location]
            Example: [player,[Car1,["wheel_1_1","wheel_1_2","wheel_1_3","wheel_1_4"]],true] call fnc_GetMpInfo;
        */
        
        fnc_GetMpInfo = 
        {
            params ["_obj1","_target","_closest","_num"];
            _target params ["_obj2","_memPts"];
            _mpNames = [];
            _mPDist = [];            
            _mpPos = [];
            _objPos = getPos _obj2;
            {
                _objMpPos = _obj2 selectionPosition _x; 
                _mpWorldPos = _obj2 modelToWorld _objMpPos;
                _mpNames pushBack _x;
                _mpDist pushBack (_mpWorldPos distance _obj1);
                _mpPos pushBack _mpWorldPos;
            }forEach _memPts;
            if (_closest) then 
            {
                _num = _mpDist call BIS_fnc_lowestNum;
            }else
            {
                _num = _mpDist call BIS_fnc_greatestNum;
            };            
            _index = _mpDist find _num;
            _return = [(_mpNames select _index),(_mpDist select _index),(_mpPos select _index)];
            _return
        };
#

working great wondering about optimization