#arma3_scripting

1 messages ยท Page 630 of 1

little raptor
#

_hordetype is string

sonic thicket
#

oh damn

#

thanks

#

lol yeah

little raptor
#

well it shouldn't be

sonic thicket
#

I see, i just tried quoting it

#

which didnt exactly worked

little raptor
#

quoting makes it string

#

it must not be a STRING

sonic thicket
#

_hordetype is saved as ["string"] in the paremeters yeah but since it is a different trigger i cant really do thisTrigger or something like it

little raptor
#

Ever heard of global variables?

frank ruin
#
if(("Land_PaperBox_open_empty_F" == typeOf _vehicle) && (!(_cartelbld isEqualTo (group player getVariable "gang_name")) || (isNil {group player getVariable "gang_name"}))) exitWith {closeDialog 0; hint "You don't own this cartel area so you can't look in this box!"};

Litteraly trying to figure this shit out for more then 2 hours.
IF item is landpaperbox AND ( Gang name is not the same OR gang is nil ) it should exit the script yet it's not doing it.

23:45:13 "DEBUG: Cartel cap_data value 1: whitefang"
23:45:13 "DEBUG: Group value 1: <null>"

sonic thicket
#

heard yes, used no
_test = 123;
publicVariable "_test";

will be global right?

little raptor
#

no

#

Global variables never start with _

sonic thicket
#

so the same without _

little raptor
#

plus you're confusing it with "public" variables

sonic thicket
#

ahh yeah bind to missionNamespace

little raptor
#

@frank ruin the structure of your conditions are wrong

frank ruin
#

cause I call the get variable on the _cartel

#

And if no variable it bugs out?

#

I should check if nil first on getvariable?

little raptor
#

Use the alternative syntax for getvariable

sonic thicket
#

Thanks Leopard20, with an format to turn the varnamespace into a string i could save and call that variable ๐Ÿ™‚

#

it works right up to the next line which threw another error but thats scripting i guess haha

#

One question though, how can i save things under a variable as an array? so that if I where to call it using "_allhordezombies = missionNamespace getVariable _hordetype; "
it would output zombie1,zombie2,zombie3,etc

So basically append to global variable

still forum
#

