#arma3_scripting

1 messages ยท Page 239 of 1

winged thistle
#

Then, you have to pull from those arrays by doing 'select' statements from the client

#

Assuming you're trying to pull on the client from the server

#

So, I believe you'd do something like

RedReinforcements select 0;
#

That would give you the first unit in that array

#

RedReinforcements is already being broadcast on the server to the clients, so you should just be able to use the variable name as it will default to the missionNamespace

#

(I've never helped anyone on here, so someone please correct me if I'm wrong)

#

If a client can pull a value for that variable when a unit is in the array, we should be able to expand upon that.

shadow sapphire
#

That's pretty helpful! I'm trying to get caught up to you just now. I'm testing your suggestions for additions to the array checks now.

winged thistle
#

Cool ๐Ÿ˜„

shadow sapphire
#

Okay, that didn't work, got a script error saying it was missing a semi-colon, but honestly, I'm much more interested in getting the objects grabbed from the arrays and added to the choppers than I am concerned with getting the array checks perfect at the moment.

winged thistle
#

In a watch field, from the client, can you pull RedReinforcements?

#

Does it list the array?

#

We have to see it before we can pull from it

shadow sapphire
#

Yeah, both reinforcement arrays are being filled and we can watch the arrays be filled as clients JIP or are killed in game.

winged thistle
#

So RedReinforcements select 0 returns a unit?

shadow sapphire
#

Wait one, will check.

#

RedReinforcements select 0;

returns

C11A

Which is the first (and only) unit in the array.

winged thistle
#

Welp, that's how you pull the selective information from the array.

#

Now, you can do a forEach loop on the array

#
{
    /*do stuff*/
    systemChat format ["%1", _x];
} forEach RedReinforcements;
#

Where _x will be each value in the array per iteration

#

I'm testing this a bit on my end. Never used the EntityRespawned EH before.

shadow sail
#

I have AddActions on some players I want to restrict while next to a specific object. How would I add an if statement to check if a player is within X feet of Y marker?

#

And then disable the addaction if its true

winged thistle
#

"player distance _whateverMarker > _specifiedDistance"

#

Use < if you want them to be next to the object

#

if you want them away from the object

zealous solstice
#

add this actions to the Object? and than look if the caller == hte player

#

or just add the action on the players client

shadow sail
#

I want players to be able to only use the addaction outside of the zone, not within, that's why I asked ๐Ÿ˜›

winged thistle
#

So use >

shadow sail
#

I know I can add the action to the init field of an object

winged thistle
#

Are you scripting or do you want a copy/paste solution?

zealous solstice
#

you know the condtion in a addaction?

#

yes @winged thistle good question

winged thistle
#

^ Jokoho is on the right track. Use the condition in addAction.

#

I'll get a link.

shadow sail
#

