#arma3_scripting
1 messages Β· Page 659 of 1
I π too
in the if above
Next time when you ask for help with an error.
provide the error, and your script and enough context so people can see whats going on without having to pull everything out of you in seperate questions wasting 5 minutes of time π
yes excuse me @still forum , I'm really into a lot of things and I'm supposed to be on vacation
Since there are some eventHandlers not listed here - https://community.bistudio.com/wiki/Arma_3:_Event_Handlers
Is there a better eventHandler to use for this? c++ addMissionEventHandler ['EachFrame',{if (cameraView isEqualTo 'GROUP') then {player switchCamera 'INTERNAL';};}];
Script for removing the group/commander/tactical view
"Since there are some eventHandlers not listed here " huh? which aren't listed?
if (worldName isEqualTo "Tanoa") then
{
CTI_TANOA_REMOVED_OBJECTS =
[
"t_ficus_medium_f.p3",
"t_palaquium_f.p3d",
"t_ficus_big_f.p3d",
"b_cycas_f.p3d",
"d_fallentrunk_branches_lc_f.p3d",
"d_fallenbranch_lc_f.p3d",
"d_treestump_natural_large_f.p3d",
"d_fallentrunk_roots_lc_f.p3d",
"b_colored_yellow_f.p3d",
"b_colored_red_f.p3d",
"b_gardenia_dec_02_f.p3d",
"tyre_01_f.p3d",
"tyre_01_line_x5_f.p3d",
"tyre_01_horizontal_f.p3d",
"garbageheap_04_f.p3d",
"garbageheap_01_f.p3d",
"garbageheap_02_f.p3d",
"garbageheap_03_f.p3d",
"clothesline_01_full_f.p3d",
"clothesline_01_f.p3d",
"fishinggear_01_f.p3d",
"cinderblocks_01_f.p3d",
"fishinggear_02_f.p3d",
"woodenplanks_01_messy_f.p3d",
"crabcages_f.p3d",
"woodencrate_01_stack_x3_f.p3d",
"woodencrate_01_f.p3d",
"woodencrate_01_stack_x5_f.p3d",
"containerline_01_f.p3d",
"containerline_02_f.p3d",
"containerline_03_f.p3d",
"woodenplanks_01_f.p3d"
];
{
if(toLower(str _x) in CTI_TANOA_REMOVED_OBJECTS) then
{
_x hideObjectGlobal true;
_x enableSimulationGlobal False;
};
} foreach (nearestTerrainObjects [[worldSize/2, worldSize/2], ["HIDE","tree","house"], worldSize, false]);
};
any idea why it does not remove the objects?
woops
did nto mean to post the whole thing
toLower(str _x) did you check that in debug console? that it returns exactly what you expect it to return?
hmm, im using the dev console, what command should i use to do that?
I couldn't find MarkerCreated, unless I'm looking wrong
go to a object that you want removed.
look at it.
tolower str cursorObject
kk
I c, thank you x2!
well there you go
it doesn't work
"560992: t_ficus_medium_f.p3d" is not IN your CTI_TANOA_REMOVED_OBJECTS
ok i just grabed one i thought it did
what i mean is
when i do it like this it works
if (worldName isEqualTo "Tanoa") then { {
if (
(toLower(str _x) find "t_ficus_medium_f.p3") >= 0 ||
{(toLower(str _x) find "t_palaquium_f.p3d") >= 0} ||
{(toLower(str _x) find "t_ficus_big_f.p3d") >= 0} ||
{(toLower(str _x) find "b_cycas_f.p3d") >= 0} ||
{(toLower(str _x) find "d_fallentrunk_branches_lc_f.p3d") >= 0} ||
{(toLower(str _x) find "d_fallenbranch_lc_f.p3d") >= 0} ||
{(toLower(str _x) find "d_treestump_natural_large_f.p3d") >= 0} ||
{(toLower(str _x) find "d_fallentrunk_roots_lc_f.p3d") >= 0} ||
) then {_x hideObjectGlobal false; _x enableSimulationGlobal true; }
} foreach (nearestTerrainObjects [[worldSize/2, worldSize/2], ["HIDE","tree","house"], worldSize, false]);
};
ob with more stuff
i deleted some so im not flooding the discord as much
It contains "t_ficus_medium_f.p3" but you are checking if it contains "560992: t_ficus_medium_f.p3d"
https://community.bistudio.com/wiki/getModelInfo
use that to get the modelName, and use that
yes but non of the othernames get remved
Yes.
is that because the first 1 is broken?
It contains "t_ficus_medium_f.p3" but you are checking if it contains "560992: t_ficus_medium_f.p3d"
It contains "t_ficus_medium_f.p3d" but you are checking if it contains "560992: t_ficus_medium_f.p3d"
ahhh
it can never match exactly, because it doesn't have the numbers
every object has a unique number too so can't really check with that
ask @midnight spoke Mason about the numbers
just use getModelInfo to get the real model name
hmm i have had issues using get model info before..
thats why i used this originally
how come the 2nd one works?
can i make the first work like the 2nd?
The second one shouldn't work
they should all have the numbers
or do you mean the other script?
Better try getModelInfo, I don't know why that wouldn't work, and it would be more efficient
it does work
the 2nd one works
it just takes forever
like 6 seconds of freezing
but im in dev
and have used the 2nd one for a long time
"or do you mean the other script?" yes, didn't understand what you meant by "2nd"
I know it works but its very bad performance wise
so why does 2nd work and first wont?
and can i make the 1st work?
the 1st one should improve performance right?
Maybe I'm not talking loud enough.
USE GETMODELINFO TO GET THE MODEL NAME.
is that better? can you hear me now?
i can hear you of course
Sorry I'm REALLY not a fan of having to repeat myself half a dozen times
sorry i just remember having a real struggle with getModelInfo in the past
we're here to back you up π
Works fine here. And I can't think of anything that would break it
kk thanks ill go mess with it
i had issues with CUP maps and other custom maps
thats why i used that stuff originally
cuse i could get returns
where sometimes i could not get the full classname
returned to me
but ill give ner a another go
getModelInfo doesn't return a classname
Some objects on terrains don't have a classname. But noone here said you should use classnames
this may be what confused me before then...
_action = _this param [0];
_handle = 0;
if (_action == "start") then
{
_handle = [] execVM "computer.sqf";
};
if (_action == "exit") then
{
terminate _handle;
};
dedmen a more question i have this script to boot the other script, but i have a problem to terminate the script any help with this?
ok so ["t_ficus_medium_f.p3d","a3\vegetation_f_exp\tree\t_ficus_medium_f.p3d",false] is returned with get model info
is like the _handle is not assigned with the exec of the script it contain the 0
"t_ficus_medium_f.p3d" use that. With your CTI_TANOA_REMOVED_OBJECTS
kk
_handle is a local variable.
When you call it with exit, _handle = 0 you will have set it to 0
ok, i need to declare it as global to work ?
im so confused.. brain hurts
so i ran
if (worldName isEqualTo "Tanoa") then
{
CTI_TANOA_REMOVED_OBJECTS =
[
"t_ficus_medium_f.p3d"
];
{
if(toLower(str _x) in CTI_TANOA_REMOVED_OBJECTS) then
{
_x hideObjectGlobal true;
_x enableSimulationGlobal False;
};
} foreach (nearestTerrainObjects [[worldSize/2, worldSize/2], ["HIDE","tree","house"], worldSize, false]);
};
the tree is not removed... sorry if im super fucking dense
oh in that part you want get modle info
Yes
i thought we where jsut using that to get the model via cursor object
Yes, nothing changed for the name in CTI_TANOA_REMOVED_OBJECTS, if you compare that to what you already had (except the typo you had in there)
I already told and showed you above that str _x returns that number at the start
yes thus why i was not getting in, i did not understand what we where changing
I thought i needed to grab the name of the object
in a different way
I don't understand why you thought that
via chainging it by grabbing it via cursor object
how would "t_ficus_medium_f.p3d" generated one way be different from "t_ficus_medium_f.p3d" generated another way, its the same thing
Its literally just a string of characters. No matter how you generate it, as long as it matches
thus my confusion
thx, i already make it
Tried it 3 times now, every time I draw a line or put down a dot on the map in one of the channels that the script is meant to delete markers in - the game instantly crashes