@frank ruin
(!(_cartelbld isEqualTo (group player getVariable "gang_name")) || (isNil {group player getVariable "gang_name"})
your nil check is wrong way around.

lets say the variable is nil.
(!(_cartelbld isEqualTo nil) || (isNil {nil})
but nil propagates, so

(!nil || true)
propagates further
(nil || true)
and futher
nil
so your whole condition is
if (nil) exitWith {closeDialog 0; hint "You don't own this cartel area so you can't look in this box!"};
but no wait, it propagates further
nil exitWith {closeDialog 0; hint "You don't own this cartel area so you can't look in this box!"};
and further
nil
your whole line is just nil

#

you need to check for nil before you use the variable, not while or after you use it

little raptor
#

which is why I told him to use the alternative syntax

frank ruin
#

Yes I realized I was the biggest of retards.

still forum
#

And if you have trouble figuring out, maybe just write it in a way that you can actually see whats going on instead of cramming everything into a single hardly readable line

frank ruin
#
if(("Land_PaperBox_open_empty_F" == typeOf _vehicle) && !(_cartelbld isEqualTo (group player getVariable ["gang_name",""]))) exitWith {closeDialog 0; hint "You don't own this cartel area so you can't look in this box!"};

Like @little raptor pointed out alternative syntax ... solves it. feels stupid as fuck. ๐Ÿ˜„

#

Thing is out of frustration I just kept adding more shit to it thinking it would fix it ... ๐Ÿ˜› Ofcourse it didn't.... ๐Ÿ˜„

sonic thicket
#

Figured it out already, appending to string

_data = "hello";

missionNamespace setVariable ["YourString",_data];

_newdata = "friend";
_appendstring = missionNamespace getVariable "YourString";
_append = format["%1,%2",_appendstring,_newdata];
missionNamespace setVariable ["YourString",_append];

_yourString = missionNamespace getVariable "YourString";


_yourString;
#

appending to global variable*

little raptor
#

what??

still forum
#

how about
YourString = YourString + "," + "friend";
๐Ÿ™ƒ

sonic thicket
#

Well, that is a whole lot easier

#

I tried to search and did asked but it got burried under a bunch of text so I figured Ill search for my own solution hence the frankenstein script ๐Ÿ˜›

little raptor
#

you don't need setVariable for missionNamespace (unless you want to public it)

still forum
#

missionNamespace is in most cases the current active namespace, so all non-local variable names go to it

sonic thicket
#

public as in globally accessible by any other script? ( because thats what i want indeed )

still forum
#

no

little raptor
#

accessible on all machines on the server

still forum
#

public means across network

#

missionNamespace is already global (but only on your computer)

sonic thicket
#

Actually YourString = YourString + "," + "friend"; is the same as _append = format["%1,%2",_appendstring,_newdata];

Regarding making it not public, how does that work?

little raptor
#

it's not public by default

#

it's only public if you "publicVariable" it

#

or set the public flag in setVariable to true

#

I'm not sure what you're trying to do though

#

What's the point of that string operation again?!

sonic thicket
#

I can see i got you confused, Barebones: one trigger spawns zombies ( using a script exevm) and puts them under a global variable array. another trigger purges them by using that same global variable and a foreach {}

little raptor
#

ok, what does it have to do with the strings?

#

YourString = YourString + "," + "friend"
was this for "testing"?

sonic thicket
#

yeah, the entire thing was for testing to save all the zombies under an array that can be read using a foreach

little raptor
#

save all the zombies under an array
you're using strings here!

sonic thicket
#

I didnt got to the foreach part so i probably would've figured it out then (but i didnt till so far) in that case YourString = YourString + "," + "friend"; from dedman would be preferable as it doesnt saves them as strings ๐Ÿ™‚

little raptor
#

yes it does

still forum
#

but they are strings ๐Ÿค” strings are still strings

#

Also my name is Dedmen

sonic thicket
#
_data = "hello"; 
 
missionNamespace setVariable ["YourString",_data]; 
 
_newdata = "friend"; 
 
_appendstring = missionNamespace getVariable "YourString"; 
_append = _appendstring + "," + _newdata; 
missionNamespace setVariable ["YourString",_append]; 
 
_yourString = missionNamespace getVariable "YourString"; 
 
 
_yourString; 

Thanks Dadmen ๐Ÿ˜œ

little raptor
#

dude this is still a string

still forum
#

wtf

sonic thicket
#

I am at a loss, how would i not save it as string?

little raptor
#

you want arrays?

#

You start with arrays

sonic thicket
#

ignore the _newdata = "friend"; stuff by the way

little raptor
#

You use append/pushback to add data to it

sonic thicket
#

Welp, i didnt knew arrays existed

little raptor
sonic thicket
#

Or actually, i meant i didn't knew specific methods for arrays existed so i was fiddeling things together in a weird way

#

because yeah i knew arrays existed but no way to append

little raptor
#

Well how did you expect to get array from string?! (I mean it is possible but not like what you did)

#

anyway, read those wiki pages on arrays

#

You're gonna need them

still forum
sonic thicket
#

Oh i know that page ๐Ÿ˜›

little raptor
#

But you don't know google well enough

sonic thicket
#

I just didnt thought to look for append, i dont know why because thats exactly what i asked here before

#

Lets not go off on assumptions Leopard20, i get it was stupid of me but im not that stupid.

little raptor
#

I think what you actually want is pushback tho

sonic thicket
#

Im gratefull for the help but I dont like people throwing that sort of stuff at me. That really invokes toxicness and thats one of the worst kind of things that can happen to a community.

Anyhow, Ill use pushback, thanks for the help ๐Ÿ™‚

sonic thicket
#

For whoever wants to have a zombie horde module with more options then ravage or ryan's ( which I think both can be used with the script ) feel free to use this:

https://pastebin.com/msC2DjgW

The parameters for the trigger are:

//On Activation Example: [0,"mixed",1,2,"horde_marker_1","horde_stop_1",10,5,thisTrigger] execVM "Environmental\HordeSpawner.sqf";
//Parameters [HordeTotalSize,"HordeType",HordeSpawnIntervalMin,HordeSpawnIntervalMax,"HordeSpawnMarker","HordeStopTrigger",HordeSpawnRadius,HordeMaxSpawned,"HordeID"]

Apart from the activation trigger there also is a StopHorde Trigger, a reactivate horde trigger & a stop + purge trigger.

#

And yes, apart from not being able to google append I did everything in that script using google to learn it + previous experiences ๐Ÿ™‚

#

Feel free to throw some salt my way i guess ๐Ÿฅณ

lucid shale
#

Im having issues trying to send data from our mission file to our server side addon on load of the server. We are using a publicvar in the initserver.sqf file but the server addon functions dosnt seem to pick up it up until its too late and the functions have executed. any thoughts on what we are doing wrong are appreciated.
our server side addon functions are initiated via postinit.

wild prairie
#

Anyone got a link to any resources on adding/editing entries to the Field Manual? Not having any luck on the wiki.

exotic flax
still forum
#

@lucid shale initserver runs on server. Why are you worrying about sending data from your server to your server?

quaint oyster
#

Is there a guide on making buttons appear on the pause screen? like the settings buttons some modders have for their mods?

lucid shale
#

@still forum we want to specify some settings in the mission file as it may change from mission to mission but the server addon stays the same. The server addon calls a bunch of functions on postinit and we want it to pick up our desired changes before they execute. we have tried a few things but we are unable to pass the data in time before the functions execute.

still forum
#

Add a preInit in mission, via cfgFunctions?

lucid shale
#

awesome! we will try that now

still forum
#

Or set a variable at the end of your script

#

And make your server script wait until that variable is set

exotic flax
#

@quaint oyster afaik is there no guide/tutorial/example for it, although you could take a look at the source code of CBA how they do it. It's rather complex though.
Not sure how RHS does it exactly, although I believe they simply add a button at a fixed location.

quaint oyster
#

I'm trying to look over a few different scripts, one by connor for his extended chat, and another called voyager compass, but i just don't understand where the button code starts and ends, i'm so confused by it.

#

I made a battlefield style target marking script, i went a step further and made the player able to change the ping color, and i was gonna make a pause menu drop down menu with a color slider, but i'm absolutely clueless.

exotic flax
#

I would suggest to use CBA Settings for that, which is a lot easier than trying to make a full UI yourself

quaint oyster
#

i'ma go research it, worse case i'll settle on maybe making a custom userface with like 12 colors on it to pick from as opposed to a slider of somekind

exotic flax
#

even has a build in color picker ๐Ÿ˜‰

quaint oyster
#

๐Ÿ˜ฎ

#

think i got that hooked up already in like 25 seconds, wish it was on the pause screen but this will work in the mean time

robust hollow
#

one by connor for his extended chat
my interrupt menu buttons are added in a scripted eventhandler when the menu opens

quaint oyster
#

Able to teach meh?

quaint oyster
#

i'm gonna have to trial and error learn this

robust hollow
#

its just creating controls by script instead of by config

quaint oyster
#

its way over my head skill wise though i'm looking at this cross eyed like its an alien language

robust hollow
#

is it that you dont know anything about making guis or just not scripting them?

sonic thicket
#

Hey guys, i am looking for a way to find any value that contains "some_value_1" in an array. If i match case it like this:

"some_value_1" in _allVarsNamespace;

it works but i want to be able to use

"some_value" in _allVarsNamespace;

and have it throwing out true.

How would i go about this?

robust hollow
#

huh?

sonic thicket
#

Im searching for a way to find "HelloThere" by searching for "There" in the following array: ["Hello1","HelloThere","Hellofive"]

#

so searching for a partially match

robust hollow
#
private _match = _array findIf {"There" in _x} > -1;
_match // true/false
sonic thicket
#

Thanks ๐Ÿ™‚

#

that works like a charm

sly glacier
#

I'm getting some kind of generic error when trying to activate sidechat with a trigger. I set the activation to radio Charlie for testing, and named the callsign and variable name of the unit "A2"

In my trigger I entered A2 sideChat "Alpha One, be advised. We're running low on fuel. We only have enough to make a few passes but we will try and assist as best we can.";

willow hound
#

Which kind of generic error exactly?

finite sail
#

and I'm going to guess he's got the left hand parameter wrong, probably sending it a string when it wants am object

idle jungle
#

Hey all

In game I have a laptop with lots of addAction commands but need to execute it server side as it changes TOD and weather etc

Can someone tell me how to put my addaction script Into a remote exec ?

#
this addAction ["Set weather forecast - Sunny",{0 setOvercast 0; hint "Forecast set to CLEAR";}];
this addAction ["Remove Fog",{0 setFog 0; hint "Fog Removed";}];
this addAction ["SkipTime 12hrs",{skipTime 12; hint"Time skipped 12hrs";}];
this addAction ["SkipTime 24hrs",{skipTime 24; hint "Time skipped 24hrs";}];
this addAction ["SkipTime 6hrs",{skipTime 6; hint "Time skipped 6hrs";}];
this addAction ["SkipTime 2hrs",{skipTime 2; hint "Time skipped 2hrs";}]; 
``` that's the code
dusk gust
#

Basically you're trying to have an add action change weather and stuff on server?

idle jungle
#

Yep

#

I was told this code only executes locally or something

little raptor
#

@idle jungle Remote exec the code inside the addAction

dusk gust
#

You might have to do something like {[[],{code you want on server}] remoteExec ["spawn", -2]}

#

On phone, cant format it :(

#

Just push that inside the addaction, should work as intended

idle jungle
#

Thanks guys!

dusk gust
#

Also, does anyone know if the code inside of an event handler is stored anywhere in a mission namespace variable or something that I can access?

little raptor
#

@dusk gust It's remoteExec [...,2]

#

not -2

dusk gust
#

Right, 2

#

Mb

little raptor
#

Also, does anyone know if the code inside of an event handler is stored anywhere in a mission namespace variable or something that I can access?
no. It's not accessible anymore

dusk gust
#

Alright. Thanks.

idle jungle
#
this addAction ["Set weather forecast - Rain!!",{0 setOvercast 1; hint "Forecast set to RAIN";}];
this addAction ["Set weather forecast - Sunny",{0 setOvercast 0; hint "Forecast set to CLEAR";}];
this addAction ["Remove Fog",{0 setFog 0; hint "Fog Removed";}];
this addAction ["SkipTime 12hrs",{skipTime 12; hint"Time skipped 12hrs";}];
this addAction ["SkipTime 24hrs",{skipTime 24; hint "Time skipped 24hrs";}];
this addAction ["SkipTime 6hrs",{skipTime 6; hint "Time skipped 6hrs";}];
this addAction ["SkipTime 2hrs",{skipTime 2; hint "Time skipped 2hrs";}]; 
}] remoteExec ["spawn", 2]}``` does that look ok? or does it have to be for each line?
#

nope that aint it hahaha im an idiot

little raptor
#

@idle jungle the addAction code not the addAction itself

idle jungle
#

yeah i just realised when i went up to it and nothing appeared lol

little raptor
#

plus, this is no longer defined in that code

idle jungle
#

like this? addAction ["Set weather forecast - Rain!!",];{[[],{0 setOvercast 1; hint "Forecast set to RAIN";}] remoteExec ["spawn", -2]}

little raptor
#

Right now your hint only appears on the server

#

plus it's 2

#

not -2

idle jungle
#

ah yeh copy paste bug i forgot to change it

#

addAction
["Set weather forecast - Rain!!",];{[[],{0 setOvercast 1;}] remoteExec ["spawn", 2]}; hint "Forecast set to RAIN";

little raptor
#

@idle jungle Try this instead:

this addAction ["Set weather forecast - Rain!!",{
  [[], {0 setOvercast 1; forceWeatherChange;}] remoteExec ["call", 2]; 
  "Forecast set to RAIN" remoteExec ["hint", 0]
}]
idle jungle
#

ah

little raptor
#

@idle jungle the remote exec must be inside the addAction code

idle jungle
#

yep baby steps im learning lol hahaha

short fossil
#

Hello there

I am making a mission, for a Unit and I've got curious if there is a script that let's me close the cockpit door of the Plane, so that the plane looks like its unused or so. Ive done some online digging and found nothing. Is there a script that let's me close the cockpit door. I am still new to the Arma community and would thankful if someone could help me.

little raptor
#

I think now it's clear enough

idle jungle
#

@little raptor thank you i really appreciate it

little raptor
#

also corrected a mistake

winter rose
#

thooough there is the forceWeatherChange that should be used, too (for overcast only, not rain nor fog)

little raptor
#

yeah

#

Also, setOvercast has local effect

#

according to the wiki

#

I just realized

winter rose
#

only for clients, the server broadcasts it

#

hmm, the page doesn't say that, it should be updated

little raptor
#

@idle jungle try the new code

idle jungle
#

thank you

#

so another one would look like this?

  [[], {0 setOvercast 0; forceWeatherChange;}] remoteExec ["call", 2]; 
  "Forecast set to CLEAR" remoteExec ["hint", 0]
}]```
little raptor
#

yeah
also, add syntax highlighting to your code. it's hard to read like this

#

see the pinned messages

#

@short fossil You mean the "canopy"?
Not sure if it's possible. Maybe if there are animation sources for that?

dull cosmos
#

Hello all, I have a question, is it possible to attach a silencer on a weapon lying on the ground? I know it is possible when it is in a container, I wonder if that can be done also if the weapon is just on the ground (maybe with a command in init?). Thanks

little raptor
#

yes

#

you'll have to create a weaponHolderSimulated (or maybe WeaponHolderSimulated_Scripted) first, then put the weapon in it

dull cosmos
#

Not possible via init as I understand, right? Thanks @little raptor

little raptor
#

why not?

#

You can do anything in init

dull cosmos
#

I meant in the weapon init

little raptor
#

@dull cosmos Just tested this and it works:

_wp = createVehicle ["WeaponHolderSimulated_Scripted", ASLtoAGL getPosASL player, [], 0, "CAN_COLLIDE"];

_wp addWeaponWithAttachmentsCargoGlobal [["arifle_MX_GL_F", "muzzle_snds_H", "", "optic_aco", ["30Rnd_65x39_caseless_mag", 15], ["3Rnd_HE_Grenade_shell", 2], ""], 2];    
dull cosmos
#

thanks!

little raptor
#

I meant in the weapon init
why use weapon init anyway? (altho I think what you create in editor is already a weaponHolder)

dull cosmos
#

I tried to attach the silencer in editor via weapon init using that command but I can't make it working, now I'm going to try with your method

little raptor
#

@dull cosmos I recommend you use a test object for the weaponHolder position

#

something like:

#
if (!isServer) exitWith {};
_wp = createVehicle ["WeaponHolderSimulated_Scripted", ASLtoAGL getPosASL this, [], 0, "CAN_COLLIDE"];

_wp addWeaponWithAttachmentsCargoGlobal [["arifle_MX_GL_F", "muzzle_snds_H", "", "optic_aco", ["30Rnd_65x39_caseless_mag", 15], ["3Rnd_HE_Grenade_shell", 2], ""], 2]; 
deleteVehicle this;
#

put this in the init box of any object

#

It will be deleted at the end

#

replaced with a weapon holder

dull cosmos
#

Thx again, will do that ๐Ÿ˜„

finite sail
#

can't wait to see the result!
@winter rose

#

youtube processing.. only has 360p version at time of writing

winter rose
#

noiiiiiiceย !

finite sail
#

yes, its good, isnt it?

#

happy with that, thanks for recommending

winter rose
#

my pleasure
now you only have to add the water splashes and we're good ๐Ÿ˜‹

little raptor
#

Maybe create a vehicle and:

veh setVelocity [0,0,-1000];
finite sail
#

lol

winter rose
#

you monster ๐Ÿ˜†

little raptor
#

oh I got the perfect object for that:

#
"virtualMan_F"
finite sail
#

as usual, Larrow shows up in seach results for obscure arma stuff

#

like splashes

still forum
#

@dull cosmos here's a way to do the same, but keep the same orientation as the weapon you placed.
Meaning place a MX, orient it in the world however you want. and with this script in init, it will replace it with a MX with silencer, in the exact same orientation as you placed the gun in editor

clearWeaponCargo this;
this addWeaponWithAttachmentsCargoGlobal [["arifle_MX_GL_F", "muzzle_snds_H", "", "optic_aco", ["30Rnd_65x39_caseless_mag", 15], ["3Rnd_HE_Grenade_shell", 2], ""], 2]; 
little raptor
#

so it was a weapon holder. I was right

still forum
#

its also simpler, and more performance efficient (not that you'd care at mission start)

#

yeah. wasn't sure about that either, so I tested

#

I thought it would get deleted when you remove the last weapon, but apparently it stays around for long enough to add a new weapon back into it

#

Thats a pretty good trick I think, that should be written down somewhere

little raptor
#

btw, how would my code work in MP? I delete the object at the end.
Does it get recreated when a new client joins the server

still forum
#

init event runs locally on every joining client

#

huh.. good question. race condition I'd say. Some clients will see the dummy was already deleted and not run its init script.
other clients might still have it and spawn a dozen weapon holders with your replacement

#

but server runs it too, maybe server runs it first. and so soon that other clients will never see that that object existed

winter rose
#

if isserver then ?

little raptor
#

good call

winter rose
#

that's the only "dirty MP trick" in my CAAS mission - I used green helper arrows that get deleted/replaced through the init field by ambient soldiers, server-side :3

jade vine
#

Hey! I have a porblem with the following code:

_items = items player; 
_all = 0;
{
_curItemName = _x;
_count = {_x == _curItemName} count (items player);
_all = _all + _count;
hint format ["%1",_all];
}forEach _items;```

If I have a firstaidkit in my inventory then it doesn't count right..
still forum
#

what even are you trying to count?

#

the number of all items it looks like.. but your code is nonsense

#

you are trying to count all items in inventory, but all items of same type you want to accumulate exponentially?

jade vine
#

I'm trying to find out how much of each item I have in my inventory. But then I saw that I got a lot more than it makes sense. So I added it all up and found out that the first aid kits give more than 1 apiece

still forum
#
_items = items player;
_uniqueItems = _items arrayIntersect _items;
_itemsCount = _uniqueItems apply {_item = _x; [_item, {_x == _item} count _items]};

not very efficient, but as long as you don't use ACE its probably fine

dull cosmos
#

Thanks @still forum @little raptor

still forum
#

if you have lots of items, there are much more efficient but a bit more complicated methods.

This there will crush your performance if you have hundred+ items (as for example with ACE Medical bandages)

little raptor
#

@still forum isn't this faster:

_itemsCount = _uniqueItems apply {count _items - count (_items - [_x])};
#

I mean it's stupid but I don't know if it's faster

still forum
#

I had that idea at first, but you are constantly copying potentially very big arrays

little raptor
#

I figured maybe the - operator would be faster than looping though the array manually

still forum
#

it will probably be if you get the big item counts done first

little raptor
#

although count is fast isn't it?

still forum
#

count _array is basically free

#

its O(1)

analog walrus
#

Sorry to barge in, but need help with a trigger activation random teleport script for an MP mission. For some reason, when the trigger activates it teleports all players, and have no idea why..