so if(_x distance _object > _specifiedDistance;

#

ah okay

winged thistle
#

Yeah

#

That makes sure the player is a minimum distance away before the action appears.

#
player addaction ["<t color='#FFA500">Action Name</t>",{/*Put script here*/},[_script,_arguments,_here],0, true, false, "Action", "_this  distance _object > _specifiedDistance"];
#

For example.

shadow sail
#

ah you're beautiful

winged thistle
#

Check out that link to learn more. In the condition part at the end, _this is the player using the action and _target is the object the action is called from

shadow sail
#

I was over here thinking of what kind of precompiled function to throw in my SQF and it's just that simple

#

Fantastic, thank you.

winged thistle
#

๐Ÿ˜„ Np

shadow sail
#

โค

winged thistle
#

If I can learn to script for Arma, anyone can ๐Ÿ˜›

#

@shadow sapphire I didn't forget about you.

#

In my arrays, I'm seeing units, not the strings you're getting.

#

[B Alpha 1-1:1 (pigneedle)]

#

Is there a conversion going on somewhere I can't see?

shadow sapphire
#

@winged thistle, every unit in my missions have a variable name.

winged thistle
#

So those are unit names?

#

That's ok

shadow sail
#

These addactions are added via script on respawn, would it make more sense to add these options to each playable units init in the Editor?

winged thistle
#

As long as they refer to units

#

Both Nano

#

On Init and respawn

shadow sapphire
#

Yeah, they refer to specific units.

winged thistle
#

Cool Del

#

@shadow sapphire Then you should be able to do the forEach loop to do things for each person in the array. You can then set conditions around which units should be handled and which should be ignored

shadow sapphire
#

@winged thistle, okay! That's awesome. Will try it now and send a code block for double check soon, if that's okay.

winged thistle
#

@shadow sail When a unit dies and respawns, the new unit object is different from the old unit object, so the action must be readded.

#

Sure Del ๐Ÿ˜„

#

This is me taking a day off ๐Ÿ˜›

shadow sail
#

Well to give context they currently have the option to spawn in a vehicle via script referenced in onPlayerRespawn.sqf, such as
player addAction ["Supply Drop","supplydrop.sqf"];

Do I need to simply change this to:
player addAction ["Supply Drop","supplydrop.sqf","_this distance _object > _specifiedDistance"];?

#

and is that comparison checked on every frame or?

#

My thought process was a waituntil with a sleep and checking a boolean, then run an if to see if the player is near the marker, if they are not within x distance enable the action

#

But if I can simply add that distance comparison in the init that would be great

winged thistle
#

You have to account for each parameter in addAction

shadow sail
#

ah I see what you did there

#

my mistake

winged thistle
#

And yes, that's the purpose of the condition parameter ๐Ÿ˜„

#

To make my headache go away ๐Ÿ˜›

#

I had the same problem fairly recently

dusk sage
#

_this select 0 distance _object

winged thistle
#

I believe johoko helped me out

dusk sage
#

As the first index of _this will be the object the addaction is attached to

winged thistle
#

Oh crap, @dusk sage is right.

#

Sorry

#

_this is the array of params

dusk sage
shadow sail
#

player addAction ["Supply Drop","supplydrop.sqf",[],0,true,false, "", "_this distance _object > _specifiedDistance"];

dusk sage
#

Namely

#
target (_this select 0): Object - the object which the action is assigned to
caller (_this select 1): Object - the unit that activated the action
ID (_this select 2): Number - ID of the activated action (same as ID returned by addAction)
arguments (_this select 3): Anything - arguments given to the script if you are using the extended syntax```
winged thistle
#

@dusk sage I liked it to him already ๐Ÿ˜›

shadow sail
#

im unfamiliar with what to put in the shortcut section hence ""

winged thistle
#

Shortcut is a shortcut name

#

Action is spacebar by default I think

shadow sail
#

ahhh gotcha

dusk sage
#

Also

winged thistle
#

There's a list of them linked in the addaction page under the param

dusk sage
#

considering the fact you've attatched the addAction to the player

#

you are more than welcome to just do

winged thistle
#

Could just use player

dusk sage
#

player distance _object

shadow sail
#

awesome

#

you guys are an oasis in the desert for sure

winged thistle
#

I prefer the copy/pastable version though ๐Ÿ˜›

#

So you can remoteExec later and allow players to create objects that have multiplayer interaction options ๐Ÿ˜„

dusk sage
#

eh

winged thistle
#

But yes, always optimize when you can.

shadow sail
#

Well, to reveal a little secret I really realllllllly missed Invade and Annex on Stratis and I've spent about 80 hours tearing it apart and putting it back together with debugmod and fnc_logs to try and get a good error-free base with a few custom features enabled. One of these features is a Tank Crew squad that can spawn in a Slammer by parachute (working) and I didn't want people to see the option, pop it, then have it fall on a team-mate or a building and/or explode in base.

#

Helping me a ton! ๐Ÿ˜ƒ

winged thistle
#

Dude don't you worry

#

I've been coding a similar mission for the past 3-4 months ๐Ÿ˜›

#

Basically re-wrote AAS from Arma 2 from scratch, and added a bunch of cool stuff.

shadow sail
#

If you see "Scorched Earth" with a password in server browser that's me mucking about ๐Ÿ˜›

#

nice!

#

That would be super fun in A3

winged thistle
#

That's the goal, anyway ๐Ÿ˜„

#

I'm hoping to release within the next 1-3 weeks.

shadow sail
#

I wish Chernarus was native to A3 ;p

#

Very cool

#

I'll keep an eye out ๐Ÿ˜ƒ

winged thistle
#

It's just the first version though. I don't know if it'll be as awesome as it will be when I'm done with all my milestones.

#

But it will be playable, at least.

shadow sail
#

Hah, I'd be happy to be good enough to need milestones ๐Ÿ˜›

winged thistle
#

I modded AAS in Arma 2. That took a few months. I was completely new and hadn't ever played Arma.

shadow sapphire
#

What is AAS and what is it all about?

winged thistle
#

Made another mission right after Christmas for Arma 3. Took a couple months. Simple dogfight mission.

shadow sail
#

Advance and Secure, capture objectives in series by outnumbering the enemy

winged thistle
#

This mission started at the beginning of March and I'm still not done.

shadow sail
#

it was pretty rad

winged thistle
#

But I'm really close ๐Ÿ˜›

#

That's pretty much all of my Arma experience. I've spent more time coding for Arma than I have playing it ๐Ÿ˜›

shadow sail
#

Haha I am complete opposite, I have 800 hours in ArmA 2 and almost 300 in ArmA 3 and maybe 20 hours scripting in a very very rough manner ๐Ÿ˜›

#

Studying other peoples code and getting the bigger picture is a huge help. I had no idea how things were called during server start in the beginning and was trying to find out how everything was linked to init.sqf, like WHY ARE THERE NO REFERENCES??

#

And of course I found the BIS page and it made sense, but it was not implicitly obvious ๐Ÿ˜›

winged thistle
#

I've got a phrase I started telling the boss way back when

#

He'd ask why we couldn't do something, and I'd only be able to respond, "Cuz Arma"

#

It stuck

shadow sail
#

haha

winged thistle
#

But compared to most other games, there's a hell of a lot you can do

#

And they only improve with every update

shadow sail
#

I was surprised, after hearing the pains of some of my buddies in ArmA 2 I am finding ArmA 3 scripting to be difficult but more time consuming than obtusely complex

#

Which is fine with me

#

๐Ÿ˜ƒ

winged thistle
#

I'd say it's been a healthy balance of both. But so is every script.

shadow sail
#

Yea, I think my ignorance is the only reason I've stuck with it this long. "Can't be that hard to take a two year old mission that no longer works OOB and make it run smooth"

#

Now I know how much I bit off before I chewed ;p

#

But, I'm this far, can't turn back now

#

I'm down to zero script errors aside from debug mode script errors for the Werthles client on respawn, but its disabled so it's all smooth atm. Just trying to do one thing very slowly at a time and get it working.

winged thistle
#

I gotta say man, I've actually been in an extremely similar position. Be glad you started in Arma 3. There were so many things we ran into that were only in Arma 3 during development. I wanted to cry sometimes. ๐Ÿ˜ฆ

shadow sail
#

Haha I am very glad ๐Ÿ˜›

winged thistle
#

If you read through Werthles client, line by line, and learn what each line does, you'll find you don't need it anymore because you'll write your own streamlined version.

shadow sail
#

Once I have my mission working in the sense that I am confident to put it in beta, I'll definitely look at reworking Werthles

#

I mean it runs great, I just think I can cut out all the debug stuff and not miss anything

winged thistle
#

It's worth it. I got back 10 frames after I dropped it.

shadow sail
#

Nice

#

Load balanced?

#

I use two HCs

#

not that it's necessary yet

winged thistle
#

We use 1 but our server is OP

shadow sail
#

Yea, I'm on some fat hardware myself probably only need one

winged thistle
#

There are a bunch of other servers being hosted on the same hardware, so 1 each is enough for now.

jovial nebula
#

Hi guys,does anyone know how can i exclude a script from error logging?

shadow sail
#

Thanks for your guys' help, it works flawlessly.

#

Is there a simple way to add a cooldown to a script?

dusk sage
#

sleep

shadow sail
#

that easy?

#

just add a 30 second sleep to the end with a hint and itll wait for the sleep before it enables the use of the script again?

dusk sage
#

Aslong as the script is run scheduled

#
sleep 30;
hint "bye";
#

Will have a 30 second gap between hi and bye

shadow sail
#

Right, I want to prevent a player from using an addAction ability for a set period after use

#

And that'll do the same?

#

After they use a supply drop I'd like to prevent them from doing it again for a set period

#

Very little on the forums in regards to that :\

#

When I do
player addAction ["Supply Drop","supplydrop.sqf",[],0,true,false, "", "player distance respawn_west > 250"];
Can I somehow add another conditional? Like..
player addAction ["Supply Drop","supplydrop.sqf",[],0,true,false, "", "player distance respawn_west > 250 && Cooldown < 1"];

and then do:

//some code
sleep 30;
Cooldown = 0;```
?
zealous solstice
#
player addAction ["Supply Drop",{
    hint "hey";
    sleep 30;
    hint "bye";
},[],0,true,false, "", "player distance respawn_west > 250 && Cooldown < 1"];
#

?

shadow sail
#

is && Cooldown < 1 a viable operand in the init field? That's what I am curious about

#

and I'll have to see

torn juniper
#

in the beginning of your supplydrop.sqf you could have a check

#

that would be easiest

shadow sail
#

okay,

torn juniper
#

unless you dont even want the addaction to appear

shadow sail
#

it depends on which is easier, I'd like it if it remained on screen and it was simply disabled

#

but, if it was removed after use and then put back once conditions were met thats fine too

#

keep the action menu lean

#

would i just wrap the code in my SQF in a waitUntil

#

like

wait Until { var = 1;
// do stuff
var = 1;
sleep 30;
var = 0;```
#

d'oh

dull parrot
#

Does anyone else feel like it's a little silly for people to be all like "I don't share my Arma scripts or code bro."

#

When we all know the code/scripts they are writing are jokingly easy to replicate anyways?

#

Why hoard knowldge like that, why not, idk share / teach / and expand the community so we have reason TO make scrips, mods, etc.

shadow sail
#

or would it be

if var == 0 
//do all my normal stuff
wait until ( var = 1;
sleep 30;
var = 0;)```
shadow sapphire
#

Depends. My community has some scripts that are extremely time consuming to replicate and we aren't hoarding them, we might share if people asked, but we won't publicly release them, because we want our server to be the one that has those scripts.

shadow sail
#

err set it to 1, sleeep, then 0

dull parrot
#

DEL-J, I guess it's less about tthe scripts themselves, and more about some folks attitude, thinking that sqf is some magic thing, or refusing to share knowldge and experince simply because they don't want anyone else to be able to do what they do. It's sad man, I know it's not everyone, but I tend to find the jerks most of the time.

marsh lodge
#

I try to make public everything I do so everyone benefits

#

The problem for me is should I release shoddy code

tame portal
#

What shoddy code

#

fill me in

marsh lodge
#

I tend to rush when I write code

#

So it might produce errors in some situations

tame portal
#

Share code when you think its worth sharing

#

if you think you rushed it and its not the best way to do it, dont share it because otherwise everyone who will use that code will be running around with non optimized stuff

#

and the people that quickly copy paste functions found on the internet tend to be the ones that are not capable of differentiating between good and bad code

#

so they will A) either think its good code and adapt your style or B) run around with bad code and dont question it

shadow sapphire
#

I would make it public if I personally came up with anything new or interesting, but I am likely never going to be at that level, myself. I'm not passionate enough about it. I've got three projects that I want to do, two are simple, one is deep, the deep one I have guys on, but my other two I can do by getting the wonderful people here to help me. I don't even intend to credit myself as the author, haha

tame portal
#

Credit yourself for what you have come up yourself

#

Mind sharing the ideas?

shadow sapphire
#

I don't mind.

dull parrot
#

A) either think its good code and adapt your style

#

Yes, can't stress enough how important this is!!!! People need to know if what they are looking at is something to emulate or not! We have to set up future sqf-kids for sucess, it's honestly the best way to keep this community a fun, great place.

agile pumice
#

sorry to interrupt, could someone help me with some config scripting?
my function:


(format ["configName _x isKindOf %1",_parent]) configClasses (configFile >> "CfgVehicles");``` it's called like ```_classes = ["aus_Physx_Objects"] call MG_fnc_returnChildren;```
but _classes returns nothing
agile pumice
#

_parent = "aus_Physx_Objects"; (format ["configName _x isKindOf %1",_parent]) configClasses (configFile >> "CfgVehicles"); returns []

dull parrot
#

I am trying to add two numbers together, what should the sum be?

#

Maybe I just don't understand the context eagledude4

#

Syntax looks good tho ;D

agile pumice
#

It just seems that trying to use format wont work

#

'configName _x isKindOf "aus_Physx_Objects"' configClasses (configFile >> "CfgVehicles");
works

zealous solstice
#

configClasses dont return inherited classes if i remeber right or subclasses of them i am not sure there was some bug with that

native hemlock
#

See the notes if you are trying to inherit subclasses

zealous solstice
#

oh right ok ๐Ÿ˜ƒ

native hemlock
#

It was a topic of discussion here a week ago

agile pumice
#

this is my workaround for now
'''_classesConfig = 'configName _x isKindOf "aus_Physx_Objects"' configClasses (configFile >> "CfgVehicles");
_classes = [];
{_classes pushBack (configName _x)} forEach _classesConfig;
_classes deleteAt 0;
_cargoClass = selectRandom _classes;'''

#

oh, I think I know what I did wrong ๐Ÿ˜›

dusk sage
#

should be able to use count

#

instead of forEach there

agile pumice
#

I'm certain the issue is with _classesConfig = (format ["configName _x isKindOf %1",_parent]) configClasses (configFile >> "CfgVehicles");

#

when i replace the format with
_classesConfig = 'configName _x isKindOf "aus_Physx_Objects"' configClasses (configFile >> "CfgVehicles");
it works

vapid frigate
#

@agile pumice it's because you're taking off the quotes

#

_classesConfig = (format ["configName _x isKindOf '%1'",_parent]) configClasses (configFile >> "CfgVehicles");

#

around %1

agile pumice
#

thanks, I'll give it a try

little eagle
#

I guess it's less about tthe scripts themselves, and more about some folks attitude, thinking that sqf is some magic thing, or refusing to share knowldge and experince simply because they don't want anyone else to be able to do what they do. It's sad man, I know it's not everyone, but I tend to find the jerks most of the time.

Luckily the code produced by those people is rarly worth looking at anyway.

velvet merlin
#

does setPos ignore all kinda of collision?

#

or is setVehiclePosition with can_collide needed?

lavish ocean
#

just for sure: documentation for new server admin #commands and server.cfg settings in profiling (performance) binaries 1.60.136560
https://forums.bistudio.com/topic/160288-arma-3-stable-server-160-performance-binary-feedback/page-77?p=3035423#entry3035423

Bohemia Interactive Forums

Page 76 of 76 - Arma 3 STABLE server 1.60 "performance binary" feedback - posted in ARMA 3 - SERVERS & ADMINISTRATION: Hey, i think u misunderstod me.
before the patch i had only a few crashes like 2-3 a week.
With the v9 everything worked perfekt, no crashes anymore. But now with the 1.60 my Server
Crashed like 6-8 Times in 24 Hours.

jade abyss
#

@velvet merlin afaik its ignoring everything. BUT (for example with a Vehicle) afterwards -> PhysX kicks in

velvet merlin
#

@jade abyss thanks

#

BR is getting floating magazines/items in weaponholder_ground with us (IFA3); trying to find out why or what to do

jade abyss
#

setPosATL ? @velvet merlin

#

[x,y,0]

#

Example:

_Pos = getPos _GWH;
_GWH setPosATL [(_Pos select 0), (_Pos select 1), 0];```
torn jungle
#

hello. im using this "if (alive (_this select 0) && {side (_this select 0) isEqualTo CIVILIAN} && {isPlayer (_this select 1)}) then {hint ""Innocent Civilian Harmed"";}"; to put out a msg whenever a civilian is hit. What i would really want is for the player's name who did the damage to also be displayed. eg. "Innocent Civilian harmed by Zaf" can anyone help?

jade abyss
#

3x ` for Code

#

(3x ` ) CODE (3x the same)

tame portal
#

@torn jungle Use EventHandlers

jade abyss
#

@velvet merlin Does the GroundWeaponHolder itself is flying in the Air or just the Item inside it? (means: When you add a Vanilla Item to it -> Is it on the ground?)

little eagle
#
params ["_unit", "_shooter"];

if (alive _unit && {side group _unit == civilian} && {isPlayer _shooter}) then {
    private _message = format ["Civilian harmed by %1", name _shooter];
    _message  remoteExec ["systemChat"];
};
#

"innocent" civilian is a tautology

velvet merlin
#

@jade abyss seems also with A3 objects

#

so othe weaponholder seems the problem imo

jade abyss
#

Then, i assume, the GWH is spawned in the air ๐Ÿ˜›

#
_Pos = getPos _GWH;
_GWH setPosATL [(_Pos select 0), (_Pos select 1), 0];```
#

Or does it occur, when you drop stuff from the Inventory? oO

velvet merlin
#

PU says when interacted, they get to ground level and after that back to floating (sounds like change of locality to me)

jade abyss
#

mom

velvet merlin
#

this is what they use currently:

                         if(getTerrainHeightASL _pos < 0) then {_pos = ASLtoATL _pos;};
                         if (surfaceIsWater _pos) then {
                                _pos setPosASLW _pos;
                        };
                         _object = createVehicle ["WeaponHolderSimulated", _pos, [], 0, "CAN_COLLIDE"];
                         _object setPos _pos;
                         _object setDir (random 360);```
jade abyss
#

tried "GroundWeaponHolder"?

velvet merlin
#

he is switching back now

jade abyss
#

+i would create the GWH first at. [0,0,0] then using setPos

#

So:

#
 _pos = _house modelToWorld (_positions select _p);
                         if(getTerrainHeightASL _pos < 0) then {_pos = ASLtoATL _pos;};
                         if (surfaceIsWater _pos) then {
                                _pos setPosASLW _pos;
                        };
                         _object = createVehicle ["GroundWeaponHolder", [0,0,0], [], 0, "CAN_COLLIDE"];
                         _object setDir (random 360);
                         _object setPos _pos;```
#

+switched setPos and setDir

velvet merlin
#

good idea. 0,0,0 was notorious from have weird behavior - did BI fix all that?

#

like back in the day -10,-10,0 or sth was safe instead

jade abyss
#

erm, never noticed any problems with it

#

hmm

velvet merlin
#

like that area was the blackhole of arma ๐Ÿ˜›

jade abyss
#

I remember, that createVehicle had a Problem with creating at a certain Spot (Pos not accurate, sometimes 1-2-3-4-500m away from real position + extremly slow updating of Pos to the Clients

#

+Is the player (who activated the Script) beeing send to the script? (wich is, i assume, is executed Serverside)

velvet merlin
#

yeah that too. was also a prob with VON

jade abyss
#

With von? oO

#

Aw yeah, Arma. Everythings possible ๐Ÿ˜„

velvet merlin
#

like ppl used to setPos ppl off map when dead

#

arma didnt like that much

jade abyss
#

hum

velvet merlin
#

you "new" guys all missed out the many fun bugs of the old days ๐Ÿ˜›

jade abyss
#

"new"

#

I am in Arma/OFP since 2001 ๐Ÿ˜›

velvet merlin
#

yes yes i was just generalizing ๐Ÿ˜ƒ

jade abyss
#

I remember: Tank flipped, switch to Gunner seat, fire Sabot, fly around the map with Hyperdrive ๐Ÿ˜„

velvet merlin
#

in OFP close after MP was introduced sth like 1.0.x locality for choppers was bugged - so you had rockets coming from nothing at times ๐Ÿ˜„

jade abyss
#

๐Ÿ˜„

velvet merlin
#

yeah that one was nice too

jade abyss
#

Or the wonderful "desctruction" Anims XD

#

"f**k, i am stuck in the Destroyed house again. crap, dead"

#

Okay, back2script:

#

Is the player send over to the script, then ->
_Player reveal _object; <-- something like this should be added to it (iirc, sometimes Arma doesn't update so fast)

velvet merlin
#

yup

#

especially after setPos player or object

#

how to determine the object p3d if it has no class - nearObjects?

jade abyss
#
  • a typeOf isEqualTo "" check?
#

(Not at pc atm and off in a few)

torn jungle
#

hmmm. i put the script commy posted: params ["_unit", "_shooter"];

if (alive _unit && {side group _unit == civilian} && {isPlayer _shooter}) then {
private _message = format ["Civilian harmed by %1", name _shooter];
_message remoteExec ["systemChat"];
};

#

into civkill.hpp

#

then i added #include "civkill.hpp" into description.ext

#

but it crashes

indigo snow
#

you can't include SQF code into description.ext

#

description.ext uses a class structure

torn jungle
#

should it be in init?

indigo snow
#

from what i see it's the code block for an event handler

torn jungle
#

the original code was

#

class Extended_Hit_Eventhandlers {
class Civilian {
class civ_hit {
// runs where unit is local
hit = "if (alive (_this select 0) && {side (_this select 0) isEqualTo CIVILIAN} && {isPlayer (_this select 1)}) then {hint ""Innocent Civilian Harmed"";}";
};
};

#

it was a script from DCG by senseii which i just modified

#

it was in an hpp file. and the description.ext "included" it

indigo snow
#

Right so convert commys code back into a string and replace the hit = ""; string

torn jungle
#

like this?

#

class Extended_Hit_Eventhandlers {
class Civilian {
class civ_hit {
// runs where unit is local
params ["_unit", "_shooter"];
hit = "if (alive _unit && {side group _unit == civilian} && {isPlayer _shooter}) then {
private _message = format ["Civilian harmed by %1", name _shooter];
_message remoteExec ["systemChat"];}";
};
};
};

#

please dont get angry

indigo snow
#

no, the params [... line needs to be in the hit = ... class as well

torn jungle
#

oh. hold on

indigo snow
#

also certain PBO packing tools will not accept a line break in a string and will error, be sure to escape with \n or remove the line break

torn jungle
#

class Extended_Hit_Eventhandlers {
class Civilian {
class civ_hit {
// runs where unit is local
hit = "params ["_unit", "_shooter"]; if (alive _unit && {side group _unit == civilian} && {isPlayer _shooter}) then {private _message = format ["Civilian harmed by %1", name _shooter];_message remoteExec ["systemChat"];}";
};
};
};

#

how bout now

indigo snow
#

now the quotes will break, replace the " inside the outer two " with ' like hit = " systemChat 'this is a string inside a string';";

torn jungle
#

all instances except the main outer two?

#

class Extended_Hit_Eventhandlers {
class Civilian {
class civ_hit {
// runs where unit is local
hit = "params ['_unit', '_shooter']; if (alive _unit && {side group _unit == civilian} && {isPlayer _shooter}) then {private _message = format ['Civilian harmed by %1', name _shooter];_message remoteExec ['systemChat'];}";
};
};
};

indigo snow
#

now all thats left is for you to test it

torn jungle
#

here we go

#

๐Ÿ˜ƒ

#

thanks cptnnick. Now i can shame players who shoot innocents in my server.

tame portal
#

@velvet merlin Fixed your issue with floating loot yet?

#

I have a function that (workaround) fixed it for me

#

on any map

velvet merlin
#

@tame portal building new release atm. we will see after that

tame portal
#

scriptName "fn_lowestPosition";
#define __filename "fn_lowestPosition.sqf"

// Parameters
_pos = param[0,[0,0,0],[[]]];
_pos = AGLToASL _pos;

// Exceptions
if (_pos isEqualTo [0,0,0]) exitWith {[0,0,0]};

// Code
_intersectsAt = lineIntersectsSurfaces [_pos, _pos vectorAdd [0, 0, -50], player, objNull, true, 1, "GEOM", "NONE"];

if (count _intersectsAt > 0) then {
ASLToAGL (((_intersectsAt select 0) select 0))
} else {
[0,0,0]
};

#

In case you need it

#

Pretty much just take the buildingPos position, run it through this function and you have an optimal position for your loot

#

works for every type of surface

#

@velvet merlin Any results yet?

velvet merlin
#

in 30min i should know more

tame portal
#

ay why so long ๐Ÿ˜›

velvet merlin
#

ok it seems my config change in groundweaponholder fixed it ๐Ÿ˜„

#

@tame portal still your assistance much appreciated
@jade abyss same to you ๐Ÿ˜ƒ

shadow sail
#

Is it possible to add a unique identifier to an object when spawned, so when its spawned again the previous version gets removed through delVehicle?

#

Do I wield missionNamespace for this?

carmine galleon
#

Try to add an id using setvarible

#

Setvariable

shadow sail
#

ah ha, thank you

carmine galleon
#

No prob mate

shadow sail
#

is there a way to add an id specific to a player itself?

#

I feel like if I add an id to a spawned vehicle and someone else spawns the same vehicle, wont it delete the first?

#

or if its private it will that name only be relevant to that thread of the script?

carmine galleon
#

What do you want to do exactly ?

shadow sail
#

I have a supply drop script that will be for squad leaders, when they spawn it a second time I'd like the first to be deleted

#

Dropping it works but I added a 'duration' to the supply drops, I realize I'd rather have the first get deleted to prevent abuse instead of it automatically deleting itself after x seconds

carmine galleon
#

They you can do this

#

Do a setVariable to the leader

#

And put as variable value the dropped item

#

When leader asks a new drop

#

Delete the old object using gervariable

shadow sail
#

ahhh

#

thank you!

carmine galleon
#

Your welcome

#

If it is for single player you can just store it in a global var

#

Note : if you want the actual setVariable to be available for every players or even server, you should make sure this variable is public by adding "true" to the set variable

#

Because by default, setVariable is local to computer who setted the var

shadow sail
#

Yea this is for a dedicated, thank you

#

I guess I only need the setvar to be available to the local machine requesting it right?

#

Since not all individuals have the action?

#

Or am I looking at it the wrong way

carmine galleon
#

If your drop script is server side, you can set the variable only server side

shadow sail
#

if (isServer) then

#

right?

carmine galleon
#

Then set variable in private ;)

shadow sail
#

awesome thanks

#

๐Ÿ˜ƒ

#

Hardest part about SQF is understanding the bigger picture

#

So far anyways

carmine galleon
#

If you need any help or improvement do not hesitate to send me pastebin of you mr script in private and I will have a look

shadow sail
#

Sure thing, I'll probably need some guidance ๐Ÿ˜›

#

I guess the dilemma is twofold. I have an option here, I can either have the box have 'duration' which I have added by self-deleting after a period of time and then add a _cooldown = 0 check with an if statement around the spawning of the object, OR make the object have a unique name and delete it on every spawn, preventing the server from filling up with extra crates. My concern with the second option is if a player spawns a crate and then leaves, if the server is up for 6 hours a number of people can do this on Stratis and I have boxes everywhere. I feel like if I add both I am making it unnecessarily complex. What would you do as an experienced scripter?

carmine galleon
#

Well here is a workaround

#

You could set a variable on you crate with the player object in value

#

And do a loop that checks every X minutes if the specified player is always logged in

#

And if not delete the crate

shadow sail
#

ahhh

carmine galleon
#

Or delete the crate after X time if no players nearby simply

#

You could even do a 2 in 1

#

When player calls drop, it deletes old drop

#

AND

#

Every 5 minutes, all crates spawned since more than, let's say 30 minutes and no players nearby, it gets deleted

shadow sail
#

Okay, so currently the addaction is given to a player and prevented from working while near the respawn_west marker with this:
player addAction ["Supply Drop","supplydrop.sqf",[],0,true,false, "", "player distance respawn_west > 250"];
And the Supply Drop script is here: http://pastebin.com/raw/Gw8WS9DR

#

I have no issue anyone seeing my probably borked code ;p

#

and objectDuration.sqf is just:

_box = _this select 0;

sleep 180;
deleteVehicle _box;```
#

its a separate script since I was going to reference it elsewhere

carmine galleon
#

I see but actualy your script is called client side

shadow sail
#

ah since if (isServer) isnt in place?

carmine galleon
#

Since you must make player remote exec on server ;)

shadow sail
#

so do I just add:

//script
};```
carmine galleon
#

Not really. Explaining

shadow sail
#

okay

carmine galleon
#

When you want script to be run on server but called from player you must use remoteExec command

#

Check BIWiki

shadow sail
#

BIS_fnc_mp?

carmine galleon
#

But you can also in your case make it fully clieny side

#

Yeah it's nearly the same

shadow sail
#

okay

#

what are the benefits/drawbacks of letting it be fully client side?

carmine galleon
#

Makes less network trafic

shadow sail
#

that sounds ideal

#

how would I make it client side only?

carmine galleon
#

Like you made

#

Just add the set variables

shadow sail
#

Oh okay ๐Ÿ˜ƒ

#

To the crate?

carmine galleon
#

And eventually on server you could add a onPlayerDisconnect eventHandler to delete crate

#

Nope, on leader

shadow sail
#

Okay, thank you so much ๐Ÿ˜ƒ

shadow sail
#

Nvm Dwarden pointed me in the right place

#

ack wrong spot

#

Can you encrypt anything aside from the mission.sqm for file size sake? I am not doing it to hide anything just to make the PBO lighter

lone glade
#

nope

shadow sail
#

Okay thank you

little eagle
#

If you have pictures , you can convert them to .paa

#

Sounds to .wss

#

Can't do anything with scripts or configs.

shadow sail
#

Thanks ๐Ÿ˜ƒ

shadow sapphire
#

The script is for more immersive respawn in a PVP game mode.

#

It takes dead and late joining players, puts them into spectator mode, and whenever an objective is captured, it triggers the respawn function, which should load the JIPs and dead (respawned) players into a helicopter and drops them off at their base.

shadow sail
#

So, I have units that are squad leaders I want to assign a specific action. Can I somehow do if (player == _unit) { and then make _unit an array with all squad leader names (like S1, S6, etc.)?

little eagle
#

player == leader player

#

?

shadow sapphire
#

@shadow sail, I am not good at this, so you'll have to hear a second opinion, but you should be able to just be able to use the array if you give variable names to all of the squad leaders.

shadow sail
#

where does 'leader' come from in that,. commy2?

#

is that a globalvar?

little eagle
#

leader is a script command that reports the leader of a group or unit

shadow sail
#

well hot damn

little eagle
#

yw

shadow sail
#

thank you!! ๐Ÿ˜ƒ

#

so I would do if (player isKindOf leader then {

#

I guess I could do a second condition in the init

little eagle
#

nope. isKindOf checks if a object or classname (left side) inherits from the classname on the right side

shadow sail
#

ah gotcha

little eagle
#

And leader needs something on the right side

shadow sapphire
#

@little eagle, any chance you feel like reading over my function and giving some guidance there?

little eagle
#

I think this is strange:
!(_spawned in GreenReinforcements)

#

Why would an object respawn twice?

#

I think this check is unnecessary.

#

Even then, you could simply replace pushBack with pushBackUnique

#

That will make sure you won't add another thing to the array if it's already in there

carmine galleon
#

@shadow sail if((leader (group player)) == player)

shadow sail
#

ah, โค

carmine galleon
#

Or, simpler, if((leader player) == player)

shadow sapphire
#

@little eagle, the respawn twice catch is because when players join in progress, they are respawned. It's because we have an issue where if a player ragequits after being killed and another player joins that slot or the player returns, it is added to the array again. However, even with that check, the issue was still happening, so I believe I will change over to pushBackUnique! Thank you for the tip! However, the main issue I am having at present is that units in the array aren't being added to the helicopter for some reason and we don't know why.

shadow sail
#

hmm, im using old invade and annex, it must treat all units as leaders as they're getting the addactions

little eagle
#

I'm pretty sure that won't work. Each time a unit respawns, a new "entity" is created. No two entities can be the same (hence entity I guess?)

#

@shadow sail In SP, you will always be the leader by default

shadow sail
#

well this is on a dedi

little eagle
#

You can decrease your rating to get the AI to be leader

shadow sail
#

if im the only player in the group am I the leader?

little eagle
#

Or increase the rating of a bot. If all ratings are equal - and that is the default - the player will be the leader

shadow sail
#

well this is a Dedi and if I choose either the Grenadier slot or the Squad Leader I get the actions added

little eagle
#

doesn't matter. By SP I mean all group members are AIs

#

Also "Squad leader" doesn't mean the unit is the leader

shadow sail
#

this isnt SP, I said it was on a dedicated

#

ah

little eagle
#

"Squad leader" is just a soldier class

#

Try to increase the rating of the Squad Leader above the default

#

You can do that by selecting a higher "rank"

shadow sail
#

And this will work in MP?

little eagle
#

yes

#

It will make sure that that slot is always the leader

shadow sail
#

Well the only AI on the mission are simply the playable units, no actual AI on my side.

little eagle
#

unless the rating changes ofcourse

shadow sail
#

Okay

little eagle
#

playable units are AI

shadow sail
#

well, I mean they arent occupied by an AI during the mission

little eagle
#

If you have AI disabled and you are the only guy in your group, you will always be the leader too

#

Every group has to have a leader

#

You can start another instance of the game to do MP testing btw

shadow sail
#

I have a dedicated up that I test on

little eagle
#

That way your second game instance can be a non-leader

shadow sail
#

So if I had AI disabled and someone else joins my squad, what happens then? Am I no longer leader?

#

Or will it fall back on the playable unit AI ranking

little eagle
#

Only one will be the leader

#

The one with the highest rank/rating

shadow sail
#

Gotcha

little eagle
#

If they are the same then a player will be the leader

#

If both are player, the unit that was placed in the editor first is the leader

#

"Squad Leader" unit class means nothing

#

If you place groups (F2), the units will have predefined ranks/ratings and usually the one with the highest rank is the "Squad Leader"

#

If you place them by hand, everyone will have the default rank/rating

shadow sail
#

Ah thank you

shadow sapphire
#

@little eagle, it seems that even pushbackunique did not stop the problem of having duplicates in the array.

little eagle
#

neither will the in check

shadow sapphire
#

In check?

little eagle
#

Because every time a unit respawns, a new entity is created

#

!(_spawned in GreenReinforcements)

shadow sapphire
#

Rats. Any ideas on how to fix it? Do we just let it go? Surely it won't be common enough to be a problem soon.

little eagle
#

are those duplicate reinforcements dead?

shadow sapphire
#

Yes, I believe. The duplicates are created whenever a player that is in the queue leaves and someone rejoins that same slot.

little eagle
#

You need another event handler that removes objects from the array if a player disconnects

shadow sapphire
#

Ah, I see. This can be done, but for now, I would have to say it isn't the priority, since we don't even have the units in the array being added to the chopper correctly at present.

#

Whenever the choppers spawn, it clears the array, the choppers arrive, land, open doors, wait, close doors, fly away, delete flawlessly, but no unit is ever put into or taken from the chopper.

little eagle
#
addMissionEventHandler ["HandleDisconnect", {
    params ["_unit"];

    // do stuff

    false //event has to return boolean, true would cause the server to keep the unit as AI
}];
shadow sapphire
#

So, I put that in the function, rather than putting a file together in the onplayerdisconnect.sqf?

little eagle
#

no, it has to run on the server

#

same place the other mission event handler is

shadow sapphire
#

Thank you!

little eagle
#

I see that you never put the units into the helicopter

shadow sapphire
#

Correct. I am unsure of how to do it.

little eagle
#

There are moveInXXX commands

#

But I believe they are broken for players and only work for AI

shadow sapphire
#

I see. We do have movein commands.

#

MoveInCargo, but it doesn't appear to be working.

#

I thought there was an assignAsCargo command that worked, but I can't find that one.

little eagle
#

Where is your script running?

shadow sapphire
#

init.sqf.

little eagle
#

Oh I just looked at the first line

#

Your script is running on the server only

shadow sapphire
#

Should be, yes.

little eagle
#

That is good, but MoveInCargo only works if you execute it on the machine where the unit is local

#

Wait...

#

[_unit, _vehicle] remoteExec ["moveInCargo", _unit]

#

That is the syntax to execute commands on other machines

#

remoteExec

#

moveInCargo is the command

#

[_unit, _vehicle] are the arguments for that command

#

basically: _unit moveInCargo _vehicle

#

And the second _unit says: "execute this command on the machine where the unit is local"

#

This is difficult networking-locality stuff, but I hope it helps

shadow sapphire
#

I am sure it will! Due to the context, do I replace _unit with _x or do I use it exacty as you've posted?

            _x hideObjectGlobal false;
            _x enableSimulationGlobal true;
            [_unit, _vehicle] remoteExec ["moveInCargo", _unit]
            ["Terminate"] remoteExec ["BIS_fnc_EGSpectator", _x];
        } forEach _units;```
little eagle
#

you obviously have to replace my variables with yours

shadow sapphire
#

Many thanks to you. Will test now, I think I've got it squared away.

shadow sail
#

So I put the names of the squad leader units into an array and am passing over it with a forEach, but unfortunately it doesn't seem to be working Doesn't it need to be the variable name of the soldier or the actual soldier name like B_Blah_TL_F?

#

It doesn't show errors but the Leaders aren't getting the actions

little eagle
#

You have to addAction on the player machines

shadow sail
#

It is

little eagle
#

Change the condition to "true" to make sure

shadow sail
#

{
player addAction ["Tank Drop","tankdrop.sqf",[],0,true,false, "", "player distance respawn_west > 250"];
player addAction ["Supply Drop","supplydrop.sqf",[],0,true,false, "", "player distance respawn_west > 250"];
} forEach mapLeaders;```
#

Neither the variable name of the leader or the soldier name seem to work. If I remove the foreach all soldiers get the aciton.,

little eagle
#

What is respawn_west ?

shadow sail
#

a waypoint on the map

#

again, its working without the foreach

little eagle
#

Can't be. Waypoints are Strings "respawn_west" would be a waypoint

shadow sail
#

I can use my actions and the distance from respawn_west all works, its when I assign it to a specific soldier it breaks

#

An object with the name "respawn_west"

#

whatever thats not relevant to the foreach

little eagle
#

You aren't adding the actions to soldiers. You are adding them to the player

shadow sail
#

Yes and I am trying to GIVE the PLAYER in that SLOT the action.

#

That's what trouble I am having

#

If I assign the slot a variable name like Leader1, and then do a forEach it doesnt work, do I need to get all players and compare them to the slot?

little eagle
#
if (typeOf player == "B_Soldier_TL_F") then {
    // add action
};
shadow sail
#

d'oh

#

thank you

#

can I do an or there?

#

"BSoldier_TL_F" or "B_Soldier_SL_F"?

little eagle
#

typeOf player == "B_Soldier_TL_F" or typeOf player == "B_Soldier_?_F"

shadow sail
#

ah ha

#

thanks

#

I guess I can just change the SL_F to TL_F too and not worry about it

#

Thanks for your help

little eagle
#

sure

shadow sail
#

is ? a usable wildcard in such things?

little eagle
#

But I still think your conditions is invalid

#

player distance respawn_west > 250

shadow sail
#

You can think so if you like, but it works just fine on my dedi.

little eagle
#

So you put your marker "respawn_west" into a variabe called respawn_west ?

shadow sail
#

?

#

I already said

#

I have an object named respawn_west

little eagle
#

Oh, so it's not a marker after all

#

I was confused because "respawn_west" is the hard coded marker name for blufor respawn points

shadow sail
#

Ah okay

#

Yea, it's my flagpole spawn ;p

#

I didn't mean to say waypoint mb

#

Sorry for being terse, sometimes this gets frustrating ๐Ÿ˜›

little eagle
#

You tell me

shadow sail
#

Hehe

shadow sapphire
#

@little eagle, your solution worked perfectly for my problem... but it is only loading one unit from the array into the chopper, but still clearing the array. Any idea why it might do this?

shadow sail
#

I'm toying with setVariable and getVariable to delete an object if a new object is spawned, I understand set and getvariable, but if I set the variable on to the crate and then spawn another, how do I getvariable of the first crate to delete it?

#
delVehicle _veh
//do the things
_veh setVariable ["DeleteThis", "1", false]```
#