try
addMissionEventHandler ["MarkerCreated", {
params ["_marker", "_channel"];
if (_marker select [0, 13] == "_USER_DEFINED" && _channel in [0,1,2,3]) then { _x spawn {deleteMarker _this}; };
}];
Propably it's due to the tons of other scripts n stuff in the mission, but those would be a bigger pain to change
will try this when game launches again
Can you either make a feedback tracker ticket for the crash, or just send me the mdmp via DM
I'll do the feedback tracker if I don't figure it out, but my guess would be that it's caused by bunch of other scripts n their errors
Through - I have it in the init.sqf, maybe that's not the correct place?
Crashes happened on "play in multiplayer" through the editor, so not an actual server
I'll also try the new one on a completely empty mission if it still crashes, just in-case
Please also do if you figure it out
I need to fix that
It doesn't matter where you execute
I just need the report please
Figured I'd ask, I know some things directly in the 'init' break things
can confirm, deleting marker in markercreated EH in hosted MP will crash the game
Only hosted MP? Any idea about dedicated server?
havent tested dedicated
Good news - doesn't crash
Bad news - doesn't remove markers
Will try the previous one on a no-mods empty mission, see if it still crashes me
it will. Please give me crashdump via DM or ticket, tickte is preferred
with _marker works like a charm!
Making error report/ticket and RPT with nothing loaded on the previous one
I don't care about mods, they wouldn't make a difference
Aye, but it's quicker to open the game when I unload everything, especially since the result of crashing is opening the game over n over again))
ok so this is what i came up with... i could not figure out how to incorporate getmodelinfo into my script myself, i tried various things. I copied a bit of what some guys did in a thread and tried to pull out what did not matter.
if (worldName isEqualTo "Tanoa") then
{
CTI_TANOA_REMOVED_OBJECTS =
[
["t_ficus_medium_f.p3d"],
["t_palaquium_f.p3d"],
["t_ficus_big_f.p3d"]
];
{
private _a = ((getModelInfo _x) select 0);
private _c = CTI_TANOA_REMOVED_OBJECTS select {_a == _x select 0};
if !( _c isEqualTo []) then {
hint "its true";
hideObjectGlobal _x;
_x enableSimulationGlobal false;
};
} forEach nearestTerrainObjects
[
[worldSize/2, worldSize/2],
["Tree"],
worldSize,
false
];
};
I shortend it to make it readable... it works, but i had to add those extra [] in there on each line item. I believe that is because im using that select 0 command. my question is is this what you meant? how can i make it better. and does this method ruin the performance im trying to gain?
Why the 2D array?
in nearest? i belive the first false is about whether the array arranges near to far.
and the one after that does 2d or 3d
No in CTI_TANOA_REMOVED_OBJECTS
you mean the brackets in the bracket?
Why not just ["P3d", "P3d"]
Ticket submitted on https://feedback.bistudio.com/T157170 & DM sent
i think that is because if the selcetion method i copied? i could not make it work without that
when i did it that way
i think the private _a = ((getModelInfo _x) select 0);
private _c = CTI_TANOA_REMOVED_OBJECTS select {_a == _x select 0};
was not working
before i put them each in brackets
how do i make it work without that?
if (worldName isEqualTo "Tanoa") then
{
CTI_TANOA_REMOVED_OBJECTS =
[
"t_ficus_medium_f.p3d",
"t_palaquium_f.p3d",
"t_ficus_big_f.p3d"
];
{
private _a = toLower ((getModelInfo _x) select 0);
if (_a in CTI_TANOA_REMOVED_OBJECTS ) then {
hint "its true";
hideObjectGlobal _x;
_x enableSimulationGlobal false;
};
} forEach nearestTerrainObjects
[
[worldSize/2, worldSize/2],
["Tree"],
worldSize,
false
];
};
Like that
ill go try
it works!
thanks!
well i might as well compare them now to see if i wasted everyones time :S
BTW has anyone ran into an Issue where doing setVectorDirAndUp and setPosATL right after the creation of an object on the server doesn't work?
@worthy willow
private _a = worldSize / 2;
private _center = [_a, _a, 0];
private _size = sqrt 2 * _a;```
TO get the exact worldsize
Forgot you did worldSize /2 π
@cosmic lichen will this make it faster?
I dunno how nearestTerrainObjects behaves outside of the terrain boundries
π
okay so i was able to improve it very minorly with toLowerANSI to 15400. no effect from changing the worldsize settings
ill keep it in there anyway maybe it will help with really really big maps
like Australia and mske
@cosmic lichen @worthy willow @still forum thanks for the help!
@glass zinc Removing the hint will give a lot more performance btw.
so it seems like its mostly having the array in the array that makes the performance that much worse
maybe you can have a faster search by using apply and the indexes
meh, no, everything seems already gudenuff
Very easy way to make it faster
Just get all trees on tanoa, stratis, altis, whatever
and store them in a variable
Then just go through them when the mission is running and hide them.
downsight is, that it's static and needs to be adjusted for every map
@cosmic lichen that sounds very cool... you mean like remove them slowly over time
it does jam up the mission at start for sure, causes a freeze while its doing its thing
No 
What I mean is. You go into the editor on Tanoa. Execute the script which collects all trees which fulfill the condition. Then you copy that array to clipboard and paste it into the script file. When you now start your mission . You only have to loop through that array and hide the trees.
I am kinda busy now but I am sure someone else will help
if (_tempad) then
{
}
Can someone explain to me why this produces an error that _tempad is not set? I mean yes it is not set, but tbh it should just check if it exist and run some code. If it doesn't then skip it. tried also the !(isNil _tempad) approach .
Or is there a better way of doing this? _tempad is an object btw
isNil "_tempad"
@hollow lantern
uh also you cant boolean-test an object.
what do you wanna test for?
_tempad is a local variable. so if it wasnt set, it will always be nil. it also does not autoupdate, if you set it at a later point.
isNil is the way to check if its existing.
I think I know the answer, but I want to ask anyway.
_lightsource = "#lightpoint" createVehicleLocal _pos;
can the lightsource by made with regular createVehicle on MP? or do I have to send the command to each machine?
createVehicleLocal π
yeah its local. also, lights are kinda dumb in arma. arma has a max amount of lightsources, so if you create more, they might not show, or extinguish old ones. noticable in illuminated cities.
just remoteExec the code
i'll just make some eventhandlers
the code spawns models + units, it's just a lack of fore thought on my end
so half has to be run on server, half on client's machines
well the lights need to be on client's machines
thats fine, remoteExec does the job well for a central script running on local machines
How would I get the doors to open on a helicopter? I've got a RHS UH-60M and I've got the list of all animations using animationnames and I've found the one for the back doors. But when I run
blkh_1 animate ["left_back_door", 1, true];
``` nothing happens. I've checked it's the right animation by using the interaction to open the door and checking it's animation phase.
try animateSource (get the animation sources from config; those with source = 'user' can be modified by you)
Hi all, looking for some help with a script that would cause damage to players if they are not wearing gas masks in a certain area; anyone done that before? thanks!
i have partly
I'm not familiar with the config viewer. Roughly where in there should I be looking?
i checked inside the radius of an area marker, and then applied ace scratch damage + coughing sound if the player wasnt using one of the defined gasmasks
Use a server only trigger; put this in it:
[thisTrigger] spawn {
params ["_trigger"];
waitUntil {
sleep 1;
{
if (goggles _x != "face_mask") then {
_x setDamage (getDammage _x + 0.025);
};
} forEach list _trigger;
!triggeractivated _trigger
}
};
not sure if it should be goggle or headgear
@little raptor I've got the config viewer open, where would I find the animation source roughly?
on the left hand side
under the vehicle class
the easies way to get there is to spawn a new vehicle in eden , right click on it and select find in config
Yeah, I've got that open, I'm not sure where in that animation source would be
https://imgur.com/a/WDalpoc
I don't see it.
you need to expand the tree
expand RHS_UH60m_d
Plus button on the far left, yeah?
no double click it
Ok, I've got animation sources expanded now.
nvm
just use this
see which one works
{
blkh_1 animateSource [configName _x, 1];
} forEach ("true" configClasses (configOf blkh_1 >> "animationSources"));
@cerulean cloak
if any of them work, put a sleep in there to see which one it was
I ran that and nothing happened to the back doors.
what about this:
{
blkh_1 animate [_x, 1];
} forEach animationNames blkh_1;
?
Also nothing.
thanks , will test tomorrow. How do I limit it to just one location (i.e. a building)?
The front doors are disappearing though so it's definitely running.
limit the trigger area 
got it
did you try the "inverse" (0)
did you try both?
Both the thing for anim sources and anim names were tried with 1 & 0.
Are you sure it can be opened?
Yes, because when you get in it opens the door for you and when inside it you can use an action to open the door.
Then probably it's not accessible for scripting 
try the actions too, if it doesn't work then idk:
https://community.bistudio.com/wiki/Arma_3:_Actions
oh wait there's none for opening doors 
I'll look in the config viewer for actions or something.
Ok, so I've opened the config viewer and for the open door action it animates both dorLB and doorhandler_l
I'll try animating both from the debug console and hope that works
don't animate, animateSource?
blkh_1 animatedoor ["DoorLB", 1, true];
blkh_1 animate ["DoorHandler_L", 1, true];
That ended up doing the job.
How do I make GUI display Image1 whenever player clicks on Document1 and Image2 whenever plays clicks on Document2? I already got the list working out
I'm trying to make a trigger activation add an eventhanlder to the player that added it
I'm getting a generic expression error. _thisList didn't seem to do anything. Any clues?
Putting this addEventHandler [... in the player init works just fine. I just need it added later in the mission
Anyone have any clue why my code isnβt working? pastebin.com/wukCvkUm
I think it has something to do with updating the value of the variables from the addAction
I noticed that the other offroad textures are not available for the offroad hmg. I wanted to know what the textures might be called or if it's possible to change the texture using something like this, this setObjectTexture [0,"0"]; or something like that?
Yes you can use that to change their texture, it will be a string path to the texture
IS there a way to make a group action? Like eject form a vehicel.
I have a squad of 8 AI,with 8 squads in total so a whole mech platoon. all 43 AI have individual names, two letters and digits so it goes SQ1_1 and so forth. I created "groups SQ_1 = group this;" put that in the init field of each soilder. I want them a leave a airplane on the runway fast. So I have created said waypoints and triggers. I know I can do it individual for each soldier with this "SO1_1 action ["EJECT",tp1];SO1_1 leaveVehicle tp1; (tp1 is the airplane) and prevent them from re entering said airplane. But its tideus for 40 or even more soilders to do it. I would need a group action, like with SQ_1action ["EJECT",tp1] but here is the trick. No SQF scripts.I know ther eis plenty para drop scripts i could use and take inspiration from. But they are external scripts. My goal is to do it all in the editor with triggers and init fields. NO external scripts. has any one a idea or a hint?
I'm not sure where the civilian textures are located, but I think that there may already be a offroad hmg with civilian textures. My friend remembers using one and so do I. We both specifically remember getting the offroad from the FIA - Cars tab in zeus. Though now looking at the same tab, it appears to be broken. There is three of each of the same vehicle listed and all of them are the same, without civilian textures.
Hello. I would like to ask you for help. Is there a way how to change type of the playableUnit controled by AI when game is in progress. Thank You
Example:
In editor is placed playableUnit CSAT soldier "O_Soldier_F"
After mission starts, I want to change the playableUnit (AI) to be AAF soldier "I_Soldier_F" with correct uniform, face and voice (language). And remain AAF soldier after respawn as well.
Why:
I would like to make FACTION (side) selection in the lobby for MP scenario.
https://steamcommunity.com/workshop/filedetails/?id=1239940319
.
I know how to do it hard way.
Change side by : createGroup and then joinSilent
change loadout by: _unit setUnitLoadout "I_soldier_F";
change identity by: setIdentity
But after respawn ,the unit is again CSAT soldier.
There should be a better solution. for example change parameters of the unit defined in the mission.sqm???
pretty sure there is no other solution
you will have to apply all that stuff on respawn again
Thank you
You use the onRespawn EH and change the side again.
Thanks @cosmic lichen that's how I do it. I thought there is some more elegant and simple solution I don't know about. π
Is there a way to make an interior pitch black (ie. a tunnel) whilst it is day outside?
I suppose you are referring to a CT_LISTBOX control? then with the user interface eventhandler "onLBSelChanged"
setDate π¬
or post-process effects
thisList is an array of objects that match the trigger's activation. so
(thisList select 0) addEventhandler ["Fired", {_this execVM "Camera.sqf"}];
``` could work
Thanks. I actually just came back to this earlier and used a _x forEach thisList
yeah that is also possible and will take into consideration other units that activated the trigger
your last condition will never execute because the variables will only be updated when the player activates the addaction. so basically your script says this:
if(isServer) then {
westReady = 0;
eastReady = 1;
//weather
sunnyMidday = 0;
afternoon = 0;
rainy = 0;
dusk = 0;
dawn = 0;
night = 0;
if(playerSide == west) then {
player addAction ["<t color='#ff0000'>Ready Up</t>", {
//--- Executed later
}];
};
if(playerSide == east) then {
player addAction ["<t color='#ff0000'>Ready Up</t>", {
//--- Executed later
}];
};
if((westReady > 0) && (eastReady > 0)) then { // will always be false
titleText ["<t color='#ff0000' size='3'>Vote for Setting</t><br/>____________________________", "PLAIN", -1, true, true];
titleFadeOut 3;
player addAction ["Sunny Midday", {sunnyMidday = sunnyMidday + 1;}];
player addAction ["Afternoon", {afternoon = afternoon + 1;}];
player addAction ["Rainstorm", {rainy = rainy + 1;}];
player addAction ["Dusk", {dusk = dusk + 1;}];
player addAction ["Dawn", {dawn = dawn + 1;}];
player addAction ["Nightime", {night = night + 1;}];
};
};
u will need to use publicvariable "var" to change tha value on server
the addaction exec is local, so that values will change on the players, publicvariable updates the value
not sure if that is really applicable in this case since the adddactions will only be available to the player that is hosting the server anyway
{(_this select 0) this say3D ["YourSoundHere", 100, 1, false, 0];sleep 230;}; is not working on an object. no script error, everything in the mission root and description.ext is correct
But that makes everything dark. What I'm trying to achieve is light outside, dark inside.
Yes, but that's an engine limitation you cannot go around
you could use setApertureNew with entrance detection
(_this select 0) this doesn't work.
Yeah I figured it out, but thanks
Thanks. I guess there's no way to limit the effect to an area then.
Is it possible to change the value of ace_medical_AIDamageThreshold 'on the fly'? As in, I have a mission with multiple enemy factions and based on which enemy faction is selected at mission start I want to change the value of that variable
No you can't; although the threshold is based on (final) damage, so after armor values are calculated. So if you want faction A be stronger than faction B, simply give them better gear with higher armor values.
Or you could try to hook into the damage event handler (is different for ACE), and modify the given damage when an unit is of a specific faction.
The current problem is that we have factions without armor and factions with level 3 armor and although we want there to be a noticeable difference, the difference is a bit too much to our liking at the moment. But i'll have a look at hooking into the damage event handler
I would be interested in altering the ACE damage handler to have minimum final damage applied
Is the following function type local or global? It's not mentioned on the wiki.
BIS_fnc_addVirtualXCargo
param for global effect
Thanks!
1 global var is okay if you just want to alter general threshold of course but handling the armor specifically with some modifiers or applying min damage/ max damage resistance would be nice
terrible armor configs + armor damage handling = some enemies incredibly easy to kill some impossible
I have an interesting scenario... Q: given, [_pos, _radius] ... is there a way to determine whether that spot is "over land"? i.e. I want to reject when it is entirely over a body of water, let's say.
you can check surfaceIsWater every 10cm or so
hmm, actually maybe https://community.bistudio.com/wiki/nearRoads or one of the other "near" bits might do the trick for what I am after
of course I could lay down a grid as such and ask if any of those positions are over water... but it's a bit much for the question being asked I think...
it's been awhile since I've worked with scripting so I'm a bit rusty, but I'm trying to improve a script I was working on, I'm trying to figure out how to name markers that get created on map clicks but don't want to have a limit (like having 3 or so pooled for use) my original thought was to have a variable count up each time they click and append that to the name with toString or something, anyone have anything helpful?
there's also selectBestPlaces command
use an array
Can someone inform me on why that part of the code will always be false? Itβs still not working even with the public variables
Thank you. Got it up working, except that I don't know how to make a command for displaying a imagne in the picturebox in GUI
hi i have a question: i'm trying to fetch allMapMarkers from the server with a mission containing only user defined markers and i noticed that the list of markers retuned by allMapMarkers is local on the client that created the marker does someone knows a command to retrieve the whole marker list from the server?
You can use a "promise" (kinda similar to C++ thing)
can you give me a brief example
Something like this:
[{
[allMapMarkers, {
serverMapMarkers = _this;
}] remoteExec ["call", remoteExecutedOwner]; //send back data
}] remoteExec ["call", 2]; //remote exec on the server
@little raptor that makes sense, thanks!
ohh i know what you mean i was using something similar to test things [[],{ [allMapMarkers,{hint str(_this)}] remoteExec ["call",remoteExecutedOwner] }] remoteExec ["call",2]; thanks for the suggestion, time to rewrite everything π₯²
If you shorten your script, it will be
if(isServer) then {
westReady = 0;
eastReady = 1;
if((westReady > 0) && (eastReady > 0)) then { // will always be false
};
};
you just set westReady to 0, so it cannot possibly be bigger than 0
Am I not increasing the value of westReady in the addAction?
no
you do that some time later
but not between setting westReady to zero, and checking if westReady is bigger than zero
I'm confused. Can you give me an example?
already posted that above?
on how to update the value (+1) of westReady so that section of code isn't false
with your code not possible
what you do:
Set to 0
Check if bigger than zero
Player will use action to set to bigger than zero
in this order
you need to check after its bigger than zero
maybe it makes sense to do that check in your action
Also that complete code is nonsense anyway
because you check "isServer", unless you are local hosting, which most people will not be, player will not be valid, and you also can't add actions on a server, the server has no UI
I'm trying to make a voting system that will check if a certain amount of players are marked as "ready" and then allow them to vote for the type of weather. You think you could point me in the right direction?
remoteExec, while/waitUntil loop, spawn
Ok. Thanks!
Apologies for interrupting, but is it no longer possible to use non-mission script files with file patching enabled? I have it enabled in my parameters but any scripts I try to execute (that worked before) simply return the script not found error.
Normally I have script files in this directory: C:\Users\Rylan\Documents\Arma 3 - Other Profiles\Rylan\scripts and can execute them from the debug menu in game in any mission. But I can't seem to do that at the moment
@still forum could we get a command to "assign" a final method? Like... Not having to Str the method first
How do I display a custom image in GUI display box? I got the button to show and all, but I don't know how to show the image.
if the "picture box" is a CT_STATIC with
style = 48; // ST_PICTURE
``` then you can use
```sqf
_ctrlPicture ctrlSetText "path\to\texture\image.paa";
How do I check if it CT_STATIC? I just learned to use GUI and used the GUI editor in-game. the "box" is class RSCPicture
unlikely for now
Meh
your control should inherit from RscPicture:
//--- Inside of your dialog (inside of class Controls ...)
class MyImage: RscPicture
{ ...
``` the base class RscPicture contains all the necessary attributes to make it display an image.
Oh. Yeah. found it. it says style = 48. I cant get it to work. It does not show my picture
And why?! π
Because.. fnc = compilefinal "Code" horrible, parsing wise, is π
And fnc = asFinal {...} much cleaner
oh so you mean make the code final (instead of compiling string and finalizing it)
yeah that makes sense
hey guys, trying to get removeaction to work over remoteexec. found this on a forum but doesn't seem to be working.
[_unit,_index] remoteExec [ "removeaction", 0, true ]
not sure what im troubleshooting since i couldnt find better documentation on this combo. just want to make sure the structure looks correct before i dive deeper.
nevermind, i see in the doc now that it recommends creating a function that does this client side thats executed from the server (not using commands)
will make that issue irrelevant
is there a simple way to only open the map for someone who uses a radio call? I've googled it and most I can find is using communication menu thing but I'm not quite to the level of doing that I think
to clarify I'm trying to make it so the map doesn't open for other players in an MP setting
what's a radio call?!
@little raptor the simple trigger thing, select radio alpha/bravo/charlie etc.
yeah
it's not too big an issue but it would be nice if I could keep it just to the person calling it, like I said I think communication menu makes it doable but right now I'm just scripting in triggers on the map rather than actual scripts in the mission file and such so I'm not too familiar with making classes and all that
that's the issue
if you use eden triggers they will be global
yeah, I figured it wouldn't hurt to ask, I'll just put it in my todo list, thanks for the help!
whats an efficient way to let a choppper land smoothly?
I'm currently using a move waypoint to let the chopper fly to the position. About 500m before the destination I delete the waypoint and then use a _aircraft LAND "GET OUT"; to make him land and eject troops.
Issue here is that the chopper then goes from height 28 to height 70 before actually touching down instead of just descending right away to the helipad.
especially under enemy presence that certainly makes the chopper a easy target because he suddently is now above all houses and anyone can spot him. No big deal for the chopper pilot as he has been given the proper care of sqf { _x disableAI "AUTOCOMBAT"; _x disableAI "AUTOTARGET"; _x disableAI "TARGET"; _x disableAI "CHECKVISIBLE"; } forEach [driver _aircraft];
but still the landing is weird. I already tried to play around with flyInHeight but this depending on the height makes the chopper dead slow
He goes up because he tries to decelerate but does it to fast (standard pilot error).
You could try having him fly slower by giving limitSpeed at waypoints before.
https://i.imgur.com/xtM6jIB.png that's how he does it basically
got some code to show?
I will try that with the limitSpeed. Maybe it works, but as described in my drawing he alread has slowed down and then still goes up again despite just land lol
Sometimes ai is dumb and just cant be helped
wouldn't be Arma if it where no issue
@still forum In the code from earlier I still can't get the
if((westReady > 0) && (eastReady > 0)) then { };
to work even when westReady and eastReady = 1.
Explain your problem
"even when westReady and eastReady = 1." how did you check that?
because they're not
you must increase the values on the server
it seems like that was what you were doing (if isServer then {...})
no publicVariable is necessary
just remoteExec
[{
westReady = westReady + 1;
call some_fnc_checkready;
}] remoteExec ["call", 2];
fnc_checkready:
if (westReady > 0 && eastReady > 0) then {
...
};
or even better
[1] remoteExec ["some_fnc_checkready", 2]; //1 for west, anything else for east
fnc_checkready:
params ["_sideID"];
if (_sideID == 1) then {
westReady = westReady + 1;
} else {
eastReady = eastReady + 1;
};
if (westReady > 0 && eastReady > 0) then {
...
};
p.s: are you sure that those values are initialized?
I ran a hint displaying the value of the variable but the if statement still wouldnβt run
the if statement only runs once
you know that?
thats what I was trying to tell you
@hushed tendon
the if statement only runs once
which is why I used that function. I had a hunch you were doing that
all code only runs once, when you start the script. you have to specifically tell it to run multiple times, using loops or recursion
loops are bad
use "event handlers"
as in my code
you only call the code when the values actually change
eventhandlers are like flares the game shoots up whenever it does something special, so you code knows immediatly its happening. way faster and more performance friendly than contanstly checking
Okay
@spark turret I did the following now:
waitUntil {(_aircraft distance _destination) < 800};
_aircraft limitSpeed 50;```
works so far and the chopper slowed down pretty nicely. Still at about 50 clicks from the helipad (_destination) the chopper suddently skyrocketed in the air. Video of that: https://dl-cdn.knight-industries.org/2021-03-06_03-06-32.mp4
maybe I need to slow him down even more?!
I don't see what the issue was. I mean this looked good to me are you talking about the portion where it rose in altitude a little higher to make sure it it landed properly?
Like when it basically pulled a vertical in the air? Cause your code here looks fine you could try limiting speed lower and play around with that. Though I don't have much experience with SQM I believe this is, correct me if I am wrong though.
exactly, it veticaled in the air
unnecassery in my opinion
because with the current altitude the chopper had he would have to turn his stick just forward to get over the helipad and then just descend
Yea it almost looked like it didn't wanna come in too hot, so purposely rose in the air for some odd reason LOL. I agree with that.
Or he could have slowed down even further.
I mean he did from 50 to 12 km/h but in a weird way
right. I am sorry I can't offer you as great as advice as other scripters here as I haven't scripted in arma before. Though I believe you could maybe try to see if you can have him stay his current altitude till he reaches above the airpad.
I mean I could also say flyInHeight and set that to a lower value. we'll see
Ye I would play around with that, and maybe tweak your speed. Cause what you have there with that function or wait until IF statement seems to logically work fine.
yeah it works, just hate doing so much static stuff instead of having a dynamic AI work they way I would like :D
Yup I feel you.
I mean I create games occasionally on the side and when the ai fails to do things annoys me.
any way to check if a player has a certain peice of clothing equipped say like the blootooth headset for the face slot
is there an event for detecting when player changes weapon? im not seeing one in the EH list. Do we have to hijack animation changed or something?
@spark turret @vague nebula okay so I played around with both flyInHeight and limitSpeed aka:
waitUntil {(_aircraft distance _destination) < 800};
_aircraft limitSpeed 50;
_aircraft flyInHeight 50;
waitUntil {(_aircraft distance _destination) < 500};
_aircraft limitSpeed 10;
_aircraft flyInHeight 30;
```
outcome is, that at the end the chopper still ignores the limits I have set and well , makes a vertical climb to 200ft (about 70 meters) until he descends again and lands.
Arma is weird sometimes :(
I think its a safety thing to prevent from like crashing LOL
I know it may look awkward but I would just leave it and call it the ai pathfinding trying to be safe
technically no, according to the wiki of flyInHeight --> Avoid too low altitudes, as helicopters and planes won't evade trees and obstacles on the ground. The default flying altitude is 100 meters.
ah
@hollow lantern are you giving the helo sufficient time to slow down using these commands because i have succesful used these to commmands on waypoints to have a helo perform a stealth insertion
just slap them commands in a waypoint
@tough abyss well can you give an example how spaced out your waypoints are? As from my code above I limit his speed to 50 when the chopper is 800m away from the target. If he is 500m away he gets limited to 10
honestly it should work when i did this using these commands in a waypoints it worked the problem is you are asking the ai to go from top speed to 50 the instant it hits 800 meters gradually slow it down over a longer distance distance
what airframe are yyou using ghost hawk
MH-6 Littlebird which tops at 120km/h
so make it slow to 100 at 1.5km, 100 at 1km, 80 at 800m, 60 at 650m, 50 at 500m 30 at 250m, 20 at 100m, 10 at 50m and ensure the flight path is actualy clear at the altatude you want to fly at or the ai will path find over obsticals or chrash
it dosnt matter how much you throtal down even a player cant go from 120 to 50 instantly without balloning into the sky
will try that later, thanks
are you trying to make this dynamic as in it will do this any where or is the aircraft on a strict flight path
dynamic is the goal
and aside from the flight path everything so far works
just the vertical sky-rocketing was my last issue
lol
yeah you got to gradualy slow em down the way you have it atm is at 800m eters i want you to go from 120 to 50
you try doing that in a chopper without gaining height
how do a add a minimum distance for the addaction command ive forgoton and the video i used to figure it out i cant find anymore
read the command description on the wiki
Hello, is possibe to somehow enable sound with say3D from hc to players?
(i attached sound to object, but when players near - they don't hear sound, it seems like local)
you probably want https://community.bistudio.com/wiki/playSound3D
Is there a way to limit the vehicle garage to certain vehicles?
Ok so im trying to use allTurrets instead of a custom script to get veh positions before the veh spawns in on the map. is this possible? I would also like to use fullcrew as well. anyone have any tricks to do this? I also have questions about allTurrets speed 0.0017 ms
vs BIS_fnc_allTurrets 0.0421 ms
why is BIS_fnc_allTurrets so much slower?
bis_fnc_allturrets uses a vehicle class, so if you want checking before the spawn, you need to use it. allTurrets command only works on objects. So you need to spawn it.
kk
im using a custom script right now that checks veh class its running at 0.0146 ms it is using compileFinal preprocessFileLineNumbers is that why it is faster then the BIS function? would the bis fuction be faster if it did the same thing to it?
look into the code and look out for differences.
how do I see the bis function code?
function viewer in the editor
kk thx
Hello people, any tips on how to add a sub-array into an existing array?
_array1 = [0,1,2];
_array2 = [a,b,c];
???
_desired_array = [0,1,2,[a,b,c]];
_array1 pushback _array2; //_array1: [0,1,2,[a,b,c]]
_array1 set [4, _array2]; // _array1 : [0,1,2,[a,b,c]]
_array1 append [_array2]; // _array1 : [0,1,2,[a,b,c]]
_desired_array = _array1 + [_array2]; // _desired_array: [0,1,2,[a,b,c]]
to learn more about the differences check out the wiki: https://community.bistudio.com/wiki/Array
See Its interesting cause to me in c++ adding an array to an array would probably make it a multi dimensional array LOL. Though I wouldn't be sure what the out come of pushing another array into an already existing array would be.
So I'm trying to make it so a red smoke/chemlight gets spawned when a unit becomes incapacitated, I figured that would be easy with event handlers but I can't find one for vanilla and attempts with ACE EH's don't seem to work any ideas?
You could use dammaged EH or handleDamage EH and inside it check if unit is incapacitated https://community.bistudio.com/wiki/lifeState
Then spawn the item
thanks for the response! I was thinking about doing that, looks like I might have to, framerate probably won't like it too much π but it's only going on playable units so it can't be too bad
EHs are no problem
I ran this with the remoteExec in the player addAction with a hint in the fnc but the hint never showed up. The code is (the fnc_checkReady)
[missionNamespace, "fnc_checkReady", { hint "The event handler runs";
params ["_sideID"];
if (_sideID == 1) then {
westReady = westReady + 1;
} else {
eastReady = eastReady + 1;
};
if (westReady > 0 && eastReady > 0) then {
hint "It Works!";
};
}] call BIS_fnc_addScriptedEventHandler;```
First of all I didn't literally mean make an event handler. (hence the quotes)
Second of all if you're going to use that you have to call BIS_fnc_addScriptedEventHandler via remote exec.
I'm hoping someone can help me solve this problem. I want to have a switch do block for performance reasons, but I want to have a condition to check for a patch class to use more cases inside the block. example:
switch (true) do {
default {true};
/*if (isClass "A3_Data_F_Exp") then {
#include "..\include\canPlayerKickDoor_Apex.sqf"
};
if (isClass "A3_Data_F_Contact") then {
#include "..\include\canPlayerKickDoor_Contact.sqf"
};*/
case (_building isKindOf "Land_i_Barracks_V1_F"): {
the sqf's just contain more cases
can I accomplish this while still using a switch do block?
@agile pumice use hashmaps
do you execute some code or does it simply return true false?
like this default {true};
it just returns true false
so for some cases true for some false?
there isn't a case that returns true. false is the default return above the switch do block
then just use hashmaps or arrays
I've never used hashmaps before so this will be a joy to figure out
wait
since you use isKindOf hashmaps are not suitable
just use array
and findIf
["Land_i_Barracks_V1_F", "Land_blabla_F"] findIf {_building isKindOf _x} == -1
that's it
@agile pumice if you meant to use EXACT matches (not derived objects) then use hashmaps (with get) or arrays (with find)
nah, I wanted to check against a parent class to save time making a case block for every child building variant
then use the code above
So I'd be eliminating the switch block right?
and then pushback the array if a patch class is valid? that's brillant
yes. that's your "switch block" now
So instead of the "event handler" would I spawn a section of code with the remoteExec? And I don't I know how to remoteExec the BIS_fnc_addScriptedEventHandler. Sorry for my lack of knowledge on this
Make a function:
https://community.bistudio.com/wiki/Arma_3:_Functions_Library#Adding_a_Function
this creates Some_fnc_checkReady:
class CfgFunctions
{
class Some
{
class someCategory
{
file = "path\to\folder\fn_checkReady.sqf";
class checkReady {};
};
};
};
Alternatively:
to call that BIS fnc simply use this:
[missionNamespace, "fnc_checkReady", [1]] remoteExec ["BIS_fnc_callScriptedEventHandler", 2];
actually that won't work
missionNamespace is local

[{[missionNamespace, "fnc_checkReady", [1]] call BIS_fnc_callScriptedEventHandler}] remoteExec ["call", 2];
this will work
but you're better off with the function method
it's a config
if you're making a mod it goes in config.cpp
if it's a mission it goes in description.ext
Alright
@cosmic lichen so I did as you suggested, dammage handler with an if statement, I have 2 test subjects with the exact same event handlers in their init, but it never works on the second one, whichever I shoot first spawns the smoke and chemlight, but the second one doesn't, any further advice?
I'm working on a download intel script with an animation loop but I'm finding it difficult to get the animation loop to work along side the hintSilent.
code?
@broken forge ```sqf
see the pinned messages
_maxDistance = 5;
_timePerPercent = 1;
if(laptop getVariable ["inUse", false]) exitWith {hint "Someone is Already Downloading the Files."};
laptop setVariable ["inUse", true, true];
hint format ["The Download Will Start in 3 Seconds. Stay at Least %1 Meters Away From the Laptop", _maxDistance];
sleep 3;
for "_i" from 1 to 100 do {
if (player distance laptop > _maxDistance) exitWith { hint format ["Download Canceled : You are %1 Meters Away From the Laptop", _maxDistance]; laptop setVariable ["inUse", false, true];};
player switchMove "acts_accessing_computer_in";
sleep _timePerPercent;
hintSilent format ["Download In Progress... %1%2", _i, "%"];
while {_i < 100} do {
player playMove "acts_accessing_computer_loop";
};
player playMove "acts_accessing_computer_out_short";
};
if (player distance laptop < _maxDistance) then {
hint "You Have Successfully Downloaded MLP_s05_1080p_x264";
myGlobalTriggerVar = 1;
player addRating 200;
player setDamage 0;
"Box_East_WpsSpecial_F" createVehicle position player;
};
@little raptor this addEventHandler ["Dammaged", {params ["_unit"]; status = lifeState _unit;
if(status == "INCAPACITATED")
then {
"ModuleSmokeRed_F" createUnit [getPosATL _unit, modulegroup,"this setVariable ['BIS_fnc_initModules_disableAutoActivation', false,true];"];
"ModuleChemlightRed_F" createUnit [getPosATL _unit, modulegroup,"this setVariable ['BIS_fnc_initModules_disableAutoActivation', false,true];"]
};
}];
making the status variable for lifestate was me troubleshooting, not sure it's necessary
Remove the while.
_maxDistance = 5;
_timePerPercent = 1;
if(laptop getVariable ["inUse", false]) exitWith {hint "Someone is Already Downloading the Files."};
laptop setVariable ["inUse", true, true];
hint format ["The Download Will Start in 3 Seconds. Stay at Least %1 Meters Away From the Laptop", _maxDistance];
sleep 3;
player switchMove "acts_accessing_computer_in";
player playMoveNow "acts_accessing_computer_loop";
for "_i" from 1 to 100 do {
if (player distance laptop > _maxDistance) exitWith {
hint format ["Download Canceled : You are %1 Meters Away From the Laptop", _maxDistance];
laptop setVariable ["inUse", false, true];
};
sleep _timePerPercent;
hintSilent format ["Download In Progress... %1%2", _i, "%"];
};
player playMoveNow "acts_accessing_computer_out_short";
if (player distance laptop < _maxDistance) then {
hint "You Have Successfully Downloaded MLP_s05_1080p_x264";
myGlobalTriggerVar = 1;
player addRating 200;
player setDamage 0;
"Box_East_WpsSpecial_F" createVehicle position player;
};
(also changed the code flow)
@little raptor Thank you so much, I've been working on this for a few hours now, lol
status should be a local var, not global (_status), but this is not your issue. just a suggestion
Are you sure it's not because of that lifeState condition?
I'll change that and see, I'm still getting used to the scope in SQF and scripting in general
@little raptor Will this script work as intended in mp?
So what is SQF or SQM a subset of exactly? Is like SQL scripting?
Or is it arma's own scripting language?
its own language
Oh interesting. So its a language they came up with that's awesome. Ye I was just interested cause I am a coder in general so I wanted to know what SQF was. I assume its object oriented language as well?
Ah. I see interesting.
Which one of these do just take into account the coordinates of the player/objective? https://community.bistudio.com/wiki/Position#PositionASLW
@little raptor By an addAction in the init field of the laptop, I'm also trying to get the weapon to be put on back so I'm not holding it when in the animation
And then set an other objective relative to it?
then no
the addAction must be called from initPlayerLocal.sqf
@broken forge When you put something in init, it gets executed for everyone every time someone connects to the server, so people get duplicate addActions
not sure what you mean
I intend to offset an object in regards to an other object without taking into account which way the first object is facing.
@little raptor initPlayerLocal.sqf: sqf laptop addAction ["Download Intel", {[] execVM "scripts\downloadIntel.sqf"}, nil, 2, true, true, "", "!(_target getVariable['inUse', false])"];
Then use any position format except getPos/setPos
setPosASL and getPosASL recommended
to offset simply use vectorAdd
yeah that's fine
you can put the laptop setVariable ["inUse", false, true]; outside the for loop (after it ends)
if you intend to reuse the laptop
Hey everyone, I've made a mission that uses a radiation script, that mainly adds radioactive geiger counter sounds. However whenever I move the files into the .pbo it makes it so that after choosing a role on the dedicated server it loads infinitely. I've already found a error in the code with some help, but didn't seem to fix it. DM me for more information. All the help is appreciated!
you can paste your script on sqfbin.com or pastebin and put the link here
Ok I will thank you.
@little raptor The laptop is a one and done, the next thing I like to add to the script is a way to hide the weapon when a player is in the animation loop. As of right now when the player is in the animation loop they're holding on to their gun, which throws off the realism
remove it before the for loop, and readd it after π
Oh, ok, that sounds easy, lol
Thanks, seems to work
@little raptor this addEventHandler ["Dammaged", {params ["_unit"];
if(lifeState _unit == "INCAPACITATED")
then {
_smoke = "ModuleSmokeRed_F" createUnit [getPosATL _unit, modulegroup,"this setVariable ['BIS_fnc_initModules_disableAutoActivation', false,true];"];
_light = "ModuleChemlightRed_F" createUnit [getPosATL _unit, modulegroup,"this setVariable ['BIS_fnc_initModules_disableAutoActivation', false,true];"]
};
}];
@little raptor sorry, I'm not sure how but I'll figure it out
@little raptor I just realized that not every player is going to have the same weapon, how do I work around this?
get the weapon + its attachments and mags
then add it
tried to make it more specifically local but it's doing the same thing, my next step is to put a hint or systemChat in to make sure it's executing but I have to run out real quick, thank you for all the help!
Oh ye that's true you could have a function that gets player weapons and possibly assign it to an array if thats a thing in SQF. though that maybe an issue since the array would get large.
not much of a problem
I'm regularly using arrays with thousands of elements 
Oh fair enough. So are you popping the elements and saving them locally to a function var? also an array of addresses to the weapons could work too.
not sure what you mean by "popping". I hope you don't mean remove
(as in popping in call stack)
addresses to the weapons
not a thing (if you mean memory addresses)
Popping I mean by removing an element from the array. and by Array of addresses. Like basically memory adresses of those weapons that you get via the function.
@little raptor ```sqf
_maxDistance = 5;
_timePerPercent = 1;
if(laptop getVariable ["inUse", false]) exitWith {hint "Someone is Already Downloading the Files."};
laptop setVariable ["inUse", true, true];
primaryWeapon player;
primaryWeaponItems player;
player weaponAccessories primaryWeapon player;
secondaryWeapon player;
secondaryWeaponItems player;
player weaponAccessories secondaryWeapon player;
handgunWeapon player;
handGunItems player;
player weaponAccessories handGunWeapon player;
hint format ["The Download Will Start in 3 Seconds. Stay at Least %1 Meters Away From the Laptop", _maxDistance];
sleep 3;
player switchMove "acts_accessing_computer_in";
player playMoveNow "acts_accessing_computer_loop";
for "_i" from 1 to 100 do {
if (player distance laptop > _maxDistance) exitWith {
hint format ["Download Canceled: You are %1 Meters Away From the Laptop", _maxDistance];
laptop setVariable ["inUse", false, true];
};
sleep _timePerPercent;
hintSilent format ["Download In Progress... %1%2", _i, "%"];
};
player playMoveNow "acts_accessing_computer_out_short";
if (player distance laptop < _maxDistance) then {
hint "You Have Successfully Downloaded MLP_s05_1080p_x264";
};
Hey everyone, I've made a mission that uses a radiation script, that mainly adds radioactive geiger counter sounds. However whenever I move the files into the .pbo it makes it so that after choosing a role on the dedicated server it loads infinitely. I've already found a error in the code with some help, but didn't seem to fix it. DM me for more information. All the help is appreciated!
decription.ext
https://sqfbin.com/jubiforukulipowodogu
init.sqf
https://sqfbin.com/qozititevumefejerehe
initPlayerLocal.sqf
https://sqfbin.com/jawayecusokidewipiza
** Also has Sound and Img folders** Would you like to see other script folders just lemme know!
no need for popping, and sqf has no access to memory obviously
you didn't save them 
store them in a variable
oh I see haha
So I got it to work by throwing stuff together and this is the product.
https://pastebin.com/J3Lg1sBW
However I get an error in
call BIS_fnc_addScriptedEventHandler]; remoteExec [2];
right before the remoteExec.
@broken forge the easiest way would be to store the whole player loadout.
and remove the weapons from it:
_loutOut = getUnitLoadout player;
_backupLoad = +_loudout;
for "_i" from 0 to 2 do {
_loudout set [_i, []];
};
player setUnitLoadout _loadout;
//for loop here...
player setUnitLoadout _backupLoad;
cuz it's wrong
@hushed tendon the remoteExec was for the voting system
not for the server script
remove that
ok
@hushed tendon i mean this:
call BIS_fnc_addScriptedEventHandler]; remoteExec [2];
remove the remoteExec and [] around the BIS_fnc_addScriptedEventHandler
Yep, it works now with no errors. Thanks!
@tough abyss it's a really bad script. lots of performance issues
@little raptor Really? I want it soo baddly to work.
@little raptor I just want that wonderful radiation sound.
will cause a lot of performance problems on the server
Even if it's written properly?
I haven't seen your entire script so idk
you're using a lot of bad practices
for instance:
execVM "AL_radiation\al_ini_fnc.sqf";
waitUntil {!isNil "glowindark"};
So basically. As long as I get the sound of radiation. Not even like the damage, the glowing or any of the effects. Is there a way.
That's not what I mean
It works fine on singleplayer, hosted locally, but not dedicated.
@little raptor I know, I dont know code, but I cant figure out the basics.
it works "fine" on the surface
@little raptor Should my init.sqf include this: ```sqf
laptop setVariable ["inUse", false, true];
no
@little raptor Well, I know it's not good code, as long as it works i'm fine with that. I just can't seem to get it to work. Do you wanna get into a call?
no
ok XD
@tough abyss this is a simplified (but better) script. It gives you the sound you want:
initPlayerLocal.sqf
_radioActiveObjs = [obj1, obj2, ...];
_geigerPlayTime = 5; //set the sound playTime here
while {alive player} do {
if (_radioActiveObjs findIf {player distance _x < 10} != -1) then {//player is closer than 10m to one
(player getVariable ["geigerSound", [objNull, 0]]) params ["_soundObj", "_endTime"];
if (!alive _soundObj || time > _endTime) then {
deleteVehicle _soundObj;
_soundObj = "#particlesource" createVehicleLocal [0,0,0];
_soundObj attachTo [player, [0,0,0], "head"];
_soundObj say3D ["geiger", 10];
player setVariable ["geigerSound", [_soundObj , time + _geigerPlayTime]];
};
} else {//optional; delete Sound source to stop the sound
deleteVehicle ((player getVariable ["geigerSound", [objNull, 0]]) select 0)
};
sleep 1;
}
of course you could just use the player as sound source and not create/delete anything, which is even faster
you made that my guy. Wow
not tested
so basically, from what i've seen it has a playtime? Shouldn't it play as long as your near an object?
Rest looks pretty sick
oh so it'll just repeat?
yes
awesome my guy. Do you the faulty sound script was perhaps the reason why the loading was infinte?
most likely
Yessssssssssssssss
probably due to the use of sleep during loading screen
don't get your hopes up cuz it's not tested π
Ok, I won't lol π
Where do I go wrong. The vehicle always lands on the ground. It never comes in flying:
_veh = "B_Plane_Fighter_01_F" createVehicle(position player vectorAdd [-2000 ,0,5000]);
_veh flyInHeight 500;
player moveInDriver _veh;
vehicle player engineOn true;
_veh setDir 90;
_veh = nil;
how should it?
I added a position 5000 meter above ground, I've tried the flyinheight function
just remove everything except for your "description.ext" (make a copy of the mission first)
flyInHeight is for the AI
ok thanks
to observe the flight height
@little raptor Yessir
@fresh wyvern use the alternative syntax for createVehicle, set placementspecial to "FLY"
Thanks a lot! It worked π
_veh = createVehicle ["B_Plane_Fighter_01_F", position player vectorAdd [-2000 ,0,5000], [], 0, "FLY"];
player moveInDriver _veh;
vehicle player engineOn true;
_veh setDir 90;
_veh = nil;
@little raptor Thanks for all the help, I've also converted it to a function for a mission I'm working on, and everything is working great. I'm starting to work on another script which uses some of the default game functions by bis
Do I even need the if (isServer) then {} for the script to work on a dedicated server? ```sqf
if (isServer) then {
trg = createTrigger ["EmptyDetector", getMarkerPos "marker_0"];
trg setTriggerArea [300, 300, 0, false];
trg setTriggerActivation ["WEST", "PRESENT", false];
trg setTriggerStatements ["this && !isnil 'alert'", "wp1 = grp4 addWaypoint [getMarkerPos 'marker_0', 0];", ""];
grp0 = [getMarkerPos "marker_0", EAST, (configfile >> "CfgGroups" >> "EAST" >> "OPF_F" >> "Infantry" >> "OIA_InfAssault")] call bis_fnc_spawngroup;
[grp0, position leader grp0, 300] call bis_fnc_taskpatrol;
grp1 = [getMarkerPos "marker_1", EAST, (configfile >> "CfgGroups" >> "EAST" >> "OPF_F" >> "Infantry" >> "OIA_InfSquad")] call bis_fnc_spawngroup;
[grp1, position leader grp1, 300] call bis_fnc_taskpatrol;
grp2 = [getMarkerPos "marker_2", EAST, (configfile >> "CfgGroups" >> "EAST" >> "OPF_F" >> "Infantry" >> "OIA_InfSquad_Weapons")] call bis_fnc_spawngroup;
[grp2, position leader grp2, 300] call bis_fnc_taskpatrol;
grp3 = [getMarkerPos "marker_3", EAST, (configfile >> "CfgGroups" >> "EAST" >> "OPF_F" >> "Infantry" >> "OIA_InfTeam")] call bis_fnc_spawngroup;
[grp3, position leader grp3] call bis_fnc_taskdefend;
grp4 = [getMarkerPos "marker_4", EAST, (configfile >> "CfgGroups" >> "EAST" >> "OPF_F" >> "Mechanized" >> "OIA_MechInf_Support")] call bis_fnc_spawngroup;
[grp4, position leader grp4] call bis_fnc_taskdefend;
alert = false;
{
_x addEventHandler ["firedMan", {
deleteWaypoint [grp4, 1];
[grp4, getMarkerPos "marker_0"] call BIS_fnc_taskAttack;
_x removeEventHandler ["firedMan", _thisEventHander];
alert = true;
}];
} forEach (units grp0 + units grp1 + units grp2 + units grp3 select {side _x isEqualTo EAST});
};
switch for performance reasons? that doesn't make sense to me, switch is not performant.
A switch is just a fancy looking chain of if statements
you need it to make sure the code is executed once (by the server)
But it also depends where you put that
@little raptor it's called from the initServer.sqf: ```sqf
[] call JAS92_fnc_spawnGroupsEast;
do you need to call that many times?
I mean JAS92_fnc_spawnGroupsEast
just once
then why do you make it a function?
FSMs should be better than switch blocks I think
Is there a way to give an addAction to every player and only one side at a time?
wdym one side at a time?
Give the addaction to blufor only
@little raptor I would like to do something in which creates some strong points around a map for missions, and I liked the organization. I would also like to implement an aspect in which if you wait long enough the ai will forget about you, as well as implementing a dead body detection.
Look at the condition section of add action
Since they are local you can do a compare of the players side.
@little raptor added debug messages to the smoke/chemlight spawning then statement and the messages pop up, so it's gotta be something with the spawning of the modules... I saw commands that could force AI to fire weapon or something but would that work if they're unconscious?
Could I use forEach?
then try creating new groups for the modules
force AI to fire weapon
not sure. it probably does work
aren't you adding the action to an object?
to the player (scroll wheel)
then check for player side before giving him the action
something like this?
if(playerSide == west) then {
...
};```
or side player
and that alone will give it to each player of that side?
depends where you're running that
anywhere I should run it specifically?
for addAction initPlayerLocal.sqf
@little raptor got it workin! I was dumb and had a global group for all the modules instead of making one that deletes when empty each time the then statement gets triggered
@little raptor I'm trying to implement a killed EventHandler that causes the AI to forget about the player(s) after some time has pasted and then return to normal to the spawn script: https://sqfbin.com/zesusaheledudorilegu
line 54 will probably only check for the last group if its side EAST.
} forEach (units grp0 + units grp1 + units grp2 + units grp3 select {side _x isEqualTo EAST});
line 7 to 20 would like to become a foreach loop π
also all your checks for the side of the units in a group is unnecessary bc the groups are all side EAST
your variable names are very confusing, enemy this enemy that
uh i have never used apply, but it lookes like a fold-list command. i dont think its meant to be (ab) used as a foreachloop.
instead, try:
_killerBuddies = units (group _killer);
{
_xEnemy = _x;
{
_xEnemy forgetTarget _x;
}foreach _killerBuddies;
} foreach _enemies;
also: maybe its enough to run the forget command for the enemy groups leaders, bc groups have "cloud" knowledge, aka all members share the same knowledge. dont quote me on that tho.
code above is untested
@broken forge
@spark turret I'll give that a try, so what exactly would I replace?
The apply part
Can you not sleep in an event handler? And if not how could you wait?
[] spawn {sleep 1; hint "uwu"};
You can spawn code which allows sleep from the eventhandler
Alright. uwu
So then my script will look like this: ```sqf
{
_x addEventHandler ["firedMan", {
deleteWaypoint [grp4, 1];
[grp4, getMarkerPos "marker_0"] call BIS_fnc_taskAttack;
_x removeEventHandler ["firedMan", _thisEventHander];
alert = true;
}];
_x addEventHandler ["Killed", {
params["_unit", "_killer"];
private _enemies = (units grp0 + units grp1 + units grp2 + units grp3 select {side _x isEqualTo _unit});
_killerBuddies = units (group _killer);
{
_xEnemy = _x;
{
_xEnemy forgetTarget _x;
} foreach _killerBuddies;
} foreach _enemies;
}];
} forEach (units grp0 + units grp1 + units grp2 + units grp3 select {side _x isEqualTo EAST});
Yeah that should work
Btw, if you want the unit to be alerted after they fired, maybe you like the suppressed EH. It fires when a bullet hits close to the unit. Could use that in addition, sometimes the AI cant fire back, like at snipers f.e.e
I spawn the sleep in the event handler separate from the code and it does nothing. Second, I throw the code from the event handler in the spawn and nothing happens from the code.
You dont use the spawned code to sleep inside the EH, but you basically spawn a new branch whicj can be suspended. So you sleep first and in the spawned code do more of the stuff you wanna da
Like, all code that was in the EH beforw; goes into the spawned code brackets
" Second, I throw the code from the event handler in the spawn and nothing happens from the code."
I did that
@spark turret So the reinforcements didn't come in once the ai started firing at me, I'm not sure why
how exactly?
probably a parameter issue. you have to pass over the values from EH to spawn with then [parameters] array
and then parse them into vars.
Here's my latest code: https://sqfbin.com/vahukoperenecutexaka
All the code in the brackets of the event handler was thrown inside the brackets of the spawn after the sleep
oh boy i angered dedmen
yes
because that's what _this is for
have you made sure the EH fires up?
with systemchat or diag_log
I'm not sure how to do that
put
systemchat "hi im a EH and i fired";
in your EH code
uh not sure if i follow. you still have to split it into usable vars, right?
//eh code
{
_this spawn {
params ["_killer","_victim"];
sleep 5;
diag_log ["i spawned with",_this];
};
};
is not the best way?
The Fired EH is working, and the Killed EH is displaying a ```sqf
systemchat "Hello I'm an EH and I Forgot About You";
Well thats good :)
But I'm not sure how the killed EH will work, as in the amount of time it takes for the AI to forget about me. It show's that system chat right away once I take out an AI quietly and none of the other enemies fire at me.
Eventhandlers are instant. The code in them is run at the frame the eventhandler happened
So they probably instantly forgot about you
So let's say I get into a heated battle, I run away for 10 or 15 min, will it show up as them forgetting about me?
I also want to get the script to change the AI behavior from Alert to Normal once they forget about me
No, the forget command is instant. And since the killed EH doesnt fire up when you run away, nothing will happen
Ok, so how would I go about creating an EH or a script that'll cause the AI to forget about me after some time where they're not firing at me or can't find me
The killed eventhandler only runs once, after you kill a unit who has the EH.
Ah okay i get what you want
Well they will forget about you after some time by default. If they cant see you, their knowledge about you drops, and reaches zero after around 2 min (iirc according to biki)
If you want to have code run some time after the eventhandler you need to do this.
It will sleep for 5 seconds and then run code
Ok, so for example after 5 sec of not finding me, the group can set their behavior to Safe and speed to limited
Yeah pretty much
I'm having troubles getting that part of it to work. I'm trying to get the AI that become alerted to reset after 30 seconds, where they're behavior is Safe and their speed is Limited. Here's what I have so far: https://sqfbin.com/xirematasosarijipefu
Nvm. Forgot a ; after the sleep
:D

Waypoints get assinged to groups not to individual units.
I thought it was set to groups, lol, well I guess my question would be, by default the ai forget after some time, once they forget do they go back to the patrol that was generated for them?
They will resume their waypoints yeah.
How would I implement an alarm that goes off once the reinforcements are called and continues until the AI forget about the player(s) and resume their patrols?
Waituntil {
//code that will run on each check
Playsound3d [myalarmsound];
Sleep 30;
//condition to stop
Ai knowsabout player == 0
}
Kinda like that
While loops are also interesting for that
They are essentially the same thing
@spark turret So like this: ```sqf
{
_x addEventHandler ["firedMan", {
deleteWaypoint [grp4, 1];
[grp4, getMarkerPos "marker_0"] call BIS_fnc_taskAttack;
_x removeEventHandler ["firedMan", _thisEventHander];
waitUntil {
playSound3D ["Alarm", getMarkerPos "marker_0"];
sleep 150;
EAST knowsAbout player == 0;
};
alert = true;
systemchat "Hello I'm an EH and I Fired at You";
}];
} forEach (units grp0 + units grp1 + units grp2 + units grp3);
I'm trying to get the alarm to sound until the reinforcements have been eliminated.
The last line of your waitUntil doesn't need the semicolon
Also, it seems like the event handler will happen once for every unit's first shot, I suspect you'll get a lot of sirens playing simultaneously.
Lastly, I don't think you can use waitUntil in an event handler, to my knowledge event handler code runs in an unscheduled environment.
thanks for your suggestions. I currently have added the following: ```sqf
waitUntil {(_aircraft distance _destination) < 1500};
_aircraft limitSpeed 100;
waitUntil {(_aircraft distance _destination) < 1100};
_aircraft limitSpeed 90;
waitUntil {(_aircraft distance _destination) < 900};
_aircraft limitSpeed 80;
waitUntil {(_aircraft distance _destination) < 750};
_aircraft limitSpeed 70;
waitUntil {(_aircraft distance _destination) < 600};
_aircraft limitSpeed 50;
waitUntil {(_aircraft distance _destination) < 500};
_aircraft limitSpeed 40;``` I might need to add more because at the end (I guess around 300-200 meters) the heli still verticals into the sky to get to a velocity of -2 before landing. So I might need to add more slow downs. Probably I also should re-write that code part to not have that much waitUntil and limitSpeed around.
@hollow lantern np glad i could help
@crimson walrus You're correct with the multiple alarms, I'm at a lost to what can be done here.
StartAlarm = {
if (isNil "AlarmHasGoneOff") then {
AlarmHasGoneOff = true;
waitUntil {
playSound3D ["Alarm", getMarkerPos "marker_0"];
sleep 150;
(EAST knowsAbout player) == 0
};
};
};
{
_x addEventHandler ["firedMan", {
deleteWaypoint [grp4, 1];
[grp4, getMarkerPos "marker_0"] call BIS_fnc_taskAttack;
_x removeEventHandler ["firedMan", _thisEventHander];
[] spawn StartAlarm;
}];
} forEach (units grp0 + units grp1 + units grp2 + units grp3);
That's what I'd do
Also fixes the part where you can't use 'sleep' in an unscheduled environment
@crimson walrus Thanks, I'll give that a try, I do have one question though. Does Group 4's waypoint reset everytime the EH is fired?
I've put in what you wrote, but the alarm doesn't sound and the reinforcements do not move in. https://sqfbin.com/revusetiwivimodawoki
Remove line 22: AlarmHasGoneOff = false;
this makes (isNil "AlarmHasGoneOff") false
Still no luck, will this line cause any problems: ```sqf
trg setTriggerStatements ["this && !isnil 'AlarmHasGoneOff'", "wp1 = grp4 addWaypoint [getMarkerPos 'marker_0', 0];", ""];
No reason to have: !isnil 'AlarmHasGoneOff'
I think the trigger wouldn't execute then
I was able to get it working, but the alarm isn't sounding yet, do I need to use the command createSoundSource? Updated Script: https://sqfbin.com/akoqohevotaqisoruhun
Maybe try removing the semicolon at end of last statement in the waitUntil?
Could also be the playSound3D command, try running that independently and see if noise is made
@crimson walrus I was able to get it to work with this: ```sqf
soundAlarm = {
if (isNil "AlarmHasGoneOff") then {
AlarmHasGoneOff = true;
deleteWaypoint [grp4, 1];
wp1 = grp4 addWaypoint [getMarkerPos "marker_0", 0];
[grp4, getMarkerPos "marker_0"] call BIS_fnc_taskAttack;
waitUntil {
_alarm = createSoundSource ["Sound_Alarm", getMarkerPos "marker_0", [], 0];
sleep 150;
(EAST knowsAbout player) == 0;
};
};
};
{
_x addEventHandler ["firedMan", {
_x removeEventHandler ["firedMan", _thisEventHander];
[] spawn soundAlarm;
}];
} forEach (units grp0 + units grp1 + units grp2 + units grp3);
Glad to hear it
position player nearObjects ["O_Survivor_F", 100];
Returns nothing if the Survivor is in a vehicle. Is there a solution to get a return if the Survivor is crew?
Not sure if you can get it to work with nearObjects, but you can always filter the list of units:
units east select {_x distance player < 100 && {_x isKindOf "O_Survivor_F"}};
what's the proper way to use this syntax for random?
waitUntil {(getpos _unit) distance (_lastLocation > (random [20,25,30]))};
3:26:25 Error position: <> (random [20,25,30]))}; if (vehicle _un> 3:26:25 Error >: Type Array, expected Number,Not a Number 3:26:25 File mpmissions\__CUR_MP.Sangin_Distirict_Helmand_Provi
waitUntil {((getpos _unit) distance _lastLocation) > (random [20,25,30])};```Watch your brackets
yepjust noticed
should have been
waitUntil {((getpos _unit) distance _lastLocation) > (random [20,25,30])};
π
throwing this into the absolute blue:
Arma 3 map drawing keybind (+shift?) to allow the lines to stick to roads.
that's all.
Is this a suggestion?
Hi there just a little question.
I was using dayz medics uav script however everytime you use the arsenal it would mess the script up and it'd no longer be on the screen. So I was like the obvious solution is to add a sleep function then execute the script as a quick fix. However everytime it would execute the script it would mess up my zeus interface by teleporting me back to my player but still technically in the zeus interface. It was extremely strange.
How would I avoid this in the future?
Bit of a specific question here:
If I wanted to define an area, with a script, whilst in Zeus mode, which would (preferably) turn the ACE weapon safety permanently on (whilst in area), or remove weapons on entering (normally via TP), how would one do that?
Weapon safety is a weapon firing mode. I think it's simply called "safe"? But you can check that in config.
For turning the weapon safety on, set the player's weapon mode on safe, then add a keyDown event on that client so that when he presses a key to turn it on you could turn it off again.
I'm not in the mood to write you a sample script (if you don't know how). Maybe someone else can help you with that.
InArea for checking if inside a trigger or marker, then removeMagazines or similar to take away ammo
Anyone who know how to combine the createVehicle into the "Fly Black Wasp" script?
if (playerSide isEqualTo blufor) then {
remoteExec [player addAction [
"Fly Black Wasp", {}, nil, 0
]
];
};
_veh = createVehicle ["B_Plane_Fighter_01_F", position player vectorAdd [-2000 ,0,0], [], 0, "FLY"];
_veh setVelocity [-5000, 0, 0];
_veh setFuel 0.15;
player moveInDriver _veh;
vehicle player engineOn true;
_veh setDir 90;
_veh = nil;
Put the script into the {}
I've tried that ..
What is that experimental undocumented remoteExec syntax though? 
it works, but the remoteExec doesn't do anything there
Many thanks, complete newbie to the world of scripting, I'll look into this further π
in fact it should throw an error, because the first element in the array should be a string, not a number
How should any of that code work?
Selecting an action in the scroll wheel menu spawns you in a flying jet.
player addAction ["Fly Black Wasp", {
//Put the create vehicle code here
}];
```That is the answer to your initial question, but that code with `remoteExec` should throw an error because `remoteExec` works differently.
it will throw error expected string got number, action will get added regardless...
seems like taking away the remoteExec made it work.
You don't need _veh = nil; by the way, the _veh variable is destroyed once the script finishes.
ok thanx
help, i am confused. i do this: if (triggerActiveted t) then; true :but then it comes up with an error: condition of presence: Invalid number in expression
dont crosspost
Any way to forcefully turn a player smoothly to face a target, setDir snaps to where i want to look
doWatch doTarget
ok how do you switch from one animation to the next
b1 playMove "Acts_Accessing_Computer_Out_Short"; sleep 1; b1 playmove "Acts_C_in1_briefing"; he wont play the second animation
also he is doing a weird unconsious animation for some reason
ok different question is there a way to stop the untit from teleporting after it finishes this animation "Acts_B_M02_briefing" when the animation ends he teleports back to his starting position
b1 playMove "Acts_Accessing_Computer_Out_Short"; sleep 1; b1 playMoveNow "Acts_C_in1_briefing";```
is it possible to make AI flown vehicles somehow ignore objects that are attached to them? now it seems like attaching anything to a AI helicopter will just make them see it as an obstacle and fly in weird ways
Hey guys, do you know if it's possible to display a special char ingame ?
When i do diag_log format ["%1", toString [8383]]; I have "βΏ" in my logs
But if I do hint format ["%1", toString [8383]]; I just have an empty space
you could try to disable collision between both objects, maybe the AI notices and wont be bothered. very wild guess tho
tried that, didn't seem to help
Disable simulation or simple Object? One of both makes AI ignore it, i think the first one
I already have enable simulation unchecked and simple object checked on the attached objects, but I can try to actually make them all as simple objects instead
now it seems to maybe slightly go towards its waypoint but it still mostly just keeps going up
@spark turret I've made an edit to the download intel script so it can display a progress bar, but now it's not removing and adding my loadout correctly. Here's my script: https://sqfbin.com/tefezivojeyinisuhesa
Line 6 is faulty. Why + _loadout?
so im still new to scripting does this look like it would work
waitUntil {_cnt =< 3;
};
{_x switchMove "animation";} forEach units group;```
would this work? have i messed up my coding anywhere
hmm can i get a hint for 100 jerremy
Also you are setting index 0, 1 and 2 to [] for your loadout. What do you indend to do with that?
yeah im just generalising it with group
Thought so
will change it to whats needed when implemented
@spark turret I'm just trying to remove all current player weapons, and then return them to the player once the download is complete. This way the player isn't holding a weapon while interacting with the laptop
just have them play the acessing computer animation
Ah it should work then. Try sleeping after first removinf the weapons so youbare sure it worked
The weapons are being removed now, but now it's not returning them to me
Im not sure, maybe your backup loadout is not a copy but a reference to the loadout, so it gets modified itself
I keep forgetting how to make copies of arrays in sqf
seriously if i had arma open right now id make you a script where they type on the keyboard
literaly 3 lines of code
well 5 if you wanty it to look nice
@spark turret Well the original script you helped me with yesterday worked, but now I've made some edits to show a progress bar instead of a hint, and took out the ```sqf
for "_i" from 1 to 100 {}
@tough abyss Well I've got the whole animation and progress bar working, but it's the remove all weapons and then return all weapons back to the player that's interacting with the laptop that's not working.
realy what animation are you using
player switchMove "acts_accessing_computer_in";
player playMoveNow "acts_accessing_computer_loop";
player playMoveNow "acts_accessing_computer_out_short";
ah im surprised that animation dosnt make him put the weapon on his back
the salute animation does
even though the preveiwer does not show him puting the weapon on his back
Yep, that's the problem, the first animation puts the weapon on the back I believe, but then the loop animation puts the weapon back into the players hand while they're interacting with the laptop
huh
Okay, I am having an issue and wandering if am doing something wrong or it's bug. I am creating an object, rotating it and then changing the pos. When this code is executed on the server it creates the object, but then doesn't rotate or change pos. But when I run the code on a client it works as expected.
_obj = unit_1;
private _c4 = "DemoCharge_Remote_Ammo_Scripted" createVehicle [0,0,0];
_c4 setVectorDirAndUp [(_obj vectorModelToWorld [-2.85742,8.50781,-2.14834]), (_obj vectorModelToWorld [0.81766,-0.0635719,0.57218])];
_c4 setPosATL (_obj modelToWorld [0,2,2]);
An example of the code I am running. The object is valid on both server and the client. The server and client both return the same values from modelToWorld. So it seems and issue with the server.
Position commands have global effects so it should work
Maybe the code is not executed on the server
I tested with Diag_log
and they were in the server RPT
so it is running on the server
I've had trouble with moving mines in the past, maybe explosives are similar
I have had it with other items aswell
no matter what i did with them on the server, the clients never saw the move
Is this recent?
no, tbh
Hmm
Will test
also.. is the object over land or water?
hmm ok would
};
waitUntil {_cnt =< 3;
};
{_x switchMove "animation";} forEach units group;}```
ok would this work
π¦
@worthy willow sorry to take away from your problem but the code i just posted does it look ok
how would one open .BIN files? Ive tried pbomanager and eliteness but the filestill cant be opened
No you have two while loops doing the sane thing and one doesnt do anything
Just do a waituntil where it first updates your variable and then sleeps 1 second ans then checks the condition.
WaitUntil {
//code that is looped
//update condition
_stop = (alive player);
//check condition
(_stop)
}
//code that runs after the loop finished
thanks for the help brain to tireds to work now will work on it tommorow
any suggestions on making name plates that disappear after a certain distance above NPC's more efficient?
addMissionEventHandler ["Draw3D", {
{
drawIcon3D ["", [0.73,0.24,0.11,1], visiblePosition _x vectorAdd [0,0,4], 0.6, 0.6, 45, "text here", 1, 0.05, "EtelkaMonospacePro"];
} foreach _npcs select {_x distance player < 20})
}];
Anyone off the top of their head knows if deleteVehicle objNull fails silently?
no error messages
Cheers π
Anyone who know to make a spawned in plane fly in a desired manner?
You could try using unit capture if you want to be highly specific on the planes movement
Why not just write it between quotes?
Someone mind taking a look at my code to make sure certain parts run properly?
weatherVoting.sqf
https://pastebin.com/2DhLBKd1
initPlayerLocal.sqf
https://pastebin.com/EHRKpYH0
Trying to make a weather voting system that every player takes part in
initServer.sqf
execVM "weatherVoting.sqf";
global vraiables should always have a TAG_
so like TAG_eastReady?
if(isServer) then {
so that code is serverside only.
titleText is useless then. It will only display the text on the server, but the server has no UI
yes
But the TAG_ is your own 3/4 letter thing, something unique to you
alright
And for setting the weather do I need to do that server side or client side?
[{[missionNamespace, "fnc_checkReady", [1]] call BIS_fnc_callScriptedEventHandler}] remoteExec ["call", 2];
That is overcomplicating it. Instead of calling call with a function. You might aswell just directly call the function
[[missionNamespace, "fnc_checkReady", [1]]] remoteExec ["BIS_fnc_callScriptedEventHandler", 2];
like that I think
Depends on the script command to set weather, i don't know. See what the wiki says
@still forum You know anything about this??
If I knew I would've already replied to you..
Also I don't understand your usage of scripted eventhandlers. Doesn't make sense to me
Me?
yeah
why not just make functions. I mean your eventhandlers are already called fnc_ as if they were functions
I don't have much knowledge so I went with what seemed to work.
Alright
I also tried using functions but I couldn't figure out how to call them. I would get an error no matter what I tried. You have a possible example?
fnc_requestWeather = { [] spawn {...} };
call fnc_requestWeather
remoteExec ["fnc_requestWeather", 2]
Hmm. I used to get an error when I tried call fnc_requestWeather; but then again your function has a spawn so that's probably it
If I call a function for the title text on line 25 in weatherVoting.sqf with the function being located in initPlayerLocal.sqf will that run for every client or still only for the server?
no its not the spawn
calling a function happens locally
if you call a function on the server, it will only run on the server
Hmm. So how could I make the title text show up for every client but still be called in that section of code?
remoteExec
so just keep it as is but run remoteExec on it. Got it
if i have multiple draw3d mission event handlers, are they evaluated synchronously or async?
one after the other
gotcha, ty
@orchid stone The way I optimize my Draw3D events is to calculate the objects outside of the Draw3D. So I use BIS_fnc_loop to calculate the objects every 0.5 seconds so that the demanding stuff is only ran twice a second. The downside to this method is that if you want perfect accuracy with the displaying of info on screen you have to use onEachFrame. But with this method you can run demanding code but also have it display on screen.
@worthy willow thanks man, i was throwing around that idea as well. could just spawn a
while{true}do{GLOBALVAR = player nearentities["Man",20] select {_x in ANOTHERGLOBALVAR}; sleep 1}
will gave that a shot π
Yeah
lol that works great! thanks again @worthy willow
I've recently been having some problems with ai not firing or even moving. Is there any way of disabling all ai squad commands? I'm trying to get ai to stop setting themselves to stance down and their combatmode to green. I just want to be able to set their combat mode and have them not change it, same with stance. I just want their stance to stay as auto.
I just want their stance to stay as auto.
not change it, same with stance. I just want their stance to stay as auto.
Aren't you contradicting yourself?!
or do you mean like auto with no prone?
No, I mean auto. There are four stances "DOWN", "MIDDLE", "UP" and "AUTO".
I want to them to be set to AUTO.
stop setting themselves to stance down
AUTO allows for each unit to think for themselves and set their stance depending on the circumstance.
If the stance is set to prone, even if they are out in the open they will stay in prone no matter what, that's what I don't want.
I don't know any simpler way to put this.
does anyone know if unitcapture has a max length?
The duration which you specify when you use the function
well i used the command, but it just stopped the recording without me stopping it
like I said, it depends on the duration
thats what i have in my trigger
rec = [heli1,180] spawn BIS_fnc_UnitCapture;
@radiant yacht
_duration = _this select 1;
_timeStart = time;
_timeFinal = _timeStart + _duration;
...
while { ((time <= _timeFinal) && (alive _unit) && !(BIS_EndCapture)) } do //< Repeat until till the end or unit died or interruption from BIS_EndCapture
...
oh
that's how the function works
so is the 180 in the command the duration?
what 180?
in here
yes
[unit, duration, FPS, firing, startTime] spawn BIS_fnc_unitCapture
```https://community.bistudio.com/wiki/BIS_fnc_unitCapture
oooh, so to stop it from being laggy i need to make it [heli1,180,60]
and to make it longer [heli1,1800,60]
right?
I'm not sure if it helps much
The code is scheduled (not sure if you know what it means)
To make it less laggy, record in a perfectly clean mission, with as few mods as possible, and make sure your FPS is high
oh no i don't mean the mission is laggy
i mean that the movement when i play it back is jittery
again, that's what I meant
For higher recording fps you need high mission fps while recording
Thats why you do it in a clean environment
twas altis with nothing around, about 120fps while doing the recording
Having other scripts in the scheduler can "slow down" the recording.
Read this:
https://community.bistudio.com/wiki/Scheduler
they may be executed by other mods
danke sir
@radiant yacht but yes setting the FPS higher can help
The script records at 20FPS by default
_inputFPS = 20;
@little raptor I was able to figure out the saving and loading of the Unit Loadout. I had to add the _backupLoadout variable to the params[]; array and then call sqf player setUnitLoadout _backupLoadout within the if statement. After that I had to add _backupLoadout to the BIS_fnc_addStackedEventHandler array at the end of the script. Here's a link to the updated script: https://sqfbin.com/iwecamutamezopunipoc
Now is there anyway to clean up or simplify the code even more, if so I'm all ears.
Yeah, what codes do you want? just all ?
Is there a way to search all the init boxes i a mission you have made in one go?
Try opening mission.sqm using a text editor, should be in there
Thanx
Also uncheck binarize mission file (or whatever it is) in 3den
@broken forge ```sqf
if (_progress > 1) then {
Will it actually ever become > 1?
yes, because of non-clipped linear conversion
but still, 
(also I'm 99% sure it's just copy-pasted)
yes, because of non-clipped linear conversion
I haven't actually looked at the code that closely
_progress = linearConversion[_start, _end, time, 0, 1];
if time > _end it becomes greater than 1
I only just did because of what you mentioned 
I found a small script for setting units pos to auto, and I edited it a little. Just want to know, does this seem right?
TOV_noProne= {
params ["_unit"];
while {alive _unit} do {
if (behaviour _unit =="COMBAT") then {
_unit setUnitpos "AUTO";
sleep 2;
};
};
};
forEach allUnits;
Uh that function is never called is it
all that is relevant. gui config, base classes, code to set the image. Also what format is your image?
You are declarind a function. You cant just add a foreach to it.
You can add a fpreach loop and in there call the function on each group (groups share the same behaviour)
That foreach will not work anyway because
}; forEach```
is there a good reference for the Extended_Init_EventHandlers anywhere?
I'm trying to run something on all vehicles
(i.e. any sort of car or tracked vehicle)
https://github.com/CBATeam/CBA_A3/wiki/Extended-Event-Handlers-(new) is the best there is
google π
yeah I tried that but I couldn't find any good references
and yes, Google π
cba extended event handler
is all I had to google to find that link
oh this is exactly what I was looking for thanks
ah, I was searching arma 3 instead of cba
makes sense
it just extends the default Event Handlers, so technically not needed, but does make your life a lot easier
yeah
I swear there was a way to find the inheritance chain of an object but I don't remember now
in scripting there is
yeah
well there's inheritsFrom
but that takes a config as a param
can you pass it in an object?
use configOf obj
that was gonna be my guess yeah
get the configParents
call inheritsFrom recursively (or in a loop)
you get every config it inherits from
oh that's annoying, there's no simple way to just get a list of superclases?
see example 2 here:
https://community.bistudio.com/wiki/inheritsFrom
BIS_fnc_returnParents is an easy method (probably does the same as example 2 of inheritsFrom)
oh! that's what I was looking for
ty
so if I wanted to run something on all land vehicles could i do something like: sqf class Extended_Init_EventHandlers { class LandVehicle { init = "_this call (compile preprocessFileLineNumbers 'retexture.sqf')"; }; };