private _spawnArray = [sp1, sp2, sp3, sp4, sp5, sp6, sp7, sp8, sp9, sp10, sp11, sp12, sp13, sp14, sp15, sp16, sp17, sp18, sp19, sp20, sp21, sp22, sp23, sp24, sp25, sp26, sp27, sp28, sp29, sp30, sp31]; 
private _randomSpawn = selectRandom _spawnArray;  
private _pos = getPosASL _randomSpawn;  
private _rot = vectorDirVisual _randomSpawn;
for "_i" from 0 to 4 do {player addItem "FirstAidKit"};
private player setVectorDir _rot;
private player setPosASL _pos;
little raptor
#

did you put this in the trigger activation code?

analog walrus
#

Yep

little raptor
#

first of all:

_i = (floor random 31) + 1;
_randomSpawn = missionNamespace getVariable format ["sp%1", _i];

would be faster

still forum
#

getVariable would be even faster

little raptor
#

right!

still forum
#

givin me shivers :u

#

private player setVectorDir _rot;
syntax error

#

is that a global trigger then?

#

if it executes on every players machine, it'll teleport every player

little raptor
#

you don't need to private everything

still forum
#

good practice on local variables. but thats also the only place where private exists

#

Its probably not the script, but trigger settings being wrong

analog walrus
#

By any change, are 3den editor triggers global?

#

Because that might answer your question then

still forum
#

you can configure it on the trigger afaik

little raptor
#

it has a serverOnly option

analog walrus
#

ServerOnly isn't ticked

still forum
#

maybe it was the condition thing

#

this && player in thisList
I remember seeing that, I don't use triggers

#

you could also put a
if (player in thisList) then {} around your code

little raptor
#

or maybe this && {player in thisList}

#

does the trigger activate per client?

#

I'm still fuzzy about the trigger activation stuff

analog walrus
#

that's well and good, but isn't that just activation conditions? meaning that when it does activate, it'll have the same effect?

#

The trigger activates per client, yes, issue is that it executes globally

#

Ends up executing the code for everyone on server

little raptor
#

I don't think a trigger is a good idea

#

afaik it triggers globally

#

Are those spX things outside the trigger area?

analog walrus
#

Aye, and they're just objects that act as the spawn point locations

little raptor
#

ok so it's probably safe enough to use

jade vine
#

Thank you so much @still forum !

analog walrus
#

I guess the question is do triggers only activate globally

little raptor
#
if (player in thisList) then {
  _i = floor random 31 + 1;
  _randomSpawn = missionNamespace getVariable format ["sp%1", _i];
  _pos = getPosASL _randomSpawn;  
  _rot = vectorDirVisual _randomSpawn;
  for "_i" from 0 to 4 do {player addItem "FirstAidKit"};
  player setVectorDir _rot;
  player setPosASL _pos;
};
#

this should fix the issue

still forum
#

just try the condition thing, and youll see

little raptor
#

does the condition evaluate per client?

analog walrus
#

Doesn't hurt to I guess

little raptor
#

does the condition evaluate per client?
does anyone know the answer to this?

still forum
#

I know where to look, but ugh

#

I guess it should

#

because "&& player in thisList" is a real thing, so it has to

analog walrus
#

Worst case scenario, I'll just ditch the trigger and use an addAction since I know that one will execute locally

#

Thanks nevertheless, I'll try the condition stuff

still forum
little raptor
#

@still forum That method I mentioned is significantly faster:

a = [];
for "_i" from 1 to 1000 do {
a pushBack toString [floor random 127,
floor random 127, floor random 127]
}

35 ms:

_cnt = count a;
a apply {_cnt - count (a - [_x])}

750 ms:

a apply {_c = _x;  {_x == _c} count a}
#

I don't think you can have more that 1000 items in your inventory!

still forum
#

you can

#

ACE

little raptor
#

It's as you said before: if you iterate thru arrays manually, the process will be slower

still forum
#

I had that problem in TFAR.

#

There are inventory functions that give you the count right away. much more efficient but more work

little raptor
#

well, the array was random tho

#

I think the count was 1 for each string

#

So that means I'm copying 999 elements

#

but it's still faster

#

anyway, I tried with 10000 elements too:
3285 ms vs my game froze

still forum
#

crashed?

#

FT ticket :U

little raptor
#

no, kidding

#

but It's still running

#

at least it was

#

for like 30 seconds

#

I killed the process :p

lucid shale
#

@still forum
So i tried putting our settings in a function in the mission file and setting it fire on preinit but it doesnt fire on the server it only fires when the player connects. here is my funcetion deffinitions that gets included at the top of the description cfgFunctions.

class utility_9
{
    tag = "utility_9";

    class utility_9
    {
        file = "utilities\utility_9";
        class init{                
                preInit = 1;                                
                postInit = 0;                
                preStart = 0;
            };
        class monitor_conditions{};
        class state_1_apply{};
        class state_1_remove{};
        class states_remove_all{};
    };
};
still forum
#

preInit in mission also fires on server

short fossil
#

@short fossil You mean the "canopy"?
Not sure if it's possible. Maybe if there are animation sources for that?
@little raptor I mean like the cockpit door wait let me get a screenshot

lucid shale
#

@still forum
this is what is in the fn_init.sqf.
As you can see ive tried alot of stuff. the messages only show up once a player connects.

["Got here!"] remoteExec ["diag_log", 2];
diag_log "got here! 2";
if (isDedicated) then
{
    //enabled ["features
    PIYWfeatures = [
        ["feature_1", true],
        ["feature_2", true],
        ["feature_3", true],
        ["feature_4", true],
        ["feature_5", true],
        ["feature_6", true],
        ["feature_7", true]    
    ];
    publicVariable "PIYWfeatures";
    ["Feature Settings loadded!!!!!!!!!!!!!!"] remoteExec ["diag_log", 2];
};
short fossil
still forum
#

just do normal diag_log and watch server log

#

maybe mission doesn't fully initialize before first player joins?

lucid shale
#

@still forum
in the code snippet from before , i already tried that. it doesn't work. i let it run and watch the log to ensure its fully started and loaded. is there something special i need to do in my description.ext to enable functions to use preinit?
this is the section of the description.ext where im adding this utility/function

class CfgFunctions
{
    // //Utilities
    #include "utilities\utility_9\cfgfunctions.hpp"