I feel like I am missing something obvious

#

or am I thinking of this the wrong way?

little eagle
#

you cannot use setVariable after you delete the object

shadow sail
#

well I am trying to check to see if a previous object with that variable exists and if so delete it

#

and keep it local to the client

#

so they cant spam airdrops and fill up the server over time

little eagle
#

you wrote

delVehicle _veh
_veh setVariable ["DeleteThis", "1", false]

but _veh is deleted before you use setVar

shadow sail
#

well it spawns the vehicle in the //do the things section

#

I shouldve been more clear

little eagle
#

Oh, they are different things

shadow sail
#
_para setPosATL (player modelToWorld[0,0,200]);
_veh = createVehicle ["B_CargoNet_01_ammo_F", [0,0,80], [], 0, ""];
_veh attachTo [_para,[0,0,-3]]; 
["AmmoboxInit",[_veh,true]] spawn BIS_fnc_arsenal;```
#

is the current supplydrop script

#

when this runs I'd like it to kill off the previous spawned object

snow pecan
#

remove the quotes around the 1 in setvariable

#

_veh setVariable ["DeleteThis", 1]

shadow sail
#

okay, so if I setvariable do I then have to do nearObjects and get all CargoNet boxes and check if the variable exists to delete?

#

Im sure there is an easier way

little eagle
#

I think you have to rethink want you want to do

shadow sail
#

Explain?

Player has an addaction to spawn a crate with a parachute. This works. I'd like it to be able to remove a previously spawned crate when a new one is spawned.

little eagle
#

So if the player paradrops another crate, the previous one is deleted?

shadow sail
#

Yea

little eagle
#
private _prevCrate = player getVariable "prevCrate";
if (!isNil "_prevCrate") then {
   // delete
};
//paradrop
player setVariable ["prevCrate", _ammoBox];
shadow sail
#

I love you.

little eagle
#

edited it, pressed enter to soon

shadow sail
#

๐Ÿ˜›

little eagle
#

You probably want to also clean up the crates when a player disconnects

#

use a handleDisconnected like I posted before and let the server delete it

#

might want to use the public setVariable then

#

so the server knows the crate too

shadow sail
#

okay cool

#

thank you

#

well currently they have a duration to avoid that

#

but thats probably better

little eagle
#

The problem with those lifetime counters is, that if the player that has the timer running disconnects

shadow sail
#

Ah..

little eagle
#

it will never reach 0

shadow sail
#

Good call

#

So an onDisconnect event handler, will do

little eagle
#

Yeah. The "HandleDisconnect(ed?)" one is nice, because you get the player object

shadow sail
#

In your code example above would my delete be deleteVehicle _ammoBox or deleteVehicle _prevCrate?

#

ahh nvm

#

Works great thanks ๐Ÿ˜ƒ

shadow sail
#

Can I do multilines in hints with \n?

#

nvm

lone glade
#

Guys bit of a warning, for some reasons it seems that groups created via BIS_fnc_spawngroup don't get deleted.

vapid frigate
#

i don't think any groups get deleted unless you delete them

lone glade
#

Unless the last unit of the group is killed (not deleted, killed) the group will NEVER be deleted

#

I wrote a cleaner to avoid reaching the group limit.

vapid frigate
#

yeah, we had to do the same recently. do you know if it's always been the case?

lone glade
#

since 1.56 apparently

vapid frigate
#

could've swarn empty groups used to get deleted automatically

lone glade
#

corpse and wreck cleaner don't work either

vapid frigate
#

i see.. that would fit when ours starting stuffing up

native hemlock
lone glade
#

Or just delete groups serverside?

native hemlock
#

I guess the conclusion was that groups that are empty don't get cleaned up if they are not local

lone glade
#

doesn't matter if they are local or not

#

If the last unit is removed instead of killed the group won't be deleeted

native hemlock
#

Is the group definitely empty? Because I would think that group would be local

lone glade
#

It was hapenning with AI groups spawned on the server

#

those don't change locality nor owner

#

I also managed to have 146 east groups somehow :p

native hemlock
#

lol that's really odd

lone glade
#

My functions spawn AOs, and just me deleting the units via zeus

#

reached 146 groups after 5-6 AOs

native hemlock
#

So are you saying you needed that script to clean up the groups, or that the groups aren't cleaned up even with that script?

lone glade
#

that I needed that

#

The body cleaner / wreck cleaner and the engine solution BI has to delete empty groups don't work

#

The only thing that seems to work fine is the ground holders being removed after some time

vapid frigate
#

can see the issue easily.. just spawn 150 single man groups with a script, then delete all the units, and count allGroups

#

will still be 144 or whatever

rotund silo
#

does anyone know if KillZoneKid uses Discord?

native hemlock
#

I have not once seen him in here

#

Unless he hasn't said anything or is under a different name

rotund silo
#

he would probably get smashed if he did.

#

@native hemlock fair point

little eagle
#

the script of quicksilver isn't safe in scheduled env.
It could wreck another spawn script doing stuff like:
(createGroup west) createUnit [blah]
by deleting the new group before the new unit was created.

jovial nebula
#

Hey guys,does anyone know how can i get player object using profilename or UID ?

lone glade
#

gimme a sec

#
// finding a player var based on his name
(allPlayers  select {toUpper (name _x) == toUpper ""} param [0, objNull]);
#

use example:

(allPlayers select {toUpper (name _x) == toUpper "alganthe"} param [0, objNull]) setDamage 1;
native hemlock
#

That wouldn't get dead players though

lone glade
#

replace playableUnits by allPlayers then

#

there.

native hemlock
#

๐Ÿ˜ƒ

jovial nebula
#

So cool thank you alganthe!

#

So name in multiplayer is the same thing as profilename ?

#

If i understand it correctly

austere granite
#

I might be wrong, but in case two people with profilename "Dardo" connect, then 'name _unit' will return Dardo (2) on the second guy, where his profilename will still be "Dardo'

#

@jovial nebula ^

#

If you start up two copies of the game you can connect to your own hosted LAN game and test it.

jovial nebula
#

Are you alganthe's brother? ๐Ÿ˜ฎ

#

Thank you so much guys,going to test it in the lan

lone glade
#

name isn't the same as profileName

#

especially if you have a squad XML

austere granite
#

name doesn't include squad XML does it?

lone glade
#

it does

#

my profileName is alganthe, my name in game will be alganthe [AW]

native hemlock
#

If you change your identity in game with setIdentity , name player will return whatever identity you've changed to

jovial nebula
little eagle
#

that is why you never script around the "names", but the objects or client IDs instead

dusk sage
#

@lone glade

Isn't == case insensitive?

(allPlayers  select {name _x ==  ""} param [0, objNull]);

or if you wanted

(allPlayers  select {toUpper (name _x) isEqualTo toUpper ""} param [0, objNull]);
little eagle
#

== is NOT case sensitive
isEqualTo IS case sensitive

dusk sage
#

exactly

#

So the toUpper isn't needed

#

Unless using isEqualTo, like in the example. I said insensitive ๐Ÿ˜›

tame portal
#

Hmmm battlefield 2 in arma..

little eagle
#

@tough abyss fuck off

#

No one said anything about performance

nocturne bluff
lone glade
#

NOT A GIFV? YOU HEATHEN

little eagle
#

YES

shadow sapphire
#

Anyone know of a script or function that has the ability to SMOOTHLY move targets in multiplayer? I've got one that's super nice for single player, but it has some odd behavior to say the least when it's done in multiplayer.

lone glade
#

what do you mean by move ?

austere granite
#

Which type of targets?

#

If it's vehicles you can use setVEelocity to make a bit better

lone glade
#

Doesn't work since it has to be synced in MP

shadow sapphire
#

@lone glade, I have the moving zombies on rails. I can send a picture to illustrate what I'm after. Wait one.

#

I think those should illustrate what I'm trying to do better than I can describe.

lone glade
#

oh that

#

setVelocity with a PFH should work fine

shadow sapphire
#

There doesn't happen to be a moving targets on rails module I can just drop in, huh?

#

Also, what's a PFH?

lone glade
#

PerFrameHandler

#

and no on rail module

shadow sapphire
lone glade
#

does that even works ? there's a syntax error

shadow sapphire
#

Haha, yeah, it works in single player and it works (with odd behavior) when I am alone on a multiplayer server.

lone glade
#

under what are those rails btw?

shadow sapphire
#

I don't quite understand your question.

lone glade
#

the rails on the ground, under what object category are they?

shadow sapphire
#

OH! I am unsure, I know they are under empty objects. I'll find it for you, wait one.

#

Props/Things/Targets/Rails

lone glade
#

nevermind found them

shadow sapphire
#

May I get a link to perframehandlers? I can only find CBA related links.

lone glade
#

it's a CBA thing, I ported it to vanilla tho

shadow sapphire
#

Oh? That's what's up.

lone glade
#

but the gist of what you want to do is pretty much:

  • align both ends properly
  • Make the object move in the direction of one of the ends
  • Check if the object is near the end, if it is stop it.
shadow sapphire
#

Both ends are definitely aligned properly. Straight as an arrow! However, the rest I don't even know where with to start!

lone glade
#

erf setVelocity doesn't work properly on non physX objects

shadow sapphire
#

That super sucks!

lone glade
#

got it working with setPos

#
[{ 
    params ["_args", "_pfhID"]; 
 
    private _dir = getDir target; 
    private _speed = 5; 
    if (target distance2D end2 >= 1) then { 
        target setPosWorld 
        [ 
            (position target select 0) - (sin (_dir))*_speed, 
            (position target select 1) - ((cos (_dir)))*_speed, 
            0 
        ]; 
         
        target setPos
           [ 
               (position target select 0) + ((sin (_dir)))*_speed, 
               (position target select 1) + ((cos (_dir)))*_speed, 
               0 
           ]; 
    } else { 
        _pfhID call derp_fnc_removePerFrameHandler;     
    };     
}, 0, []] call derp_fnc_addPerFrameHandler;
#

name both your end rails, and invert the + and - pos for advance, back up

#

just gimme a sec to pack up the mission

#

am bad with maths so it won't go forward, but it goes backwards fine :p

shadow sapphire
#

Wow! Holy cow! Thank you very much! I didn't expect you to do it for me while I was away! Goodness.

#

Do you think there is any way I could make the targets go forward instead of backwards simply? Like by changing a +/- somewhere, maybe?

lone glade
#

maths, and i'm bad with them

shadow sapphire
#

Haha, okay. I'll see what I can do!

#

It's throwing an error saying advance.sqf not found, but it's working perfectly nonetheless! Going to test in MP as soon as I get it figured all out here.

#

@lone glade

lone glade
#

forgot to remove the class under functions

shadow sapphire
#

Okay, I'll do it!

#

Thanks so much!

#

SO, SO much.

little eagle
#

wait, did this actually work?

velvet merlin
#

Fixed: The HandleDamage Event Handler was not working correctly
Added: โ€˜No spamโ€™ versions of some of the RPT logs
gotta love the descriptive commit messages

carmine galleon
#

Hey

jade abyss
#

No

carmine galleon
#

Lol, fun

#

Much lol

jade abyss
#

๐Ÿ˜ƒ

carmine galleon
#

I already love you

jade abyss
#

yeah, i know. i am charming.

#

Now go and ask your question.

carmine galleon
#

Yup

#

Seems that when using setVariable on building even with public flag at true, result is not reliable on players

#

Sometimes broadcasted, sometimes not

jade abyss
#

on MapObject?

carmine galleon
#

Yup

jade abyss
#

Yep

#

Known

carmine galleon
#

Weird

#

Gonna do a workaround from hell

jade abyss
#

Create a Can (or whatever) at the Pos of the House and check the Var from there.

little eagle
#

It's not even setVariable

carmine galleon
#

Yup, was the idead

#

Thx for tip

little eagle
#

The game can't even remember damaged winows and opened doors

carmine galleon
#

idea*

#

Seems legit โค

jade abyss
#

Just when the Data is beeing set, before its known by the player.

prime valve
#

Or you know, maybe attach a white flag on the house and set variables on it

carmine galleon
#

Pirat flag

carmine galleon
#

If you see anything to add

#

Dwarden asked me to do a bug report

#

(Also for @little eagle )

jade abyss
#

I think, there was already a bugtracker entry

carmine galleon
#

IDK

#

Dwarden - Aujourd'hui ร  23:32
ye i need repro or seriously serious simple yet effective report ๐Ÿ˜‰(รฉditรฉ)

prime valve
#

Let's say this new one is less dusty

carmine galleon
jade abyss
carmine galleon
#

Will merge

#

Le

#

l

#

Can't

jade abyss
#

add a note with the Link to the other one? Maybe? Just an opinion?

carmine galleon
#

I did

#

Seems like the ticket you gave me is in "Feature request" and not bug report

#

Could be why it didn't got fixed since march 2014

jade abyss
#

I just made an "example"

#

Check the 2nd Link, there are alot of other Entrys with the SetVariable problem

carmine galleon
#

Yep I know there are others feebacks about this

#

But as Dwarden asked me to do a bug report, it's done and link sent in PM to him

#

So at least it could me more "accessible" for BI Dev team

earnest valve
#

Hey is anyone getting radio issues with the Intro and Outro modes of the editor?

#

I cannot seem to use sideRadio, groupRadio, globalRadio and vehicleRadio. (same issue applies with kbTell too)

#

the only command that works is "DIRECT" for kbTell and directSay

earnest valve
#

I have searched everywhere, but every single thread out there has been unsolved. :(

shadow sail
#

When doing addaction is there a way to prevent it from showing up on the players crosshair immediately?

vapid frigate
#

@shadow sail: think that's the 'showWindow' parameter

shadow sail
#

Thanks!

#

Would anyone happen to know the default values of weapon sway and associated coefficients for ArmA 2?

little eagle
#

It's totally different from A3.

gleaming relic
#

Does anybody knows what has changed in 1.60 regarding Taru Pods? In Exile-Mod the pods are no longer accessible / lockable

shadow sail
#

Seems that guy can get at least one of them working, wonder if their classnames changed?

shadow sapphire
#

Okay, I'm back and I'm still having issues with my helicopter redeploy function. At present, it's only grabbing one object from my array to redeploy, but it's clearing the whole array.

#

Anyone feel like taking a look?

lavish ocean
#
Bohemia Interactive Forums

Page 6 of 6 - Development Branch Captains AI Log - posted in ARMA 3 - DEVELOPMENT BRANCH: 13-05-2016Added: A default value for the AIAvoidStance to the Default class of cfgSurfaces (0 means no change in the behavior on that surface, 1 means less preference for going prone, 2 means almost never going prone)Relates to the previous post.

shadow sail
#

Is there an easy way to give all players the option to repair vehicles? Spawn them with a toolbox or?

shadow sapphire
#

@shadow sail, it's a little more complicated than that, but it's not super hard. Wait one and I can try to help you out.

shadow sail
#

Thank you, that would be great.

#

awesome!

shadow sapphire
#

@shadow sail, try this and let me know what happens. Paste it into your initplayerlocal.sqf:

player addAction ["Field Repair",{
    _ct = cursorTarget;
    _startTime = time;
    _totalTime = time + 60;    
    [60, ['FIXING','','FIELD REPAIRING'], 'Acts_CarFixingWheel', true];
    _dmg = getDammage _ct;
    _ct setDamage _dmg;
},nil,1,true,false,"",'
    ("ToolKit" in items player || "ToolKit" in itemCargo cursorTarget) &&
    (cursorTarget isKindOf "LandVehicle" or cursorTarget isKindOf "Ship" or cursorTarget isKindOf "Air") &&
    speed cursorTarget <= 3 &&
    player distance cursorTarget <= 4
'];```
shadow sail
#

