#arma3_scripting

1 messages · Page 579 of 1

surreal peak
#

read the documentation I linked above

#

if u want the exact preset, look into the ace3 PBOs

#

should be somewhere in there

jaunty shadow
#

We have been going over that. We can get the preset to run in game just fine. by using that Chat command.

surreal peak
#

ohhhhhhh

#

remoteExec should be able to call it

#

in init.sqsf

polar anchor
#

@still forum oh okk! ty! and what about _this select index? why u said no to that one as well? is it bad to use for parameters?

hallow mortar
#

You're stuck on trying to use the chat command to do it. But if you want to do it automatically as part of the mission, you should use the "via code" (acex_fortify_fnc_registerObjects) method described in that documentation. You probably can somehow get the chat command to run automatically, but that's not the smart way to do it.

#

In init.sqf, put your register command (based on the example provided in the documentation) inside if isServer then { yourcodehere };

jaunty shadow
#

Ok, so I'd place that in Init.sqf, and then include my item array code in those brackets

hallow mortar
#

That is what I said, yes

#

Make sure your item array code is correctly formatted based on the documentation for the acex_fortify_fnc_registerObjects method.

winter rose
#

@polar anchor _this select x is obsolete;
params does everything for you: selection, using private, even filtering the data type if you want.

jaunty shadow
#

So for the examples in their framework it should look like this?
if isServer then { [west, 5000, [["Land_BagFence_Long_F", 5], ["Land_BagBunker_Small_F", 50]]] call acex_fortify_fnc_registerObjects };

#

And we would just replace or add item classNames for each item we want to add or replace, correct?

hallow mortar
#

That is what I, and the documentation, said, yes

#

as described in the documentation, the number after each item classname is the cost within the ACE Fortify budget system, and the number after west is the total budget available, and west is the side for which the object list is being registered

jaunty shadow
#

Yeah, we get the parameter coding. We're just trying to muddle through it.
So, complete code would look like this, placed in an Init.sqf?

if isServer then { [west, -1, [["Land_BagFence_Round_F", 5],
["Land_BagFence_Short_F", 5],
["Land_BagFence_Long_F", 10],
["Land_Plank_01_4m_F", 10],
["Land_BagBunker_Small_F", 25],
["Land_HBarrierTower_F", 100],
["Land_HBarrierWall4_F", 25],
["Land_HBarrierWall_corner_F", 25],
["Land_HBarrier_1_F", 5]]]
call acex_fortify_fnc_registerObjects };

winter rose
#
if (isServer) then
{
  [
    west,
    -1,
    [
      ["Land_BagFence_Round_F", 5],
      ["Land_BagFence_Short_F", 5],
      ["Land_BagFence_Long_F", 10],
      ["Land_Plank_01_4m_F", 10],
      ["Land_BagBunker_Small_F", 25],
      ["Land_HBarrierTower_F", 100],
      ["Land_HBarrierWall4_F", 25],
      ["Land_HBarrierWall_corner_F", 25],
      ["Land_HBarrier_1_F", 5]
    ]
  ] call acex_fortify_fnc_registerObjects
};
#

(formatting only, I don't know anything about ACE)

jaunty shadow
#

Thank you sir. I'll try that instead

still forum
#

@jaunty shadow don't try to use the chat commands, serverCommand doesn't work. Call the scripts that the commands are calling directly

#

@polar anchor

why u said no to that one as well? is it bad to use for parameters?
It just doesn't make sense as it does the same as params, in longer, slower, harder to read

polar anchor
#

thanks @still forum and @winter rose for all this infos 🙂

hallow mortar
#

Are you sure you want to use -1 in the budget parameter? @jaunty shadow If that's the "infinite budget" number then OK, but it's not described on the wiki so I would not assume it'll work if you don't know.

jaunty shadow
#

I am pretty sure that's the infinite number.

hallow mortar
#

try it and find out I guess

jaunty shadow
#

Hmm missing semicolon somewhere it tells me.

winter rose
#

then change something somewhere 🙃

hallow mortar
#

usually the error message tells you approximately where the semicolon is missing

#

I suspect it's after fnc_registerObjects, but I'm not sure. Just put semicolons in likely spots until you get the right one.

mortal wigeon
#

Is there a faster way to add something to the start of an array than reversing it, appending it, and reversing it again?

winter rose
#

yes, _newArray = [newElement] + _oldArray; ^^

#

(or using pushBack of course)

mortal wigeon
#

so for example private _newJarvis = [_rFirst, 0, 0] pushBack _jarvisArray;

winter rose
#

yup

mortal wigeon
#

cool. I was hoping for something that didn't need copying the array

#

like append but for the front

winter rose
#

wait, pushBack returns a number

#

there is a deleteAt, but not an insertAt
let's see if there is a function though

#

@mortal wigeon ^

mortal wigeon
#

I see Killzone Kid has a function he says is much faster than that

#
KK_fnc_insert = {
    private ["_arr", "_i", "_res"];
    _arr = _this select 0;
    _i = _this select 2;
    _res = [];
    _res append (_arr select [0, _i]);
    _res append (_this select 1);
    _res append (_arr select [_i, count _arr - _i]);
    _res
};

// Example
arr = [1,2,3,4];
[arr, ["a","b"], 2] call KK_fnc_insert; //[1,2,"a","b",3,4]
still forum
#

much faster

private []
HAH

#

Killzone Kid has a function he says is much faster than that
Killzone Kid is a developer, who can just edit the BIS functions, I doubt that he wouldn't fix the main game function but instead make a faster version and publish it somewhere where only few people see it.

#

Also that script there is very clearly outdated

mortal wigeon
#

so it's not faster?

winter rose
#

maybe the BIS function has been updated since, yes

#

at the time it was posted it may have been faster, but (most likely) not anymore
anyway, is (high) performance important, is it a frequent operation you do?

mortal wigeon
#

yes

winter rose
#

the benchmark button (bottom left of the debug console) it is then

still forum
#

I told KK

#

if the BIS functions aren't fixed yet they will be

mortal wigeon
#

Can anyone explain what I'm doing wrong?

Running this:

_array1 = [ [d,e,f], [g,h,i], [j,k,l] ];

_array2 = [a,b,c];

[_array1, [_array2], 0] call BIS_fnc_arrayInsert;

Returns this:

[[any,any,any],[any,any,any],[any,any,any],[any,any,any]]
still forum
#

yeah well your variables are undefined

#

what else did you expect?

mortal wigeon
#

@still forum do you want people to ask for help or not? You're free to simply not reply. Why are my variables undefined?

still forum
#

Well I assume your variables are undefined because you never defined them

#

Your code is doing exactly what you wrote

#

what did you expect if the result you got wasn't it?

mortal wigeon
#

Cool I'll ask for help somewhere else

still forum
#

Can't help if you don't tell me what I need to know to be able to help ¯_(ツ)_/¯

somber shuttle
#

@mortal wigeon your array elements are undefined. you'll need to declare them elsewhere in your script.

mortal wigeon
#

@somber shuttle oooohhhh got it duh thank you

hallow mortar
#

@jaunty shadow Lou didn't provide any new code. That was just tidying up the formatting on your existing code to make it readable on Discord. As for why it doesn't work...I mean...does it give any error messages? Anything? What does happen?

jaunty shadow
#

Yes. I get that. I was just letting him know it worked for me in one instance and not the other.
It's a step in the right direction and I appreciate the help.

In editor when I go to play>mp Fortify works fine and the array of items available is correct.

When exported and run on a dedicated server, Fortify just doesn't init it seems.

hallow mortar
#

Perhaps the "MUST BE CALLED ON SERVER" note in the documentation means it needs to be called on the server and clients. Try it without if isServer { };

still forum
#

no

#

server only

#

it does public variable internally

#

plus it has a if (!isServer) exitWith {}; in the first line

jaunty shadow
#

So I need that if (!isServer) exitWith {}; in my code instead?

hallow mortar
#

No, you do not.

still forum
#

you don't need any isServer check

hallow mortar
#

That is something that is in the function your code calls

still forum
#

but doesn't explain why it doesn't work

jaunty shadow
#

Ok. I'll try it without the IsServer line and see what happens

hallow mortar
#

You should check whether your dedicated server has ACE set up correctly, and is in fact using a mission with the Fortify module in it.

still forum
#

I'll try it without the IsServer line and see what happens
shouldn't make a diff

jaunty shadow
#

We verified that first. ACE is running no problem, Fortify module is placed.

#

We can run it with the Description.ext method fine. It all works using that.
The Code version that lets us bypass the Admin command is giving us fits.

hallow mortar
#

Yes, we know. No one thinks there's a problem with the description.ext/admin command method. (Other than that it can't be automated)

winter rose
#

are you sure that… your init.sqf is not indeed a init.sqf.txt?

hallow mortar
#

Would that work in local testing? The problem seems to be somewhere in the move from local to dedicated, I think if it was .txt it would break in local too

winter rose
#

oh true, it works at one point.

#

unless it is put somewhere else in the mission and doesn't run on the server 😄
at this point, I don't know (and I don't know ACE functions so *shrugging intensifies*)

jaunty shadow
#

Meh, we'll figure it out down the line.

winter rose
#

try a fresh new mission to narrow it down, if this is not the case already

modest parcel
#

Hey, wondering if anyone can help me turn the following contents of a initPlayerServer.sqf file to an Add Action, I want to run the script on player demand, not on player connection. The contents of the file is:

_thisPlayer = _this select 0;
[_thisPlayer]execVM "scripts\UTFN\fn_Server_getUnit.sqf";
still forum
#

you cannot addAction in initPlayerServer.sqf, its serverside, actions are clientside only

#

you want initPlayerLocal

#

with
player addAction ["look at me! I'm flying!!!", "scripts\UTFN\fn_Server_getUnit.sqf"];

modest parcel
#

Thank you @still forum I'll test it now.

#

@still forum can said add action be applied to an object?

still forum
#

yes

#

give it a variable name in editor

#

and replace player with that

modest parcel
#

Awesome, I'll try it now

#

Thank you

still forum
#

Why don't you try later?
Lean back and chill out and savor the moment for a second

modest parcel
#

I'm in the zone haha

#

Appears on the box, doesn't appear to trigger any action

still forum
#

😢

#

well its not passing _thisPlayer to the function

#

do you need that?

modest parcel
#

yes, it basically passes it to a database query

still forum
#

as player is always player anyway

robust hollow
#

it is meant to run that script on the server?

still forum
#

so does it need to run on the server?

modest parcel
#

Yeah it does

#

Do you want me to post the file?

still forum
#

player addAction ["look at me! I'm flying!!!", {[player, "scripts\UTFN\fn_Server_getUnit.sqf"] remoteExec ["execVM", 2]}];

#

works if you use params to get the parameters

#

which you should anyway always do so I'm not gonna even assume nor offer you solutions for the case that you're not

modest parcel
#

Giving this one a go, pretty sure I'm using params

#

So this one does something, throws an error of

  Error select: Type Object, expected Array,String,Config entry
File mpmissions\__cur_mp.VR\scripts\UTFN\fn_Server_getUnit.sqf..., line 6
Error: Object(4 : 3) not found

Line 6 being

_Player = _this select 0;
robust hollow
#

params ["_player"];

#

use that instead

modest parcel
#

In place of _Player on line 6?

robust hollow
#

in place of _Player = _this select 0;

modest parcel
#

I'll give it a shot, thanks @robust hollow - sorry if a bit clueless - first time looking at SQF yesterday

#

That one returns the same error as above

robust hollow
#

paste error

#

shouldnt be exactly the same

modest parcel
#
File mpmissions\__cur_mp.VR\scripts\UTFN\fn_Server_getUnit.sqf..., line 6
Error: Object(4 : 3) not found
#

I'll try again just to double check

robust hollow
#

u still using select

modest parcel
#

I think I forgot to pack the file, running it again.

#

Nope that does indeed work @robust hollow @still forum many thanks. Really helpful.

still forum
#

wup wup wup

formal moth
#

I am having a problem with a script I am calling from a addon not fully executing, essentially when it hits a 'if' it kicks out and stops executing. Has anyone experienced this or know where I can start to figure out this problem?

#

it also does not display any errors as if it just gives up

#

I tested adding more lines to execute before different ifs and moving stuff around and it seems to only be if statements alone

verbal saddle
#

What are your if statements?

formal moth
#

//stuff here

};```
#

very simple things like that really

#

I added systemChats around everything and it neither finishes the script as in it stops running at the if and checked to see if the bool was true and it was

verbal saddle
#

have you made sure your if statement conditions are true?

formal moth
#

Yea

#

I can send the full sqf if it were to help

robust hollow
#

it would

formal moth
#

one sec

#

huh, it won't let me upload the script even in parts lol

#

even copy and pasting it seems to kick back one second

#

there we go

robust hollow
#

shouldnt paste entire scripts in the chat. use pastebin or something similar

formal moth
#

gotcha one sec my bad

#

There we go

#

I call this from a addon using a EH on a unit

#
            Respawn = "_this spawn compile preprocessFileLineNumbers 'AV_Pack\Scripts\InitLibrarian.sqf';";
        };```
verbal saddle
#

Specifically Attributes are available only within the Eden Editor workspace. You cannot access them in scenario preview or exported scenario!

formal moth
#

Lemme try removing them and if it gets past the first if then

verbal saddle
#

And because you use those as conditions for your if statements it would stop them from running

#

If it did work then you would run into a syntax error because get3DENAttribute returns an array. If statements cannot have an array as their condition.

formal moth
#