    #include "features\feature_3\cfgfunctions.hpp"
dull cosmos
#

@dull cosmos here's a way to do the same, but keep the same orientation as the weapon you placed.
Meaning place a MX, orient it in the world however you want. and with this script in init, it will replace it with a MX with silencer, in the exact same orientation as you placed the gun in editor

clearWeaponCargo this;
this addWeaponWithAttachmentsCargoGlobal [["arifle_MX_GL_F", "muzzle_snds_H", "", "optic_aco", ["30Rnd_65x39_caseless_mag", 15], ["3Rnd_HE_Grenade_shell", 2], ""], 2]; 

@still forum
Tried on dedicated server, it works fine, only had to replace clearWeaponCargo with clearWeaponCargoGlobal
Thx a lot again ๐Ÿ˜„

still forum
#

the script runs locally everywhere

#

global shouldn't be needed for either

#

@lucid shale no that should work I guess

lucid shale
#

crap

#

im doing something wrong somewhere

still forum
#

I don't remember a "code snippet from before" that just does diag_log

#

you do remoteExec in your script

lucid shale
#

i tried a few things.

still forum
#

ah I see there is a normal log too

lucid shale
#

at the same time

still forum
#

well it should work..
maybe try a simple mission with just that script and see if that works, maybe something else breaking it

lucid shale
#

wilco

lucid shale
#

@still forum it works in clean skin. thanks for your help. time to start commenting things out one at a time.

little raptor
#

@short fossil well, yeah, it's called the "canopy" not "cockpit door"
as I said, if it has animationSources for that, you can use that command to close it.
you can find the animationSources in the config
you can also try the "animationNames" command

analog walrus
#

Btw, thanks Dedmen and Lepoard for the help with the trigger, turns out the && player thing in condition was the solution all along

#

Definitely noted down for the future haha

wooden pilot
#

I want the player to take a secret letter from the inventory of an AI (Zeus controlled). or drop to pickup the intel.

Is there a way to put a leaflet with intel in the inventory? or a better solution?

#

intel will be text based, an encrypted message

little raptor
#

You can pretend some item is an "intel" document.
Add a "Take" event handler to the player.
Once you find that the picked up item matches your "intel", show some text in a dialog or something

wooden pilot
#

I see (actively busy building the mission) files can be picked up. will see if I can do something with that, add an inspect to reveal the text and recall when handed over to intel department.

untold sail
#

May I ask what the script is for turning on helicopter and car engines in Eden and where I can find the scripts (if needed) for setting ambient animations? I tried searching and trying for a bit now but cannot really find an answer online sadly.

#

(Please ping me c:)

winter rose
#

@untold sail POLPOX's artwork supporter iirc

untold sail
#

Hm, I took a look at it. It says its for still images, but if you start the scenario will the NPCs keep on doing an animation?

winter rose
#

I misunderstood what you wanted to do.

to turn the engine on, you can use engineOn

#

as for the ambient anim, see BIS_fnc_ambientAnim

#

@untold sail โ†‘

willow hound
#

Interestingly you can also use it to turn the engine off.

winter rose
#

it would be even more confusing if engineOff existed ๐Ÿ˜†

willow hound
#

I'm just having fun blobcloseenjoy

winter rose
#

me too, me too

untold sail
#

I simply put engineOn onto the init field and then started the scenario. Sadly it didnt work. I also used this https://imgur.com/WXLiJUK but it didnt work either

willow hound
#

All the knowledge is on that website

winter rose
#

I'll give you a hand on that one, because init fields are bad```sqf
if (isServer) then { this engineOn true }

#

"bad" in MP, because the code runs for every players, even joining ones

willow hound
#

_helicopter is the problem

untold sail
#

Thats what I tried using to the best of my understanding, sadly I dont really know much about coding except some very basics meanings

willow hound
#

Don't no _helicopter exist in that init field

untold sail
#

Where should I put that Lou since the init field is the only thing I could think of

willow hound
#

The magic will come with this instead of _helicopter magic

winter rose
#

the init field ^^

untold sail
#

Oh I thought its bad xD

winter rose
#

the "this" variable will refer to the init field's object
the if isServer prevents the "bad" thing of the init field

#

(yet still not ideal)

willow hound
#

Don't worry, you are not a pro and even the pros will sometimes use the init field ๐Ÿ™‚

untold sail
#

Thank you guys really much, its astonishing how helpful and friendly this community is. Everytime I had a question so far I got patient people to help me, I really appreciate this c:

winter rose
#

don't hesitate!

untold sail
#

And thank you for Polpox' mod, now I can actually take nice screenshots as a sidenote :D

untold sail
#

I want a chopper to have its engine on while not taking off, so my script looks like this now if (isServer) then { this engineOn true } ; this flyinHeight 0;

#

Hm, wanted to use a codeblock๐Ÿ˜…

winter rose
#

```sqf

#

(see pinned messages)

untold sail
#

Oh wrong direction then

#

The problem is it gains height and then just hovers 2-3 meters above the floor

winter rose
#

what do you want to happen?

untold sail
#

I want the engine to turn on (which functions now due to your help) and now I just want to helicopter to stand on the floor, its more ambiente like.

willow hound
#

Do you need / want the pilot? If there's no pilot the engine can still run but it can't go anywhere.

winter rose
#

you can disableAI the pilot, or remove it entirely yes

untold sail
#

It would look a bit weird without pilot since the players will walk a few meters beside it. if (isServer) then { this engineOn true } ; { this disableAI } ; Will that work like that?

winter rose
#

nope!

willow hound
#

The wiki awaits!

winter rose
#
if (isServer) then
{
  this engineOn true;
  driver this disableAI "MOVE";
};
untold sail
#

You're such a big help, I tried it and it works perfectly. The floor doesnt seem to be leveled though and the helicopter tail flies up into the air. I read something about attaching stuff to the floor earlier so I will try educate myself on that for the moment

idle jungle
#

Does anyone know of a good vehicle respawn script?

Using the vehicle respawn modules it just makes vehicles endlessly blow up :(

#

Been an issue since 2013

smoky verge
#
addMissionEventHandler ["EachFrame",{

    _spoopy = (allUnits + vehicles) select {_x getVariable ["GOM_fnc_spoopy",false]};

    if (currentVisionMode player isEqualTo 2) exitWith {

        {_x hideObject false} forEach _spoopy;

    };

    {_x hideObject true} forEach _spoopy;

}];```
I used this script made by Grumpy Old Man to make certain units appear only in thermal vision
considering its an EachFrame eventHandler

would it be correct in thinking that using this on a group of 40 AI pre placed units is going to massively lag the server? especially if its being populated by 30 players?
still forum
#

@smoky verge that script is clientside only. It won't lag the server at all. And number of players also won't make much difference.

#

But that script is pretty inefficient it's repeatedly hiding the same units over and over again every frame.
That's stupid, it only needs to do it once, when you switch your thermal mode

smoky verge
#

is there an eventhandler for thermals on?
and it would also need to play when the player switches the goggles off

still forum
#

@obsidian violet don't use the selectRandom function, use the selectRandom command instead.

#

And it's random. Maybe you are just unlucky

#

@smoky verge afaik no, but you can just build your own in the EachFrame handler

#

Maybe your paradrop function stores your stuff in a global variable. And later calls just overwrite it

obsidian violet
#

Solved the problem its me being a retard.... time for bed duck3 ๐Ÿ”ซ
Would help if I would call the correct function that I did all changes in. sorry for my spam and good night โค๏ธ

little raptor
#

But that script is pretty inefficient it's repeatedly hiding the same units over and over again every frame.
That's stupid, it only needs to do it once, when you switch your thermal mode
it's also looping through the array twice. in each frame meowsweats

cosmic lichen
#

is there an eventhandler for thermals on?
and it would also need to play when the player switches the goggles off
Would be nice to have an event handler for this which triggers when NVGs are activated and as parameter it should return the unit and vision mode โค๏ธ

umbral nimbus
#

I have an issue with a script creating a static object, then orienting it in a certain direction.

#

in MP (dedicated) there seems to be a few seconds delay in rotating the object.

#

sometimes its instant. sometimes it takes 10 seconds.

#

In my script players are teleported onto the object but due to the delay in rotating, they fall off or get stuck.

#

Any clever work arounds?

cosmic lichen
#

How do you do it?

umbral nimbus
#

Good question I dont have the script in front of me.

setDir if I remember correctly

#

is there a beter command?

#

like setVecordirandUp?

willow hound
#

Seems like setDir has some issues and quirks regarding its intended Global Effect.
You can try calling setPos after setDir, maybe that'll help the updated object state propagate.

short fossil
#

@short fossil well, yeah, it's called the "canopy" not "cockpit door"
as I said, if it has animationSources for that, you can use that command to close it.
you can find the animationSources in the config
you can also try the "animationNames" command
@little raptor Thank you very much

forest ore
#

Someone more experienced able to point out why [any] is returned when "GUER" is supplied into setVariable but then [WEST] and [EAST] are returned when "WEST" or "EAST" are supplied into setVariable in a trigger that has been set up like below?

_x setTriggerStatements [
format ["this && ((thisTrigger getVariable 'BIS_WL_sector') in ((BIS_WL_sectorsArrays # %1) # 3))", _forEachIndex],
format ["(thisTrigger getVariable 'BIS_WL_sector') setVariable ['BIS_WL_revealedBy', ((thisTrigger getVariable 'BIS_WL_sector') getVariable 'BIS_WL_revealedBy') + [%1], TRUE]", "EAST"],
"systemChat format ['%1', ((thisTrigger getVariable 'BIS_WL_sector') getVariable 'BIS_WL_revealedBy')]"];
winter rose
#

@forest ore seems that the GUER variable is undefined

#

Try RESISTANCE maybe

finite sail
#

formatting side does something wierd

#

ill check

#

Converting a side to string will not always return the side command text: e.g str resistance // returns "GUER".
See Side page to see the return value of all side commands.

#

is that relevent?

#

I think format might do the same thing as str in this case

forest ore
#

Thanks for the quick response and suggestion Lou. Using "RESISTANCE" (finally, lol) returned [GUER] as I've been expecting the result to be for some time.

As continuation from that the correct side is supposed to be supplied on the trigger's activation from a _handledSide variable like so

format ["(thisTrigger getVariable 'BIS_WL_sector') setVariable ['BIS_WL_revealedBy', ((thisTrigger getVariable 'BIS_WL_sector') getVariable 'BIS_WL_revealedBy') + [%1], TRUE]", _handledSide],

_handledSide on the other hand goes like so: _handledSide = BIS_WL_competingSides # _forEachIndex;. BIS_WL_competingSides resides elsewhere and is basically: BIS_WL_competingSides = [WEST, RESISTANCE]
As far as I understand _handledSide should provide the needed WEST or RESISTANCE. But for some still unknown reason to me RESISTANCE returns [any]. I don't know if the problem could have something to do with _forEachIndex: so far I don't understand how it (_forEachIndex) should actually work and haven't yet figured out if it really offers RESISTANCE to the trigger's on activation as it should be doing.

forest ore
#

Taking from what Tankbuster said there: would it be on the right path that _handledSide is in this case providing "GUER" when it should be providing RESISTANCE (or "RESISTANCE")? If format makes the same thing than str then is there any way to provide RESISTANCE as is? I think format is needed if one wants to substitute %1 with something?

winter rose
#

@forest ore if you stringify a side, there is a difference, yes

west/blufor โ†’ "WEST"
east/opfor โ†’ "EAST"
resistance/independent โ†’ "GUER"
civilian โ†’ "CIV"

see https://community.bistudio.com/wiki/Side

forest ore
#

This seems to be the case Lou. I guess it's now to figure a way how to not stringify a side until certain point..I think

winter rose
#

why do you want to stringify the side anyway?

forest ore
#

It's like that from the get-go (ie. not my work). I'm just trying to figure out why what's been readily provided does not work for only one side

winter rose
#

most likely because str west == "WEST"

forest ore
#

Actually I don't even understand that at what point RESISTANCE turns to "GUER" which in turn makes stuff not work

winter rose
#

when formatting or str'ing

#

I don't know the WL framework, I simply hope BI does not rely on str west == "WEST" ยฏ_(ใƒ„)_/ยฏ

forest ore
#

I wouldn't know ๐Ÿ™‚
Guess could ask if there's a chance to educate myself at the same time: what are other possible ways to apply something to something than just using format?

#

Is there ways to turn this sqf format ["(thisTrigger getVariable 'BIS_WL_sector') setVariable ['BIS_WL_revealedBy', ((thisTrigger getVariable 'BIS_WL_sector') getVariable 'BIS_WL_revealedBy') + [%1], TRUE]", _handledSide], to something else that's without format?

winter rose
#

Iโ€ฆ don't get what you are trying to say

#

why do you use format really? to compile and call it?

forest ore
#

Like I said there earlier it's not my work. I'd be all in for using something else than format but at this point in time I at least don't know how or what to use instead.
As far as I understand format is there to pass some data where it needs to be. There is another function that will return true when BIS_WL_revealedBy has been setVariable'd with corresponding side: ```sqf
waitUntil {sleep WL_TIMEOUT_STANDARD; BIS_WL_playerSide in (_sector getVariable "BIS_WL_revealedBy")};

*BIS_WL_playerSide* is `BIS_WL_playerSide = side group player`. `side group player` returns "GUER" so how I read this is that BIS_WL_playerSide needs to be "WEST" or "GUER" for the above `waitUntil` to return true
idle jungle
#
Number
When 0, the function or command will be executed globally, i.e. on the server and every connected client, including the one where remoteExec was originated.
When 2, it will be executed only on the server.
When 3, 4, 5... it will be executed on the client where clientOwner ID matches the given number.
When number is negative, the effect is inverted. -2 means execute on every client but not the server. -12, for example, means execute on the server and every client, but not on the client where clientOwner ID is equal to 12.
Object - the function will be executed only where unit is local
String - the function will be executed only where object or group defined by the variable with passed name is local
Side - the function will be executed only on clients where the player is on the specified side
Group - the function will be executed only on clients where the player is in the specified group. In order to execute the function where group is local pass owner of the group as param:
_myGroup remoteExec ["deleteGroup", groupOwner _myGroup];
Array - array of any of types listed above```
Which one is just 1 client (for a hint, just want it on 1 guy not everyone
#
["Shoothouse - Loading event, plase wait..."] remoteExec ["hint", 0];``` 

thats my code but im aware 0 is everyone and server
winter rose
#

hint "my text" ?

#

@forest ore then that's an awful code that is only meant to work with west or east ๐Ÿคทโ€โ™‚๏ธ

idle jungle
#

ohhh so hint without remote exec??

winter rose
#

if the script is local to the machine, yes

idle jungle
#

ah

winter rose
#

otherwise, ["myText"] remoteExec ["hint", theUnitWhereItIsLocalUsuallyThePlayerUnit]

idle jungle
#

i nearly just copied that..

winter rose
#

hue hue

idle jungle
#
this addAction ["ShootHouse",  
{  
 [  
  [],  
  {  
   [] spawn  
   {  
    if (isServer) then  
    {  
     if (isNil "SAS_SHOOTHOUSEDATA") then  
     {  
      SAS_SHOOTHOUSEDATA = [SAS_SHOOTHOUSE] call SAS_fnc_AICreate;   
      G_1 animate ["Door_1_rot", 0]; G_2 animate ["Door_1_rot", 0]; G_3 animate ["Door_1_rot", 0]; G_4 animate ["Door_1_rot", 0]; G_6 animate ["Door_1_rot", 0];  
      sleep 60;  
      G_1 spawn   
      {  
       waituntil  
       {  
        private _Player = [PlayableUnits,_this,true] call BIS_fnc_nearestPosition;  
        (_Player distance2D _this > 250)  
       };  
       [SAS_SHOOTHOUSEDATA] call SAS_fnc_AIDelete; 
       SAS_SHOOTHOUSEDATA = nil;     
      };  
     };  
    };  
   };           
  }     
 ] remoteExec ['bis_fnc_Spawn',0];
["Shoothouse - Loading event, plase wait..."] remoteExec ["hint", 0];
sleep 10;       
    player setPos(getPos Veiw2);
["Event Started - Shoothouse"] remoteExec ["hint", 0];  
}];``` thats the code
#

some is on the server

#

apologies if its messy code lol

winter rose
#

dafuq

#

even Discord's parser gave up ๐Ÿ˜„

idle jungle
#

lmao!

#

basically long story short its a massive training ground with loads of places on altis with resettable events

#

which i place ai down on the editor and grab it into a code and it gets put into an array library

little raptor
#

what language are you using for syntax highlighting?!

#

it should be sqf

winter rose
#

โ€ฆcss

little raptor
#

I thought it was cs

idle jungle
#

oh woops

#

new to the highlighting thing

#

edited

little raptor
#

why do you use BIS_fnc_spawn?

#

and why do you spawn inside spawn?!

winter rose
#

(more or less)

idle jungle
#

its very very early days but its fully functioning

#

even on a dedi

winter rose
#

so you add an action, the player will hint, have the move, but if the player is not the server nothing will happen.
hmmm nope

#

oh wait, you remoteExec that code. ouch.

idle jungle
#

newbie lol

little raptor
#

It looks weird!

winter rose
#

6 max, apparently :p

idle jungle
#

well i must say thank you for not laughing in my face lol
that i apprechiate

winter rose
#

tabs > spaces

little raptor
#

tabs > 4 spaces

idle jungle
#

ohhh

little raptor
#

usually (but it has it's own character)

idle jungle
#

ive been smashing space bar like its valentines day

little raptor
#

try Notepad++

winter rose
#

that's where alcoholic astronauts go actually

little raptor
#

If you haven't already

winter rose
#

(VSCode > N++ ๐Ÿ˜‹)

idle jungle
#

yeah notepad++ with dark theme

little raptor
#

With the right plugin
I couldn't find one with auto completion (at least not one that works)
Also, they're all old

idle jungle
#

ok ill do some googling thanks gents as for my original question ive taken that hint out of the remoteexec to become local

little raptor
#

And remove the [] spawn

#

That code is already being spawned

idle jungle
#
this addAction ["Para Training",   
{  
 [       
  {      
   {   
    if (isServer) then   
    {  
  comment "CODE THAT ONLY THE SERVER EXECUTES HERE.";  
     if (isNil "SAS_HALOTYLER") then   
     {   
      SAS_HALOTYLER = [SAS_HALO] call SAS_fnc_AICreate;    
      sleep 40;   
      halo1 spawn    
      {  
       waituntil   
       {   
        private _Player = [PlayableUnits,_this,true] call BIS_fnc_nearestPosition;   
        (_Player distance2D _this > 800)   
       };   
       [SAS_HALOTYLER] call SAS_fnc_AIDelete;   
    SAS_HALOTYLER = nil;  
      };   
     };   
    };   
   };              
  }        
 ] remoteExec ['bis_fnc_Spawn',0];
hint "HALO - Loading please wait...";   
sleep 10;
hint "Halo - Event starting now";
sleep 1;                 
    player moveincargo halo1;   
}];```
Like so?
little raptor
#

you forgot to delete the { }

idle jungle
#

ah yep

little raptor
#

for that spawn

idle jungle
#

sorted thanks guys

winter rose
#

since this code should only be executed on the server, you could remove the if isServer check and remoteExec with 2 (server) as the target @idle jungle ๐Ÿ™‚

idle jungle
#

Ohhhhh yeah i see it now

#

thanks lou

untold sail
#

Hey there again, I was playing around with POLPOX artwork mod and encountered a "problem" to which I couldnt find the answer in his guide. This is an example code that used to start and loop the animations of the NPCs [ "Acts_Explaining_EW_Idle03", -1, objNull, false, 0, "", "", true ] Now playing the scenario it seems like the npcs playing an animation are invincible and dont stop the animation when being shot at. Is there a way to fix that e.g. do I have to change on of the variables?

cedar sundial
#

Hi, I have declared an eventHandler in 'initPlayerLocal.sqf' to trigger below script. It works fine. But Iยดm having one issue with the 'globalChat'
My goal is to print a message that includes 2 variables, in chat for all players to see. Iยดm not getting syntax error but when hosting MP mission, only the player that triggers the event is able to see the chat message.

_thisPlayer = (_this select 0);
.....
[_thisPlayer,(format ["text ..... %1 text..... [%2] text... ", _var1 ,_x])] remoteExec ["globalChat",0];

winter rose
#

@untold sail they shouldn't be shot at, since it is for screenshot purpose?

#

@cedar sundial most likely _x is undefinedโ€ฆ?

#

can't really tell without the code, what you posted should work

untold sail
#

I thought about modyfying it a bit so that the animations can be used on a hosted server to give them npcs a bit more life.๐Ÿ˜…

#

It also seems much more comfortable implementing the animations this way

cedar sundial
#

@winter rose
If remoteExec is correc, Iยดll try isolate it and execute. Thanks :)
[_thisPlayer,(format [" text %1", _var1 )] remoteExec ["globalChat",0];

winter rose
#
[_thisPlayer,(format [" text %1", _var1 )] remoteExec ["globalChat",0]; // wrong
[_thisPlayer, format [" text %1", _var1]] remoteExec ["globalChat", 0]; // correct
tough abyss
#

heyo, I'm having trouble with adding an eventhandler to a multiplayer mission on a server. it is working when testing in locally hosted multiplayer. anyone got a clue for me?
this is my init:

if (!isServer) exitWith {};

private _allPlayers = allPlayers select {_x isKindOf "Man"};
{_x addMPEventHandler ["MPkilled",{[_x] call grad_persistence_fnc_redlistClasses;}];} forEach _allPlayers;
winter rose
#
if (!isServer) exitWith {};
{
  _x addMPEventHandler ["MPkilled",
  {
    params ["_unit", "_killer"];
    [_unit] call grad_persistence_fnc_redlistClasses;
  }];
} forEach allPlayers
#

@tough abyss โ†‘

tough abyss
#

ou, alright, im gonna try that

winter rose
#

_x does not exist in the EH code ๐Ÿ˜‰

#

it's a whole different scope here

tough abyss
#

oh, alright

#

would never have figured that out on my own

#

so, apparently this doesn't work when executed from init as no unit is technically spawned yet? we just added the EH from console after spawning and the EH fired

#

so should we add a second EH playerconnected to execute that after we're spawned in?

winter rose
#

yep
depending on your respawn settings as well (think of the JIP!), all players may not be the same

tough abyss
#

yikes

winter rose
#

put the EH in initPlayerLocal.sqf

#

should do

tough abyss
#

that sounds better than two stacked EHs ๐Ÿ‘

#

I'll report back, thanks so far

winter rose
#

though, you shouldn't then need an MPEH, only EH

tough abyss
#

wouldn't be initPlayerServer.sqf be better

#

?

winter rose
#

if you want it to happen server-side only then yes

tough abyss
#

well, the framework is supposed to be running on server only, so, i guess yes:)

winter rose
tough abyss
#

ayyy, we got it working :D the framework is relying on remoteExec anyway

#

thanks a lot for getting us over that hurdle @winter rose

winter rose
#

my pleasure

short goblet
#

Is this script correct? I'm trying use it to spawn opfor forces when all three of these vehicles are destroyed. When I test the mission with this script I keep getting a generic error in expression.
({ alive _x } count units Group1 == 0)&&({ alive -x } count units Group2 == 0)&& ({ alive _x } count units Group3 == 0)

tough abyss
#

i guess "-x" is a typo?

short goblet
#

Thanks that fixed it.

tough abyss
#

no worries

finite sail
#

mmm, dev build

#

well, if you insist ๐Ÿ™‚

#

ok, so when I'm drawing on the map (in dev build), left ctrl + left shift, and lmb draws the straight line

#

is there a way to have a more than a single line in each 'stroke'?

#

releasing the lmb ends to draw and the marker

#

also, the line doesn't actually draw until i release the lmb in straight line mode, where as in normal draw mode, (without left shift) it draws as I drag the pointer

finite sail
#

biki says setmarkerpolyline

#

Be aware that this command expects an array with a minimum array size of 4 elements and that the array count always needs to be dividable by 4 and return a whole number.

#

but if it has anything less than 6 elements in the array, it becomes invisible

drifting sky
#

Arma2OA. Is there any way to prevent AI armed with only a pistol from going prone on contact with the enemy? I cannot use setUnitPos because it is bugged for AI armed with only a pistol.

umbral nimbus
#

Seems like setDir has some issues and quirks regarding its intended Global Effect.
You can try calling setPos after setDir, maybe that'll help the updated object state propagate.
@willow hound Thanks Ill try

drifting sky
#

Arma2OA. Is it possible to prevent AI all belonging to one group from sharing target info with each other?

fair drum
#

I don't think there is, because that is an inherent trait of being in a group. The only way I know how to stop info sharing is to have everyone in individual groups.

#

Unless you did an actual AI modification

drifting sky
#

The problem is once a member of the group spots you, the whole group has ESP, spinning around to shoot you the millisecond they have line of sight to you, even if they are facing the opposite direction.

fair drum
#

you could try a

{
    if (leader grouphere != _x) then {
        doStop _x;
    };
} forEach units grouphere;

but I still think they get shared info however they will ignore the "unit attack that man" command from the squad leader, so it can be slower.

drifting sky
#

I've already got them stopped and to not accept targets from the leader

#

However they don't seem to make any distinction between "knowing" of the target, and actually being able to "see" him.

#

As soon as they "know" about the target, they appear to "see" him the moment they have line of sight. Regardless what direction they're facing, how far away they are, etc.

fair drum
#

well they are actually getting a command and following it. once they have a clear LOS, the leader tells that unit to fire upon the unit, so he turns around and engages. Its just silly fast because its the AI that is generating the command. If you have AI in your squad and do the same thing, you will see your squad mate, who may be facing backwards, whip around and engage

drifting sky
#

I've got disableAI "Target", which is suppoed to prevent exactly that, as I understand it

exotic flax
#

if person A tells person B "enemy 200m north", than person B can and will turn that direction and most likely see the enemy as well

#

so it's not that strange IMHO
but I agree that AI can be pretty OP, since they always know where you are and only visual/audible cues are used to check if they will fire at you

fair drum
#

maybe attempt to disable autotargeting as well

drifting sky
#

The situation I'm in right now is urbat combat. I've got men stationed at different positions around the town. Once the group is aware of me, it is basically impossible to sneak up on any of the AI. They will turn toward me the moment they have line of sight, regardless of direction.

fair drum
#

or the easiest way is to just make them their own individual groups

#

yeah from that comment, make them their own groups

#

and reenable target and autotarget

#

are you running any AI mods?

drifting sky
#

Problem is there's quite a lot of AI. don't want to degrade performance by having a lot of groups.

#

I suppose I could try it and see if it's a problem

exotic flax
#

well, a group communicates with each other, so if one of them know where you are, all group members do

drifting sky
#

i am using ASRAI, but as far as I know, it doesn't give AI ESP.

fair drum
#

... sigh...

#

ASRAI and VCOM both have extrasquadal (lol) communication

#

same with LAMBS

exotic flax
#

ASRAI also communicate between groups, so if one person knows where you are; all AI units within a range know where you are (independent of group)

drifting sky
#

I've disabled their radio communication, and I believe that is only for between groups anyway

#

not within a single group

exotic flax
#

within single group is already vanilla behaviour

fair drum
#

well you wanting group members to not communicate with each other goes against the basic AI package

#

not possible... now you could write a script that runs on individual units that deletes their target after a certain time, or eliminates knowledge of nearby players after a certain time, etc. but if you have tons of AI and you throw that on, you degrade performance too.

drifting sky
#

alright forgot this issue. let me go back to the AI units with pistols. Is there a way to stop them from going prone? UnitSetPos causes bugged behavoir for AI armed with pistols. So can you think of another way?

fair drum
#

not to prevent the prone command from firing, but you have the right idea with unitSetPos but you would put that as an event handler onEachFrame or with a while { blah; sleep 1;} type thing

#

and if the pistol gets bugged by putting it away or whatever happens, you can always script them into pulling it back out when it fires

drifting sky
#

when I use unitsetpos on a guy armed with a pistol, they get stuck forever switching weapons

fair drum
#

have you attempted that without ASRAI

drifting sky
#

nope, but I've read about other people encountering that bug with nothing to do with asrai. Plus looking at all the stuff asrai does, I don't see how it could be responsible for causing the error.

fair drum
#

well in the future, always test your theories without AI mods, then introduce them and see if it still works. there are so many things firing with these AI mods at any given second. if you are finding others having the same issue, without mods, then you can conclude that its an unintended bug/interaction and you might have to do something different with your mission.

#

have you thought about using a pistol caliber primary instead?

drifting sky
#

The pistols are just there for variety.

#

I don't suppose I can lock a unit in aware, as opposed to combat mode

fair drum
#

even if you were to do a script that changes the combat mode back to something else, the AI will override it. only thing that goes through is "CARELESS"

little raptor
#

@drifting sky

Arma2OA. Is there any way to prevent AI armed with only a pistol from going prone on contact with the enemy? I cannot use setUnitPos because it is bugged for AI armed with only a pistol.
I think it's an animation bug (was also present in Arma 3, maybe still is)

#

I mean if the prone thing is temporary, it's definitely the same bug
In A3, when the AI were running and they wanted to raise their pistol to aim at the target, they would go prone first, then get up
It was a bug in the animation connections/interpolations

fair drum
#

can I pass additional parameters to an addEventHandler? sort of like an addAction?

robust hollow
#

no

#

get/setVariable the arguments you need somewhere that is accessible in the event, or format the arguments into the event code (if they are static variable values)

fair drum
#

alright

crude vigil
#

An example to format the arguments, in case you need.

violet gull
#

Is it a bug that setTriggerInterval doesn't work on triggers created with createVehicleLocal command?

crude vigil
violet gull
#

@crude vigil createVehicleLocal allows creation of triggers local to clients, whereas createTrigger only allows trigger creation local to server. The triggers work, just can't set the interval apparently.

robust hollow
#

Since Arma 3 v1.43.129935 triggers can be created locally on clients setting optional param makeGlobal to false
?

crude vigil
#

Umm no? You can create local triggers with the makeGlobal set to false?

violet gull
#

Ooooh god damn it, got confused with the parameter cuz of the mission placed trigger settings...

#

Mission placed one is either global or local to server lol

#

I've legit been doing it via createVehicleLocal this whole time notlikemeowcry

idle jungle
#
marker_1 = createMarker ["object", position this];``` 

Would this spawn a marker on an objects location?
#

Oh I'm on phone sorry for formatting

violet gull
#

@idle jungle You also need to set some other extra marker stuff:

_marker1 setMarkerType"mil_dot";
_marker1 setMarkerAlpha 1;
_marker1 setMarkerColor"ColorPink";
_marker1 setMarkerSize[.5,.5];```
idle jungle
#

Yeah just wanted to make sure the spawning of it was correct :) thanks @violet gull