and an easy way to include the ToolKit on all players?

shadow sapphire
#

Players have to wear a backpack to hold the toolkit, so you'll need at least:

_unit addItemToBackpack "ToolKit";```

In your loadout script.
jovial nebula
#

Hey guys does anyone know how hard is to make a unit play an animation while in a vehicle?

shadow sail
#

Thanks a bunch DEL-J. โค

shadow sapphire
#

@jovial nebula, with Arma scripting, the question usually shouldn't be, "is it possible?" it should be, "how hard is it?"

jovial nebula
#

Lol let me edit the question

#

Done ๐Ÿ˜„

shadow sapphire
#

Haha, good stuff. Anyway, I'm not very good at this stuff, so I don't know how to answer your question, but I know making a unit play an animation is usually very easy, but it seems like to make the units do it in a vehicle, you may have to know some commands that I don't know.

dusk sage
#

If you play an animation while in a vehicle

#

It should work

#

But you won't return to your sitting position

shadow sapphire
#

@dusk sage, does it matter if it's a switch move or play move animation?

dusk sage
#

Not enirely sure, I could imagine playMove would cause problems, switchMove wouldn't

shadow sapphire
#

@jovial nebula, take note!

#

@dusk sage, any chance you feel like helping me with my helicopter redeply function?

jovial nebula
#

Lol i got it

dusk sage
#

Where is it?

shadow sapphire
#

I'll get you a paste or gist. Which do you prefer?

dusk sage
#

paste

#

so I can copy paste it

#

๐Ÿ˜„

#

Prefer reading from my own editor

#

Which really, means it doesnt matter

#

Jesus, too hot today

shadow sapphire
dusk sage
#

Okay

#

So what's the problem at the moment

#

So I don't need to read it all

shadow sapphire
#

The problem is that when the chopper spawns, only the first unit from the array gets added in to the chopper. That's not the only problem, but that's the big one.

#

The secondary problem is that most of the time, the players don't get "seated" in the chopper, they just levitate above their seat the whole ride in that "unknown" animation that happens when you're on a handrail or other thing you shouldn't be on, as if the chopper is freefalling to simulate microgravity.

shadow sail
#

How difficult is it to implement extdb for saving kills and deaths? Very few guides in regards to setting it up and even fewer in pulling out the data I am looking for. Or is there a way to keep kills and deaths persistent and also export those values when the server restarts?

#

I know I can do it using profileNamespace and eventhandlers in the mission itself, but I am interested in getting that data out and am not sure the best way.

dusk sage
#

Having a look now

#

PM @shadow sapphire

#

@shadow sail

Using extDB to save kills and deaths would be incredibly easy

#

Just keep a count, or even update on each death/kill

#

onPlayerKilled gives you the killer

shadow talon
#

Does anyone know a way to log who's drawing on map using that new feature? We have addon that logs placed markers but it doesn't log drawing...

little eagle
#

don't you think iterating over all markers every frame is overkill?

lone glade
#

it is

shadow sapphire
#

@lone glade, the moving target script with per frame event handler didn't work. I came up with an alternate idea that was much easier to use.

lone glade
#

but fuck penis drawing

#

troll spotted

shadow sail
#

I can't find anything in regards to building the extDB database with MySQL. It seems as if the old extdb2 github repo is down and the bitbucket guide for extdb has no information regarding it. Where would I start?

little eagle
#

No, you don't use the scheduler

#

But you use a map draw eh

dusk sage
#

Here's a fork of it

little eagle
#

Because both methods are equally bad

shadow sail
#

Thanks!

lone glade
#

It's getting more and more subtle quicky :p

little eagle
#

Alganthe, I'd add a draw eh to the map display

dusk sage
#

Building a database with MySQL has no special relation to extDB2. It will work absolutely fine on any database, regardless if it is for ARMA or not. So nail down making a simple SQL with a table, and Bob's your Uncle @shadow sail

little eagle
#

that way only markers are deleted if the map is shown

lone glade
#

I'll do that then.

shadow sail
#

Okay, so I can just make it whatever and then put the credentials in the extdb config and go from there?

dusk sage
#

yep

shadow sail
#

Thanks!

dusk sage
#

It executes simple commands, that is all

little eagle
#

you spend like 1% of the time on the map, so huge improvement

#

won't happen. computers are really bad at identifying pictures

#

see reverse image seatch ...

lone glade
#

we need that penii detection algorithm in arma 3

little eagle
#

well, you know

#

or BI fixes the disable setting

lone glade
#

good luck doing that

little eagle
#

doesn't sound that hard

#

but it probably won't happen

#

you have to know WHO made a marker

#

idk if there is a way for that

shadow talon
#

:/

little eagle
#

just delete them all

#

you have to know who made the penis for that though

lone glade
#

still a PITA

little eagle
#

that deletes all markers for that player

#

everyone who is in that white list would either still see the markers

#

or see no markers

#

depends on if deleting them is global

lone glade
#

it's global afaik

little eagle
#

So if there is at least one client that is not whitelisted on a map

#

all ploylines vanish

#

stringtable.csv no longer usable wih 1.60 ?

#

can't find the strings anymore

lone glade
#

You can use setVar / getVar on markers ?

#

the code above should work, it can be improved tho.

#

no

#

merge the two IFs into one and use in instead of that BIS func

#

going to grab a bite, I'll check after that, I don't have much to do :p

shadow sail
#

How would I implement a HandleDisconnect event handler to delete any vehicles spawned by a player? And is there an eventhandler for switching squads or positions on the same side?

little eagle
#

store the spawned vehicle object references in a public object namespace variable

#

and on dc, iterate through the array and delete the objects

shadow sail
#

and what about switching squads or roles?

#

is there an EH for that?

#

and do you have an example by chance of any of this?

little eagle
#

switching groups? The object would stay the same

shadow sail
#

right I mean is there an EH to handle switching groups?

little eagle
#

Switching roles? how? HandleDisconnect should fire when returning to the lobby

shadow sail
#

Ah

#

if the script is referenced by multiple people and it sets a publicVariable will they all get overwritten?

little eagle
#

there is no event hander for switching groups

shadow sail
#

okay

little eagle
#

if the script is referenced by multiple people and it sets a publicVariable will they all get overwritten?
nonono

#

not a global variable

#

a public object namespace variable

#

player setVariable ["blah", [<array>], true]

shadow sail
#

ah okay, I have that currently for when the script fires a second time it deletes the previous iteration

#

player setVariable ["prevCrate", _veh];

little eagle
#

yes. You make that one an array and append it every time you spawn a vehicle

shadow sail
#

So the event handler would be PlayerDisconnected

#

player addMPEventHandler ["PlayerDisconnected", {deleteVehicle _prevCrate; deleteVehicle _prevChute}];?

little eagle
#

two things

#

PlayerDisconnected is a mission event handler

shadow sail
#

doh

little eagle
#

you use it on the server

shadow sail
#

okay

little eagle
#

Secondly, PlayerDisconnected is kinda broken atm

shadow sail
#

hmm so how should I go about this? HandleDisconnect or?

little eagle
#

alternative:
["myTag_myOPD", "onPlayerDisconnected", { script }] call BIS_fnc_addStackedEventHandler

shadow sail
#

myOPD?

little eagle
#

just a string to identify the thing

shadow sail
#

ah okay

little eagle
#

can be anything, but should be tagged

shadow sail
#

so I would say ["_veh","onPlayerDisconnected", { deleteVehicle _prevCrate }] call BIS_fnc_addStackedEventHandler ?

little eagle
#

what is your tag?

shadow sail
#

prevCrate

#

ah

#

["_prevCrate", "onPlayerDisconnected", { deleteVehicle _prevCrate }] call BIS_fnc_addStackedEventHandler

#

right? since _prevCrate is assigned by player setVariable ["prevCrate", _veh];

little eagle
#

no

#

totally wrong

shadow sail
#

lol okay

#

I am not seeing the bigger picture unfortunately

little eagle
#

onPlayerDisconneted is not what you want

shadow sail
#

that was in your example?

little eagle
#

addMissionEventHandler ["HandleDisconnect", {
params ["_unit"];

private _objects = _unit getVariable ["thearray", []];

{
} forEach _objects;

}];

#

HandleDisconnect != (on)PlayerDisconnected

shadow sail
#

ah

little eagle
#

HandleDisconnect gives the old player object, OPD does not

#

also HandleDisconnect isn't broken

shadow sail
#

I see, so that will grab the player unit info when they disconnect, get the variable I defined in "thearray" from "_unit" and then iterate over each object, right?

#

I know the actual action is missing in your example I just wanted to make sure I understood

little eagle
#

yes

shadow sail
#
    params ["_unit"];

    private _objects = _unit getVariable ["_prevCrate", []];

    { deleteVehicle 
    } forEach _objects;
}];```
#