Yea I removed them and changed the _canCast bools to directly true and the first if hasInterface doesn't even evaluate. Out of all those systemChats the only one that prints is the first one.

verbal saddle
#

Do you get Exited Librarian Init Script?

formal moth
#

No

#

Which is why I believe it to be killing off the execution

crimson birch
#

Hey guys

#

I have dabbled in coding but Ive never modded any game

#

I was thinking about a dodge mod

#

When you get shot, your stamina is drained a certain amount, should you not have enough stamina, the shot will deal damage

#

so it acts like regen health

#

how hard would this be to code?

robust hollow
#

sounds straight forward. would probably only need the get/setfatigue script commands in a handledamage event. (along with ur conditons and whatever)

unreal scroll
#

What EH I can use to track unit incapacitated status (without ACE)?

bright flume
#

o.O

hallow mortar
#

I don't think there's a specific EH for it, but you could probably use a dammaged EH and use the lifeState command to check if the unit became incapacitated as a result

bright flume
unreal scroll
#

Thanks guys. I think there is no sense in making scripted EH, it should be called by script in any case.
Will try to make MPHit EH.

bright flume
#

well not exactly sure what you need as a trigger for said EH... knowing that will help.

ebon ridge
#
onLoad = "uiNamespace setVariable ['vin_loadingScreen', _this select 0]";
onUnload = "uiNamespace setVariable ['vin_loadingScreen', displayNull]";

Somehow when I read this value in sqf I get type error, and somehow it is controlNull instead of displayNull?

private _display = uiNamespace getVariable ["vin_loadingScreen", displayNull];
if(!(_display isEqualTo displayNull)) then {
  (_display displayCtrl 101) ctrlSetText _message;
};
#

"Exception has occurred.
displayctrl: Type Control, expected Display (dialog)"

robust hollow
#

is that onload event on a control instead of a display? or, does a control also set to that variable?

ebon ridge
#

yeah, actually i just realized I think I am making a group control not a screen, sorry!

torn coral
#

Hello, I am currently trying to install infistar to my server but it won't work at all any advice would be great

cosmic lichen
#

Can anyone think of a reason why diag_log doesn't work for me anymore on dev branch?

#

Nevermind. No logs was enabled for some reason

young current
#

@torn coral you probably should contact infistar support for that. It is external unofficial program.

tough abyss
#

Hey guys, im doing a project with the arsenal and im trying to get every image, ingame class name/id and weight and few other things of every item in the arsenal , do you know if there is a way do to it? maybe if arsenal items are saved in some file so i can get it from there?

spark rose
#

So, I assume someone has already done this - I want to have a spawn point follow the squad. IE if player_1 is dead, it moves to player_2, and so on. if all players are dead the spawn point does not exist.

young current
#

@tough abyss what do you need those for? Where do you intend to use them?

wispy cave
#

With ace is there a way to log what medical actions someone did?

tough abyss
#

@young current the goal for my clan is to use those "values" in our website in a way that every role/ duty in missions will have loadouts that when you log into the server your automaticly get the loadouts you need for you role in the mission

late hawk
#

So I have a question regarding a mod I was working on: If I want to give the bagpacks of disassembled guns (e.g. the vanilla mortar) a different skin, it works perfectly fine by creating a new backpack based on the original class and just overwriting the hiddenSelectionsTextures. Then I can just use the regular assembly function and the normal turret is being spawned/created. BUT: When I disassemble it, it spawns the gun in the original vanilla bags. Can I add an addAction or something like that to the vanilla objects (the HMG for example), which goes like "disassemble to <CustomBagName> [...]"? Is there an easy way to add an action to a gun turret, when it's being assembled?

Note: since it's vanilla, I obiously can't change the gun itself. Ideally as a mod, since I want to do it for the unit I am a part of.

#

I would think, that those addActions usually belong into the init.sqf, but since I can't edit it (vanilla - duh...), I need to solve this mystery differently.

young current
#

I think you may need to create custom guns too that use those custom bags.

tough abyss
#

are you answering to chaser?

young current
#

Yes

tough abyss
#

ok

young current
#

For you I don't quit have an answer.

#

Since you want to put that data outside of Arma you need to collect it from the configs somehow

late hawk
#

@young current I hoped to avoid that, because I have to copy quite a bit of code 😦 is there no way to abuse an eventhandler or sth like that, which listens to createVehicle commands?

young current
#

Don't know. But inheriting a class is like 2 lines

#

And then you add you changes

tough abyss
#

@young current i know, but what im asking here is if someone know where this data might be? like in which files

late hawk
#

alright, cheers! I'll look into that, then

young current
#

If you unpack the configs properly then in the config.cpp files in each pbo respective folder

#

Or you can try the all in one config dump. Since you want ace stuff you may need a custom dump with ace loaded

tough abyss
#

weight is ace?

#

or vanilla

young current
#

Possibly. Don't remember off the top of my head

#

If you want simple approach, just make gear collections/loadouts ready in game that your players can choose from

tough abyss
#

If you unpack the configs properly then in the config.cpp files in each pbo respective folder
@young current what is pbo folder, and what do you mean unpack the configs?

young current
#

I think you have a weekend of googling ahead of you.

tough abyss
#

i bet, i dont know anything about that stuff and i never had any work with arma before

#

its gonna be Big OOF time

#

@young current can you help me in understanding what i need to google about to understand where i can find this config.cpp?

winter rose
#

@spark rose set the waypoint on leader group _playersGroup? else cycle through all the units and stop at the first alive one

echo smelt
#

How do I change how much storage is in a vehicle?

#

Virtual Storage

winter rose
#

in Eden Editor properties iirc, there is a "Virtual" tab

echo smelt
#

And if I put this to a server through eden will it stay?

#

For example when you buy it through a shop will it have that amount?

#

For example in an Altis Life server how would I add more virtual storage?

winter rose
#