violet gull
#

If you create more than one marker, it might be a good idea to give it a unique name also:
_marker1=createMarker[format["mkr_%1",getposworld myLittleObject],getPosATL myLittleObject];

#

If the marker name is the same as another, it'll have issues spawning

idle jungle
#

Yeah I plan to have quite a few actually so thats even better

#

So each marker spawn would be _marker1 _marker2 so forth

#
_marker1 setMarkerShape"ICON";
_marker1 setMarkerType"mil_dot";
_marker1 setMarkerAlpha 1;
_marker1 setMarkerColor"ColorPink";
_marker1 setMarkerSize[.5,.5];```
#

Ah bloody phone

violet gull
#

_marker1, 2, 3, etc is a local variable in your case, so it might be easier to just create the markers within a forEach or something like this:

//I use this for my civilian script when debugging solo


private["_m"];
{
_m=createMarker[format["mkr_%1",getposworld agent _x],getPosATL agent _x];  
_m setMarkerShape"ICON";
_m setMarkerType"mil_dot";
_m setMarkerAlpha 1;
_m setMarkerColor"ColorPink";
_m setMarkerSize[.5,.5];
}forEach agents;
idle jungle
#

Oh yeah thats a better idea

acoustic abyss
#

@crude vigil createVehicleLocal allows creation of triggers local to clients, whereas createTrigger only allows trigger creation local to server. The triggers work, just can't set the interval apparently.
@violet gull This looks like a fix to my problem. I wish to make a music cue / trigger. But I want each player to trigger it themselves (competing teams each visit same location). This would allow the trigger to fire separately on each machine, yes?

violet gull
#

@acoustic abyss I actually use a couple triggers for that exact purpose, so yes. ๐Ÿ™‚

#

_t=createTrigger["MuhTrigger", _muhTriggerPos, false];

#

As long as it is executed where player is local. initPlayerLocal.sqf or a script called from there should do.

#

Global triggers in my experience are poops.

acoustic abyss
#

Thank you! Saves a lot of headaches with remoteExec

still forum
#

For the marker talk above. I recommend using all local marker commands, until the last one

#

because every of these marker commands that you use there, is re-sending the whole marker via network to all players

#

also private["_m"]; Don't use that, its a performance waste @violet gull

lyric eagle
#

Is there a way i can get the AI the react differently to certain Ammo types/Grenades?

spark turret
#

hello, im trying to make an AI sniper countersnipe me.
so far i have given the AI sniper knowledge about me with reveal [player,4] and added a destroy waypoint at my position.
dis my code:

//reveal target
_this reveal [player,4];
//add waypoint
_wp = (group _this) addWaypoint [position player, 0];
//set type destroy
_wp setWaypointType "destroy";
//attach waypoint
_wp waypointAttachVehicle vehicle player;

but the AI sniper just refuses to shoot and just runs around :D
also the waypoint is instantly completed ?

#

the AI stands literally infront of me and ignores me wtf

exotic flax
#

a) is the AI able to move towards you? Otherwise waypoints don't work.
b) "destroy" is to destroy vehicles etc, not to kill infantry

spark turret
#

yeah ai can path. what other waypoint should i use?

#

or method, it doesnt have to be a waypoint, just what i figured would work

exotic flax
#

No waypoint, unless it should move around

spark turret
#

if i cant use a waypoint, how do i tell the AI to attack the player?

exotic flax
#

And it should attack you by itself if it's able to, unless you disabled it in any way

finite sail
#

following... an AI sniper secondary mission is on my todo list

little raptor
#

if i cant use a waypoint, how do i tell the AI to attack the player?
AI doTarget player

finite sail
#

in the stuff ive done so far, they rarely engage > 600m

spark turret
#

right, forgot about the doStuff. will try

little raptor
#

they rarely engage > 600m
Yeah. You need to mod it

spark turret
#

ah yes, this works instantly better:

_this reveal [player,4];
_this doTarget player;
_this disableAI "path";
finite sail
#

when you say mod, you mean use an addon?

#

or script the AI behav

little raptor
#

If you want the AI to always know where you are, do this in a loop:

_AI forgetTarget player;
_AI reveal [player, 4];
#

when you say mod, you mean use an addon?
or script the AI behav
Both can be done. But I meant use an addon

#

Also, set the AI detection skill to maximum

spark turret
#

why forget? to clear wrong positions where it thinks i am?

little raptor
#

yes

finite sail
#

after 2 mins, they do

little raptor
#

without that the target position never updates (when target is unknown), even if you use reveal

spark turret
#

hm i still cant get the sniper to fire at over 500 m

#

sad

finite sail
#

even with dofire?

spark turret
#

will try that

finite sail
#

i think (note disclaimer) that viewdistance might be involved here?

#

can onyone confirm deny?

spark turret
#

nope ,i checked and it says 12 km

finite sail
#

ok, good

spark turret
#

okay, so it seems that it only works on fresh spawned units.

#

like, i cant script-order the same unit twice. it will just stop doing anythin

finite sail
#

really? why would that be? I;ve come across some counterintuitive stuff in my 15 year career as a BI customer, but thats a new one

spark turret
#

well idk. i tried playing them close, add command, they fire. then i zeus move them further away. but they will just stop shooting,even if i run the command again.

#

if i spawn a new sniper far away + command, it works fine

finite sail
#

mmm, keep at it fella. save me all the testing pls ๐Ÿ™‚

spark turret
#

lol sure will. ill try to write a log

finite sail
#

hehe

spark turret
#

so far the AI snipes at 1km now

#

2km with fresh zeus spawned unit and

_this reveal [player,4]; 
_this doTarget player; 
_this disableAI "path";
_this setSkill 1;
little raptor
#

I told you. You have to forgetTarget

spark turret
#

i did and it didnt help

little raptor
#

And you do that in a loop?

spark turret
#

nope, by hand a couple of times. but since the target never moved, it shouldnt matter

#

okay, now that snipers somewhat work, how do i make an AI helicopter shoot at infantry ๐Ÿ™‚

glossy pine
#

How can I get the displayctrl number of a display, for example display 46.

winter rose
glossy pine
#

yeah but i mean the idc of the ctrl not the IDD

winter rose
#

idd = id of a display
idc = id of a control

glossy pine
#

for example i want hide the load button in the arsenal display, what is the number of that specific ctrl

winter rose
#

you have to browse the config, or find with allControls display

glossy pine
#

ok, thanks for the help I'll take a look at it

cosmic lichen
#

@glossy pine copyToClipboard loadFile "a3\ui_f\hpp\defineresincldesign.inc"

#

There are all the IDCs and IDDs of many GUIs including Arsenal

glossy pine
#

Ok, Ty @cosmic lichen

dull cosmos
#

Hello all, I have another question ๐Ÿ˜„ . I know this has been asked already (example here https://forums.bohemia.net/forums/topic/167988-hide-gps-crosshair-from-rscmapcontrol/) and as I understand it is somehow hardcoded, but is there a workaround to prevent the GPS crosshair to be shown when you are in certain vehicles? I'm particularly interested in hiding it when you parachute. If it is not possible to delete the crosshair, would it be possible to make it white or transparent? Thanks in advance for replies!

spark turret
#

the init fields in editor dont allow "sleep" commands. any other way i can suspend code without using a script file?

#

ah, using spawn {sleep 1; hint "hi"}; works

vestal field
#

can somebody test this script and tell me if it works for them?

winter rose
#

```sqf plz (see pinned message)

