#arma3_scripting

1 messages ยท Page 342 of 1

spice kayak
#

I realize how odd that looks, considering the variables.

#

ModTrack1Pos is the name of a Task Destination Module, which is what I can't get to move. vSmuggleTruck1 is the name of a vehicle, the one it's tracking.

#

I'd use a trigger, which does work when I have modTrack1Pos setPos (getPos vSmuggleTruck1) in the Activation Code, but I want it to activate every 60 seconds, like a ping, so I was doing it this way.

#

Yet everything else in that while { if { statement works :(

little eagle
#

How did you determine that the module did not move to the position of the truck?

spice kayak
#

When I go within range to activate the Task, the Task's destination has stayed the same (that being the origin point of the Destination Module, not where it should have moved to)

#

That said, I could quickly debug the two locations.

little eagle
#

If you execute:

modTrack1Pos setPos (getPos vSmuggleTruck1) 

via debug console, does the tasks destination move to the position of the module?

spice kayak
#

Interestingly, visually it does not move at all.

#

But the getpos for both the modTrack1Pos and vSmuggleTruck1 position are the same.

little eagle
#

Then I conclude that moving the task destination module does not move the tasks destination.

#

Which is what I'd expect.

spice kayak
#

Yet the task's destination is tied into the Task Destination Module, is it not? I mean, if you're using that module anyway.

#

Because it works if through a trigger.

#

Which is the odd part.

little eagle
#

No, it's not.

#

A module is just a game object that executes a piece of code at the mission start.

#

The module probably uses it's starting position to set the destination position of a task.

#

But there is no loop that updates that position. A loop would be needed.

spice kayak
#

The bit of code I sent before; is that not a loop? Because it loops.

little eagle
#

No, the piece of code is invisible and hard coded into the module.

#

It's nothing you wrote.

spice kayak
#

I admit, I'm mostly throwing stuff against a wall and hoping it sticks, so my understanding of the language is rather poor, sorry.

#

Right.

#

So would you kow anyway to update a task's location in a way similar to what I was attempting?

#

Sadly I can get everything else to update every minute, including markers and such, which I'm also using just in case, but I'd really like the task system in place too.

little eagle
#
    class ModuleTaskCreate_F: Module_F
    {
        function="BIS_fnc_ModuleTaskCreate";
#

I think this is the modules classname, right?

#

ModuleTaskCreate_F

#

Right?

spice kayak
#

I'm not sure, sorry.

little eagle
#

You can check in the editor.

spice kayak
#

If you could guide me to where I'd be able to see the classname, that would be great.

#

Oh.

#

Sorry, yeah, you're right.

little eagle
#

Found it:


    class ModuleTaskSetDestination_F: Module_F
    {
        function="BIS_fnc_ModuleTaskSetDestination";
#

"ModuleTaskSetDestination_F"

#

And all this module does, is execute this function:

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

if (_activated) then
{

private _modules = _logic call BIS_fnc_moduleModules;
private _module = objNull;

{if (typeOf _x == "ModuleTaskCreate_F") exitWith {_module = _x}} forEach _modules;


if (isNull _module) exitWith {false};

private _task = _module getVariable ["ID", ""];


if (_task == "") exitWith {false};

private _destType = call compile (_logic getVariable "Destination");


if (_destType == 1 && count _units == 0) exitWith {false};

private ["_dest"];

if (_destType == 0) then
{

_dest = position _logic;
}
else
{

_dest = [_units select 0, true];
};
private _showNotification = (_logic getVariable ["ShowNotification", 1]) == 1;

[_task,nil,nil,_dest,nil,nil,_showNotification] call bis_fnc_setTask;
};
indigo snow
#

if you set a unit as task destination, does the task not follow the unit around?

little eagle
#

I don't know. And the goal is to update it every 60 seconds.

#

Those modules are weird and their scripts suck. I'd just not use a module for this.

spice kayak
#

Yeah, was hoping to avoid it, but most of the basic task structure is module-based.

indigo snow
#

theyre pretty simple functions luckily

#

you can just have an infinite loop that calls the same function and sleeps every time

spice kayak
#

I tried tskLocateTruck1 setSimpleTaskDestination (getPos vSmuggleTruck1) too with no luck.

#

Well that's pretty much what I have. A function that loops every 60 seconds.

indigo snow
#

better off if you use the function

spice kayak
#

Or, something that loops every 60 seconds anyway.

indigo snow
#

[taskLocateTruck1,TRUCK] call BIS_fnc_taskSetDestination

#

local effects, so if this is for MP you have to remoteExecute the function

little eagle
#
[modTrack1Pos, synchronizedObjects modTrack1Pos, true] call BIS_fnc_ModuleTaskSetDestination;

This after updating the position of the module?

spice kayak
#

Thanks, I'll give that bit a try.

indigo snow
#

why even deal with the module at this point?

little eagle
#

Idk. It's moving atm.

indigo snow
#

if its MP youre gonna have issues if that module isnt local, i think

spice kayak
#

Well, it's being run through players that meet a certain condition, so maybe it's local?

little eagle
#

Yeah, network traffic of everyone moving the module.

indigo snow
#

it wont be local, Luro

#

[taskLocateTruck1,TRUCK] remoteExec ["BIS_fnc_taskSetDestination",SOMETARGET]

little eagle
#

The module object exists on every machine and is local to the server.

#

Global object owned by the server.

spice kayak
#

I'll give that last one a try in a second, thank you.

#

Didn't realize it was 4am :(

indigo snow
#

Rip

#

Ive had the pleasure of toying around with a lot of task stuff just last week so if you have questions about the commands and stuff, feel free to ask

spice kayak
#

Thank you.

#

Just to clarify about that SOMETARGET part though. If that what the destination should be, or? because I feel TRUCK would already do that.

#

Sorry, function confused me. I haven't had any experience with them, or their formating.

little eagle
#

SOMETARGET is the channel you want to execute the function (here: BIS_fnc_taskSetDestination).

#

You can just remove it from the array and it's done everywhere.

indigo snow
#

yea i assumed in MP some players might have other tasks or something, look up remoteExec on the wiki for whats all allowed

spice kayak
#

Oh

#

I'm an idiot.

#

I probably should have left it as SOMETARGETS then. I didn't realize what it meant.

little eagle
#

No, SOMETARGET is just a placeholder by cptnnick and it would error if you copy pasted it into your script like this.

indigo snow
#

^ yes

#

you can put a side, object, numbers, arrays of objects, all kinds of stuff if you look on the wiki

spice kayak
#

Yeah, I didn't copy it. Sorry, I meant i interpreted it to mean the location I wanted the task to go to, not the people who should execute it.

#

Yeah, poor wording on my part. Sleepy me.

indigo snow
#

yea no left side is what gets fed into the function itself

little eagle
#

TRUCK is the location

indigo snow
#

[arguments for function] remoteExec ["function",TARGETS]

#

which translates to [arguments for function] spawn function on the client

little eagle
spice kayak
#

Yeah, got that. Now I'm back to an older issue haha. No biggie though.

little eagle
#

Modules are a pitfall for beginners.

indigo snow
#

theyre ideal. in SP.

spice kayak
#

Ha, yeah. Now my issue is that it doesn't exist yet, so the game is going all mental at me.

#

I mean, I know what the issue is, and I had ways around that.

#

Actually.

#

Yeah, figures. Now my issue is that, the task doesn't exist when it's doing it's loop, so it's calling it an unknown variable. Yet if I assign a variable name to the task, the function you guys gave me fails.

little eagle
#

Where did taskLocateTruck1 come from?

spice kayak
#

From the completion of another objective.

#

Well, it's created from the trigger that ends the last task.

little eagle
#
modTrack1Pos getVariable ["ID", ""]

You can use this to get the task from the module.

spice kayak
#

If i was using [tskLocateTruck1,vSmuggleTruck1] remoteExec ["BIS_fnc_taskSetDestination",west];, is the modTrack1Pos module even needed?

little eagle
#

Triggers, modules... You made this unnecessarily complicated. If you did it all by script, it would be a hundred times easier to handle.

spice kayak
#

Ha, I'm sorry!

little eagle
#

is the modTrack1Pos module even needed?
Don't think it is.

indigo snow
#

what module is truly needed though

little eagle
#

Good question.

spice kayak
#

Well, none, but still.

#

This undefined variable thing is annoying though D:<

indigo snow
#

have you made a diagram of what youre doing? it helps me sometimes

#

just write up in your own words what happens in each step

spice kayak
#

Nah, I haven't made any diagrams, sorry. I think it's just because it's trying to call on the function too early, but even when I have measures in place to delay it until it's needed, I still get the error.

#

For example, trying this, while even waiting until the number = 1, which is clearly after the task is created, still gives me the undefined variable issue with the task's ID / name.

                    [tskLocateTruck1,vSmuggleTruck1] remoteExec ["BIS_fnc_taskSetDestination",west];
                };```
indigo snow
#

does that variable exist on other clients?

spice kayak
#

Which one? the tskLocateTruck1?

indigo snow
#

whichever one it complains about

spice kayak
#

Oh, it's saying tskLocateTruck1 is an undefined variable

indigo snow
#

well then that one

#

what is it supposed to be? how / when do you set it?

spice kayak
#

Well, the server creates the task, I'm assuming globally, or at least on the west side.

indigo snow
#

I'm assuming globally,

spice kayak
#

The task is created when the previous task's objective is complete, which is done via a trigger and a sync.

indigo snow
#

tasks are local

#

bad assumption

spice kayak
#

Oh, I didn't know that.

indigo snow
#

thats why you have to remote exec

#

everything with tasks is local

spice kayak
#

Right. So I'm not sure where to go from here, outside of trying to get the task to be declared globally, or scrapping it all together.

#

Man, I don't get why I can get a marker and shit to follow a target at intervals so easily, but a task? Nope.

indigo snow
#

because you dont have the string that is the task everywhere

#

markers are global so theyre everywhere, tasks not nevessarily so

#

thats why its a bit more involved

#

For yourself, draw out the workflow, what functions you call, what you execute, what variables are set in a very global manner so you have your structure clear

#

youre getting bogged down in minor details struggling to solve an error that likely can be avoided if you have a clearer picture

spice kayak
#

Yeah, for something that I think should be so simple.

indigo snow
#

Its simple when you wrap your head around it

#

but theres a level of understanding needed and just drawing / writing the structure out might help you with that

spice kayak
#

I'm not even sure where to start with that.

#

I mean, the system I was trying to implement isn't evne necessary.

#

It was just something I wanted because I figured it would flow better / look nicer.

indigo snow
#

yea so go for it man, youll end up learning something from it too

spice kayak
#

Maybe another day. I'm a little too tired I think. But thanks for the help though.

indigo snow
#

np

undone turret
#

When using the foreach command on an array? What do I put in the array so it will be used on my entire squad?

#

eg _myArray = [?];

delicate totem
#

_myArray = units player;

undone turret
#

I want it to be used on multiple AI groups using this to call on the script
null=group this execvm "charge.sqf";

#

Are you sure that will work?

delicate totem
#

That will not work, that returns the player's current squad.

undone turret
#

even if i use it on AI controlled squads?

warm gorge
#

Is it possible to set the frame color of a RscEdit control? Or do I need to just get rid of its frame and add my own RscFrame over it

delicate totem
#

@undone turret [group this] execvm "charge.sqf";
That will pass the group of the unit the script is running on to the script.
You could access that in the script by changing line 1 to
_myArray = _this select 0;

undone turret
#

not working for me

#

is there a way to change the execution of the script so that I can pass the entire group into the array?

delicate totem
#

How are you starting the script in the mission?

undone turret
#

null=group this execvm "charge.sqf";

#

in the squad leaders init

delicate totem
#

Alrighty. The script is aimed at working on the units in the group, but the function is only passing the group itself. First put in the square brackets. Things that are inside the square brackets before the script runs are passed to the script as parameters.
null=[group this] execvm "charge.sqf";
This passes the group of the squad leader to the script. The group is its own entity, it's not an array.
You could change the script to take that group and get the units in the group.

_myArray = units _group;```
or
if you want to pass the units that make up the squad leader's group, you could use
`null=[units this] execvm "charge.sqf";`
and in the script
`_myArray = _this select 0;`
undone turret
#

ok it works thanks

warm thorn
#

Does anyone have an idea how to reactivate the Incoming Missle Warning System of Hummingbirds?

spice kayak
#

@indigo snow After some sleep, I got it to work!

indigo snow
#

๐Ÿ‘

#

Nice

spice kayak
#

I realized I could use call BIS_fnc_taskExists to set a variable to true or false, and make it so the destination updates using call BIS_fnc_taskSetDestination only when the variable is true \o/

#

Thanks for all your help last night. Was downright stressful, but I'm grateful for the assistance, and for the knowledge of functions haha.

indigo snow
#

Yea no worries, its all a bit of learning, and executing stuff only on select clients isnt always trivial

#

And now the task icon moves and players will never know the blood sweat and tears that went into it haha

spice kayak
#

Ha, yeah, sadly. Especially when this mission will probably only be played once.

#

The idea was nice, and getting it into reality was fun, but how it'll play out I have no idea.

indigo snow
#

You know the trick for next mission too, now

spice kayak
#

Yeah, pretty much. Was actually using some code from a mission I made over a year ago as it was.

#

I actually think you helped me with that one too, if I remember correctly.

indigo snow
#

Or toy around with it, only update the icon when the vehicle passed certain checkpoints or has been spotted

#

I waste a lot of time in here its true

spice kayak
#

I think you helped me on Reddit actually.

#

But yeah, the way it is set right now is that the task destination will only update when the blufor are within range of the tracker, and only every 60 seconds.

indigo snow
#

If its player controlled, have it update everytime someone in the vehicle uses their radio (if you use acre or tfar)

spice kayak
#

Oh damn, it was two years ago you helped me. Found the thread haha.

#

That would be interesting, we do use TFR a lot.

#

I was thinking if there was any way that it would only be tracked based on the quality the short range radios would have.

#

But then the thought of having to figure that out hurt my head.

indigo snow
#

Just check the type of radio they have i guess

#

You can do a lot of funky stuff

spice kayak
#

Sounded neat though. If you were just in range, you'd get an area marker which covers a broad range, but the more you narrow in, the smaller it becomes.

indigo snow
#

Sure, and the SF forces might be able to deploy fake beacons or destroy the listening posts

#

Makes sneaky missions a bit more doable for the hunters

#

I like bullshitting about mission ideas if you hadnt noticed

spice kayak
#

Yeah, that would be neat. I guess I probably should explain the basics of the mission. Resistance has the objective to locate and deliver two armed prowlers, containing smuggled goods to their leader, who is hidden away. They know they're being pursued, hence the armed vehicles. Two of them.

Blufor on the other hand has the objective to assassinate the leader, but they don't know where he is. They do however have trackers installed into the smuggled goods, because of received intel blah blah blah.

#

That's the basics of it though. It started out as a 'Prowlers vs Littlebirds' fuckfest though.

halcyon crypt
#

anyone know a more fancy way to get "30_0" from "30_0_23_134" without using splitString and selects? Substrings don't work either since number of digits per part is variable

#

Currently have the below but it feels meh..

_tmp = "30_0_23_134" splitString "_";
_tmp = format ["%1_%2", _tmp select 0, _tmp select 1];
_tmp;
indigo snow
#

_string splitString "_" select [0,2] joinString "_"

#

parenthesis should not be needed

halcyon crypt
#

oh cool totally forgot about the array "substring" like thingy select ranges ๐Ÿ˜„

#

thanks

still forum
#

Always the same number of digits?

halcyon crypt
#

always 4 numbers but the number of digits per number vary

#

@indigo snow parenthesis aren't needed but I like it more with them for clarity ๐Ÿ‘

tough abyss
peak plover
#

What does that mean

#

Client groups, is that like how many groups are on the client?

#

also which side is fps?

subtle ore
#

How the hell did you manage 5 server fps?

#

even with 100 server groups

peak plover
#

and <30 client fps?

subtle ore
#

I'm a bit skeptical.

#

42 client fps with 100 groups of 5 at 12000 meter view distance not even cached yet. How did you test these results? @tough abyss

peak plover
#

maybe he has like 100s players and that's the median?

subtle ore
#

100s of players? 0_0

peak plover
#

Mad speculations, I can't think of another way to achive, what he has

subtle ore
#

No clue ๐Ÿคท

undone turret
#

while {alive count _myArray} do {};
Guys need help using an Array as condition, What would be the syntax in the codition above using the Array as the condition in a while loop?

subtle ore
#

@undone turret what? alive count _myArray alive needs to be checking a unit

undone turret
#

_myArray is all members of a squad

subtle ore
#
{alive _x} count units _myArray
undone turret
#

keep getting error

peak plover
#

What is your goal?

#

Does your code need to be executed more than once per frame?

undone turret
#

this is my code

#

trying to make a charge script

#

where it used on the entire squad

peak plover
#

it won't work

undone turret
#

why?

peak plover
#

You want your units to switch between lying down and standing up?

undone turret
#

at the moment yes

#

I want it to pick a random unit out of the squad to sqwitch between going up and down

subtle ore
#

Why are you using a number return value as a condition for while ?

#

and can you even use special variables with while ?

undone turret
#

not really sure, what do you mean by number return value?

#

Haven't really tried working on the statement of the while loop yet

#

trying to get the condition to work first

peak plover
#

while does not contain _x

#

units _myArray

#

wrong

undone turret
#

ok

#

I'm confused

#

So i can't use _x in the condition?

peak plover
#

not with while

#

familiarize yourself with the commands you use...

undone turret
#

ok

peak plover
#

If you still stuck after that, just ask ๐Ÿ˜‰

undone turret
#

ok, thanks

undone turret
#

ok got what i wanted to do working

#

using this

peak plover
#

hmm

#

It won't work as intended

#

while {alive _x} do
This means it will not go to the next unti until the first one dies

#

I don't think that's your intent

daring pawn
undone turret
#

@peak plover maybe, they seem to be randomly proning atm though

daring pawn
#

but thats 7 years old now, i'd imagine some updates since then have made an easier/faster solution

subtle ore
#

@daring pawn handleDisconnect is the only one that has a player object passed

#

but Nigels concept is better if it works.

daring pawn
#

I'm using this in a missionEventHandler. Trying to get the player's object when they connect/disconnect so I can save/load data I have to inidbi

peak plover
#
while {alive _x} do {
 
 hint "working";
 _currentElement =  selectRandom _myArray;

You are doing the event for a random unit from your array, while a certain unit is alive...

undone turret
#

what is the certain unit that is alive?

peak plover
#

forEach _myArray;

undone turret
#

is it the enitre array?

peak plover
#

The first unit in the list... until he dies, it will be the 2nd unit and so on

undone turret
#

thats what I wanted

peak plover
#

But it will run the up/down to random units until they are all dead

undone turret
#

thats what i wanted(for now)

peak plover
#

It's wrong. I'm having trouble explaining why...

west veldt
#

I got hacked ._.

subtle ore
#
(units _myArray); //otherwise you're just selecting the group
undone turret
#

already made a varible for _myArray with units in it

subtle ore
#

it's a bit slopy. why not just do

_myArray = units (group _this select 0);
undone turret
#

ok

#

trying to make the AI charge, why the hell did BIS change careless behaviour to make them walk ๐Ÿ˜ฆ

#

can't make the AI break combat and retreat as well because the dam AI just walk, even when set to speed full

subtle ore
undone turret
#

I know

#

but CARELESS forces the AI to walk

subtle ore
#

Set them to aware if you really want to get picky

undone turret
#

ok aware works, as it seems

peak plover
#

Do you want them to charge or break contact?

subtle ore
peak plover
#
  • enableAttack false
undone turret
#

I want them to charge

subtle ore
#

"RED" (Fire at will, engage at will)

#
_group1 setCombatMode "RED"
#
_group1 enableAttack true;
spice kayak
#

Hey, I'm sorry, but you think anyone could help me understand this? I was running my mission a few times, changing one or two things with tasks, but nothing that should have caused this, which seemingly came out of nowhere. http://i.imgur.com/BSSuo6Q.png

subtle ore
#

That is a BI error

spice kayak
#

private _destType = call |#|compile (_logic getVariable "Destination...'
Error compile: Type Number, Expected String
File A3\modules_f\Intel\Functions\fn_moduleTaskSetDestination.sqf
 [BIS_fnc_moduleTaskSetDestination.sqf], line 28```
#

There you go, sorry about the image before.

#

Ah, so nothing on my part?

subtle ore
#

Yep if it's an A3 root error then nothing on your part

spice kayak
#

Just seemed a little odd, but thank you.

subtle ore
spice kayak
#

Yeah, will do. Thank you.

subtle ore
#

Yep.

spice kayak
#

Well dang, that means my mission is out for now :C

subtle ore
#

Well if you send it in and have them review it, they won't ever not fix it. But it may take a while for a hotfix maybe

spice kayak
#

I actually found out what specific module that was breaking stuff.

subtle ore
#

setTaskDestination ?

spice kayak
#

Yeah, I did just add one more of those modules and sync'd it to a task module I had.

#

For some reason, that one specific taskDestination module broke, despite me using them elsewhere.

subtle ore
#

could be completely conditional I guess

quartz coyote
#

Hello, I created a vehicle with weapons in it :

Weapon = "GroundWeaponHolder" CreateVehicle [0,0,0];
Weapon AddWeaponCargoGlobal ["srifle_LRR_SOS_F",1];
Weapon AddMagazineCargoGlobal ["7Rnd_408_Mag",3];
Weapon SetPos (GetPosATL Player);

Now i'd like to detect if the weapon is in or not. something like :
if (Weapon hasWeapon "srifle_LRR_SOS_F") then {
OR
if ("srifle_LRR_SOS_F" in Weapon) then {

But it's not working. Can someone help

indigo snow
digital pulsar
#

where do JIPs spawn if their units start in vehicles?

#

i.e. what happens when vehicle is destroyed

#

or someone occupies their seat

quartz coyote
#

@indigo snow tried this but not working ether Content = getWeaponCargo Weapon;
if ("srifle_LRR_SOS_F" in Content) then {

indigo snow
#

look at the wiki page for the getWeaponCargo command, it's probably a different format than you expect

quartz coyote
#

@indigo snow it returnes this : [["srifle_LRR_SOS_F"],[1]]

indigo snow
#

right so you have to select that first array inside of that array to use the in command

#

so something like _content = getWeaponCargo Weapon select 0

delicate totem
quartz coyote
#

@indigo snow if ("srifle_LRR_SOS_F" in (Content select 0) then {
??

indigo snow
#

or use the command that Tommo linked and I forgot about

quartz coyote
#

@indigo snow @delicate totem Sure but I don't understand how it works ... To me it's ... the same thing as GetWeaponCargo

indigo snow
#

look at the return value on the wiki, its a different structure

quartz coyote
#

@indigo snow @delicate totem but you still have to select in the array don't you ??

indigo snow
#

no because the weapons wouldnt be in a sub array

#

you dont have to ping me every time btw

quartz coyote
#

yeah sorry ^^ bad habit. i'll try this out

delicate totem
#

weaponcargo returns one single array of all weapons in the container. If the container had three of those weapons, it would return
["srifle_LRR_SOS_F","srifle_LRR_SOS_F","srifle_LRR_SOS_F"]
So you could skip to
("srifle_LRR_SOS_F" in (weaponCargo Weapon) then {

quartz coyote
#

YEAH ! It's Working ! Thanks Guys !

rancid pecan
#

hello everybody

#

my 1 have problem

#

problem: pixel photo

#

How should size be?

full kindle
#

whats the resolution of that picture?

#

you probably need it in size of power 2 (512, 1024, ...)

warm gorge
#

Is it possible to return the sounds a vehicle has associated with it? Cant find any config values for it. Im trying to find a sound of a vehicle which I want to use with playSound/say3D, hoping thats possible

indigo snow
#

theres a sounds subclass

#

You can download the samples tool from steam and look at the car sample

warm gorge
#

@indigo snow Samples tool? Not sure what tool you're referring to

indigo snow
#

in steam, go to Library > Tools > Arma 3 Samples

#

it contains a bunch of sample configs

warm gorge
#

Ahh yep I see ill download now and have a look

indigo snow
#

if you browse the car example, theres a sounds include file

#

i can see a bunch of engine noises and stuff

warm gorge
#

Alright ill see if I can see what im looking for. Trying to find the sound refuel trucks use when you refuel a vehicle with one

warm gorge
#

I doubt its possible to find out what sounds are being played at a time?

chrome nebula
#

Hey guys,
Trying to figure out where I'm going wrong
I've put some script into my initserver file to add custom textures to billboards
the billboard spawns but the texture doesn't, I have the whole "cannot load texture" error
This is the script
private _signs = [
["Exile_Sign_WasteDump", [1966, 2462.09, 22.897], [0.852215, 0.523191, 0], [0, 0, 1], false, [0, "zbay.paa"]]
];

{
private _sign = (_x select 0) createVehicle (_x select 1);
_sign allowDamage false;
_sign setPosWorld (_x select 1);
_sign setVectorDirAndUp [_x select 2, _x select 3];
_sign enableSimulationGlobal (_x select 4);
_sign setVariable ["ExileIsLocked", -1, true];
_sign setObjectTextureGlobal (_x select 5);
}
forEach _signs;

rotund cypress
#

Anyone who have questioned Bohemias configs before?

#

Uniforms in CfgWeapons? ๐Ÿค”

little eagle
#

The items you put in containers and your inventory are in CfgWeapons. The soldier models are in CfgVehicles. They are cross-linked with a config entry in both.

rotund cypress
#

Either way, I still think it's very weird and not an optimal system

#

Containers and inventory doesnt justify it being called CfgWeapons in my opinion

little eagle
#

They do. And yes, it's very convoluted which is explained, by uniforms being an afterthought in A3 from the original system (A2 and older).

rotund cypress
#

Yep, still think that stuff like that should be sorted.

#

Maintain the code and make it up to date

little eagle
#

Kinda late for A3.

rotund cypress
#

Not like ArmA 3 is not going to run for 5 more years

warm lintel
#

You could strangle someone with a pair of pants, that's enough to call them a weapon surely

peak plover
#

Ughh... I'm having hard time understanding preprocessor commands

indigo snow
#

dont use them

peak plover
#
// --- SETTINGS ---
#define PLUGIN settings
#define PLUGINF(fnc) PLUGIN##_fnc_##(fnc)
#define PLUGIN_PATH #plugins\PLUGIN
#define PLUGIN_PATHF #plugins\PLUGIN##\files
#define PLUGIN_PATHFNC(fnc) #plugins\PLUGIN##\files\##fnc
#define PLUGIN_PATHS #PLUGIN_PATH##\settings.cpp
#

Is this in any way correct?

spice kayak
#

Sorry, but is it possible to teleport something to their starting location without markers?

#

Without respawning, I mean.

peak plover
#

Yes

#

Save the starting location

#

_unit setPos _startingPos;

spice kayak
#

Yeah, should have expected that. Thank you.

coarse olive
#

How would I script custom AI to spawn with the "Spawn AI" module?

peak plover
#

Try one of the 100 ai scripts available on biforums instead. You might find something you need faster there

spice kayak
#

Sorry, but this should work, right? I'm getting '2 elements needed, 5 provided,' which is odd, because the wiki says it supports up to 5 elements now.
titleText ["<t color='#00F700' size='5'>Green Team Scores!</t>", "PLAIN", -1, true, true];

little eagle
#
isStructuredText (Optional): Boolean - true to switch support for Structured Text formatting. Default: false (See Example 3. Available since Arma 3 v1.73.142260)
#

Current version is 1.72

spice kayak
#

Oh, you're right. By the way it was written, I just assumed otherwise - thanks!

still forum
#

@little eagle Current version is 1.74 not 1.72

spice kayak
#

Oh yeah, mine is 1.74 also.

#

Yeah, I was intrigued when I saw it supported it.

little eagle
#

Then I guess the change didn't make it into stable for 1.74

#

I can try. I'm on 1.77 dev...

spice kayak
#

It's all good - if it's not in now, it doesn't really matter :D

little eagle
#

Works on dev.

spice kayak
#

Ah, awesome. Thanks.

peak plover
#

#define PLUGIN settings

#define PLUGINF(fnc) PLUGIN##_fnc_##(fnc)
#define PLUGIN_PATH #plugins\PLUGIN
#define PLUGIN_PATHF #plugins\PLUGIN##\files

Would this work? Because PLUGIN is not a string, will line 2-3 wrork?

bitter jay
#

So im working on this server and i have this issue come up (http://imgur.com/a/nrDU2). It causes players to spawn in the middle of no where on the map, but when they hit respawn a proper spawn menu and they can choose a spawn point

indigo snow
#

nigel that really doesnt look correct

#

but did you try

#

just push it through eliteness' linter

peak plover
#

The what now?

indigo snow
#

you dont use ## correctly

#

\ already is an escape character for defines

#

so you dont need to ## before them, but after them

peak plover
#
#define PLUGIN settings
#define PLUGINF(fnc) PLUGIN##_fnc_##(fnc)
// settings_fnc_(fnc)
#define PLUGIN_PATH #plugins\##PLUGIN
// "plugins\settings"
#define PLUGIN_PATHF #plugins\##PLUGIN##\files
// "plugins\settings\files

?

#

I assume

indigo snow
#

PLUGINF(fnc) PLUGIN##_fnc_##(fnc)< using fnc twice is also retarded btw, just use var1,var2 for input etc, im not sure how that gets resolved atm

#

and im not sure at all about trying to immediately stringify the entire thing with the pound sign, youd normally use a separate QUOTE macro for that

coarse olive
#

Would anyone know how to redress AI when they spawn? Since the module does not support custom spawning, I could use a script to redress the AI with the modded equipment

indigo snow
#

You have the objects, you call code on them

#

If you spawn them yourself eith a script just use the returned objects

peak plover
#

Ok thanks...

#define QUOTE(var1) #var1
#define PLUGINF(var1) PLUGIN##_fnc_##var1
#define PLUGIN_PATH QUOTE(plugins\PLUGIN)
#define PLUGIN_PATHF QUOTE(plugins\##PLUGIN\files)
#define PLUGIN_PATHFNC(var1) QUOTE(plugins\##PLUGIN\files\##var1)
#define PLUGIN_PATHS QUOTE(PLUGIN_PATH##\settings.cpp)
#

I understand that ## adds the two on left and right together

indigo snow
#

L3 misses ## for sure

#

but have you tried them?

#

L6 is wrong too

peak plover
#

No, I'm having trouble understanding

indigo snow
#

have you tried the first ones instead of immediately wanting them all?

peak plover
#

I don't want to try and find a fix by bruteforce. I want to learn ๐Ÿ˜ฆ

indigo snow
#

play around with it a bit

peak plover
#

Alright thanks a lot

#

Does ## work for strings at all?

#

nvm.

#

You can merge two macros or text and a macro together
So I can't add strings

#

Just macro to string or macros

indigo snow
#

"a"##"b" ->> "a""b"

peak plover
#

Very nice

velvet merlin
#

would you make sure a HD call gets processed as fast as possible, and outsource non damage return related code to a separate thread (spawn), or just handle everything in one go

tough abyss
#

@velvet merlin i use spawn in my code

tough abyss
#

would
{_x disableUAVConnectability [_uav, true]} forEach allPlayers;
work globally?

#

if executed from one client

indigo snow
#

The wiki doesn't mention locality but I would personally assume it has local effects / arguments

#

(which means executing it on only one client isnt enough)

tough abyss
#

Right, ill just use my first method to disable it

rotund cypress
#

@tough abyss In case the command does not only support local effects it should work yes, however chances with a command like that is slim that it would have global effects

#

You could just remoteExec the command and have the same effects, however that would probably affect in more overhead, but I don't think you have an option.

tough abyss
#

Well im setting a variable for the UAVOwner on serverside and i have a thread (a decent sleep to prevent lag) and just checking if they have isUavConnectable availible, i disable it then

#

thats how im doing it now

rotund cypress
#

Ew new thread

#

Run it unscheduled

#

Performance effects

#

Better to run it unscheduled in something like OEF

#

Unless I am terminating thread after said work has been done, I always run in like OEF

#

So I usually have no threads running more than a couple of seconds

#

I.e. for waiting for confirmation from a player or w/e

amber palm
#

@everyone So im working on a new life server and I have this issue come up (http://imgur.com/a/nrDU2). It causes players to spawn in the middle of no where on the map, but when they hit respawn a proper spawn menu appears and they can choose a spawn point

rotund cypress
#

Well, that is relative @tough abyss

amber palm
#

@tough abyss I looked into that, and it wasnt the issue

rotund cypress
#

Thats why you don't do things in every frame in OEF

dusk sage
#

Depends on precision

rotund cypress
#

You don't run everything in every frame

#

Just because it is in OEF

dusk sage
#

Whatever is best for the task

rotund cypress
#

Doesnt mean you have to execute everything at once

#

You mostly got Draw3D for visual stuff

#

But as I said, as long as you are not executing things in the same framecount etc etc you don't need to worry about FPS

#

You can change the precision to whatever you want

tough abyss
#

can anyone tell me why this script wont work?

#

this removeMagazinesTurret ["4Rnd_Titan_long_missiles", [0]]; this addEventHandler ["Fired", {deleteVehicle (_this select 6); _this execVM "Flak\flak.sqf";}];

#

Im trying to make a flak effect

rotund cypress
#

flak? @tough abyss

#

First off, I would suggest using params instead of select for more readability

#

Also execVM is not to recommend, first off because it creates a new thread, and second you should store that flak.sqf in a function for easier calling.

#

Also you are placing this in an init of an object in editor, hence the this, yes?

tough abyss
#

@SimZor#5644 I'm going to be honest i just used someone else's script and i couldn't figure out why it didn't work and was hoping for someone to correct the script so I could use it in my mission.

#

@SimZor#5644 ^^

undone turret
#

_firednear = forEach _myArray addEventHandler ["FiredNear", hint "fired near" ];

trying to use an event handler on _myArray

#

this is the first time i used an eventhandler

#

anyone tell me whats wrong with my script?

cloud thunder
#
    _x addeventhandler ["FiredNear", {(_this select 0) hint "fired near"}];
} forEach _myArray;```
indigo snow
#

@undone turret you need to look up the syntax for commands on the wiki, you cant just string words together and hope for the best

cloud thunder
#

^

undone turret
#

I know, I've done a few tutorials

#

any good ones you could recomend?

indigo snow
#

Not really, just have the wiki open and look up every command you use

still forum
#

@Quiksilver#5042 the precision and execution speed of OEF comes at a cost of system resources, ultimately affecting FPS Unscheduled Performance is literally the same as scheduled. It's just that scheduled scripts might get..... scheduled.
theres very little that really needs to be executed each frame ... mainly UI stuff for visual smoothness Or stuff that needs to be done right now and not in 10 minutes.

daring pawn
#

clyde is stopping me posting that for some reason

still forum
#

Who were you writing to?

daring pawn
#

In here

#

thats why its odd

still forum
#

I've seen that message but only when PMing someone

#

spawn your code and add a waitUntil {player isEqualTo player};

daring pawn
#

the eventHandler is run on the server in initServer however

#

and the inidbi addon is only run server side too

still forum
#

Ouhh

#

Okey.. uhm

#

waitUntil {!isNull getByUIDstuff}; ?

#

Could create problems though if player disconnects before that condition goes true

little eagle
#

spawn your code and add a waitUntil {player isEqualTo player};
That always reports true, dedmen.

peak plover
#

Should report false before postInit

little eagle
#

Wrong.

peak plover
#

Hmmm...

little eagle
#

objNull isEqualTo objNull
-> true

peak plover
#

ohh right.

#

waitUntil {!isNull player}; ?

little eagle
#

Or you could just use any postInit script which guarantees the player exists and don't worry about it.

peak plover
#

Yeah, resonable

daring pawn
#

I'll try waitUntil isnull on the getByUID. I've never used it before so i'mm not really certain how reliable it is

#

its also weird behaviour fromm the eventhandler doing things twice

#

I don't know why its getting that output seemingly fine first then null the second time

still forum
#

oops.. Thought I could replace == but yeah.. isEqualTo can copare null's

#

@little eagle postInit script with PlayerConnected Eventhandler on the Server?

little eagle
#

The script in the screenshot is doomed to fail based on the first two lines. If nothing changed in the last year, PlayerConnected is executed on the server only.

daring pawn
#

Thats part of my issue. So I do need it to execute on server only, because the mod (inidbi2) runs server side to allow me to save some information. My problem is, I need the object (a player) to load it onto. And i'm struggling to work around and get that when that player connects

little eagle
#

I think I read it wrong. The second line is pointless. The eventhandler will only ever execute on the server.

daring pawn
#

oh the isServer?

#

Yea I was under the impression due to what you can see in the rpt snippet that you can see it happens twice, that its happening twice somewhere on the player

little eagle
#

You maybe added the eventhandler twice by accident. Or the player returned to lobby and picked a slot again.

daring pawn
#

Nah the eventhandler only exists once. In regards to returning to lobby, its a mission event handler, so should only be added upon mission start once? When the server runs it?

#

and nah the "player" is me joining the dedi server and seeing that happen

little eagle
#

So, BIS_fnc_getUnitByUID reports null is the issue?

daring pawn
#

Correct. I'm using it, as the other method I was using to get the object of whoever the UID is, was also reporting null

little eagle
#
// Parameters
private ["_uid"];
_uid = _this param [0, "", [""]];

// The shooter
private "_unit";
_unit = objNull;

// Go through all units and find matching UID
{
    if (getPlayerUid _x == _uid) exitWith
    {
        _unit = _x;
    };
} forEach allUnits + allDeadMen;

// Return
_unit;

^ this is the script

daring pawn
#

thats the functions code?

little eagle
#

Yes.

daring pawn
#

well fuck thats basically what I was using as my own function previously

little eagle
#

What you should do is use initPlayerServer.sqf event script instead of the eventhandler. initPlayerServer reports the avatar and PlayerConnected doesn't.

daring pawn
#

Oooh hey yea thats an idea

still forum
#

Wait... Bohemia......
They are searching for a Player by UID... And they check every AI and dead body?!

#

AI's don't have a UID

peak plover
#

allPlayers

still forum
#

Yes. Should be

peak plover
#

Old function?

still forum
#

Maybe. allPlayers was added in 1.48

rotund cypress
#

@tough abyss don't get me wrong, I do use scheduled threads, however I try to use it as little as possible and not having new threads run for the whole mission.

#

And use OEF when applicable instead of scheduled

still forum
#

New "threads" actually don't hurt that much. Extremly cheap if they are sleeping via sleep/uiSleep or.. as cheap as the condition in waitUntil

rotund cypress
#

I also think OEF is easier to handle, like removeMissionEventHandler when not needed etc

#

Pretty much the same as having a script handle, but still

still forum
#

The biggest difference with unscheduled is that it doesn't have the 3ms limit. Which is a safety net for all the noobs. But if you are careful about your runtime then you are just fine in unscheduled

rotund cypress
#

You mean scheduled

still forum
#

no

#

unscheduled = no 3ms limit = no safety net
scheduled = 3ms limit = safety net

#

The "Which is a safety net" sentence can be confused to mean unscheduled.. I also saw that when writing but thought it wasn't that bad

rotund cypress
#

But if you are careful about your runtime then you are just fine in unscheduled

still forum
#

yep

rotund cypress
#

Oh I see what you mean

still forum
#

like as long as you don't run your unscheduled scripts longer than 3ms per frame then you don't cause any lag. Lag being what most people complain about when doing unscheduled. But if you're careful that doesn't happen. Needs more skill though.

rotund cypress
#

Well I would never come close to 3ms in unscheduled

#

I would try to stay under 1ms

little eagle
#

allPlayers still has this bug that it reports [] at the start of a local hosted MP game.

rotund cypress
#

if (time > 20) then {allPlayers}

little eagle
#

BIS_fnc_getUnitByUID is fine, but you could make a wrapper for caching.

rotund cypress
#

Oh really, there is a BIS function for that

#

I made one myself

#

Guess I will use that from now on then

little eagle
#
params ["_uid"];

if (isNil "commy_UnitUIDCache") then {
    commy_UnitUIDCache = [] call CBA_fnc_createNamespace;
};

private _unit = commy_UnitUIDCache getVariable [_uid, objNull];

if (getPlayerUID _unit != _uid) then {
    _unit = _uid call BIS_fnc_getUnitByUID;
    commy_UnitUIDCache setVariable [_uid, _unit];
};

_unit
#

This could help if you use the function multiple times in the mission and have a large amount of units.

queen cargo
#

You can schedule all stuff that needs to finish some time in the future

little eagle
#

You have to schedule stuff that you want to finish in the future. That is basic reality.

still forum
#

That cache doesn't help in willithappen's care though. Because his code executes once per player

little eagle
#

Yes.

#

In willithappen's case, you don't want to use the function at all. initPlayerServer.sqf instead.

queen cargo
#

You also can run it in non scheduled environment @little eagle

#

But that is not required for everything

little eagle
#

?

#

"it"?

queen cargo
#

Code

#

On mobile

little eagle
#

I have no idea what you're talking about.

queen cargo
#

So... Do not expect lengthy answers ๐Ÿ™ˆ

#

Check the message I sent before

little eagle
#

Still no idea. Is this still about BIS_fnc_getUnitByUID?

queen cargo
#

Dedmen sent a message about scheduler

#

I answered

#

You added some random note

#

I sent some other stuff

still forum
#

Cookies!

queen cargo
#

Good idea

little eagle
#

You tagged me...

tough abyss
#

I need some help, I'm lost with scripting and i just need someone to help me out. I don't know why but this script doesn't work: this removeMagazinesTurret ["4Rnd_Titan_long_missiles", [0]]; this addEventHandler ["Fired", {deleteVehicle (_this select 6); _this execVM "Flak\flak.sqf";}];
Im trying to make a flak effect

still forum
#
this removeMagazinesTurret ["4Rnd_Titan_long_missiles", [0]]; 
this addEventHandler ["Fired", {deleteVehicle (_this select 6); _this execVM "Flak\flak.sqf";}];
#

doesn't look wrong to me

#

what is insdie flak.sqf?

indigo snow
#

Is it there, right folder, does a systemChat work, does the projectile get deleted, what is 'doesnt work'?

still forum
#

What of the works is the one that doesn't? #sohfunneh

tame portal
#

What's the beneficial thing of running code in unscheduled other than it being ran to completion in one go?

indigo snow
#

i mean thats the difference, in when it gets executed

daring pawn
#

@little eagle

I'm much closer now

 0:59:39 "#1 -- B Axe 1-1:2 (MAJ Davis) REMOTE"
 0:59:39 "#2 -- PMF_Player_76561198051383016"
 0:59:39 "#3 -- false"

Moving my previous code to initPlayerServer and selecting the player object from there (_this select 0) I get the above output.

diag_log format ["#1 -- %1",_this select 0];
_p = format ["PMF_Player_%1",getPlayerUID (_this select 0)];
diag_log format ["#2 -- %1",_p];
PMF_DB_Players_Data = ["new","inidbi"] call OO_PDW;
["setDbName",_p] call PMF_DB_Players_Data;
_existspd = ["loadPlayer",_this select 0] call PMF_DB_Players_Data;
diag_log format ["#3 -- %1",_existspd];

    if (_existspd) then {
        ["loadPlayer",_this select 0] call PMF_DB_Players_Data;
        ["clearInventory",_this select 0] call PMF_DB_Players_Data;
        ["loadInventory",[_p,_this select 0]] call PMF_DB_Players_Data;
    };

Problem now is the existence of REMOTE. I'm curious as to why that is now part of the object information? Additionally i'm getting false when checking if the players DB exists. Although that part is probably for code34 as its his addon, unless you happen to know about OO PDW

indigo snow
#

the REMOTE probably tells you the object isnt local to the server but the players computer

daring pawn
#

Ah yes possibly

#

If that is the case. I'm sort of back in a similar position

#

Nearly worth going to write my own just using the base INIDBI2 to achieve what I want

#

instead of this extra script

#

Just need to pass and read a position and a loadout

#

Not sure if you'd know what I could do there about the locality @little eagle ? (also scuse my lack of Params :P)

indigo snow
#

is there anything you need to do about it?

#

its perfectly normal

daring pawn
#

It might be a fault of the OO PDW system, or a problem with the locality that its not correctly loading the player in a dedicated environment now

indigo snow
#

player objects are always local to the player client

#

its how the game works

#

you can run a lot of commands on them just fine

daring pawn
#

Yea you can run commands from a server onto player objects just fine ik. in this case, when the player connects, they need this to be run on them. But i'm shit out of luck having it work on dedicated at the minute

indigo snow
#

script seems to run just fine with the diag output

#

god knows what those functions are doing though

indigo snow
#

im not familiar at all, im just saying the script works fine

#

if theres issues with that framework contact the author

daring pawn
#

It doesn't seem to be the framework though, well it does, but it seems like its a locality thing

indigo snow
#

then the framework doesnt work with non-local objects? surely the author can tell you more about how it works

#

from a scripting perspective non-local units are just fine

#

(and its not really something you can influence either way)

daring pawn
#

hmm alrighty. On a similar note, lets say I created a function that ran parts of the above, can I remoteExecCall a function the client doesn't have but the server does?

indigo snow
#

no

daring pawn
#

alright. I'll try figure something out. Thanks for baring with my madness cptnnick and commy

tough abyss
#

@indigo snow It says there is no 'Flak/flak.sqf'

indigo snow
#

well then obviously the file isnt present in the mission folder

still forum
#

Makes sense

peak plover
#

Cute name

indigo snow
#

(it also gives a bit more to work with than 'doesnt work')

tough abyss
#

@indigo snow Would i need a file called Flak/flak.sqf or something. I'm not that good at scripting and i don't know what to do to make this work.

indigo snow
#

well yes

#

the script isnt included with the game

#

youd have to download it and place it in your missionfolder

little eagle
#

The REMOTE suffix in the stringified object is normal and expected. It would be worrisome if the suffix wasn't there.

tough abyss
#

@indigo snow Thanks, that is all i really need to know

indigo snow
#

it's cool

#

wherever you find / download that script will probably also have a quick howtouseit explanation with it

tough abyss
indigo snow
#

see Installation / Usage:

tough abyss
#

@indigo snow I extracted the file and put it in the mission file and it doesn't work still but i no longer get the error msg

indigo snow
#

Ok. do the bullets it fires get deleted? Is it actually a tigris vehicle?

#

the init line bit itself is fine, and the files are in the folder, so if that doesnt work it might be with the script itself

tough abyss
#

Yes, the bullets get deleted and Yes it is a Tigris

indigo snow
#

Aight then it seems like the problem lies with the script itself. you gotta either dig through it or contact the author

tough abyss
#

alrighty

rose hatch
#

Is there a simple way to prevent an object from being added to zeus with addCuratorEditableObjects? As in something that can be placed in the object init or similar?

indigo snow
#

no

rose hatch
#

Drat

#

Guess I'll have to rewrite my zeus script :/

grizzled spindle
#

is it possible to use a string variable inside a addaction condition?

subtle ore
#

@grizzled spindle yes, but your string has to end inside the condition string.

"Strng = ''"
#

Etc

grizzled spindle
#

okay ill expand a little

#

_infostand addAction[_scrollText,{[_this, _x] call RRP_fnc_processAction},"",0,false,false,"", _reqItemsString];

subtle ore
#

Either has to be your double quotes "" or the single quotes ''

grizzled spindle
#

_reqItemsString = format ["%1 license_civ_%2 && !life_is_processing && !life_action_inUse",_reqItemsString, _x];

little eagle
#

Change the second _reqItemsString to str _reqItemsString

subtle ore
#

There you go.

little eagle
#

^^

grizzled spindle
#

so

#

_reqItemsString = format ["%1 license_civ_%2 && !life_is_processing && !life_action_inUse", str _reqItemsString, _x];

little eagle
#

Wait, that is a totally different line

grizzled spindle
#

that one?

little eagle
#

Yes, lgtm

grizzled spindle
#

Yeah not working mate

little eagle
#

str STRING will double up the quote marks. Basically a string that contains a string. This way the string will be correctly "escaped" after put in with format

#
format ["%1", 0]       // "0"
format ["%1", "0"]     // "0"
format ["%1", str "0"] // ""0""
grizzled spindle
#

Sorry I think i explained my question wrong

#

I have my conditions in a variable because i used a forEach to build the condition. Once i have built the condition using format and put the variable into conditon it does not work

little eagle
#

Sounds convoluted.

subtle ore
#

So why arent you using the magic variable _x ?

little eagle
#

Can you post the full code or at the least the block?

grizzled spindle
#
    {
        private _scrollText = getText(missionConfigFile >> "ProcessAction" >> _x >> "scrollText");
        private _reqItemsString = "";
        private _requiredItems = getArray(missionConfigFile >> "ProcessAction" >> _x >> "MaterialsReq");

        {
            _reqItemsString = format ["%1 life_inv_%2 > 0 && ",_reqItemsString, _x select 0, _x select 1];
        } forEach _requiredItems;

        _reqItemsString = format ["%1 license_civ_%2 && !life_is_processing && !life_action_inUse",_reqItemsString, _x];

        _infostand addAction["nope",{[_this, _x] call RRP_fnc_processAction},"",0,false,false,"", _reqItemsString];

    } forEach _itemsToProcess;```
little eagle
#

%1 life_inv_%2
^ this part doesn't look like it can work. The space looks wrong after the %1.

#

What is %1?

grizzled spindle
#

I did a diag_log of _reqItemString

#

" life_inv_cannabis > 0 && license_civ_marijuana && !life_is_processing && !life_action_inUse"

little eagle
#

_reqItemsString is "" then

grizzled spindle
#

used nope to check the scrolltext

little eagle
#

But what is the problem now?

grizzled spindle
#

the action doesnt show up

#

If i go in game and through debug console do:

little eagle
#

The condition is probably false then

grizzled spindle
#
cursorTarget addAction["test3",{[_this, _x] call RRP_fnc_processAction},"",0,false,false,"",   _test];```
#

it does work

#

which is making me thing maybe its to do with _infoStand

little eagle
#

_infostand undefined or null in that script?

grizzled spindle
#

anyway to check actions on a object?

little eagle
#

You also have to add these actions on every machine. So if this is done in a script that runs on the server only, it won't work on a dedicated client.

grizzled spindle
#

oh

#

lol

#

It is running on server

little eagle
#

It has to run everywhere.

winter rose
#

you can use a remoteExecCall addAction, and put in the condition to display it a variable that will make it unavailable later on (after activating for example)

little eagle
#

Or just remove the isServer check or put this code before it.

grizzled spindle
#

its ran on the server addon

#

so lol whats the best way of making it global?

dusk sage
#

Somebody above gave you a solution

#

Or, for security, you could always do it locally

grizzled spindle
#

it wouldnt work for jip though would it?

little eagle
#

so lol whats the best way of making it global?

Not a server addon, but you can also use:

[object, arguments] remoteExec ["addAction"]
dusk sage
#

Yes, you can JIP remoteExec(Call)

little eagle
#
[object, arguments] remoteExec ["addAction", 0, true]

then for JIP

grizzled spindle
#

awesome

#

ty

#

Will try now!

#

Thank you so much @little eagle @dusk sage @winter rose

#

apreciate it

peak plover
#

Ugh can someone give me an opinion on

//-----------------------------------------------------------------------------
// --- SETTINGS ---
// ----------------------------------------------------------------------------
// Setting: mission_settings_cool
// Description:
//    Sets the settings as cool as opposed to not cool
// Values:
//         true    - the setting is cool
//        false    - the setting is not cool
//-----------------------------------------------------------------------------
#define SETTINGS_COOL true
//-----------------------------------------------------------------------------
//  --- PARAMETERS ---
// ----------------------------------------------------------------------------
// Parameter: p_settings_real
// Description:
//     Will this be a real parameter?
// Values:
//        1    - True, the parameter is real
//        0    - False, the parameter is not real
//-----------------------------------------------------------------------------
#define SETTINGS_PARAM_REAL_DEFAULT 1    // Parameter default setting
//-----------------------------------------------------------------------------
#

Trying to think of bettter ways of doing settings

#

I think I'll do 1 file which defines all of these (default values) and then 2nd one where I would change them specific for the mission

half monolith
#

waitUntil{!isNull (findDisplay 46)};
chucksays = (findDisplay 46) displayAddEventHandler ["MouseButtonDown","hint 'add';_this call S3_mouse_f;"];
(findDisplay 46) displayRemoveEventHandler ["MouseButtonDown","hint 'remove'; _this call chucksays"];
i am sorry i forgot the syntax code for discord, anyone have anyideas on how to make this work?

still forum
#

```sqf
code
```

#
waitUntil{!isNull (findDisplay 46)}; 
chucksays = (findDisplay 46) displayAddEventHandler ["MouseButtonDown","hint 'add';_this call S3_mouse_f;"];
(findDisplay 46) displayRemoveEventHandler ["MouseButtonDown","hint 'remove'; _this call chucksays"];
#

That is not how displayRemoveEventHandler works

#

check wiki

half monolith
#

lol i grabbing at straws on this one now, i had a working example, twice, lost it twice, due to doing this too many hours in a row. thanks tho ๐Ÿ˜ƒ

little eagle
#

Try to understand what it does and then you will be able to reconstruct it yourself the next time. ๐Ÿ˜‰

#

Also the third line looks wrong to me. Id is a number and not a string.

#

And chucksays appears to be the id. But it's called like it was a function...

still forum
#

He thinks removeEventHandler will call a script

little eagle
#

Very weird.

still forum
#

Just didn't take a look at biki. that's all

little eagle
#
Syntax:
    display displayRemoveEventHandler [handler name,id]
Parameters:
    display: Display -
    [handler name,id]: Array -
#

Having two "MouseButtonDown" event handllers right after each other is weird too. Could just be one calling multiple functions.

#

Maybe it's supposed to be a one time fire only event handler?

still forum
#

It looks like he wanted a eventhandler that's fired when somebody removes the MouseButtonDown eventhandler

#

What he probably really wants is MouseButtonUp

little eagle
#

Hard to tell.

half monolith
#

i was under the impression to make it work i had to remove then point to the add,

#

the goal. like last week, find a way to get past the mouse button use it for something else.

#

at this point the couple times i did cancel the mouse, it could have been a glitch.

#

mousedown worked, when it worked, but for the life of me, i cant get it to cancel and call the other function , i only got it to either call the function with no cancel, or just a straight cancel.

#

this is all because i cannot find the action assosiated with pilot when he release missiles in manual mode, it is primary action, up until he switches to manual, then its something else, couldnt figure it out

still forum
#

what is "cancel"?

half monolith
#

id like the mouse to not use its regular function, but call this function, while being a pilot in manual fire

#

there is a gui of sorts it could be attached to as well

#

so, in the two cases i did get it to work, i was able to pull trigger on wepon and have nothing happen,

little eagle
#

You mean block the input? Disable the weapon?

#

We went over this already. It's not possible for helicopters in manual fire mode.

#

And MouseButtonDown does not overwrite the input. keyDown does. But that doesn't work for the mouse buttons. You cannot overwrite the mouse buttons in this game.

#

The only thing you can do is overwrite DefaultAction by using it as the shortcut for a custom action menu entry that is set to overwrite.

#

But that doesn't work for helis in manual fire mode and there is nothing you can do about.

half monolith
#

like i said i may be chasing a unicorn, and the couple times it did work it could have been a glitch, dunno.

little eagle
#

MouseButtonDown definitely cannot overwrite the weapon.

half monolith
#

like i said, at this point, could have been a glitch, i have one measly screenshot of when it did work, and i was too tired to rember to save it in the good pile..

little eagle
#

No repro = didn't happen.

half monolith
#

lol like i said with the one measly screen i have of it happening, and no way to repro, it could have been a glitch. you were not here to say whether it happen or not unfortunatly

#

instead of doing it like this do you have a non abrasive way to prove it wont work? or why mouse events are handled differently? id rather understand than just be told it wont happen.. if you know why.. can you enlighten me?

little eagle
#

Prove that MouseButtonDown doesn't block the input?

peak plover
#

Could have been cosmic rays

#

Are you using ECC ram?

little eagle
#

You could add a MouseButtonDown eventhandler, press LMB and see that it didn't block the input

half monolith
#

no hbm lol

#

wtf

little eagle
#

There is no "why" to explain here really. Check the wiki. keyDown can block input. MouseButtonDown can't.

#

It's because that is how it was programmed in Czech a long time ago.

half monolith
#

but could key down feasably block mouse, or just not possible?

#

damn...

#

i just looked

#

hbm2

#

screw ecc

little eagle
#

No, keyDown only triggers for keyboard keys. A mouse button doesn't trigger keyDown. Therefore, keyDown cannot be used to block a mouse button.

half monolith
#

ok, i have read things like this. im not disagree with you, but the flipside to that is, some mods to achieve freeing up the mouse button, temporarily for other things.. i find it hard to see as imposible, i dont want to use it free like this, it would in all likleyhood be attached to a gui of sorts, (the brackets on the target) in a perfect world the override would only be used if there was a locked target. no this isnt a mod, but it may be at somepoint, if its not possible to kill mouse, its incomplete.. people will use mouse, lose a missile per pull.. we are using an addaction to fire guided for now.

#

if we were to make it a mod would it be easier to achieve?

little eagle
#
player addAction ["", {true}, [], -99, false, true, "DefaultAction", "commy_blockLMB"];
commy_blockLMB = true;
#

To me, the only thing hard to believe is, how stubborn you are about this.

spice kayak
#

So, I'm having a bit of a server issue here. If I host a file locally, or online via my PC, the scripts all run fine. However, if I put it on my friend's bought server, the isServer scripts don't initiate. Even when I export the file to MP Missions, it'll work for me, but not on the dedicated server.

little eagle
#

Post the servers RPT fille.

indigo snow
#

File?

little eagle
#

Yes.

#

The servers RPT file.

indigo snow
#

sorry, referring to If I host a file locally

little eagle
#

Probably mod.

still forum
#

Probably mission file

#

You don't export a mod to MP Missions

little eagle
#

Or that

peak plover
#

can complie used for macros?

little eagle
#

No, preprocessFile(LineNumbers) can. And only these.

peak plover
#

as in ```sqf
_macro = "MYMACRO" call fnc_retrive_macro;
//
#include "macrolist.cpp"
_result = compile _this;
_result

still forum
#

You have not understood how macros work

peak plover
#

parsed == analyzed
So during preprocessing (cfgFunctions) it replaces MACRO with what it's defined as?

spice kayak
#

Sorry, mission file, not compiled or anything as .pbo.

#

I figured out the issue though.

little eagle
#

waitUntil {!isNull player}
?

spice kayak
#

Nah, it was mostly the hint system, wasn't working because obviously the hints would only show for the server, not the players

half monolith
#

stubborn maybe, but like i said, had i not seen it work, i probably wouldnt still be chasing .kk method does work, on ground, but as i said, the dafault action doesnt do it for a pilot, after he switched to to manual mode.

still forum
#

preprocessing is not compiling @peak plover

#

And yes. A macro is usually replaced by it's definition.

grand berry
#

Does anyone know how to get a list of GEO lods for use in addAction?

#

No worries found it -
selectionNames _veh

half monolith
#

@little eagle is this wrong?

waitUntil{!isNull (findDisplay 46)};
(findDisplay 46) displayAddEventHandler ["MouseButtonDown", "_this call fnc_mouseDown_13"];
little eagle
#

lgtm

#

"looks good to me"

half monolith
#

cool

little eagle
#

When you actually make this a mod.

#

Then add OFPEC tags to your global variables.

#

fnc_mouseDown_13

half monolith
#

we see if we get there lol, i dont want to release something half ass, if it confusing for player or they lose missiles, right now i can work as this as a fallback, and try to get people to use the addaction, the problem with mouse is, some choppers fire doubles one will goto target and one is a flier,, most cases its not an issue but there are a few where it is

#

while im here i have another question we have a higly scripted ai environment, we use DOM_squad to control groups and joining groups of ai. would there be a way to get the bis group menu to work in the same way? join and command ai groups ? we set the amount of units and groups in params before mission launch

little eagle
#

I think the command menu is all hard coded except from radio commands on 0.

half monolith
#

i dont want to screw with the commend menu, the way our mission layout currently works is that it uses this DOM_squad scripting to allow you to group with the ai, so for example you spawn in goto crate select your class and while this menu is up press ctrl-k it allows you to join one of the groups of ai, and command them. my one big goal is to replace all older functions with newer ones that didnt exist when this template was conceived. it may not be possible with this one .. group menu (u)works, but i cannot see the existing groups of ai, to join, let alone command them

little eagle
#

If this group menu is from the mod, then you can change it to whatever you want.

half monolith
#

no its not a mod ,

little eagle
#

I don't know what you are referring to then.

half monolith
#

id like to use the dynamic group menu system as opposed to selecting groups with ctrl-k on the crate, but im not sure if that system is as flexible as required. it doesnt see the ai groups let alone let you command them.. as is anyhow

gray thistle
#

So hello once again, i try to find out more about the return array of vehicles is there a site existing explaining the returned value especially the hex one? I think its like an object id

gray thistle
#

sure was already there but it does not really explain the first number it seems diffrent every time?

little eagle
#

first number?

#

With a mod that is.

#

There are no numbers in vehicles. Only objects.

gray thistle
#

[1a6f6c080# 1675075: apc_tracked_01_aa_f.p3d, 15cf3c080# 1675076: apc_tracked_01_aa_f.p3d]

#

Alright there you go sure there is an .p3d which is the object but i talk about the very first number

little eagle
#

That is how these objects are represented in the gui.

#

There is nothing to explain. It's a unique object id

gray thistle
#

commy2 this is exactly what i wanted to hear

little eagle
#

Don't try to use it for your scripts. You'll make a mess.

gray thistle
#

It may helps me to get further in my project . I needed an unique id for my DBs

little eagle
#

Then use this instead:

_vehicle call BIS_fnc_netId;
half monolith
#

we have a menu it is not a mod, it has its own gui and all of this, it is just outdated.. the more vanilla i can make things look the better, if i can replace an old function with something new and probably less taxing for server, i would lol. and as you know i like to chase unicorns.. the "template we work from has about 100 files lol, any i can remove is for the best

#

may be like you said just write something that works the same just looks nicer, i think DOM_squad is from a2

tardy yacht
#

Anyone know how to keep a texture's aspect ratio when applying it to a button?

little eagle
#

pretty sure the whole texture will always be on the button.

tardy yacht
#

So there's no way of moving it or scaling it so it's not stretched? Right now I can't see the whole thing as it stretches out of the button.

velvet merlin
#

what is faster/better design in general?

_string in ["TEXT1","TEXT2",...,"TEXTX"];
or
_string == "TEXT1" or _string == "TEXT2" or _string == "TEXTX" 
#

(case sensitivity is ensured to be fit)

indigo snow
#

count ([_string] arrayIntersect ["a",...,"z"]) > 0

#

in is probably faster

#

but it depends if your array of "TEXT" is of knows size?

little eagle
#

definitely in, but then it becomes case sensitive. It wasn't case sensitive with ==.

#

I think 2 elements should already be faster with in.

nocturne basalt
#

hi guys. is it possible to check which resolution lods you're on? I want certain scripts to run only on the highest res lods

velvet merlin
#

size is known but different

#

@nocturne basalt cant be done

nocturne basalt
#

but how about if (polucount < 1500) or something

#

impossible? no hack/workaround for this?

little oxide
#

No @nocturne basalt

nocturne basalt
#

Ok

tardy yacht
little eagle
#

The top left of the texture corresponds to the top left of the control etc. There is no way to scale this yourself differently.

tardy yacht
#

How do people make super good looking menus with textures on their buttons then? I have just tried shrinking the texture and that just made it pixelated. It's still weirdly stretched.

little eagle
#

Maybe your button control is not a square. Then it will be stretched.

tardy yacht
#

That would make sense.

#

I'll have a look at that.

little eagle
#

The picture you showed doesn't resemble the texture at all. Wrong image path?

tardy yacht
#

No the path is right.

#

It's the same texture, it's just REALLY weirdly stretched.

#

The left half is stretched but the right half is shrinked to fit the whole texture in.

little eagle
#

Never seen that.

tardy yacht
#

I don't understand how that happens.

tardy yacht
#

There's no more shrinking in the right half.

#
w = 0.0575 * safezoneW;
h = 0.1045 * safezoneH;
#

That should be square right?

indigo snow
#

That would depend on the aspect ratio of your screen and possibly UI size

#

Always square would be to use the same entry for w and h

tardy yacht
#

Isn't the safezone 4:3 24/7?

little eagle
#
w = 0.1045 * safezoneH;
h = 0.1045 * safezoneH;

^ this would be a square. Because w=h.

tardy yacht
#

oh

#

Thanks I guess.

#

That was pretty dumb of me.

little eagle
#

It's not the worst thing I've heard today^^ : P

tardy yacht
#

Ok, I might be doing something completely stupid and please tell me I am, but that's somehow not square

w = 0.1045 * safezoneH;
h = 0.1045 * safezoneH;
rotund cypress
#

Hey guys, is there an easy way to check how many times the same string is in an array?

#

So if "string" is in array 2 times, I wanna get that, how would I do that?

#

I guess I could pull out that from a array where it matches, and then count

#

Okay

indigo snow
#

or use CODE count ARRAY and skip a step

#

{_x == "string"} count ARRAY

#

if youre interested in pure multiples, you can also intersect the array with itself and check how much shorter it became, since arrayIntersect removes doubles

little eagle
#

^ this requires the array to be made out of strings only.

tardy yacht
#

I've tried asking the admins over at GrandTheftArma (as they have something similar to what I'm trying to achieve) and the response was negative. I'm running out of options here.

rotund cypress
#

@tardy yacht what are you trying to do?

tardy yacht
#

Have a button with a texture on it that's not stretched.

rotund cypress
#

use the inherit ctrl from Bohemia

#

RscPictureKeepAspect

#

And then put a background on it

#

If that is what you want to do

tardy yacht
#

I'm unsure what you mean

rotund cypress
#

Do you know what a ctrl is?

#

Or a inherit class?

tardy yacht
#

Yes

#

to both

rotund cypress
#

Then you should understand what I told you

tardy yacht
#

Well that means I don't know what both of these things are.

rotund cypress
#

Do you know what a ctrl is?
Or a inherit class?

You: > Yes
You: > to both

tardy yacht
#

What's RscPictureKeepAspect?

rotund cypress
#

Its a class Bohemia uses

#

Take that

#

Then inherit from that class to your button

#

And use some type like that supports actions

#

or ButtonClick evh

tardy yacht
#

Ok now I think I got it.

#

Let me try that, thanks.

rotund cypress
#

Also, a tip is not to ask communities for help, better to ask here since they will most likely not give you the answer. @tardy yacht

tardy yacht
#

@rotund cypress I'll keep that in mind, but I've had help from a french server before when I asked nicely. A surprise to be sure, but a welcome one.

tardy yacht
#

@rotund cypress I've been trying to use it with my button. But it doesn't seem to change anything. I'm using type = 16. Does that change anything?

#

@rotund cypress

        class appButton : RscPictureKeepAspect {
            idc = -1;
            type = 16;
            style = 0;
            default = 0;
            shadow = 0;
            text = "";
            x = 0.8733 * safezoneW + safezoneX;
            y = 0.6015 * safezoneH + safezoneY;
            w = 0.1045 * safezoneH;
            h = 0.1045 * safezoneH;
            animTextureNormal = "contacts.paa";
            animTextureDisabled = "contacts.paa";
            animTextureOver = "contacts.paa";
            animTextureFocused = "contacts.paa";
            animTexturePressed = "contacts.paa";
            animTextureDefault = "contacts.paa";
           
    [...] 
            
            class TextPos {
                left = "0.25 * (((safezoneW / safezoneH) min 1.2) / 40)";
                top = "(((((safezoneW / safezoneH) min 1.2) / 1.2) / 25) - (((((safezoneW / safezoneH) min 1.2) / 1.2) / 25) * 1)) / 2";
                right = 0.005;
                bottom = 0.0;
            };
            class Attributes {
                
                font = "RobotoCondensedLight";
                color = "#E5E5E5";
                align = "left";
                shadow = "false";
            };
            class ShortcutPos {
                left = "(6.25 * (((safezoneW / safezoneH) min 1.2) / 40)) - 0.0225 - 0.005";
                top = 0.005;
                w = 0.0225;
                h = 0.03;
            };
    [...]
        };
rotund cypress
#

copy the class

#

either go into arma files

#

or run [] call BIS_fnc_exportGUIBaseClasses; in debug

#

It will be copied to your RPT

#

then copy that into your description.ext or something

#

and call it like mamie_RscPictureKeepAspect

subtle ore
#

Cant you also use copyToClipboard ?

rotund cypress
#

Ehm....where to get the classes from then? ๐Ÿค” @subtle ore

tardy yacht
#

That ([] call BIS_fnc_exportGUIBaseClasses;) already copies them to the clipboard.

subtle ore
#

Copied to RPT?

rotund cypress
#

Yes

#

What else?

subtle ore
#

.rpt file that is external to the game?

rotund cypress
#

Yes

#

Why is that so weird?

subtle ore
#

Because you can just copy data to the windows clipboard without having to access the rpt.

rotund cypress
#

Actually, now that I think about it

#

It just copies to clipboard

subtle ore
#

Yeah, that makes more sense.

rotund cypress
#

Either way though, you questioned cant you just use copyToClipboard

#

Which it already does then

subtle ore
#

Well, from what i had read so far: i didn't. so that is why i did

rotund cypress
#

icic

tardy yacht
#

RscPictureKeepAspect inherits RscPicture and only adds style to it. These are 0x800 + 0x10 + 0x20. If I just changed the style of my button to this line

style = 0x800 + 0x10 + 0x20 

would that work?

rotund cypress
#

btw that is not sqf

#

its hpp

#

or cpp

#

or h

tardy yacht
#

hpp works

#

Just a matter of habit...

rotund cypress
#

Just copy the rscpicture class aswell

#

Use all classes

#

Just make a file with RscControls or something

#

include that in description.ext

#

done

#

and just add your prefix to all the shit

amber palm
#

Need help with the whole _name = worldName script

#

Can someone join out TS for assistance on that? PM me if you can

#

@everyone

undone turret
#

_enemyArray = [b1, b2, b3, b4, b5];

_myNearestEnemy = (_enemyArray select 0) findNearestEnemy player;

{

if((side _x == west) && (player distance _x < 100) ) exitWith {hint format["nearest enemy %1", _myNearestEnemy];};

} forEach _enemyArray;

#

anyone know why this is retruning <null-Object> when being executed?

subtle ore
#

Add a private

#
private _myNearestEnemy = (_enemyArray select 0) findNearestEnemy player;

To begin with

#

And are all the units in the enemy array defined?

#

You also might have this backwards, as you might want to define the nearest enemy player in the foreach, otherwise you will always get the nearest enemy of b1

#

@undone turret

undone turret
#

yes at the moment just want the first element of the array

#

All the units in the array have variable names of b1, b2 ect

#

its still returning null object

undone turret
#

anychose to use nearestObjects instead

zenith edge
#

is there an event for player chat/messages?

zenith edge
#

nvm figured out a way

dusk sage
#

No

spice kayak
#

So I've just started using Arrays for the first time, and while I understand very little of it, I was hoping someone here might be able to proofcheck it for me, for any mistakes or critiques. I'll give you a comparison of what it was, compared to what it is with arrays, for a better understanding of what has changed. There are still a few parts I'm rather unsure about.

spice kayak
#

Okay, so I was able to finally test it, and after tweaking it a little, the part that I was unsure about doesn't work, and I'm not sure how to get it to work.

#

_x setPos (_x + "Origin"); is my main issue, where I'm trying to get it to set the position of the helo to "vHelo1Origin", which should work, but doesn't. I've tried adding vLoc = str _x and changing it to setPos(vLoc + "Origin", but that doesn't work either.

limpid pewter
#

hey, quick question for anyone who knows. On the BIS wiki page for the player command (https://community.bistudio.com/wiki/player) it says this : "on dedicated server this value is null.". I was wondering if this was refering to the fact the command "player" would return null if executed on a dedicated server, or if it meant that on a dedicated server non of the player command wouldn't work on any of the clients

#

So if i had a function that used the command player and was executed locally on the client's computer. Would it work or not?

delicate totem
#

the command "player" would return null if executed on a dedicated server this
So if i had a function that used the command player and was executed locally on the client's computer. Would it work or not? yes it would work.

limpid pewter
#

ok cool

#

that's a relief ๐Ÿ˜›

still forum
#

If you execute a script on a client then it is by definition not "on dedicated server"

delicate totem
#

@spice kayak _x setPos (_x + "Origin");
if _x is "vHelo1", that'll return
"vHelo1" setPos "vHelo1Origin"

still forum
#
(missionNamespace getVariable _x) setPos (_x + "Origin");
little eagle
#

That looks wrong ^

still forum
#

it is

#

:X fixed

#

wait

little eagle
#

But:
object setPos position

still forum
#

yeah

little eagle
#

Positions don't have strings

still forum
#

@delicate totem what is vHelo1Origin ?

little eagle
#

What is vHelo1 ?

delicate totem
#

That's what I think his script will do when it mashes the _x together with "Origin" which is a string.

hat won't work because setpos needs an array of coordinates to work. So you need to get it to something like
"vHelo1" setPos [x,y,z]

still forum
#

answer questions please

delicate totem
#

That's what I think his script will do when it mashes the _x together with "Origin" which is a string.

little eagle
#

setPos doesn't work with strings.

#

OBJECT setPos ARRAY

#

ARRAY being PosAGL

still forum
#

ah... It's not your script it's @spice kayak

delicate totem
#

Yes.

spice kayak
#

Sorry.

#

vHelo1 is the name of the Object.

#

Sorry, was still cleaning up - didn't think anyone replied.

little eagle
#
_x setPosASL getPosASL (missionNamespace getVariable (vehicleVarName _x + "origin"));

???

spice kayak
#

I'll give that a try, thank you.

#

Got to say, Arrays are amazing.

little eagle
#

The inner parenthesis are optional.

spice kayak
#

Cut down my script by, god knows how many lines.

delicate totem
#

@spice kayak What is "Origin" in your script by the way? Is it another vehicle, a marker?

spice kayak
#

vHelo1Origin is just a variable within one of the vehicles.

#

To mark where the vehicle spawns, basically.

little eagle
#

hmm, what is the value of the variable?

#

A position?

spice kayak
#

Yeah.

little eagle
#

Then you need to change the script.

delicate totem
#

Ah, that makes a lot more sense.

little eagle
#
_x setPosASL (missionNamespace getVariable (vehicleVarName _x + "origin"));
delicate totem
#

^

little eagle
#

And you need to change how you determine the position to getPosASL.

spice kayak
#

Ah, thanks.

little eagle
#

You probably use getPos, but getPos and setPos work in different position formats. AGLS vs AGL

spice kayak
#

I didn't know, thank you.

#

with something like this, how would I add helicopters to this as well? nearestObject ("LandVehicle")

#

Like, nearestObject("LandVehicle" or "Helicopter") I tried 'AllVehicles,' without realizing that included Men too.

velvet merlin
little eagle
#

Luro, you can't use multiple classnames for parents in nearestObject, but you can with nearestObjects (not the S).

#

And I think they are sorted by distance, so you just have to add

param [0, objNull]

to the right side to get the nearest object.

tough abyss
#

feelsgood.jpg

little eagle
#

kju,

params ["_vehicle"];

private _weaponsAllTurrets = [];

{
    private _turret = _x;

    {
        _weaponsAllTurrets pushBack [_x, _turret];
    } forEach (_vehicle weaponsTurret _turret);
} forEach ([[-1]] + allTurrets _vehicle);

_weaponsAllTurrets

I think this is the closest you can have ^

velvet merlin
#

yeah. sorry was more like a little rant about the inconsistency from BI again

spice kayak
#

I just wish Men didn't fall under Vehicles.

#

D:<

little eagle
#

What do you mean? vehicles does not report persons.

spice kayak
#

AllVehicles does, doesn't it?

little eagle
#

AllVehicles is a classname. And Land inherits from that and Man inherits from Land

#

What are you trying to do?

spice kayak
#

I want to respawn the closest vehicle to me, be it either a LandVehicle or a helo.

little eagle
#

Ah, it's nearestObject again, but with multiple classes.

spice kayak
#

It was just vDestroyedVehicle = (getPos player nearestObject "LandVehicle"); to get the variable set, but because I wanted to add helicopters to that list, I got confused.

little eagle
#
nearestObjects [origin, ["Car","Tank","Plane","Helicopter"], 50] param [0, objNull]

^ this is essentially the same, but with multiple classnames.

#

The reason to use nearestObjects (S) over nearestObject (no S) is, that this one supports multiple classnames. And then you select the first one, because they are sorted from closest to farthest. The 50 is just the hard coded range of nearestObject. You use param instead of select, so you can determine the default value of null (otherwise it would be undefined, nil), because the array can be empty if you stand in the desert.

tame portal
#

@little eagle Does [] select 0; result in error and stopped execution or error and continuing execution with nil?

little eagle
#

Good question, ...

#
[] select -1 // error
[] select 0 // no error, nil
[] select 1 // error
#
["a"] select -1 // error
["a"] select 0 // "a"
["a"] select 1 // no error, nil
["a"] select 2 // error