right?

little eagle
#

sure. it'd choose a different variable name, but whatever

shadow sail
#

why so?

little eagle
#

"_prevCrate" means "prvious crate"

shadow sail
#

yes

#

I want to delete any previous crates the player has dropped

#

๐Ÿ˜›

little eagle
#

crateS

shadow sail
#

well there can only be one per player, there is an if (!isNil) check to see if there is a prevcrate and it deletes it to prevent the server from filling up

#

I just wanted a way if they left to also get rid of it

little eagle
#

also , having a global variable with underscore is confusing and strange

shadow sail
#

well its private at the moment, I realize I have to make it global

#

gonna change that

little eagle
#

I think you completely misunderstood that

#

private _crate = ...createVehicle
^ local variable

#

player setVariable ["MyTag_crate", _crate, true];
^ global public (object namespace) varibale

shadow sail
#

ah nvm its PrevCrate I was referencing the wrong part here

#

its late im tired ;p

little eagle
#

setVariable always is about global variables

shadow sail
#

yea

#

its player setVariable ["prevCrate", _veh];

#

im just blind and tired

little eagle
#

About tags...

#

It is good practice to name your global variables with a tag

#

So they don't collide with global variables of the base game or other mods and missions

#

It also indicates what a global variable is and what a scripting command

#

So it makes the code easier to read

#

You can't for example not name your global variable "items", because "items" is a scripting command

shadow sail
#

gotcha

little eagle
#

If you used "params" as global variable before 1.44 your script would've been broken by BI adding a command with that name later

#

So you should name them "MyTag_params" or "MyTag_items"

shadow sail
#

ahh

little eagle
#

MyTag can be anything

#

CBA uses "CBA_"

shadow sail
#

just to separate it from the standard

#

yea

little eagle
#

ACE3 uses "ACE_"

#

BW mod uses "BWA3_"

#

etc etc

shadow sail
#

EH only needed to be executed once, correct? So I could put that in its own SQF and execVM in init.sqf?

little eagle
#

only once and only on the server

shadow sail
#

so if (isServer) or initServer?

little eagle
#

doesn't matter