vestal field
#

i made it into an sqf

little raptor
#

He means add syntax highlighting to your code on discord

#

It's not readable like this

real tartan
#

is there a way to check if damage is from back-blast ? (using HandleDamage EH)

vestal field
#

He means add syntax highlighting to your code on discord
@little raptor like this?

guy1 addEventHandler ["HandleDamage", 
{ 

   private ["_return"];
   _unit             = _this select 0; 
   _selection         = _this select 1; 
   _passedDamage     = _this select 2; 
   _source            = _this select 3; 
   _projectile     = _this select 4; 
   
   _oldDamage = 0; 
   
   _bodyMultiplier      = 0.0000000000127; 
   _legsMultiplier      = 0.0000025; 
   _handsMultiplier     = 0.00000025;
   _headMultiplier      = 0.0000000075;
   _overAllMultiplier     = 0.000000000025; 
   
   switch (_selection) do
   { 
       case("head")    :
       {
           _oldDamage     = _unit getHitPointDamage "HitHead";
           _return     = _oldDamage + ((_passedDamage - _oldDamage) * _headMultiplier); 
       }; 
       case("body")    :
       {
           _oldDamage     = _unit getHitPointDamage "HitBody";
           _return     = _oldDamage + ((_passedDamage - _oldDamage) * _bodyMultiplier); 
       }; 
       case("hands")    :
       {
           _oldDamage     = _unit getHitPointDamage "HitHands";
           _return     = _oldDamage + ((_passedDamage - _oldDamage) * _handsMultiplier); 
       }; 
       case("legs")    :
       {
           _oldDamage     = _unit getHitPointDamage "HitLegs";
           _return     = _oldDamage + ((_passedDamage - _oldDamage) * _legsMultiplier); 
       }; 
       case("")        :
       {
           _oldDamage = damage _unit;
           _return     = _oldDamage + ((_passedDamage - _oldDamage) * _overAllMultiplier); 
       }; 
       default{}; 
   }; 
   
   _return
}]; ```
#

the variable for "guy1" was called "private" which i assumed is the unit's variable name which i promptly changed in the sqf file as well.

little raptor
#

Almost. You should put sqf in front of ```