go to the L*fe Discord Server to talk about L*fe scripting, you will have a better chance to have a precise answer
(see #channel_invites_list)

west grove
#

hm. i have some issues with saved variables. i am saving stuff in mission 1, then i go to mission 2 and everything works. BUT if i am in mission 2, save, leave the campaign, and in the main menu then revert to mission 2, suddenly the game seems to have forgotten the saved variables ... is there anything i can do here?

#

actually the mein menu thing isnt even necessary. it's enough to just revert the current mission

#

saving and reloading the savegame is ok. it's really just completely reverting the current mission that seems to cause this

#

heh, ok i know why

#

or actually i dont

#

so i've added some debug messages ... and they tell me that the variable content is still correct.

#

yup ... seems the code is running too early. i've moved it into a new [] spawn and added a sleep 1; before running it and now reverting the mission will not break it anymore

#

thanks for the help, folks :>

winter rose
#

you're welcome! anytime

winter rose
#

@west grove you did use saveVar I believe?

west grove
#

yup

winter rose
#

since there is no "getVar" (and given the last time I used these was in OFP), this is a global variable that is automatically set on next mission's namespace, right?

west grove
#

wiki says it is saved in campaign space

winter rose
#

(even campaign's namespace iirc, so you had to use a numbered var so you don't load mission 1 and get the mission 7 var)

west grove
#

that's not the case now

#

at least as far as i am aware

winter rose
#

I may add a note to the page if it is still the case; would you mind to give it a try? like saveVar "varMission7" and try to load it in mission 1 ?

west grove
#

i dont really have a setup like that in my campaign

#

but i can tell you that persistency seems to hold up from mission to mission

#

even if i revert to an older mission now, it will behave correctly

winter rose
#

^ yes! the revert was the issue with one campaign i played: I got badly hurt at the end of mission 2, started mission 3 pretty hurt, I said let's revert… started mission 2 injured

west grove
#

something like this happened to me when i used it wrong

#

i saved the variable in some other name space

#

i think it was profile namespace, because i didnt know better

winter rose
#

ah, yes indeed 😅

#

there was no access to profileNamespace in OFP:R
with a bit of luck they fixed this saveVar variable "descending" to the next mission
if not, I should try and document that

smoky verge
#

is there a way to make a script so you can't remove or exchange gear?
tried with an open inventory eventhandler but its not very reactive

winter rose
#

you would still be able to "refill ammo", too

smoky verge
#

yeah
so what I've done so far is
found a way to remove corpses in a creative way
and trying to make a Keydown eventhandler to close the inventory if someone presses "I"

winter rose
#

what is going wrong then?

smoky verge
#

oh I had this idea after I asked
not even sure if it works

winter rose
#

it would

#

coupled with the inventory EH too

smoky verge
#

figured one would made the other redundant

winter rose
#

nope as you could still open a subordinate's inventory (if any)
better have belt and garters? :p

smoky verge
#

luckly there are no sub inventories in the mission if I remove bodies

winter rose
#

subordinates imply group members, not corpses 😄

smoky verge
#

there are not backpacks either

#

unless there is an hidden button to check in your homies cheeks

winter rose
#

B 👀

#

now that doesn't help me, I am looking for a nice motivating idea in order to use some nice effects like conversations, ppEffects, noice scripting, ambience…

I can't find the perfect idea 😢

smoky verge
#

what are you trying to do?

winter rose
#

some kind of "showcase", of I don't know what it could be!

#

I am okay with scripting one stuff as a Proof of Concept, but making one full interesting story is another (story)

smoky verge
#

lol I have the exact opposite problem
have a ton of ideas but need to learn all these various functions to make them reality

#

how can I apply the EH in a MP mission?
tried with addMPEventhandler

#

but nope

winter rose
#

for inventory? player addEventHandler in initPlayerLocal.sqf

smoky verge
#

oh yeah

#

thanks

#

still can't seem to make it work

player addEventHandler ["InventoryOpened",{
        _this spawn {
            waitUntil {
                not isNull findDisplay 602
            };
            if (_this select 1 isKindOf "Man") then {closeDialog 602}
        }
}];```
still forum
#

closeDialog doesn't take a IDD

#

it takes a button code

#

usually 0 or 1

#

I think you used the same copy paste than my units mission maker

#

he gave me that garbage a few weeks ago too and I had to fix it up for him

smoky verge
#

probably the same thing
weird, seemed to work for the guy we copied from

still forum
smoky verge
#

mhmm true it doesn't take the IDD
and apparently it hasn't since flashpoint
no idea how it worked for that guy

#

@still forum still doesn't work

still forum
#

exactly that snippet works fine for me

#

just ran that last week

#

i copy pasted it out of my mpmissionscache

smoky verge
#

did you put it in initPlayerLocal.sqf?

still forum
#

yes

smoky verge
#

mhm, lets me open the inventory just fine

#

maybe it doesn't work in the eden testing or something?

spark rose
#

@winter rose thanks but I can't even get to that point. If i click "select custom respawn position" under multiplayer in the 3den menu and run the game, then try to respawn, i get a long error and get stuck in the map screen.

oblique arrow
#

can you provide the error?

spark rose
#

i may be able to screenshot it

#

ok got it

#

@oblique arrow how do i post it?

smoky verge
oblique arrow
#

^

#

upload the image to imgur and post the link here

smoky verge
#

or become a veteran

oblique arrow
#

heh thats the hard route

spark rose
smoky verge
#

apparently you've given variable names that lead to nowere

spark rose
#

I can repeat this on the fly. Open a new livonia map, put down multiple respawns (respawn_west_1, respawn_west_2, etc) click to choose respawn position in multiplayer settings in 3den, and thats it

oblique arrow
#

are you using any scripts in the mission?

spark rose
#

i'm using a ton, but for troubleshooting, i just did this on a brand new map

oblique arrow
#

as in any custom scripts

spark rose
#

reason being, i've never seen this happen before

oblique arrow
#

so this error happens without any custom scripts?

#

Can you try replicating that with just the contact addon loaded and without any mods?

spark rose
#

Sure gimme a sec

oblique arrow
#

I assume that this is one of those contact addon incompatabilities

spark rose
#

i assumed that too, but then i just ran livonia without the "DLC" and had the error. I'm going to unplug all mods and try again

oblique arrow
#

odd

spark rose
#

Hmmmmmm. With all mods uninstalled i don't get the error. Now to find which one is doing it...

oblique arrow
#

Odd

winter rose
#

mods are ebol

spark rose
#

nope I was wrong

#

it's the Contact DLC

#

now i have to figure out how to unload the "contact_ui" from my mission...

#

so i can use it without having the DLC checked

smoky verge
#

we talked about this
stop moving missions between contact dlc and contact platform
its gonna cause these errors

bright flume
#

what is in the mission right now?

spark rose
#

@smoky verge Thank you for your kind advice. I began this mission on the contact DLC before I knew better.

smoky verge
spark rose
#

@smoky verge Yes, you told me a few days ago, again, I've been working on this mission for about 3 weeks.

winter rose
#

I believe you cannot open it anymore without Contact?
can you remove everything that is Contact-y and open it again in non-Contact Arma?

smoky verge
#

try merging the mission with an empty mission to solve all dlc and mod related issues and start fresh without having to completely start over

spark rose
#

@winter rose I've removed all i can think of but the contact_ui is the one that's killing me.

winter rose
#

if everything has been removed, edit (MAKE A BACKUP) your mission.sqm and remove it from requiredAddons

winter rose
#

interesting
in previous titles, AI subordinates could activate actions added with addAction using the commanding menu
they cannot in A3

spark rose
#

@winter rose how do i go about doing that?

oblique arrow
#

open up mission.sqm with a text editor
search for addon name
delete

spark rose
#

nvm. merging it with a blank map worked

winter rose
#

noice!

spark rose
#

Yes, thanks @winter rose and thanks @smoky verge

solar chasm
#

Scripting friends. Please forgive a questions from a scripting newb. I've been trying to do the research, but hitting a few stumbling blocks. My goal is add a function into a mission to change the ammo loadout in a modded artillery piece; and once I get it working in SP/MP, have it usable in a zeus-run setting as the vehicles are spawned.

I created the function (based on a sample script from the mod creator) as an sqf file. I defines the sqf in the description.ext under both class cfgFunctions and class CfgRemoteExec. Then I list [<params>] RemoteExec [<function>, Object] in the init script for the vehicle. The last bit (specifically the 'Object' argument) is giving me errors.

1> should I class the function as both Function and RemoteExec, or only one? Or more classes that I'm not aware of?
2> Is remoteExec correct, and what is the actual string I should put in the 'Object' line if I want the code to be executed on the machine where the vehicle is local? Does it have to be the specific vehicle's "name", or can I use a pointer like "_this" or similar?
3> Perhaps beyond the scope of the initial question, but once I have it working, is it possible to bind it to a vic in a mission so that it executes when the vic is placed by a zeus (i.e. not on pre-existing assets, but things taken from the spawn menu that don't exist at mission or server start)?

jagged elbow
#

Hi, im trying to create some form of spawn system, i have succesfully got it to choose a random marker to teleport the player to but id like to make it so the player gets teleported to a random building with a certain distance of the marker, this is what i have so far:

spawnBuildings = ["jbad_House_c_10", "jbad_House_c_3"];

if (playerSide isEqualTo resistance) then {
  indepSpawn = selectRandom ["indep_respawn1", "indep_respawn2", "indep_respawn3"]
};

//player setPos getMarkerPos indepSpawn;
playerPos = nearestObject[getMarkerPos indepSpawn, spawnBuildings, 50];

player setPos playerPos;

cutText [" ", "BLACK IN", 3];
_camera = "camera" camCreate (getpos player);
_camera cameraeffect ["terminate", "back"];
camDestroy _camera;
"dynamicBlur" ppEffectEnable true;
"dynamicBlur" ppEffectAdjust [100];
"dynamicBlur" ppEffectCommit 0;
"dynamicBlur" ppEffectAdjust [0.0];
"dynamicBlur" ppEffectCommit 4;

closeDialog 1;

Thanks in advance for any help.

robust hollow
#

I think you're meaning to use nearestObjects there instead of nearestObject. fix that up and you can just use selectRandom to select a random nearby building, like you do for markers.

playerPos = selectRandom nearestObjects[getMarkerPos indepSpawn, spawnBuildings, 50];```
#

you may want to rework that script a little though, because if the playerside isnt independent it will error (unless indepSpawn is also defined elsewhere)

jagged elbow
#

I’ve got a different spawn system for the other sides they just spawn directly on markers with code executed from a dialog directly

#

But thanks for the help I’ll give it a go in the morning!

daring field
#

I am trying to create a "zone" ellipse around a marker. How do i get that to happen?
_marker = createMarker ["dropMarker", position _crate];
_marker setMarkerShape "ICON";
_marker setMarkerType "hd_destroy";
_marker setMarkerText "Air Drop";
_marker setMarkerColor "ColorWhite";
_marker setMarkerSize [0.5,0.5];

_marker2 = createMarker ["zone", position dropMarker];
_marker2 setMarkerShape "ELLIPSE";
_marker2 setMarkerColor "ColorRed";
_marker2 setMarkerSize [5,5]; 
_marker2 setMarkerBrush "DiagGrid";

thats what i have but it does not work. The first marker creates just fine

robust hollow
#

is dropMarker a defined variable?

daring field
#

no

#

how would i need to define it?

robust hollow
#

so position dropMarker wont work

#

change it to position _crate like the first marker

daring field
#

i did and it still does not work

#

that was the first one i tried

robust hollow
#

that snippet works for me. is there already a marker called "zone"?

daring field
#

nvm

#

got it

#

thank you

loud python
#

Good morning, or whatever time you are all living in :D
I am about to start working on a script to add some radiation hotspots to a mission so players have to use CBRN gear when they want to go inside those areas and I'm wondering what the best mechanism for detecting them would be

#

I had a prototype that used a trigger which spawned and removed a script to add tick damage when the player entered or left the trigger area, but that doesn't work well with overlapping hotspots

#

my second idea was to just have a script always running on the client that checks for game logic objects with a certain variable set using nearObjects, but I'd need a radius of at least 500 meters for that

#

any other ideas, or should I just go with one of those two?

spring lodge
#

yea, inArea

#

if you use rectangle/ellipse for 'defining' your area on the player's map you can use that to check if they are in the area

loud python
#

hmmm... would that have any advantage over just calculating the distance to the hotspot?

#

the part I'm trying to avoid the most is having some script running a loop even when there's no hotspot nearby

winter rose
#

@solar chasm the remoteExec of a function takes a string as an argument, so "tag_fnc_functionName", between quotes

spring lodge
#

well i think that calculating the distance to the hotspot is less performant than your previous ideas

#

triggers are quite annoying to deal with (in my experience) and the near objects wouldnt be very performant

#

but imo the inArea is just a neat way of doing it, even if you need to do a while loop

loud python
#

would running it once per second with a radius of like 100 to 300 be a performance problem though?

#

I can also increase the sleep to 5 if there's no hotspot nearby

spring lodge
#

wdym the radius? you could just measure the distance between the player and the center of the hotspot?

loud python
#

I have to find the hotspots first though 😄

#

for now they're just game logic objects with a "contamination_level" variable set

spring lodge
#

ohhh i get you, so are you not using a marker for these hotspots?

loud python
#

nope

spring lodge
#

if so your nearobjects is your best bet I think

loud python
#

ideally I want them to be dynamic

#

so I can also spawn hotspots with a halflife that despawn if I ever feel like it 😄

robust hollow
#

why not add the logics to an array of hotspot logics, then check the distance to each one?

loud python
#

I was considering that just now

robust hollow
#

that way u are specifically checking against the logics you have spawned rather than any nearobject, logic or otherwise

loud python
#

then the hotspot would need to have more logic of its own though

spring lodge
#

not really

loud python
#

hmmm...

#

where would I save the hotspot array though?

#

all I can think of is a filthy global variable

robust hollow
#

nothing wrong with global variables

loud python
#

lots wrong with global variables, actually

#

I'm not against using them per se

#

I just like to avoid it whenever possible 🙂

spring lodge
#

one wont hurt

robust hollow
#

well, in that case assign the variable to something else?

loud python
#

I'll add that to my list of reasons why Arma 4 should use Lua for scripting /offtopic

#

is there actually a way to benchmark how long the nearObjects takes?

robust hollow
#

yea, the code performance button on the debug console

#

imo it doesnt make sense to be searching for a logic if you already know it is spawned somewhere, but you do you

loud python
#

hmmm...

#

guess I'll write your idea of caching the hotspots in an array into a comment and go with Donald Knuth for now

#

premature optimization is the root of all evil

winter rose
#

someone did read the wiki!

loud python
#

wiki?

#

that has become one of my favourite quotes

#

probably second after "Improve code by removing it"

winter rose
loud python
#

🙂

#

so far spawning the script 20 times from the debug console doesn't even change my FPS by one

winter rose
#

bottom-left "timer" button will run the code 10000 times and benchmark it (the execution itself, not the actual spawn running)

loud python
#

I will try that then, thanks 😄

#

0.039 ms

#

guess I'mma just go with this then 🙂

#

And now is the moment when you all cringe because I tell you it's for an altis life server ;D

winter rose
#

*cringe*

#

if you benchmarked the spawn, then you benchmarked nothing unfortunately

quartz pebble
#

Is there away to figure out vectorDir and vectorUp from vectorFromTo?
I'm trying to make objectA to point to objectB. Apparently I can calculate all I need manually working with sin/cos, but I'm looking for a more engine-optimized way.

loud python
#

I benchmarked the (position player) nearObjects [ "logic", 300] select { shenanigans }; that I use to find the objects 😄

winter rose
#

okido, then all good!

quartz pebble
#

Yep, I saw it. But so far I decided to go with manual sin/cos. Tx.

winter rose
#

GL, because this is clearly not my 🍵

west grove
#
_obj = getItemCargo _test select 0; 
hint format ["%1", _obj];```
#

returns error

#

what am i doing wrong?

robust hollow
#

whats the error

west grove
#

generic error in expression

robust hollow
#

i imagine this might help _obj = getItemCargo (_test select 0);

west grove
#

oh yeah .... silly me

loud python
#

hmmm... is there some way to detect when a player equips some gear?

#

like one of those fancy CBRN masks and such

#

I've had a look at the event handler list, but there's nothing related to equipping/unequipping items

robust hollow
#

you'd be doing some kind of loop for it

loud python
#

I feared that might be the case...

winter rose
#

not "equip" per se, but you can e.g check if the headgear has changed

#

if he takes it in his inventory then equips it, you're doomed

loud python
#

hmmm... yeah, guess I'm gonna go with the loop then xD

winter rose
#

yup, way safer (and no EH for that)

verbal rivet
#

Does anyone have a good example on how to make AI say custom sentences (out of standard radio protocol words)?

#

Trying to make a scripted AWACS in mission, but cannot grasp how I can define custom sentences for kbTell (using existing words)

verbal rivet
#

I am looking at it right now. Trying first without an argument. Here's what I got so far:

description.ext

class CfgSentences
{
    class AWACS
    {
        class Contact
        {
            file = "awacs\contact.bikb";
            #include "awacs\contact.bikb"
        };
    };
};

Mission file awacs/contact.bikb:

class Sentences
{
    class ContactReport
    {
        text = "Contact at";
        speech[] = { Contact, at1 };
        actor = "awacs";
        class Arguments 
        {
            //class Team { type = "simple"; };        // refers to %Team, first element of speech[]
            //// "RequestingCloseAirSupportAtGrid" is part of Radio Protocol
            //class Location { type = "simple"; };    // refers to %Location, last element of speech[]
        };
    };
};
class Arguments {};
class Special {};
startWithVocal[] = { hour };
startWithConsonant[] = { europe, university };
#

There's an HQ entity called 'awacs', but calling ["Contact", "AWACS"] spawn BIS_fnc_kbTell; does not seem to do anything

#

Hm, changing HQ entity to actual soldier helped. Wouldn't have thought

#

Now to get it working over radio..

crystal rune
#

I'm not 100% sure if this is the right place to ask, apologies if it's not.

I have a script setup and working in: initPlayerLocal.sqf for a mission.
Was wondering if there is a tutorial/easy way to convert it to a Server Side Mod so it runs the on every mission?

verbal rivet
#

Now to get it working over radio..
Anyone knows how I can force sentence to be played over radio and not directly?
["Contact", "AWACS", "", true] spawn BIS_fnc_kbTell; and/or setting channel = 4 in .bikb do not seem to help

winter rose
#

there is no channel parameter in bikb 🤔

verbal rivet
#

According to code of BIS_fnc_kbTell, there seems to be:

        //--- Custom channel
        _noChannel = false;
        private _channelCfg = gettext (_cfgSentences >> _sentenceId >> "channel");
        if (_channel isequalto false && _channelCfg != "") then {_channel = _channelCfg}; //--- When undefined, use config channel

Or rather, that's CfgSentences parameter, but since I'm using an #include anyway...

Got it working using plain kbTell though, was missing kbAddTopic

winter rose
#

oh well, time to document it then!

verbal rivet
#

Wish I could :(
Registraion of new accounts for the Community Wiki has been temporarily suspended. We apologize for the inconvenience.

#

(sic)

winter rose
#

I was talking about myself 😉

verbal rivet
#

Ah, splendid

winter rose
#

Splendid\™* 😄

jagged elbow
#

Hi, i sent a message in here early this morning asking for help with an issue i was having, after applying the change that was mentioned i am recieving an error and cannot figure out what it means, the error is: https://gyazo.com/98ba0d0f39cbb37db16b47d472981236 and the code used is:

spawnBuildings = ["jbad_House_c_10", "jbad_House_c_3"];

if (playerSide isEqualTo resistance) then {
  indepSpawn = selectRandom ["indep_respawn1", "indep_respawn2", "indep_respawn3"]
};

//player setPos getMarkerPos indepSpawn;
_playerPos = selectRandom nearestObjects[getMarkerPos indepSpawn, spawnBuildings, 50];

player setPos _playerPos;

cutText [" ", "BLACK IN", 3];
_camera = "camera" camCreate (getpos player);
_camera cameraeffect ["terminate", "back"];
camDestroy _camera;
"dynamicBlur" ppEffectEnable true;
"dynamicBlur" ppEffectAdjust [100];
"dynamicBlur" ppEffectCommit 0;
"dynamicBlur" ppEffectAdjust [0.0];
"dynamicBlur" ppEffectCommit 4;

closeDialog 1;

Once again any help is greatly appreciated

unreal scroll
#

getMarkerPos "indepSpawn",

robust hollow
#

at a guess I'd say your nearestobjects is returning an empty array, selectrandom is selecting nil and therefore _playerPos is not defined. but idk for sure.

unreal scroll
#

Do not use global variables.
private _spawnBuildings = ["jbad_House_c_10", "jbad_House_c_3"];
private _playerPos = selectRandom nearestObjects [getMarkerPos "indepSpawn", _spawnBuildings, 50];
Then, you want to use objects as coords for setpos? :)
_playerPos contains object in your case.
private _playerPos = getpos (selectRandom nearestObjects [getMarkerPos "indepSpawn", _spawnBuildings, 50]);
But it is better to check if the array is not empty:

private _indepSpawn = "";
if (playerSide isEqualTo resistance) then {
  _indepSpawn = selectRandom ["indep_respawn1", "indep_respawn2", "indep_respawn3"]
};
private _spawnBuildings = ["jbad_House_c_10", "jbad_House_c_3"];
private _objects = nearestObjects [getMarkerPos _indepSpawn, _spawnBuildings, 50];
private _playerPos = getpos player;
if (count _objects > 0) then {
    _playerPos = getpos selectrandom (_objects);
};```
robust hollow
#

indepSpawn is a variable not a marker

winter rose
#

then

at a guess I'd say your nearestobjects is returning an empty array, selectrandom is selecting nil and therefore _playerPos is not defined.

#

what @robust hollow said ^ @jagged elbow

unreal scroll
#

"and therefore _playerPos is not defined" - this is what Prent's log says, and it is obvious.
He should use marker name, or another correct position.

"indepSpawn is a variable not a marker" - variable can contains marker names.

robust hollow
#

right, but doing getmarkerpos "indepSpawn" doesnt get the contents of the variable

unreal scroll
#

This is what I said before.

robust hollow
#

your snippet didnt reflect it but i see you've fixed it now 👌

jagged elbow
#

Thanks for all the help, its very appreciated, i tried to use the snippet from @unreal scroll , there are now no errors however the player doesnt get moved instead just stays where it was.

robust hollow
#

yea because there are no near objects

queen junco
#

Hey, I would got a small question as well. I am currently trying to do a livefeed. This is my script so far:

cam1 = "camera" camCreate [0,0,0];
cam1 cameraEffect ["Internal", "Back", "man1rtt"];
cam1 attachTo [source1, [0.12,0,0.18], "head"];```
So it basically works quite fine. but I noticed that the camera is only rotating on the Z axis. Does anyone know how you make it so it gets the EyeDirection of source1 and applies it to the cam1?
unreal scroll
#

@jagged elbow Check the nearestobejcts with nearestObjects [getMarkerPos "indep_respawn1", ["jbad_House_c_10", "jbad_House_c_3"], 50]; for all your markers

jagged elbow
#

Sorry if this sounds stupid, still very new at this, what do you mean by check the nearestObjects?

robust hollow
#

run that little snippet in debug to see if it returns any objects

unreal scroll
#

If there is an empty array you get in output, then try to use empty objects array - maybe you use incorrect classes:
nearestObjects [getMarkerPos "indep_respawn1", [], 50];
Also check the markerpos - does it correct?

jagged elbow
#

so when i run nearestObjects [getMarkerPos "indep_respawn1", ["jbad_House_c_10", "jbad_House_c_3"], 50]; in the debug console it finds the buildings, but only the ones placed by me in the editor and not the existing map objects, is there a way to find the class names of the buildings already on the map, im using a modded map btw.

unreal scroll
#

nearestObjects finds only objects that are entities - it means what you said exactly. Standard buildings at the map are not entities.

jagged elbow
#

ah, so would there be a way to look for the map objects? i essentialy want to pick a random city using the indep_respawn1, indep_respawn2, indep_respawn3 markers and teleport the player to a random building within a certain distance from the marker

winter rose
unreal scroll
tough abyss
#

hi everybody. I'm trying to create a weapon workbench script.
I want to place the player's current weapon on a table.
So, I create a variable: _pWeap = currentWeapon player;
And after that a table with an id: workb_table

Then use that syntax:

_pWeap setposATL [getPosATL workb_table select 0, getPosATL workb_table select 1, ((getPosATL workb_table select 2)+0.83) ];
_pWeap attachTo [workb_table];

But it doesn't works. The program shows me that error:

_pWeap |#|setposATL [getPosATL workb_table select ...'
Error setpostatl: Type String, expected Object

winter rose
#

the error being Type String, expected Object
currentWeapon returning a String.

unreal scroll
#

@tough abyss You don't need to setpos. attachTo is enough, but your syntax is wrong.

#

Also you can't attach your weapon directly. Your weapon is not a world object. You need to create WeaponHolder.

tough abyss
#

ufff i'm very noob scripting, how can i create a WeaponHolderSimulated?!

winter rose
#

createVehicle

tough abyss
#

_pWeap = createVehicle ["WeaponHolderSimulated", [0,0,0], [], 0, "CAN_COLLIDE"];

I'm on the right direction?!

unreal scroll
#

@tough abyss
"I'm on the right direction?!" - yes.

The syntax: _holder = createVehicle ["WeaponHolderSimulated",_pos, [], 0, "CAN_COLLIDE"];
Then you will need to drop your weapon with attachements and ammo to _holder container.
Try the "DropWeapon" action, but in general your idea is hard to impelement for beginners without reading manuals/command description, and it is ~90% of success.
Also you can try _holder addWeaponWithAttachmentsCargoGlobal [_your item, 1]; and then remove your weapon.

tough abyss
#

Something like this?!

{hide_attach_crate addWeaponcargo [_x,1];player removeWeapon _x} forEach (primaryWeapon player);
#

it's simply for a weapon without accessories

#

now I need the final part, place the moved weapon into the holder on the table

oblique arrow
#

Hey peeps whats the best way to give vehicle unlimited ammo?

tough abyss
#

unti now, I have this:

_holder = createVehicle ["WeaponHolderSimulated",_pos, [], 0, "CAN_COLLIDE"];     
{hide_attach_crate addWeaponcargo [_x,1];player removeWeapon _x} forEach (primaryWeapon player);

_pWeap attachTo [workb_table];
unreal scroll
#

hide_attach_crate - use the local variable, like _hide_attach_crate.
And why forEach? AFAIK there can't be more than one primaryweapon 🙂

_pWeap attachTo [workb_table]; - did you read about the command syntax? 🙂
Then, you create _holder, but trying to attach something to undifined object.

private _weapon = primaryWeapon player;
_holder addWeaponcargo [_weapon,1]; 
player removeWeapon _weapon```
young current
#

@oblique arrow fired eventhandler to se ammo in magazine to full after each shot perhaps

tough abyss
#

it shows me an error of undefined _pos variable

jagged elbow
#

Hi, currently just looking through some scripts hoping to gain some more understanding and came accross this: ```sqf
_pos = getMarkerPos "PlayZone";
_size = getMarkerSize "PlayZone";
_size = _size select 1;
_size = _size/2;

Wondering if anyone could explain what `_size = _size select 1;` and `_size = _size/2;` mean?
verbal rivet
#

_size is result of getMarkerSize, which returns an array. _size = _size select 1 assigns second value from array to that variable (instead of array itself), _size = _size/2 divides that value by 2 and assigns into same variable

jagged elbow
#

I see, thanks for the explanation

tough abyss
#

@unreal scroll what does this "_pos" refer to?

unreal scroll
#

Position where you want to spawn the object.
Theoretically, you can spawn anywhere - attach command will place it at relative coordinates from parent object.
But for dedicated you can get some bugs with it. If you're not using dedicated - don't care about this. Just spawn it where you want. I.e. [0,0,0]

tough abyss
#

in my case i want to spawn it at the same coordinates of the placed table that i want to use as a workbench, is it possible?!

unreal scroll
#

I don't recommend it, as sometimes you could see its turning on the table. Spawn it somewhere you can't see, and attach.

tough abyss
#

well, until now, I've this.

private _weapon = primaryWeapon player;
_holder = createVehicle ["WeaponHolderSimulated",[1,1,1], [], 0, "CAN_COLLIDE"];

_holder addWeaponcargo [_weapon,1]; 
player removeWeapon _weapon;

_weapon attachTo [workb_table];
unreal scroll
#

_weapon attachTo [workb_table];
Firstly, not _weapon 🙂 You need to attach _holder.
Secondly, again: read the command manual we gave to you 🙂

#

It is essential

tough abyss
#

well, as I undestand I need to add the position relative to the objecto to attach, right?!

#

jmm something doesn't work, there's no error message, but the weapon doesn't appear on the attached table

#

private _weapon = primaryWeapon player;
_holder = createVehicle ["WeaponHolderSimulated",[1,1,1], [], 0, "CAN_COLLIDE"];

_holder addWeaponcargo [_weapon,1]; 
player removeWeapon _weapon;

_holder attachTo [workb_table,[0.5,0.5,0.5]];
unreal scroll
#

Does workb_table variable contains the real object? Check it, for example
player setpos (getpos workb_table)

#

Also, try to add some time for weapon to be added to holder.

sleep 1;
player removeWeapon _weapon;
_holder attachTo [workb_table,[0.5,0.5,0.5]];```
tough abyss
#

Finally, I think it works, so do u know if it's possible to rotate the attached weapon on the table?!

unreal scroll
#

Of course. Try to experiment. If you need only yaw rotation, try setDir before attaching.
Depends on what you want. Is I remember, after attaching it will use the parent object orientation, and its axis.

dry tendon
#

Hi guys, so I have a trigger that BLUFOR players activate a trigger. However, they will have air support which i don't want prematurely popping a trigger. Is there code so that the trigger will not pop for blufor players in a helicopter?

#

I could use trigger height I know, but there's been glitches where players survive impossible to survive crashes that could still pop the trigger

oblique arrow
dry tendon
#

It's a server only trigger, so does it check "player" variable?

#

I don't know much about this forgive me if it's a stupid question

oblique arrow
#

Mmh not sure about that actually

fading dock
#

Hey guys, Anyone know of a script to make all buildings/trees on my map indestructible / take no damage? Most objects I placed in Terrain Builder

dry tendon
#

Make them simple objects?

unreal scroll
#

@dry tendon "It's a server only trigger, so does it check "player" variable?" - of course no.
You should use allplayers array to find the player on a server.

"Make them simple objects?"
It will disable all doors.
But if it doesn't needed, then it is the best way to keep perfomance level.

dry tendon
#

I'm not trying to find a specific player

alpine ledge
#

@dry tendon ```sqf
this && (({_x isKindOf "Car"} count thisList) > 0 || ({_x isKindOf "Tank"} count thisList) > 0 || ({_x isKindOf "Armored"} count thisList) > 0)

pretty sloppy so if someone wants to make a tidier version, go ahead, but put this in the condition of the trigger
#
this && !({_x isKindOf "Air"} count thisList > 0)

might be better now that i think about it

dry tendon
#

That looks perfect thank you

lofty anchor
#

anyone able to recommend a script that i can use to have buildable structures a little like how bulwark has it im working on a a mission and one of the aspects is going around and setting up road blocks and id like the players to be able to build the gates, barricades and bunkers themselves then have a trigger go off when the required items are built in the areas, im pirtty good a being able to figure how scrips are working and bend them to my will just dont know where to start when building anything from the ground up

polar anchor
#

hey, im making a script to drop money when someone dies and add an action to the money. here's my onPlayerKilled.sqf


_deathLocation = getPos _player;

_moneyObject = "Land_Money_F" createVehicle _deathLocation;

[_moneyObject, ["Pickup", {[_moneyObject] call crimilo_fnc_moneyPickup}, [], 6, true, true, "", "(_this distance _target) > 3"]] remoteExec ["addAction", 0, true];```
moneys get created correctly, problem is the addaction never gets added. someone knows where is the problem?
also, should i pass arguments the way i made it (`[arguments] call functionName`) or should i pass them trough `addAction` arguments parameter?
alpine ledge
#

have you got that > the right way around? that condition is if you're more than 3m away

polar anchor
#

thank you @alpine ledge

alpine ledge
polar anchor
#

should i pass arguments the way i made it ([arguments] call functionName) or should i pass them trough addAction arguments parameter?

alpine ledge
#

personally, i'd do it through the way you've done it since it's just easier to read, but i don't think it makes too much difference at the end of the day

polar anchor
#

it makes the difference by how u select it in your function, because the way i made it allows me to use params. passing it trough addaction parameter force me to use _this select 3 select index i guess

alpine ledge
#

that's what i meant; easier to deal with imo when you do it that way

jagged elbow
#

Hi, im attempting to create a script that randomly spawns checkpoints with random groups of units and creates a task along with it, i have managed to get this to work the way i intended however i am trying to use an event handler to switch the task state to complete once all units have been killed but i recieve this error: https://gyazo.com/eecd4c94e8944ace30f71cb91414ec12
the code i have wrote is as follows: ```sqf
private _title = "Take Out The Checkpoint!";
private _description = "Kill The Checkpoint.";
private _waypoint = "checkpoint";

//groups
_group1 = ["rhsusf_army_ocp_rifleman_10th","rhsusf_army_ocp_rifleman_10th","rhsusf_army_ocp_rifleman_10th"];
_group2 = ["rhsusf_socom_marsoc_teamleader", "rhsusf_socom_marsoc_teamchief", "rhsusf_socom_marsoc_sarc", "rhsusf_socom_marsoc_cso"];
_group3 = ["rhsusf_socom_marsoc_sniper", "rhsusf_socom_marsoc_spotter"];

_groups = selectRandom [_group1, _group2, _group3];

//markers
_markers = selectRandom ["checkpoint1", "checkpoint2", "checkpoint3"];

//create group
_groupWest = createGroup west;
_groupWest = [getMarkerPos _markers, west, _groups] call BIS_fnc_spawnGroup;
_vehicle1 = "rhsusf_m1025_d_m2" createVehicle getMarkerPos _markers;

//create Task
private _title = "Take Out The Checkpoint!";
private _description = "Kill The Checkpoint.";
private _waypoint = "checkpoint";

private _myTask = [player, ["task1"], [_description, _title, _waypoint], _markers, 1, 2, true] call BIS_fnc_taskCreate;

//complete task
_groupWest addMPEventHandler ["MPkilled", {["task1","SUCCEEDED"] call BIS_fnc_taskSetState}];

Any help is greatly appreciated.
spring lodge
#

the syntax for addMPEventHandler is that it requires a player object, you’ve used a group

jagged elbow
#

ah, is there any way to set a task state to succeeded without using an event handler?

spring lodge
#

Not sure, but you could use a for each loop and units _groupWest

#

To assign each player with an event handler

jagged elbow
#

ill look into that thanks for the advice

#
{ _x addMPEventHandler ["MPkilled", {["task1","SUCCEEDED"] call BIS_fnc_taskSetState}]; } forEach units _groupWest;

This worked perfectly for me. Thanks for the help! @spring lodge

ebon ridge
#

I'm trying to get a unit to walk to a chair so I can play the SIT animation in it, but he won't walk within 5 m of it when using doMove or waypoints. Is there any way to force unit to walk to a position?

#

I'm sure I can get precise movement when using squad command, how can I replicate this precision with sqf?

still forum
#

waypoints have a completion radius

#

maybe there was a way to configure it?

ebon ridge
#

yeah but its not accurate sadly

#

i set it in editor to 0, 1 or 0.1 it still completes within 3 m or so

#

I want to to walk to an exact spot, but it seems its not really possible :/

#

i have to use setPos to move them the last few meters which looks bad of course

robust hollow
golden cosmos
#

oh thx@robust hollow

robust hollow
#

and then you'll want to delete it from this channel otherwise you get done for double posting

acoustic abyss
#

@ebon ridge I had a similar issue with getting units to run in a very strict formation for an intro sequence. The most precise method requires using the walking animations a set number of times. PM me if you don't manage to Google it.

stark granite
#

Looking for someone to help me debug a mission, one or two errors left to find in the script simply out of my capabilities, namely the h_cam functions, turning the screen black upon loading then getting stuck on a wait until, can't remove the script, tried, just causes more errors because the scripts are all interlinked to work properly, any help appreciated

winter rose
#

where is the code @stark granite ? we cannot help if we don't see it

stark granite
#

Right on, hold on I'll get an rpt generated and find the code that's messing me up

#

So im getting (bellow) allot, but that dosent seem to be the main issue, paste bin to follow

11:07:57 Error in expression <]] call ace_common_fnc_canInteractWith} >
11:07:57 Error position: <>
11:07:57 Error Missing )

vague perch
#

Shoot with the mouse in a static screen. I want to find a way of shooting with a static screen. The screen doesent move when you move your mouse only the haircross moves and when you click the left mouse button it shoots.
You can see a short example of what im trying to do in the movie below.... https://www.youtube.com/watch?v=_0z9R86-pR8

stark granite
#

This seems to be a main issue

oblique arrow
#

@vague perch Take a look at the deadzone setting (I think it was)

stark granite
vague perch
#

@vague perch Take a look at the deadzone setting (I think it was)
@oblique arrow So, you think I can get a deadzone over the whole screen? Where do I find Deadzone... hmmmmm

winter rose
#

@stark granite missing ) it is

stark granite
#

Where abouts?

#

I havent even edited those scripts xD And they work perfectly before I ported them Sad times....

winter rose
#

somewhere in the code

stark granite
#

Ill find it, thanks

winter rose
#

I like to help

queen junco
#

Hey I am rather new to the whole scripting thing. But I am currently trying to create a livefeed script. This is what I got so far:

cam1 = "camera" camCreate [0,0,0];
cam1 cameraEffect ["Internal", "Back", "man1rtt"];
cam1 attachTo [source1, [0.12,0,0.18], "head"]; ```
The problem I got is that the camera only turns on the Z-axis though. Does anyone have an idea on how to fix that?
oblique arrow
#

Mmh i think Killzone Kid has a good camera live feed script, might be worth taking a look at that

queen junco
#

thanks for the quick response. I actually used the killzonekid script for what I got so far. But because he uses it on a drone and I was planning to have a helmet-cam kind of thing I didnt really found any more input that helped me with that in his tutorial.
I was thinking it might be possible to connect the camera to the head the same way vanilla does it with helmets. But I am not sure if that is too complicated

austere sentinel
#

Is there a way to prevent airdropped objects from drifting laterally?
Tried setVelocity but it didn't seem to do anything.

robust hollow
#

turn off the wind

austere sentinel
#

I'm rather upset. Thank you lol

tough abyss
#

@unreal scroll Hi, did you konw if there's any way of changing that weapon _holder that I have attached to the table for another weapon type?!

unreal scroll
#

@tough abyss Hm... Don't know. Theoretically it should change its model appropriately, depending on what you put inside.

spark rose
#

Hey all. So i have a simple script to keep the respawn point on a squad member when a player dies. It works fine on a Hosted server, but does not work on the dedicated one. See below. if (alive player_1) then { "Respawn_West_1" setMarkerPos getpos player_1; "Respawn_West_1" setMarkerText "Squad Location"; }; if (alive player_2) then { "Respawn_West_1" setMarkerPos getpos player_2; "Respawn_West_1" setMarkerText "Squad Location"; }; if (alive player_3) then { "Respawn_West_1" setMarkerPos getpos player_3; "Respawn_West_1" setMarkerText "Squad Location"; }; if (alive player_4) then { "Respawn_West_1" setMarkerPos getpos player_4; "Respawn_West_1" setMarkerText "Squad Location"; }; if (alive player_5) then { "Respawn_West_1" setMarkerPos getpos player_5; "Respawn_West_1" setMarkerText "Squad Location"; }; if (alive player_6) then { "Respawn_West_1" setMarkerPos getpos player_6; "Respawn_West_1" setMarkerText "Squad Location"; }; if (alive player_7) then { "Respawn_West_1" setMarkerPos getpos player_7; "Respawn_West_1" setMarkerText "Squad Location"; }; if (alive player_8) then { "Respawn_West_1" setMarkerPos getpos player_8; "Respawn_West_1" setMarkerText "Squad Location"; };

winter rose
#

```sqf

#

(see pinned message)

spark rose
#

oh

#

thanks

#
{ 
"Respawn_West_1" setMarkerPos getpos player_1;
"Respawn_West_1" setMarkerText "Squad Location";
};
if (alive player_2) then 
{ 
"Respawn_West_1" setMarkerPos getpos player_2;
"Respawn_West_1" setMarkerText "Squad Location";
};
if (alive player_3) then 
{ 
"Respawn_West_1" setMarkerPos getpos player_3;
"Respawn_West_1" setMarkerText "Squad Location";
};
if (alive player_4) then 
{ 
"Respawn_West_1" setMarkerPos getpos player_4;
"Respawn_West_1" setMarkerText "Squad Location";
};
if (alive player_5) then 
{ 
"Respawn_West_1" setMarkerPos getpos player_5;
"Respawn_West_1" setMarkerText "Squad Location";
};
if (alive player_6) then 
{ 
"Respawn_West_1" setMarkerPos getpos player_6;
"Respawn_West_1" setMarkerText "Squad Location";
};
if (alive player_7) then 
{ 
"Respawn_West_1" setMarkerPos getpos player_7;
"Respawn_West_1" setMarkerText "Squad Location";
};
if (alive player_8) then 
{ 
"Respawn_West_1" setMarkerPos getpos player_8;
"Respawn_West_1" setMarkerText "Squad Location";
};
/```
#

i call the .sqf with a trigger for each player, which the condition is !alive player_1 (and !alive player_2 for the next trigger and so on)

#

not sure why my code isn't highlighted

still forum
#

because you put a line break before the sqf

winter rose
#

```sqf
/* your code */
hint "yes!";
```
↑↓

/* your code */
hint "yes!";
spark rose
#
if (alive player_1) then 
{ 
"Respawn_West_1" setMarkerPos getpos player_1;
"Respawn_West_1" setMarkerText "Squad Location";
};
if (alive player_2) then 
{ 
"Respawn_West_1" setMarkerPos getpos player_2;
"Respawn_West_1" setMarkerText "Squad Location";
};
if (alive player_3) then 
{ 
"Respawn_West_1" setMarkerPos getpos player_3;
"Respawn_West_1" setMarkerText "Squad Location";
};
if (alive player_4) then 
{ 
"Respawn_West_1" setMarkerPos getpos player_4;
"Respawn_West_1" setMarkerText "Squad Location";
};
if (alive player_5) then 
{ 
"Respawn_West_1" setMarkerPos getpos player_5;
"Respawn_West_1" setMarkerText "Squad Location";
};
if (alive player_6) then 
{ 
"Respawn_West_1" setMarkerPos getpos player_6;
"Respawn_West_1" setMarkerText "Squad Location";
};
if (alive player_7) then 
{ 
"Respawn_West_1" setMarkerPos getpos player_7;
"Respawn_West_1" setMarkerText "Squad Location";
};
if (alive player_8) then 
{ 
"Respawn_West_1" setMarkerPos getpos player_8;
"Respawn_West_1" setMarkerText "Squad Location";
};
winter rose
#

and where is this code launched?

spark rose
#

first i had it server only, then i unchecked that box, thinking that would fix it

#

didn't seem to

winter rose
#

in a trigger then. put it in initServer.sqf

private _players = [player_1, player_2, player_3, player_4, player_5, player_6, player_7, player_8];
private _index = _players findIf { alive _x };
if (_index != -1) then
{
  "Respawn_West_1" setMarkerPos getpos (_players select _index);
  "Respawn_West_1" setMarkerText "Squad Location";
};
spark rose
#

Lou i feel like you are Morpheus...but i am not Neo

winter rose
#

Where is your faith, Arthur Neo?

spark rose
#

there is no spoon?

#

😉

winter rose
#

there is, in the mint ice cream I am about to eat!

spark rose
#

lol

winter rose
#

lockdown and great weather, what a shame 😛

spark rose
#

not here. windy and rainy.

#

@winter rose it's not working through testing in 3den...hmm

winter rose
#

initServer.sqf , and not initServer.sqf.txt?

#

also, this code will only move the marker once

spark rose
#

Yes, initServer.sqf , i think what happens is it moves it at the very beginning, when everyone spawns in. But it would need to continue to move whenever the condition is met to be effective for my purposes.

#

my previous triggers were repeatable so the spawn point would be wherever the squad was when a player died.

#

but of course they didn't work in a dedicated server environment...

winter rose
#
[] spawn {

  private _players = [player_1, player_2, player_3, player_4, player_5, player_6, player_7, player_8];

  while { sleep 1; true } do
  {
    private _index = _players findIf { alive _x };
    if (_index != -1) then
    {
      "Respawn_West_1" setMarkerPos getpos (_players select _index);
      "Respawn_West_1" setMarkerText "Squad Location";
    };
  };
};
#

^ will check every second

#

you should not set the marker's text every second though

#

@spark rose ?

sturdy cape
#

hi.how can i chek if a module is present in a scenario?

tough abyss
#

do you mean like in scenario editor, or if you're actually playing that scenario? @sturdy cape

sturdy cape
#

like in "if (module present in mission) then {do something}"

spark rose
#

@winter rose due to the storms I've lost my internet connection...

winter rose
#

heh… sun and internet are indeed better

spark rose
#

Yes...much sadness.

winter rose
#

does the code do what you want though? 🙂

tough abyss
#

damn.. im really not sure, never thought i'd need something like that. I'll try to find what i can on the interwebz @sturdy cape

winter rose
#

@sturdy cape @tough abyss I believe the following could work:```sqf
entities "moduleClass" isEqualTo []

spark rose
#

I don't know yet, since I wasn't able to copy it before the internet went out, I will try to do it when it after I've got some house work done

winter rose
#

okido! glhf

tough abyss
#

tell us how it's working then BAD

sturdy cape
#
nearestTerrainObjects [
                    [worldSize/2, worldSize/2],
                    ["MODULE CLASS NAME HERE"],
                    worldSize,
                    false
                ];```you just need to know which module,in my case thats enought
winter rose
#

won't nearestTerrainObjects return a terrain object? 🤔

still forum
#

yes

winter rose
#

¯_(ツ)_/¯

modest parcel
#

Is there a way to export for example, the class names & friendly (display) names of all items in a crate/arsenal - or alternatively any way to export/access a list of classnames / friendly names of a specific mod?

winter rose
#

you can use ```sqf
private _friendlyName = getText (configFile >> "CfgWeapons" >> _weaponName >> "displayName"); // iirc


but it is doable
lapis ivy
#

Hi. Can you tell me how to limit the spectator? I need the Reds to only watch the Reds. ACE spectator.

tough abyss
#

im not 100% sure, you might have options in Attributes/Multiplayer

#

if not you could maybe find it in addon options that may have possible instructions for ACE Spec

modest parcel
#

Thank you @winter rose

sturdy cape
#

won't nearestTerrainObjects return a terrain object? 🤔
@winter rose yeah well i typo´ed there^^

winter rose
#

ah :p ok

copper raven
lapis ivy
#

@copper raven thanks!

compact maple
winter rose
#

unfortunately, no besides drawing many lines side by side (which might be performance-hungry)

cosmic lichen
#

drawLines3D is acutally not that hard on performance so would be worth a try

#

Not sure though if it would look fine visually

ebon ridge
#

BIS_fnc_ambientAnim
This command seems to cause units to lose their gear?! Surely it should restore it once it is complete, or when I call BIS_fnc_ambientAnim__terminate?

#

I am also passing in ASIS to try and avoid it but it still causes them to lose their primary

cosmic lichen
#

Gear is removed depending on the animation that is playing.

#

It is however, re-added once the animation has been finished.

compact maple
#

Alright will give it a try, thanks @winter rose @cosmic lichen

#

Oh, but when you create a new line3D, the old one is automatically deleted

#

So I think that's not possible

ebon ridge
#

It is however, re-added once the animation has been finished.
@cosmic lichen I don't see where, I'm looking at the function code and there is no place that it even stores let alone re-adds the stuff it changes.

spark rose
#

@winter rose It works, thank you. Quick question - when doing it this way - does the "sleep" command pause all code execution or just this one?

winter rose
#

just this one loop

#

@compact maple I don't think so? 🤔 both drawings have to be made per drawing frame, though

compact maple
#

Oh Okay I see

#

It works

winter rose
#

don't use onEachFrame, use addMissionEventHandler @compact maple

compact maple
#

For debug purpose I have to use onEachFrame right ?

winter rose
#

it's easier yep

spark rose
#

@winter rose so my understanding is the "private" command is simply assigning a local variable and preventing it from being overwritten?

winter rose
#

in a way yes, it reserves this variable name for the current scope (and lower ones)

spark rose
#

ok

#

and the explanation point after index? (line 10)

#

*exclamation

winter rose
#

(you can edit your messages on Discord ^^)
_index != -1?
it means _index different of -1

spark rose
#

okay

still forum
#

! is not.
!= not equal

ember dune
#

?¿

real tartan
#

why is "Land_MedicalTent_01_white_IDAP_closed_F" (idap medical tent closed) enterable ?

#

[_building] call BIS_fnc_isBuildingEnterable; return true for this one

#

units / agents can go inside, but players not 🤔

round scroll
#

a question on physx forces and scripting: The Unsung A-1J Skyraider model is not aligned with the ground and drops the rear when the mission starts. Once this happens and the rear wheel touches the ground, it starts moving forward. Is there a way I can see which forces are applied to the plane by script and probably can counter them? Or would a setVelocity [0,0,0]; per frame until engine is on the best way to counter it script wise?

spark rose
#

@winter rose when you spawn a script from a trigger, will that script keep running even if the trigger is non-repeatable?

winter rose
#

yes

#

the trigger, once triggered, "fires" its code
if it is repeatable, it will fire it again (and if not, not, hehehe)

spark rose
#

fantastic. I'm using while {true} to update the enemy on player's position with doMove. seems to be working

#

previously if the player moved after the ai was given the waypoint, and the ai was far away, player would be long gone before they ever got there

winter rose
#

don't while true with waypoints, add some 10s sleep or something

spark rose
#

great minds think alike! already did

round scroll
#

seems the ground is not physx, an epecontact eh doesn't get triggered when the rear drops 😦

lofty anchor
#

i need abit of help with some code
so to start of the Hints are just for testing those will be replaced with code later

so i need to check what side a player is on and i also need to be able to recheck incase there swap from blufor to opfor for example heres what i have so far but i dont think this is the best way to do

waitUntil {!isNil "preloadFinished"};

while {true} do {
waitUntil {!isNull player};
                if (side player == west) then Hint "You are on the West Side";
                if (side player == east) then Hint "You are on the East Side";
                if (side player == ind) then Hint  "You are on the Indipendent Side";
sleep 10.00;
};                ```
real tartan
#

@lofty anchor if ( ... ) then { ... }; also ind => independent

winter rose
#

@lofty anchor ```sqf
see pinned message for code formatting

also, then takes { }

lofty anchor
#

im not sure what you mean with the if & then tbh im no scripting Veteran im sorted intermediate with my level of skill so id need a little more explanation

winter rose
#
if (side player == east) then Hint "You are on the East Side"; // WRONG

if (side player == east) then
{
  hint "You are on the East Side"; // CORRECT
};
lofty anchor
#

do you mean the wrong way of formatting it as it dose work in its current state im just not sure if the while loop is the best way to check it the player swapped sides

real tartan
#
//initPlayerLocal.sqf
switch (side player) do 
{
    case west: { hint "You are on the West side"; };
    case east: { hint "You are on the East side"; };
    case independent: { hint "You are on the Indipendent side"; };
    default { hint "You are renegate"; };
};

//onPlayerRespawn.sqf
switch (side player) do 
{
    case west: { hint "You are on the West side"; };
    case east: { hint "You are on the East side"; };
    case independent: { hint "You are on the Indipendent side"; };
    default { hint "You are renegate"; };
};

not tested @lofty anchor

lofty anchor
#

@real tartan so how will i get it to run the onPlayerRespawn.sqf

#

would i need to put a execVm in for it

real tartan
#

no, just put it in root folder of mission, it will automatically run when player respawn

lofty anchor
#

ahh i see thankyou

real tartan
#

same goes for initPlayerLocal

lofty anchor
#

oh thankyou so much for your help im going to test now

#

initPlayerLocal.sqf

addMissionEventHandler ["PreloadFinished", {preloadFinished = true;}];
[] execVM "getside.sqf";```


getplayerside.sqf
```sqf
waitUntil {!isNil "preloadFinished"};
switch (side player) do 
{
    case west: { hint "You are on the West side"; };
    case east: { hint "You are on the East side"; };
    case independent: { hint "You are on the Indipendent side"; };
    default { hint "You are renegate"; };
};```


onPlayerRespawn.sqf
```sqf
waitUntil {!isNil "preloadFinished"};
switch (side player) do 
{
    case west: { hint "You are on the West side"; };
    case east: { hint "You are on the East side"; };
    case independent: { hint "You are on the Indipendent side"; };
    default { hint "You are renegate"; };
};```

@real tartan would this work?? as id need to wait for the player to fully initialise just thinking ahead
jagged elbow
#

Hi, im attempting to create a databse using inidbi2 and im coming accross an error: https://gyazo.com/60b945b60de8a6a92af9b656ebb91ec7

I have inidbi loaded through the launcher and the code so far is as follows:
init.sqf

_clientID = clientOwner;
_UID = getPlayerUID player;
_name = name player;

checkForDatabase = [_clientID, _UID, _name];
publicVariableServer "checkForDatabase";

initServer.sqf

"checkForDatabase" addPublicVariableEventHandler {
  private ["_data"];
  _data = (this select 1);
  _clientID = (_data select 0);
  _UID = (_data select 1);
  _name = (_data select 2);

  _inidbi = ["new", _UID] call OO_INIDBI;
  _fileExists = "exists" call _inidbi;
  if (_fileExists) then {
    hint "file does exist";
  }else {
    hint "file doesnt exist";
  };
};
#

If anyone has any idea what is causing the error help would be greatly appreciated.

potent dirge
#

Is there anyway to nest a forEach loop and refer to the first magic variable from within the second loop, as well as the second magic varaiable. e.g.

{
  {_x1 deleteVehicleCrew _x2} forEach crew _x1;
  deleteVehicle _x1;
} forEach (_vehArray);

Evene better is there a way to delete the crew and vehicle from an array of vehicles?

edgy quiver
#

Hi, I want to use an Unitplay function for inserting with the advanced flight model, so I could land the helo (CH-47D from RHS) on the runway and then roll to the point where the crew should disembark. Sadly I´m unable to disengage the wheel brakes so the helo crashes when it touches the runway. Could someone help please?

potent dirge
#

Or wait, I'm dumb, maybe I can just assign the _x in the first nest to a new var

fair lava
#

yeah i was gonna say

{
  _x1 = _x;
  {
    _x2 = _x;
    _x1 deleteVehicleCrew _x2
  } forEach crew _x1;
  deleteVehicle _x1;
} forEach (_vehArray);
potent dirge
#

Thanks

alpine ledge
#

is there a way to get the internal name of a location from the config file?
i.e.

configfile >> "CfgWorlds" >> "Stratis" >> "Names" >> "NatoBase1"

is Stratis Air Base - how does one go about getting "NatoBase1" ?

fair lava
#

should work

#

_name = configName (configfile >> "CfgWorlds" >> "Stratis" >> "Names" >> "NatoBase1")

alpine ledge
#

solved it: discovered a new command className peepoCheer

manic sigil
#

I can force the map open, but I can't seem to find the script for moving the map's focus :/

#

Nvm, I'm figuring it's 'mapAnim' and related?

winter rose
#

I suppose so yes; I never really wrapped my head around map controls

manic sigil
#

Yeah; mapAnim, set how long to wait, how fast it goes, and where it goes, then mapAnimCommit

#

Or rather, how fast, how close in, where it goes... the wiki is a bit unclear at times :/

winter rose
#

we can update it
if you have a precise description, I'll gladly update the page(s)

manic sigil
#

Lemme double check so I'm sure :p

potent dirge
#

Sorry again, but I dont know why I'm getting an Undefined error for this function call.
specialArray = ["_arg1"] call fnc_specialFunction;

winter rose
#

you are sending a string as an argument, yes

potent dirge
#

yes

winter rose
#

I don't know the rest of your code nor do I know where the error triggers, sooo…

could you e.g post a snippet on sqfbin? or here if short (see pinned message for formatting)

potent dirge
#

It's supposed to return an array.

Init reference:

execVM "functions\fnc_specialFunction.sqf";

fnc_specialFunction.sqf:

fnc_specialFunction = 
{
    private ["_arr"];
    _arr = [];
    {
        _obj = _x;
        {
            if ([_obj, format ["%1",_x]] call BIS_fnc_inString) then {
            _arr append [_x];
            };
        } forEach allMissionObjects "ALL";
    } forEach _this;
    _arr
};

Credit for the func goes to Wolfenswan

winter rose
#

first,```sqf
private ["_arr"];
_arr = [];
// ↓
private _arr = [];

manic sigil
#

I was correct; Time for how long to complete the move, Zoom for zoom level (which seems to run from .001 to 1, full in to full out), and location is self explanatory.

winter rose
#

GJ! @manic sigil

manic sigil
#

yey :3

winter rose
#

@potent dirge this code is… weird

what is the error you are getting, and what do you want this code to do?

potent dirge
#

Error undefined variable in expression: fnc_specialFunction.
It's supposed to return an array of every object containing the specified string argument.

winter rose
#

and where is the code executed? it seems that your execVM arrives too late

potent dirge
#

execVM is run in init.sqf the function call is within a script, the script is called by the init of an in game object. What makes this more weird is that I tried it with the in game debug console, even after the error threw and the function returned properly

winter rose
#

init field happens before init.sqf iirc

potent dirge
#

Wow, maybe that's it. Because I have another function with similar parameters that works perfectly but it was triggered by a trigger later on in game.

winter rose
#

this is it, actually ^^

#

and of course the debug console happens once everything has been initialised, so you can't see that it didn't exist at the time

potent dirge
#

Thanks you've saved me, I might actually sleep tonight

winter rose
#

pulled hairs from other people don't have to be re-pulled by others 😄

potent dirge
#

back again 😅
I'm getting a Type string expected Bool error for this line:

_this select 0 addAction[
  ...
];

_this is the parameter for the script. The script was executed in an object init by

0 = [this] execVM "scripts\choosePlan.sqf";
#

Which is strange because _this select 0 is neither bool nor string, and addAction doesn't even accept string

winter rose
#

the solution might be in the ... @potent dirge

also, use params whenever possible

potent dirge
#

I've finished debugging each parameter and I think I figured it out. Somehow the radius parameter is only accepting string and not number? Using any number value throws Expected String error even though the Biki description says it only takes number

#

Wait no this is wrong I missed one param. Clear sign I need to sleep. Good night

silent latch
real tartan
#

is there function to get "select one from array"? _one = (_array select { code }) select 0;

tiny wadi
#

Is there an easy way to detect if an object is a map object?

#

I would assume isKindOf but there isn't really a base class I can use for saying type of map object

winter rose
#

@tiny wadi maybe the smallest nearestTerrainObjects search ever yes ^^

tiny wadi
#

thats actually what i've ended up resorting too

#

seems like a waste tho

#

in performance

winter rose
#

not if you use the object's position and the smallest radius?

#
private _isTerrainObject = {
  params ["_object"];
  private _terrainObjects = nearestTerrainObjects [_object, [], 0.1];
  private _result = _object in _terrainObjects;
  _result;
};
```@tiny wadi
tiny wadi
#

ahhhhh okay

#

didnt think of making it happen at the object

#

thank you

winter rose
#

yeah no need to grab the whole map for comparison, I am behind you on that one 😄
though an isTerrainObject would be nice… 🤔
not too late to ask!

tiny wadi
#

haha it might be 🤔

#

but yeah nah i did a 4meter radius check initially for mine

#

the 0.1 will be much better

winter rose
#

is there function to get "select one from array"? _one = (_array select { code }) select 0;
@real tartan this…? also, be sure to cover the case where the array is empty

winter rose
#

@lucid valve how do you execute unitPlay?
also, have you tried with a vanilla airplane?

queen junco
#

Hey I send a message here earlier this week. But I got another quick question. I used the tutorial from killzone kid to create a livefeed which I wanted to use as a helmetcam. All good so far, works fine. But when I wanted to use it in multiplayer I noticed that only the character sending the feed is able to see it on screens. Now my question: Is the script working clientside only or what error may I have done?

cam1 = "camera" camCreate [0,0,0];
cam1 cameraEffect ["Internal", "Back", "man1rtt"];
cam1 attachTo [source1, [0.12,0,0.18], "head"];```
winter rose
#

it is indeed clientside only

#

not because of the setObjectTextureGlobal, but because the camera is a local object I believe.

try to remote exec a function on each client for best results @queen junco

queen junco
#

@winter rose thanks for the fast answer. I am not that into arma scripting though. So am I correct if you suggest I remoteexec the script on every player?

potent dirge
#

Found a hacky workaround to my earlier problem. I was able to get the functions to work, but somehow in the process of defining description.ext, none of my mods would load so long as I had that description.ext. Maybe there's a way to define mods to load ni description.ext I don't know.
Instead I just made the object public and made the function call after execVM compiled in init.sqf and it works fine

winter rose
#

yes
not to use ["camera", [0,0,0]] remoteExec ["camCreate"]
but to make one file and have it called e.g in initPlayerLocal.sqf

queen junco
#

okay, thanks ^^

winter rose
#

@queen junco don't forget, some players have PiP disabled too 😉

quaint ivy
#

This may not be the correct channel to ask in but I've heard somewhere that AI units spawned by a Zeus are processed on the Zeus' machine instead of the server, kind of like a Headless client. Is this true?

winter rose
#

I don't think this is true

still forum
#

Yes thats true

quaint ivy
#

Is it possible to avoid it trough scripting?

still forum
#

you can setGroupOwner

quaint ivy
#

Alright, thanks for the lead

winter rose
#

wb, "Dedmen"! ^^

dusky pier
#

@still forum in new update is changed something with inventory?

still forum
#

what mean

dusky pier
#

i tryed to fix duplicating backpacks with loot a few days ago - duplicating is worked

#

now - not working

#

so i understand is fixed with update?

still forum
#

depends on what method you used

#

there is a fix for a method that was used on dev branch. but not in todays update

dusky pier
#

can i send u pm with screenshots?

still forum
#

is it related to sitting in a vehicle?

dusky pier
#

yes, but not only inside vehicle (u can do that from outside)

still forum
#

pm me screenshots then

#

the inside vehicle one is fixed in next updoot

still latch
#

How can I handle JIP player connection but on client side?

still forum
#

initPlayerLocal.sqf ?

winter rose
#

@still latch do you mean "if someone else connects, other players should get notified"?

#

if so, possibly an addMissionEventHandler ["PlayerConnected"] on the server that would then broadcast something.

still latch
#

I want to create action menu entry on player connection

#

initPlayerLocal.sqf ?
@still forum
seems legit except that it will be executed before init.sqf where I want to define condition related value.
Hope spawn and waitUntil !isNil "var" will work in initPlayerLocal.sqf

winter rose
#
waitUntil { not isNull player }``` ?
still latch
#
[] spawn {
    waitUntil { !isNil "allowedUsers" };
    if (player in allowedUsers) then {
        player addAction .....;
    };
};```
winter rose
#

isNil

#

also, aren't public variables sent before the inits are run? 🤔

#

@still forum, you maybe have a tip on that? ^

still forum
#

not right now no

#

isNil should be fine

#

don't trust things written on wiki 😄

queen junco
#

Hey I got another question. I am still trying to get the cam feed working in multiplayer. But after adding the script to one file beeing loaded only the last player spawned could see all cams. I assumed this is due to the camera being created again with the same variable once a new player spawned.

_retVal = if (!alive cam1) then {
    cam1 = "camera" camCreate (ASLToAGL eyePos source1);
    cam1 cameraEffect ["Internal", "Back", "man1rtt"];
    cam1 attachTo [source1, [0.2,0,0.2], "head"]; 
}
else {
    cam1 cameraEffect ["Internal", "Back", "man1rtt"];
    cam1 attachTo [source1, [0.2,0,0.2], "head"];      
};```
This was my idea on a solution. But it seems like it broke everything. Anyone got an idea?
winter rose
#

```sqf

also, use only setObjectTexture since the script is local

#

you also might want to check (if not isNil "cam1")

formatting tips is in the pinned messages

queen junco
#
receiver1 setObjectTextureGlobal [0, "#(argb,512,512,1)r2t(man1rtt,1)"];
_retVal = if (!alive cam1) then {
    cam1 = "camera" camCreate (ASLToAGL eyePos source1);
    cam1 cameraEffect ["Internal", "Back", "man1rtt"];
    cam1 attachTo [source1, [0.2,0,0.2], "head"]; 
}
else {
    cam1 cameraEffect ["Internal", "Back", "man1rtt"];
    cam1 attachTo [source1, [0.2,0,0.2], "head"];      
};```
winter rose
#

```sqf ← line return
/* your code */
hint "works!";
```
↑↓

/* your code */
hint "works!";
#

yup

#

also, no use of _retVal here

exotic flax
#

so I see 3 variables, although none of them are the current player, and all are global:

  • receiver1 = object which displays feed(?)
  • cam1 = camera object which is recording the feed to receiver1
  • source1 = object on which the camera is attached
#

so how is this called and how are the variables defined?

queen junco
#

-receiver1 being the screen which displayes the feed
-cam1 as you said
-source1 as you said as well
receiver1 and source1 one just being the variable name of the object in the editor

winter rose
#

do you reuse cam1 anywhere?

queen junco
#
source1 addEventHandler [ 
  "Respawn", 
  { 
    _handle = execVM "livefeed.sqf";
  } 
];

source2 addEventHandler [ 
  "Respawn", 
  { 
    _handle = execVM "livefeed.sqf";
  } 
];

source3 addEventHandler [ 
  "Respawn", 
  { 
    _handle = execVM "livefeed.sqf";
  } 
];```
yes, when anyone else spawns
still forum
#

_handle = useless to create a variable that you're throwing away right away anyway

queen junco
#

So basically if I dont use the if then else the feed will be displayed to the last player spawned. And I thought checking if the camera was already created could fix this issue but not sure.

high silo
#

Trying to make a IED explode when a AI is shot and killed, but when I do !alive it just sets of the IED straight away. How to I reverse this

winter rose
#

Trying to make a IED explode when a AI is shot and killed

when I do !alive it just sets of the IED straight away

…what do you want to do, delay it?

high silo
#

When the AI is shot and killed I want a IED to explode

winter rose
#

and what is your code…?

high silo
#

Im doing if {!alive x; IED setdamage 1}; But that just explodes it straight away, as its returning True.

winter rose
high silo
#

That code isnt working now, I was playing around with and broke it.

winter rose
#

also: you don't want to "check if the unit is dead", you want to "wait until the unit is dead".
if is an immediate check, waitUntil is what you need

#

try the following

waitUntil { not alive x };
IED setDamage 1;
```given that `x` is your unit varname
high silo
#

Didnt work

winter rose
#

where is this code, in a trigger?

high silo
#

init for the AI, should I put it in a trigger instead?

winter rose
#

no, no
ideally, don't use init fields for MP missions

high silo
#

I placed it in a trigger, gonna test it now

#

Works now

winter rose
#

NO urgh

high silo
#

urgh?

winter rose
#

if you have to use init fields, use```sqf
if (isServer) then
{
this spawn {
waitUntil { sleep 1; not alive _this };
IED setDamage 1;
};
};

high silo
#

I just placed it in a trigger, it works so gonna leave it as is

winter rose
#

make it server-side ☝️

high silo
#

Thanks for the help, and I did.

compact maple
#

Hey, a button on a GUI should call or spawn a script ? Whats the better way

winter rose
#

it all depends on what you want to do with it

compact maple
#

The script is going to change a text of a ui element

winter rose
#

the current interface?

compact maple
#

Yes

winter rose
#

then call I would say, if it doesn't take ages

compact maple
#

Ok. call just put the script at the end of the scripts list to be executed right ?

#

spawn execute it right away?

winter rose
#

no, that's not that

code1 call { code2 }
code1 waits for code2 to finish

code1 spawn { code2 }
code1 and code2 run """in parallel"""

compact maple
#

Ok got it, thanks, again

teal sequoia
#

idk if this is a good channel to ask in but i dont think i can do it anyway other than script it

how can i do that players without guns will be civilians and if they take any weapon they will be back to their old faction

winter rose
#

you can use setCaptive when they have no weapons

teal sequoia
#

ok thanks

misty salmon
#

Hello every one, I have a simple question, how do I force an aircraft to drop a bomb? I tried forceWeaponFire and Fire commands

winter rose
#

1/ how did you try them?
2/ which plane?
2/ which bomb?

wet shadow
#

You could try BIS_fnc_fire

misty salmon
#

I tried this:
driver jet1 forceWeaponFire ["pylon1rnd_FuelTanka4_w","LoalAltitude"];
jet1 forceWeaponFire ["pylon1rnd_FuelTanka4_w","LoalAltitude"];
driver jet1 fire "pylon1rnd_FuelTanka4_w";
jet1 fire "pylon1rnd_FuelTanka4_w";

#

maybe de name of the munition is wrong, I get it by ussing getPylonMagazines jet1; I dont know if it is the correct way to get it

#

oh yeah, I was using the incorrect munition, thanks @wet shadow I made it work using that function

oblique arrow
winter rose
#

yipp yep

jagged elbow
#

Does anyone know of any tutorials for extdb3? All i can find is altis life and exile tutorials and the documentation for extdb3 is slightly advanced for my current level of knowledge

ebon ridge
#

I found a case where BIS_fnc_attachToRelative fails totally: I'm trying to attach Sign_Pointer_Cyan_F to Land_WoodenTable_02_large_F and it doesn't preserve orientation at all.

#

setVectorDirAndUp doesn't work on these Sign_Pointer_Cyan_F properly either

#

Is there some known bug with some objects like this?

still latch
#

mission with #include #include "\a3\ui_f\hpp\defineCommonGrids.inc" in description.ext works in single/multiplayer editor and fail if exported to multiplayer.
Is this known behavior? How to fix?

gilded rover
#

how does the new arsenalRestrictedItems work exactly? and what would be a better way to create a Arsenal that has limited objects?

hollow thistle
#

@still latch double include is not correct, hope you have only one in your source.

#

Not working includes after eden export is a known issue.

#

You can just copy the folder and use that. Missions does not have to be a PBO

#

at least for an windows server.

still latch
#

Yep I just copied needed defines directly in description.ext. Thank you

upbeat grove
#

Hey, does anyone know how I'd apply loadouts to a group of ai units? I spawn the units with

_groupWest = [getMarkerPos _markers, west, _groups] call BIS_fnc_spawnGroup;

and I tried using, but setUnitLoadout needs a Object not a Group

_groupwest setUnitLoadout [
    ["arifle_MX_ACO_pointer_F","","acc_pointer_IR","optic_Aco",[],[],""],
    [],
    ["hgun_P07_F","","","",["16Rnd_9x21_Mag",16],[],""],
    ["U_B_CombatUniform_mcam",[ ["30Rnd_65x39_caseless_mag",2,1] ]],
    ["V_PlateCarrier1_rgr",[]],
    ["B_AssaultPack_mcamo_Ammo",[]],
    "H_HelmetB_grass","",[],["ItemMap","","ItemRadio","ItemCompass","ItemWatch","NVGoggles"]
];
ebon ridge
#

Regarding attachTo not working I found a related post at last that had the solution: run attachTo twice :/

_mrk attachTo [_object, _relPos];
_mrk setVectorDirAndUp [_vectorDir, _vectorUp];
_mrk attachTo [_object, _relPos];

Now it works perfectly in all cases I have tested.
If I don't run the second one it will not correctly orient objects when attaching them to some other objects, its not clear what the differentiating factor is.
This should really be in the docs somewhere as its a major bug with this function.

#

@upbeat grove just do that but instead run

{
  _x setUnitLoadout [blahblah];
} foreach units _groupwest;
upbeat grove
#

Thanks @ebon ridge, that worked splendidly. I might be pushing it here, but is there any way to give separate members of this group separate loadouts? This is my units

_groups = ["CUP_B_US_Soldier","CUP_B_US_Soldier","CUP_B_US_Soldier"];
ebon ridge
#

well i guess you know they come with their own loadout when you spawn them right, based on what the class author gave them?

upbeat grove
#

yea, but I'd like to give them custom loadouts separately from each other ideally

ebon ridge
#

but of course you can customize all the units differently

#

This is my units
That looks like a list of unit classes

#

anyway if you make an array of loadouts you could assign random ones to each unit in the group like this:

private _loadouts = [[loadout],[loadout],...];
{
  _x setUnitLoadout selectRandom _loadouts;
} foreach units _groupwest;
#

Or if you have 3 loadouts and want to assign it to three units you could do it like:

private _loadouts = [[loadout],[loadout],...];
{
  _x setUnitLoadout _loadouts#_forEachIndex;
} foreach units _groupwest;
#

That will give an error of some kind if you don't have enough loadouts defined

upbeat grove
#

Thanks I really appreciate it, I'll see if I can get that working

lunar plume
#

Hi everybody I have one question for script its possible help

#

?

robust hollow
#

k

lunar plume
#

I have a script to make vehicles appear from the virtual arsenal that works very well in solo and once in multi and then it makes the vehicles appear normally but the other players don't see why ?

robust hollow
#

at a guess id say the vehicles are local only, but idk for sure.

#

or ur unhiding them locally? upload ur script so i can see what u are working with.

lunar plume
#

No the vehicles are not local I can try to send you back the script page

robust hollow
#

sure

robust hollow
#

works for me, but the best I have to test on is a local server with multiple clients of me connected, so its not identical conditions.

lunar plume
#

Okay, but I'm going to try to see if it might work.

lofty anchor
#

i could do with some help if anyone could, i made a Warlords mission and i added a custom hint that welcomes the player and give my discord info i added a little scrip to wait for the player to initialise before displaying the hint but now im not able to enable AI because if i do it brakes the warlords, warlords wont start up and will display a load of errors so the only code i changed is as follows

initPlayerLocal.sqf

_iff = [units group player] execVM "a3\missions_f_exp\campaign\functions\fn_exp_camp_iff.sqf";
addMissionEventHandler ["PreloadFinished", {preloadFinished = true;}];
[] execVM "Welcomehint.sqf";```
queen junco
#

Hey quick question: How do I check if a player is dead in a if then command?

if (isNil source1) then {};

This is what I came up with. But it seems like it is not working.

robust hollow
#

if !(alive source1) then {};

queen junco
#

thanks ^^

cosmic lichen
#

@queen junco it's sqf isNil "source1"

#

but yeah, what connor said

queen junco
#

I worked around it by using addEventHandler "killed"
but thanks ^^

austere sentinel
#

Is there an EH for weapon switching? I.E. Player has pistol equipped, then switches to primary?
Trying to force holster while a player is moving an attached object. I'd like to avoid using a while loop in the interest of performance

still forum
#

CBA has one

#

a player event

austere sentinel
#

I'll take a look. Haven't really gotten into their stuff yet, thanks!

eager stump
#

Using getObjectTextures on a vehicle works nicely. I tried this on a cargo box "Land_Cargo40_orange_F" and it returns nothing. What is the logic or what am I doing wrong?

robust hollow
#

hiddenselections i think theyre called. basically you can only get the texture if you can set it too. evidently you cant set the texture on that cargo box.

young current
#

All objects are not configured with them

eager stump
#

Thx. Seems that 'all' cargoboxes behave that way.

robust hollow
#

you can still find the texture paths. its been a while but iirc they are in the cfgvehicles object class which you can look at in the config viewer.

#

im not sure that applies to all objects though.

eager stump
#

I'll just attach a sign to the container as I could change the texture on it. 🙂

austere sentinel
#

is there a list of keywords for BIS_fnc_randomPos, or is it just "ground" + "water"?

winter rose
austere sentinel
#

😁 yeah figured as much

winter rose
#

I just checked the code, and there is no other "magic keyword"

exotic flax
#

technically it's just surfaceIsWater and !surfaceIsWater

winter rose
#

how dare you reveal the dark secrets of our evil overlords…!

austere sentinel
#

😆

exotic flax
#

but you can use the condition field to add additional checks (like {isOnRoad _this} in the comments of the wiki page)

austere sentinel
#

I may look into that. Don't think it'll be too useful for what I'm planning though.

Basically just want to select a random position either starting from the map center, or from one of two bases (depending on which team is winning at the moment) to spawn bonus weapons & gear.

May just use two triggers & a switch/if tree to select which mode to use

mighty vector
#

Hi.

Is there any way, form the server side pov, to run a command when a mission starts, without having to edit missions init.sqf ?

eg:i want to run "myserver.sqf" at mission startup, no matter what mission is loaded or if the mission editor included something in init.sqf or not.

my best bet would be to make a mod (probably there are some to do this, already)

halcyon crypt
#

yep, you'd need a mod for that

#

anything else is mission based

mighty vector
#

do any of you know if there are any mod for this?

#

(going to ask on general)

winter rose
lapis ivy
#

Help me please...

waitUntil {!(isNull player)};
waitUntil {player==player};
switch (side player) do
{
case WEST:
{
        [[west], [east,independent,civilian]] call ace_spectator_fnc_updateSides;
        FW_SpectatorSides call ace_spectator_fnc_updateSides;
};
case EAST:
{
        [[east], [west,independent,civilian]] call ace_spectator_fnc_updateSides;
        FW_SpectatorSides call ace_spectator_fnc_updateSides;
};
case RESISTANCE:
{
        [[independent], [west,east,civilian]] call ace_spectator_fnc_updateSides;
        FW_SpectatorSides call ace_spectator_fnc_updateSides;
};
case CIVILIAN:
{
        [[civilian], [west,east,independent]] call ace_spectator_fnc_updateSides;
        FW_SpectatorSides call ace_spectator_fnc_updateSides;
};
};
winter rose
#

@lapis ivy ```sqf, see pinned message

lapis ivy
#

Is that correct?

#

I need to prohibit surveillance of the enemy. But the script returns an error. Can you help me?

ebon ridge
#

What error?

lapis ivy
#

I deleted a line "FW_SpectatorSides call ace_spectator_fnc_updateSides" nd now it works.

winter rose
#
waitUntil {!(isNull player)};
waitUntil {player==player};
```is redundant - you could simply use ```sqf
waitUntil { not isNull player };
lapis ivy
#

Thanks

smoky verge
#

small question
what does this do exactly?

if ((!isServer) && (player != player)) then {waitUntil {player == player};};
oblique arrow
#

I think it means that its waiting for the player to be loaded in? That'd be my guess atleast, the smarter peeps props know

still forum
#

the && player != player is useless

smoky verge
#

I see this basically in all multiplayer scripts so I was curious of what it did

still forum
#

it waits till player is initialized

#

in init.sqf

#

because init.sqf starts before player is ready

smoky verge
#

by initialized it means the player can actually see ingame?

oblique arrow
#

rooHappy I guessed correctly, just with the wrong wording

still forum
#

by initialized it means the player can actually see ingame?
no

#

when the unit is assigned

#

before that player returns objNull

solemn token
#

waitUntil {player == player}
Sound useless for me.
true == true / false == false will always return true

still forum
#

no

#

objNull == anything always returns false

solemn token
#

Oh, so

player == objnull

Would also return false here?

still forum
#

yes

solemn token
#

✍️

winter rose
#

objNull == objNull // returns false

smoky verge
#

was looking for ways to make sure my scripts worked for the entire server and not only for the trigger activator
should I just activate the server only checkbox or do I need extra lines?

solemn token
#
objNull == objNull // returns false

Damn, you are right.

winter rose
#

oh thank you!!1!

#

but it is more readable to do ```sqf
waitUntil { not isNull player };

smoky verge
#

lol

solemn token
#

We NEVER complete learning

winter rose
#

…especially AI and driving 😁

solemn token
#
waitUntil { not isNull player };

Thx, this would be my check in general. But it is also important to know how other checks would work in that case ☝️

smoky verge
#

so how do I activate a script for everyone in the server and not just for me?
though that did the job

oblique arrow
#

Depends on what it does I imagine, maybe a forEach player kinda thing if it does somethig for every individual player?

#

as in call/spawn forEach player (not accurate Syntax)

solemn token
oblique arrow
#

Oh ye fair, depends on when the script needs to be executed I guess

solemn token
#

Yes, correct.

#

You can also do everything just within the init.sqf by a check like this:

if (isserver) then {
    ....
};
if (hasinterface) then {
    ....
};

But there are several ways to differ where a script will be called.

lapis ivy
#

Help please...
@winter rose
You helped me make the call Serp unitprocessor work. But now I have another problem.
The script issues equipment at the beginning of the game and after the player respawn. But it gives respawn not to one unit, but to everyone who has one script written.
Example:
There are three units with equipment "officer_squadleader"
With respawn, it is activated on all three units, it does not matter if they are alive or not. Also, when you enter the game slot, the same thing happens.

[this,"opfor","officer_squadleader"] call SerP_unitprocessor;
if ( isServer ) then { 
  this addMPEventHandler ["MPRespawn", { 
      params ["_unit", "_corpse"]; 
      [_unit, "opfor", "officer_squadleader"] call SerP_unitprocessor;   }]; 
};```
#

How can I make one script work on several units, but for the script to give out equipment only to the unit that has just respawning or entered the game.

#

unitprocessor.sqf

_unit = _this select 0;
_faction = _this select 1;
_loadout = _this select 2;

_item_processor = {
    removeAllItems _this;
    removeAllWeapons _this;
    removeAllItemsWithMagazines _this;
    removeAllAssignedItems _this;
    removeUniform _this;
    removeBackpack _this;
    removeGoggles _this;
    removeHeadgear _this;
    removeVest _this;
};

_unit call _item_processor;

_svn = format ["SerP_equipment_codes_%1_%2",_faction, _loadout];
if (isNil _svn) then
{
    missionNamespace setVariable [_svn, compile preprocessFileLineNumbers format ["Equipment\%1\%2.sqf", _faction, _loadout]];
};

[_unit] call (missionNamespace getVariable [_svn, {}]);
#

officer_squadleader.sqf

comment "Добавляем Items, карту, компас, часы и рацию";
_unit linkItem "ItemMap";
_unit linkItem "ItemCompass";
_unit linkItem "ItemWatch";
_unit linkItem "ItemRadio";

comment "Добавляем униформу";
_unit forceAddUniform "rhs_uniform_msv_emr";
_unit addHeadgear "rhs_6b27m_green";
_unit addVest "rhs_6b23_digi_6sh92_headset_mapcase";

comment "Добавляем ДВ рацию";
_unit addBackpack "tf_mr3000";

comment "Добавляем бинокль";
_unit addWeapon "Binocular";
queen cargo
#
// Добавляем Items, карту, компас, часы и рацию
_unit linkItem "ItemMap";
_unit linkItem "ItemCompass";
_unit linkItem "ItemWatch";
_unit linkItem "ItemRadio";

// Добавляем униформу
_unit forceAddUniform "rhs_uniform_msv_emr";
_unit addHeadgear "rhs_6b27m_green";
_unit addVest "rhs_6b23_digi_6sh92_headset_mapcase";

// Добавляем ДВ рацию
_unit addBackpack "tf_mr3000";

// Добавляем бинокль
_unit addWeapon "Binocular";``` btw.
no need for the `comment` stuff
lapis ivy
#

Okay

tough abyss
#

Anyone know how i can mute von locally from near players?

jagged elbow
#

Anyone able to explain why when i kill the Ai with the variable name testAI it sets my cash variable to 200 istead of 100? Cash is initially defined as 0 so to my understanding once the AI is killed it should update the value by 100 but its updating it by 200?

execVM "shop.sqf";
_clientID = clientOwner;
_UID = getPlayerUID player;
_name = name player;
cash = 0;

checkForDatabase = [_clientID, _UID, _name];
publicVariableServer "checkForDatabase";

// player addAction ["Sync Data",
// {
//   _UID = getPlayerUID player;
//   _gear = getUnitLoadout player;
//   saveData = [_UID, _gear];
//   publicVariableServer "saveData";
//
// }];

"loadData" addPublicVariableEventHandler
{
  private ["_data"];
  _data = (_this select 1);
  _gear = (_data select 0);
  cash = (_data select 1);

  player setUnitLoadout _gear;
};

player addAction ["hint cash", {hint str cash;}];

testAI addEventHandler ["Killed",
{
  cash = cash + 100;
  hint str cash;
}];

_saveDataScript = {
    execVM "saveData.sqf";
};

waitUntil {
    _until = diag_tickTime + (2 * 60);
    waitUntil {sleep 1; diag_tickTime > _until;}; // wait until the timer is greater than whats time is stored in local variable _until.
    0 spawn _saveDataScript;
    false; // Loop waitUntil forever. Once the timing condition is met and the function has been spawned as a separate thread, it will return false and loop to the beginning of the original empty waitUntil.
};
surreal peak
#

@tough abyss can you elaborate on what your end goal is? May or may not be possible depending on what you are trying to achieve

winter rose
#

@jagged elbow you may run your script twice. put a systemChat to be sure.

jagged elbow
#

so it turns out the script is running twice

#

but i have no idea why

#

or how

tough abyss
#

who here knows cfgFunctions

robust hollow
#

i know him. good guy.

tough abyss
#

I need help with cfgFunctions and scripts not running

robust hollow
#

ok... set the scene for us. how is everything set up? what are you working with?

winter rose
#

@tough abyss but the wiki has

still forum
#

@tough abyss what other info would you want?

vocal agate
#

Greetings. To get a grasp on the modding stuff, I am currently "creating" a module that syncs to any kind of static objects and adds an action to them (through addAction). This works fine, however, any kind of "big" flag poles do not have that action applied to them.

The function that is run by the module is the following:

private _logic        = param [0, objNull, [objNull]];
private _objects    = param [1, [], [[]]];

private _actionDText        = _logic getVariable ["ActionText", ""];
private _actionDistance        = _logic getVariable ["ActionDistance", 3];

{
    _x addAction [
        _actionDText,
        { createDialog "CORP_TeleportDialog" },
        nil,
        100,
        true,
        false,
        "",
        format ["(player distance _target) < %1", _actionDistance]
    ];
} forEach _objects;
#

I have placed the module in the editor and synced a few objects to it. Namely, a camping table, an Altis map, a Flag (Checkered), a Flag (BI) and a Flag (Blue). Objects in bold are those on which the script seemingly has no effect (there is no addAction).

#

However, I tried to apply the same addAction to said objects in their init fields, and this worked fine.

#

I am consequently unable to understand what is going wrong in the function, compared to the actual "addAction" script in the init field of the objects.

#

hint (str _objects) clearly shows that all objects (including the flags that don't work) are listed in the _objects array

still forum
#

maybe the poles are simple objects somehow?

#

not sure if they can have actions

#

However, I tried to apply the same addAction to said objects in their init fields, and this worked fine.
nevermind I didn't finish reading yet

robust hollow
#

are the synced flag poles in _objects the same object as what you actually look at in game? it doesnt pull some sneaky switch-a-roo on you?

vocal agate
#

it doesnt pull some sneaky switch-a-roo on you?
Sorry, I don't understand that.

are the synced flag poles in _objects the same object as what you actually look at in game?
Is there a way I could confirm that?

still forum
#
} forEach _objects;
[] spawn {sleep 20; hint str _objects;}
#

if they are still in there 20 seconds later, its probably fine

vocal agate
#

Alright, I'll try that.

#

That's interesting

#

I've seen an error