real tartan
#

@vestal field private is SQF keyword ๐Ÿ˜ , not unit's name

little raptor
#

And no

#

private is a command

#

it makes the variable "local" to a scope

#

damage is from back-blast
Isn't that an ACE thing?

#

@vestal field I don't see anything wrong with that code. (except for that guy thing)

#

But _overAllMultiplier and the other multipliers are ridiculously small and probably will cause the return value to be too small, and you might not see the unit taking any damage at all

#

put the sqf after ```

#

And edit your old code. Do not spam

vestal field
#

@little raptor i edited the old code, still doesnt work however so the only culprit i can think of is somehow they're not spaced right or there's somehow a typo... but outside of "this" being replace with "guy1"; the unit's variable name i cant think of anything else

little raptor
#
guy1 addEventHandler ["HandleDamage", 
{ 
    params ["_unit", "_selection", "_passedDamage"];
    private ["_return"];
    _bodyMultiplier      = 0.1; 
    _legsMultiplier      = 0.1; 
    _handsMultiplier     = 0.1; 
    _headMultiplier      = 0.1; 
    _overAllMultiplier     = 0.1; 
    
    switch (_selection) do
    { 
        case("head")    :
        {
            _oldDamage     = _unit getHitPointDamage "HitHead";
            _return     = _oldDamage + ((_passedDamage - _oldDamage) * _headMultiplier); 
        }; 
        case("body")    :
        {
            _oldDamage     = _unit getHitPointDamage "HitBody";
            _return     = _oldDamage + ((_passedDamage - _oldDamage) * _bodyMultiplier); 
        }; 
        case("hands")    :
        {
            _oldDamage     = _unit getHitPointDamage "HitHands";
            _return     = _oldDamage + ((_passedDamage - _oldDamage) * _handsMultiplier); 
        }; 
        case("legs")    :
        {
            _oldDamage     = _unit getHitPointDamage "HitLegs";
            _return     = _oldDamage + ((_passedDamage - _oldDamage) * _legsMultiplier); 
        }; 
        case("")        :
        {
            if (time == _unit getVariable ["LastDamageTime", 0]) exitWith {_return = 0};
            _oldDamage = getDammage AI;
            _return = _oldDamage + ((_passedDamage - _oldDamage) * _overAllMultiplier);
            _unit setVariable ["LastDamageTime", time]; 
        }; 
        default{
          _return = 0;
        }; 
    }; 
    
    _return
}]; 
vestal field
#

wow cheers ๐Ÿ‘

#

i didnt change anything apart from the multiplier

little raptor
#

the code works

#

What's the problem?

vestal field
#

i die in like ... about 3 hits lmao

#

did i do something wrong and i'm actually taking more damage than normal?

#

@little raptor sorry but can i post a screenshot here

#

theres an error message

#

it says "error local variable in global space"

little raptor
#

try it again

#

I made some changes

vestal field
#

thank you

#

died after one shot from a 9mm pistol ๐Ÿ˜ญ

#

i leave the init field of the unit blank right?

little raptor
#

whose "guy1"?

#

are you sure it's you?

#

and have you defined it?

vestal field
#

so under object:init in attributes i gave the object in this case an aaf rifle man the variable name "guy1" without the quotation marks

#

@little raptor can i post a screenshot anywhere

#

but yes the unit in question's variable name is definitely "guy1"

little raptor
#

@vestal field why don't you just put that code in the unit's init box?
And replace guy1 with this in the code (only the code, not the variable name)

vestal field
#

alright np will do

#

how many hits did your guy take? @little raptor

#

still dies in 1-2 hits after placing the code in the init field

#

weapon the ai used on me is the mp443

little raptor
#

Are you running ACE?

#

how many hits did your guy take?
whole mag didn't hurt my guy

vestal field
#

nope no ace

#

i had it on in a earlier scenario but i dont want any interference so i made a new one from scratch without ace

#

the only addons i have adds objects like rhs/cup nothing that alters any game mechanics like ace

#

im also testing with vanilia ingame units

#

@little raptor is there a way to check if the sqf file is working properly?

#

like bring up a debug menu ingame

little raptor
#

put some hint or systemChat at the end

vestal field
vestal field
#

@little raptor i just cant figure it out sorry, could you upload or send me your mission.VR and let me test to see if it works?

little raptor
#

@vestal field The code should work if you simply changed guy1 to player:

player addEventhandler ...
#

Simply make that change and execute the code in the debug console

#

If it doesn't work, you have a mod conflict or something

#

Ok that's weird. The code doesn't work for me now

#

I mean it does reduce the damage but it takes me 4-5 shots to kill someone

vestal field
#

yea its weird

#

i cant change it to player as a variable name are you getting that too?

#

it says restricted characters

little raptor
#

not the player name

#

I said change the code

#

And try it in the debug console

#

But doesn't matter now since there's something else wrong

vestal field
#

yea i changed it to player

#

do i just paste the whole code into debug console and hit enter?

little raptor
#

@vestal field it was a code issue

#

Try it again

#

And increase the damage multipliers

vestal field
#

@little raptor weird its working now lol he emptied 2 mags into me

little raptor
#

because I fixed it

vestal field
#

i just pasted the same code yea

#

thanks dude

little raptor
#

i just pasted the same code yea
you mean the one above?

#

Otherwise it's not fixed

vestal field
#

yea

#

idk why that is working all of a sudden

little raptor
#

I changed the code dude. I mean are you using the old one on your PC?

vestal field
#

the one you posted at 1:53pm (for me) so about 2 hours ago

#

no the one you posted in this chat

little raptor
#

I didn't send you any code

vestal field
#

yea its just weird because it wasnt working 2 hours ago, but i stuffed around with the name and now it just decided to work

#
guy1 addEventHandler ["HandleDamage", 
{ 
    params ["_unit", "_selection", "_passedDamage"];
    private ["_return"];
    _bodyMultiplier      = 0.1; 
    _legsMultiplier      = 0.1; 
    _handsMultiplier     = 0.1; 
    _headMultiplier      = 0.1; 
    _overAllMultiplier     = 0.1; 
    
    switch (_selection) do
    { 
        case("head")    :
        {
            _oldDamage     = _unit getHitPointDamage "HitHead";
            _return     = _oldDamage + ((_passedDamage - _oldDamage) * _headMultiplier); 
        }; 
        case("body")    :
        {
            _oldDamage     = _unit getHitPointDamage "HitBody";
            _return     = _oldDamage + ((_passedDamage - _oldDamage) * _bodyMultiplier); 
        }; 
        case("hands")    :
        {
            _oldDamage     = _unit getHitPointDamage "HitHands";
            _return     = _oldDamage + ((_passedDamage - _oldDamage) * _handsMultiplier); 
        }; 
        case("legs")    :
        {
            _oldDamage     = _unit getHitPointDamage "HitLegs";
            _return     = _oldDamage + ((_passedDamage - _oldDamage) * _legsMultiplier); 
        }; 
        case("")        :
        {
            _return     = _passedDamage 
        }; 
        default{
        }; 
    }; 
    
    _return
}]; 

@little raptor this one

little raptor
#

well yeah I changed it

vestal field
#

ah i see

#

idk what the error was it didnt say anything, but hey it works at least

little raptor
#

but now it won't return any damage

#

so your player won't die ever

vestal field
#

oh so im basically in god mode

#

oof

little raptor
#

not really

vestal field
#

alright ill try making the multipliers higher

little raptor
#

Your arms and legs can take damage

#

It won't make any difference

#

@vestal field ok fully fixed now

#

try the updated code

#

it was a timing issue

vestal field
#

alright thanks again ๐Ÿ˜„

little raptor
#

Your character was taking damage multiple times per frame

vestal field
#

weird now hes dying normally again

#

3 hits from the khaliba

little raptor
#

@vestal field I think you're using your own code again

#

that's what you should use

vestal field
#

my bad copied the wrong one

#

ye it works like a charm cheers mann ๐Ÿ‘

vestal field
#

Only problem is that i gotta fire from the debug console for it to function but beside that thanks heaps meowthis

little raptor
vestal field
#

ok will do, i checked some videos of other ppl doing something similar (not to alter the same functions but they gave the variable name something arbitrary like blue1/red1), and it was working for them so i assumed it shouldnt matter what i name it.

#

their was much simpler however and only to perform a function like notifying ammo is reloaded so i guess theres a big diff

little raptor
#

i checked some videos
most of them are really bad. don't learn programming from videos

vestal field
#

i see

#

guess ill rely on the wiki from now on

little raptor
#

You can also learn from other people's scripts (altho it's better to steer off obscure mods). then look up the commands on the wiki to learn what they do and how stuff works
And if you have any questions, feel free to post it here.

vestal field
little raptor
#

in case you need reference
why would I?!

vestal field
#

thanks, ill try to improve on my coding

#

idk lol

#

his codes were working for him so i assumed it should be the same on my end

winter rose
#

why would I?!
cuz u bad hue hue hue

vestal field
#

im not tryna accuse anyone of giving a crap guide here but ok

winter rose
#

j/k, don't worry ๐Ÿ˜‰

smoky verge
#

hello
I'm trying to optimize an MP mission
and came across this function
https://community.bistudio.com/wiki/BIS_fnc_replaceWithSimpleObject
apparently using this on a large amount of props clogs the server network.
But the biki says this

In MP it is better to directly create the simple object, if possible, to avoid the unneeded network traffic.
which makes me think, is there a way turn every placed object in the mission into a CreateSimpleObject script?
In this way there would be no need to replacing, only creating, which would defenitely decrease traffic.
if something like this exists/would be created it would really change things for mission makers.

winter rose
#

there is a tickbox in the object's properties "Simple Object" @smoky verge - you can select all and mass-tick

smoky verge
#

its not present for all objects, only physx ones

and before you say "then it doesn't need it" I can guarantee there is a difference, for more info check the convo in #arma3_questions

winter rose
winter rose
#

you could create an array with type/position/vectorDirAndUp, delete everything server-side then create them client-side only (local = true)
"only" the array would be transferred

smoky verge
#

shame I don't know how to do it but thanks

#

would that method in the link work?

winter rose
#

yeah, but same network thing

#

the server deletes then replaces

smoky verge
#

I see thanks

tough abyss
#

Sjalom!
An abstract question: in addons, you are able to preinit functions.

Is it possible to pre-init your function in mission scripting? For example in init.sqf?

little raptor
#

@tough abyss You can define cfgFunctions with preInit=1

tough abyss
#

in description.ext?

little raptor
#

yes

exotic flax
#

CfgFunctions can also be used in description.ext

tough abyss
#

It didn't seem to when I tried. But I will experiment some more.

exotic flax
#

you could try postInit, since preInit might be too soon

tough abyss
#

My function doesn't need to load with the game. But it does need to load before mission gameplay starts.

#

Thanks

little raptor
#

preInit does work before the mission initialization

#

perhaps what you're doing is not supposed to happen then

exotic flax
#

preStart runs at game start, which won't be called at all when in a mission.
preInit runs at mission start, BEFORE objects/modules/etc are initialized (unscheduled)
postInit runs at mission start, AFTER objects/modules/etc are initialized (scheduled)

See exact moment on https://community.bistudio.com/wiki/Initialization_Order

karmic light
#

Someone can help me with Scripts ๐Ÿ˜ฆ ?
i getting Error and i can't understand exactly what the problem ๐Ÿ˜ฆ

warm hedge
#

Without looking your script, nobody

karmic light
#

i prefer doing it in Private chat,

cosmic lichen
#

Then this is not the right place for you @karmic light

dusk gust
#

Just asking for security sake, is there any way to terminate or modify a spawned script without a handle to it through external means?

karmic light
#

Just asking for security sake, is there any way to terminate or modify a spawned script without a handle to it through external means?
@dusk gust

U talk to me?

dusk gust
#

Whats the issue exactly?

karmic light
#

idk, i got a script about Rocket Interception, and it not work pefect it gives me error lines and idk what the problem exactly,

i prefer private, becuase i could spam here xd and i wont do it here, so i asking if someone can help me and will continue in private chat \o/

warm hedge
#

Nobody cares if you spam this chat, unless it's too much

winter rose
#

spam = too much
asking many valid questions on a topic = not spam

#

@karmic light ๐Ÿ˜‰

winter rose
#
_interceptor = position _launcher nearObjects [_ammo, 100] select 0;
```_can_ return [], so `select 0` on this would return nil
#

@karmic light โ†‘ (PS: ideally, try not to post links without description #rules)

karmic light
#

ok.

#

so, [] select 0;
this what i have to do?
no numbers?

winter rose
#

no, no.

#
position _launcher nearObjects [_ammo, 100]
```this โ†‘ can return [ ] (empty array)
if you do a select 0 on an empty array, _interceptor will be undefined of course

so check first that this โ†‘ does not return an empty array
karmic light
#

_interceptor = position _launcher nearObjects [_ammo, 100]

or, to remove the _interceptor

winter rose
#

wat

#

โ€ฆyou have no idea what you are doing, right? ๐Ÿ˜…

karmic light
#

no, becuase u saying here 2 things so i littley confused

#

and ye it not my script haha

winter rose
#

with the above script, you get near objects
then you say "hey, from this list, pick the first item"
the problem is that the list can be empty
if the list is empty, the "pick the first item" returns nil, therefore the variable is undefined

#

basically, you are not even checking there is something to pick from

karmic light
#

ye haha, so i need just remove the Select?

winter rose
#

โ€ฆno

#

you need to check if the returned array is empty, and if not, continue with the first element

karmic light
#

it suppose to talk about the system that shoot the rockets out right?

winter rose
#

IDK this script, I am telling you where the issue comes from

#

script-wise, there is an error, that's it

karmic light
#

so, there nothing to do?

winter rose
#

you need to check if the returned array is empty, and if not, continue with the first element
there is

little raptor
#

@dusk gust afaik no.

brave elk
#

Anyone know how to change a texture over time?

#

as in, when i hit 10minutes into the mission, change one texture on the model

winter rose
#
sleep (10 * 60);
obj setObjectTextureGlobal stuff
```@brave elk?
little raptor
#

Sleep?!

brave elk
#

Thanks lou, but i need it to set it to one hiddenselection

#

i want the screen to change texture

winter rose
#

yesโ€ฆ? is it a texture that can be changed with setObjectTexture/Global?

little raptor
#

Isn't that the same as what Lou just did?

brave elk
#

ah idk, you see i never scripted before ๐Ÿ˜‚

#

If you know what SCP-079 is, i want to change the screens to that ai face at a certain time for cool missions

#

as if it were hacking the building

little raptor
#

There's only one command to change the object textures and it's that

brave elk
#

Thanks lou

sacred slate
#

how do i do in sp: onPlayerKilled do team switch next unit in squad

winter rose
#

overriding with onPlayerKilled.sqs and selectPlayer should do

sacred slate
#

well syntax wise i am lost.

winter rose
#

what did you try so far?

sacred slate
#

i thought i could find a snippet for that, or somthing similar to modify it. while i can change some things, i still can't write my own code

winter rose
#

a very detailed/cut down code that should work:

onPlayerKilled.sqf

if (isMultiplayer) exitWith {};
params ["_oldUnit"];
private _group = group _oldUnit;
sleep 3; // time to die
private _units = units _group;
if (_units isEqualTo []) exitWith { enableEndDialog };
private _unit = _units select 0;
selectPlayer _unit;
sacred slate
#

many thanks. ill test it asap ๐Ÿ˜„

#

can i change ismultiplayer to issingleplayer?

winter rose
#

no, such command does not exist

#

the line says "if it is multiplayer, do not do anything"

sacred slate
#

ah

#

@winter rose its not working, if i die i get the restart and team switch dialog

#

i tried it also with this in the description.ext

#

respawn = 4;
respawnDialog = 0;
respawnButton = 0;

winter rose
#

in SP, it won't matter

#

also it won't switch on side units, only group ones

sacred slate
#

well 4 is wrong anyways, just noticed it

#

oh wait, respawn 4 = Respawn in your group. If there is no remaining AI, you will become a seagull.

#

but yeah its not teamswitch

winter rose
#

it does not matter in singleplayer

sacred slate
#

ok

still forum
#

look up in discord search

spark turret
#

missionnamespace getVariable can be called from client to access a serverside variable, right?

distant oyster
#

no missionnamespace is local to every client

finite sail
#

if it was made using setvariable with the public flag set true

#

then yes

distant oyster
#

if it was made using setvariable with the public flag set true
@finite sail that only updates the variable once. any updates will not propagate

finite sail
#

ja

#

๐Ÿ™‚

distant oyster
#

:)

sacred slate
#

@winter rose funny thing, if i am not the initial player and kill my self, the script works as intended

spark turret
#

thanks, that settles the question

sacred slate
#

i have now the ability to automaticly switch to the next squad member if i get killed. this is in the onPlayerKilled.sqf:

if (isMultiplayer) exitWith {};
params ["_oldUnit"];
private _group = group _oldUnit;
sleep 3; // time to die
private _units = units _group;
if (_units isEqualTo []) exitWith { enableEndDialog };
private _unit = _units select 0;
selectPlayer _unit;

the problem is now, it works only if i am not the squad leader. if i am the squad leader and i die, i cant do anything anymore. i can switch to map and back but everything else is locked out of my controls, i have to kill the game then, cause there is no other interaction possible.

winter rose
#

replace sqf private _units = units _group; with```sqf
private _units = units _group select { alive _x };

spark turret
#

how difficult is it to make a small CBA settings thing from a script?

winter rose
#

I would say CBA doc, but I am not an expert in CBA

sacred slate
#

works now! many thanks

compact maple
#

Hi, how can I remove any items in a vehicle cargo ?

winter rose
compact maple
#

Thanks ๐Ÿ™‚

#
clearBackpackCargoGlobal
clearItemCargoGlobal
clearMagazineCargoGlobal
clearWeaponCargoGlobal

were the cmd I was looking for ๐Ÿ™‚

spark turret
#

okay, so i added my cba setting, but how do i access its value? ideally without a chaned_setting eventhandler

still forum
#

the settings name is the values variable name

little raptor
#

They're just regular global vars

#
["AIO_enableMod", "CHECKBOX", "Enable All-in-One Command Menu", ["All-In-One Command Menu", "Initialization"] ,true, 1, {}, true] call CBA_fnc_addSetting;

_value = AIO_enableMod//true or false for checkbox
sacred slate
#

@winter rose may i bother you again, how can i re-gain high command syncs after i got team switched? ๐Ÿ˜„

#

i got so far: player hcSetGroup allGroups;

#

but looks like i have to send allgroups to a array

#

yeah to refine my question, how do i do: player hcSetGroup allgroups

winter rose
#

I don't know HC well I'm afraid

#

@sacred slate ```sqf
{
player hcSetGroup [_x];
} forEach (allGroups select { side _x == side group player });

#

should do

little raptor
#

You should also make yourself the commander (high command leader)

#
if (player != hcLeader _group) then {
    hcLeader _group hcRemoveGroup _group;
};
player hcSetGroup [_group];
#

otherwise hcSetGroup wont work

winter rose
#

writing down on paper

little raptor
#

well, you own the wiki, write it down there! ๐Ÿ˜„

winter rose
#

hey! just you wait, amma threaten you with an account ๐Ÿ˜„

#

@little raptor do you happen to know what is the third param? a string?

little raptor
#

no

#

I'll check

winter rose
#

thanks!

sacred slate
#

hmm this add's only the first squad, lets say alpha 1-1

little raptor
#

@winter rose The third param is a string. "teamred", etc.

winter rose
#

thanks! update on the way

#

done

#

fixed already :p

little raptor
#

the example is still wrong

winter rose
#

F5, dear ๐Ÿ˜Ž

little raptor
#

by the way, you can add an optional tag to the 2nd and 3rd param since they're not necessary

winter rose
#

true that!

#

and done again.

sweet salmon
#

So I have a random question:

Is it possible to completely override the Lift and Drag values of an aircraft? Not augment, but replace them entirely?

I want to circumvent both the SFM and AFM via scripting.

winter rose
#

yes, but with modding, not scripting

sweet salmon
#

Well, the core of the overall mod would be via scripting. So if I understand you, then I would need to do the override via config?

winter rose
#

yep

spice vigil
#

Hey, I'm having difficulty activating a script to an event handler I attached to a weapon.

Should it be something like:

        {
            fired = "_this call [Fnc Class name]_fnc_[Fnc File name]";
        };
winter rose
little raptor
#

And no need for _this

spice vigil
#

And this works if I add it into a weapons class?

Edit: Wait I think the error was I missspelt EventHandlers in my config. XD

worn forge
#

Looking for a little guidance here relating to score...

#

case: player starts mission in side west, getPlayerScores player shows what you'd expect: [0,0,0,0,0,0]

#

player uses joinSilent to join a group not in side west, scores tracking seems to get messed up. getPlayerScores player now shows [] and doesn't update when new kills are tracked

#

player uses joinSilent to join back to a group in side west, score tracking has been working all along; getPlayerScores player shows all kills that were accumulated while player was in other group.

#

Question; how do I access these scores while player is in the non-west side?

open star
#

Would it be possible to make a ForEach to play music at all my loud speakers at once by activating one of them with an addAction command.

#

As I've set it now I have to walk to each one to play it and obviously that get's them off beat of each-other.

little raptor
#

@open star
By "loud speakers" you mean some in-game object right?

#

And not your physical loud speakers?

#

@worn forge Wouldn't it be better to report it on FT so that it can be fixed?

worn forge
#

FT?

#

Feedback tracker?

winter rose
#

yep

worn forge
#

Well, I wasn't sure it was a bug, yet ๐Ÿ™‚

little raptor
#

It seems like a bug

open star
#

Loud Speakers, not Load.

little raptor
#

yeah typo

open star
#

an Object yeah, just a little game object that would be used in like schools or soemthing

#

for Alarms, announcements, etc.

little raptor
#

Well if so the answer is yes

spark turret
#
["AIO_enableMod", "CHECKBOX", "Enable All-in-One Command Menu", ["All-In-One Command Menu", "Initialization"] ,true, 1, {}, true] call CBA_fnc_addSetting;

_value = AIO_enableMod//true or false for checkbox

@little raptor
oh thats simple

#

thanks

little raptor
#

@open star for example your addaction code could be:

isNil {
  {
    playSound3D [_musicFile, _x];
  } forEach [obj1, obj2, ...];
}
#

np

open star
#

Oh cool that's a lot simpler than I would've done.

little raptor
#

for example:

object addAction ["Title", 
{
  isNil {
    {
      playSound3D [_musicFile, _x]; //music file must be defined
    } forEach [obj1, obj2, ...];
  }
}]
spark turret
#

i keep forgetting over and over but:
how do i avoid errors for possibly undefined variables?
f.e. i have a global var " boolean debugmode" and that one gets initialised quite late. any way to just skip earlier checks?

#

isNull?

little raptor
#

isNil

#

"boolean debugmode"
That doesn't seem right

#

I mean if it's your variable name

spark turret
#

oh yeah, was just to clarify what it is

worn forge
#

Alrighty, made my first feedback entry ๐Ÿ˜‰

open star
#

wait

#

So I'm using MusicCFG for it

#

does that no define it?