#arma3_scripting
1 messages ยท Page 670 of 1
One more. I'm looking at taw_vd (view distance scripts) and I see "class Initialize", as I understand, it auto-executes its scripts, but I don't want them to be executed on dedicated server. Did anyone resolve this?
just put a if (!hasInterface) exitWith {} in it (also prevents it from launching on Headless Clients)
Thanks a lot, but I'm kinda lost on where should I put it? Only inside stateTracker? Everywhere? Somewhere inside CfgFunctions.hpp?
in the initializer script(s)
it's a scripting command. you can't put it in the config
Sorry, only stateTracker is called on Initialize or all of them?
class TAW_VD {
tag = "TAWVD";
class Initialize {
file = "view_distance";
class stateTracker {
ext = ".fsm";
postInit = 1;
headerType = -1;
};
class onSliderChanged {};
class onTerrainChanged {};
class updateViewDistance {};
class openMenu {};
class onChar {};
class openSaveManager {};
class onSavePressed {};
class onSaveSelectionChanged {};
class autosaveOnMenuClose{};
};
};
it's an fsm. it's a bit trickier
Really? Seems like just wrapped sqf to me
Sorry, only stateTracker is called on Initialize or all of them?
stateTracker is the init (postInit = 1)
if you know what you're doing then it's no problem
Got it, so I should exitWith only there, thanks.
I'm only learning this stuff, so I may think I know while I'm not xD
FSMs have a starting condition (iirc), just put the condition there (or alternatively you may have to put it in a separate block and link it to exit)
Someone mind helping me fix up my script. The while loop is breaking the rest of the code.
WAG_animalAttack =
{
params["_ai", "_animal", "_grp"];
[] spawn {
while{alive _ai} do {
_targets = ASLToAGL getPosASL _ai nearEntities ["Man", WAG_animalDetectionRange];
_target = _targets select 1;
if !(isNil "_target") then {
for "_i" from count waypoints _grp - 1 to 0 step -1 do
{
deleteWaypoint [_grp, _i];
};
_wp = _grp addWaypoint [_target, -1];
};
sleep 1;
};
};
};
spawn it
just spawn the whole thing instead of calling it
outside the function?
do you call the function?
yes
spawn it instead
[blabla] call WAG_animalAttack -> [blabla] spawn WAG_animalAttack
I don't even know what you're doing
but if you're spawning that code for every rabbit it's bad
I'm creating rabbits that are attached to invisible AI. Right now I'm trying to get each rabbit (AI) to run to their own closest unit of an enemy side
This is my script if you wanna look it over.
https://pastebin.com/NMh3MAmJ
Probably a few things wrong with it
Hey all, I'm making a custom faction mod, and I'm bumping into an issue. I have no idea what I'm doing and working from templates and learning as I go.
Issue is that the uniform on the soldiers shows up on the character, but not as an equipped container. In other words: In the inventory the soldier is "naked", but in game it looks like he has his uniform on.
The uniform is from a mod, and the inventory list was exported from ACE arsenal. Other than that, the rifle optics is also missing, but everything else is there.
Does anyone who has experience with this have time, and want to help me with this issue? Much love
@vestal hearth That is more of a #arma3_config question but you probably set (cfgVehicles >> yourUnit >> nakedUniform) to your uniform instead of a naked uniform.
Thanks @crude vigil, I'll ask there! I'm quite new to this, so sorry for posting in the wrong group ๐
Anyone able to help me make a script that runs privately for every unit in an array. I'm trying to make each unit individually look for the closest enemy unit and run up to them.
I have something but it breaks as I don't know how to make it run separately for each unit.
Please, do share your code ๐
[_ai, _animal, _grp] spawn WAG_animalAttack;
WAG_animalAttack =
{
params["_ai", "_animal", "_grp"];
while{alive _ai} do {
private _targets = ASLToAGL getPosASL _ai nearEntities ["Man", WAG_animalDetectionRange];
private _target = _targets select 1;
if !(isNil "_target") then {
for "_i" from count waypoints _grp - 1 to 0 step -1 do
{
deleteWaypoint [_grp, _i];
};
private _wp = _grp addWaypoint [_target, -1];
};
sleep 1;
};
};
And what you want is WAG_animalAttack running for several units at once?
I want each unit to pick their own closest target and run up to them
but for each ai in the array
In which array?
_ai is the moving unit
_animal is the rabbit attached to their _ai
_grp is the _ai's group
All of my code is here https://pastebin.com/NMh3MAmJ
But that's only one AI.
but there is an AI created for each "C_man_p_beggar_F" placed
What do you mean? Like a few "C_man_p_beggar_F" placed in the mission?
Or are you dynamically creating them?
If you take a look here [https://pastebin.com/NMh3MAmJ] this is how I'm running the script
["C_man_p_beggar_F", "init", {_this call KB_fnc_killerAnimals;}, true, [], true] call CBA_fnc_addClassEventHandler;
any ideas for locally execute selectPlayer _unit for current player
What kind of ideas are you after?
any ideas*
But there is no AI in killerAnimals.sqf, that's a problem because we need one for WAG_animalAttack.
I'm trying to eventually have it so that when "C_man_p_beggar_F" is spawned it will be replaced by a rabbit that hunts down nearby units and nibbles on their legs
And with which specific object do you intend to fill the _ai parameter?
The _ai is supposed to be the rabbits spawned ai unit that does the running
Well, first we need to retrieve that specific unit then. Have you looked into that?
In JBOY_spawnAnimalAI I am spawning the WAG_animalAttack.
_grp = createGroup civilian;
_ai = _grp createUnit ["C_Man_1", _pos, [], 0, "FORM"];
//_ai = createAgent ["C_Man_1", getPosATL player, [], 0, "FORM"];
//[_ai] joinSilent _grp;
[_ai, _animal, _grp] spawn WAG_animalAttack;
But then you are already running a separate instance of WAG_animalAttack for every AI-Animal-Pair. ๐
Should I send you the mission file so you can see the issue?
So This code appears to only give me full missiles after it reaches to 1 left I would like to know I I can reaload with 0 missiles left and if possible add a timer between each shoot
Rhea SAM
this addEventHandler ["Fired",{(_this select 0) setVehicleAmmo 1}] I now is sleep but where do I put it?
I'm not that interested in rabbits ๐
First time testing my year+ coding adventure of a mission in multiplayer environment!
30 Minutes Later
T_T
In fact, this code replenishes the ammunition after every shot
You could modify the code to check how many missiles are still left and only setVehicleAmmo when no missiles are left.
Well they do place a waypoint, but it shows up like 50m under the map. Plus it looks like they target each other
Might be able to fix the waypoint position with _grp addWaypoint [getPosASL _target, -1]; (addWaypoint documentation specifically states to use PositionASL if radius is negative).
Them targeting each other... you're using nearEntities with "Man" and the AI is of type "Man".
anyway to exclude them?
Use setVariable to set a little marker variable on them and check for the presence of that variable when selecting a target in WAG_animalAttack.
got it
Okay, working down my list...
I think most of it can be solved by switching my 'remoteexec ["execVM",2]s for ["execVM",0], except for the .sqf files I'm executing that will spawn in units, those have to be execVM 2'd so they're only on the server.
And a few actors need to have their switchMove turned into a global statement, not just in their init field
How would you go about selecting the next _target?
The thing I'm not understanding though, is how every CSAT unit I placed has my generic white face o.0
Something like
WAG_animalAttack =
{
params["_ai", "_animal", "_grp"];
_ai setVariable ["WAG_animalAI", true];
_selectTarget = 1;
while{alive _ai} do {
private _targets = ASLToAGL getPosASL _ai nearEntities ["Man", WAG_animalDetectionRange];
[_targets] spawn WAG_checkTarget;
WAG_checkTarget = {
params ["_targets"];
private _target = _targets select _selectTarget;
if (_target getVariable ["WAG_animalAI", true]) then {
_selectTarget 1++;
[_targets] spawn WAG_checkTarget;
};
};
if !(isNil "_target") then {
for "_i" from count waypoints _grp - 1 to 0 step -1 do
{
deleteWaypoint [_grp, _i];
};
private _wp = _grp addWaypoint [_target, -1];
};
sleep 1;
};
};
Questions. 1) Does addPublicVariableEventHandler fire each and every time the variable it is attached to is changed via publicVariable* functions? 2) Can publicVariableServer set from the server to the server, in the event of a serve and play setup?
- most likely, but unsure about 200% certainty
- cannot be triggered from the same machine
spawn only returns the script handle, no value. Either way I meant something more like so:
private _targets = ASLToAGL getPosASL _ai nearEntities ["Man", WAG_animalDetectionRange];
private _target = { if !(_x getVariable ["WAG_animalAI", false]) then { breakWith _x; }; } forEach _targets;
you can't just randomly change remoteExec targets and hope for the best.
Look at the locality for every command.
and don't use execVM
because setFace has local effect
But they're not setFace'd o.0 They're just regular units, except like 98% of them have my generic face instead of the generic CSAT face.
Depends how you created them
_selectTarget 1++;
that's not valid even in c++
These units were simply placed in the editor, and a few edited for equipment but otherwise untouched.
As for changing remoteexec targets, I know it's not going to be that easy, but it's a starting point. It's partially successful, but I know I have a lot of tweaking to do to get it multiplayer ready.
Sorry it took so long for me to respond lol. I was unable to find the ww2_fnc_findPlayer function sadly.
There we go... thankfully, I compartmentalized enough of my coding that switching remote targets is surprisingly working pretty well.
Unless I have Matryoshka-layered targeting problems xD
Staging .sqf called to all hosts, calls a dialog staging .sqf to all hosts... calls the individual texts to server where they won't display
Or, in order to get the staging to work by calling it on the clients, I forget that setFriend is in there and has to be called on the server xD
One thing after another
Ahh, the extract helicopter spawn is in a script I pushed to the clients... gonna have to pull that one out.
Or... it did work and they immediately crashed? o.0 Hmm.
New oddity, some units I hideObjectGlobal'd turn to neutral yellow :/
this addEventHandler ["Fired",{(_this select 0) setVehicleAmmo 0}] like this? @willow hound
Hey, I am trying to set a variable with a numerical value then add/subtract from it. I am unsure of how to do this in arma? For a dedicated server. I am using the variable as a method of counting 'ammo', for example I am trying to do:
TEST123 = 1;
if (TEST123 > 0) then;
// Code here
I have also tried, among variations:
_MyVariable setVariable ["TEST123", 1, true];
These are in sqf files, which are executed with execVM
/// nvm solved i was dense
Alright, resolved most of my issues... except that my BIS_fnc_holdActionAdd's are coming up multiples, one per server and client T_T
How and where are you adding it?
That gets a little complicated xD
Alright, I have initServer, which calls my Staging.sqf on Server, which calls the Task.sqf on server, which calls the holdActionAdd... wherever, I've tried different interpretations, from 2 to -2.
remoteExec ["BIS_fnc_holdActionAdd", 0, IGNITE32];
Hrn... should I be scripting it as a Call? I liked the remoteExec version because it was neatly formatted in the wiki.
The task that calls it doesn't fire until the previous task, getting everyone off a helicopter, completes; and then it hits a waitUntil for the player to get 200m away.
But you look at the guy, and see two actions, and they do not interact nicely - he'll heal, then immediately go back into wounded animation.
Post the script which adds the add action
//in initServer:
"Scripts\Staging.sqf" remoteExec ["execVM",0];
//in Staging.sqf
"Scripts\Tasks\T43.sqf" remoteExec ["execVm",0];
//In T43, rescue Ignite32
IGNITE32 disableAI "all";
IGNITE32 switchmove "UnconsciousReviveBody_B";
ignite32 setdammage .4;
Ignite32 allowdamage false;
waitUntil {Vip11 distance IGNITE32 < 250};
//A bunch of dialog, works fine, cut for space -ed
sleep 56;
[East, ["Rescue","Operation1"], ["On approaching IGNITE, a radio signal finally breaks the silence; IGNITE 3-2 confirms that the convoy is under attack, before being wounded. <br/><br/> Locate IGNITE 3-2 and provide medical support", "Rescue", "cookiemarker"], [IgniteMedical] ,1, 1, true] call BIS_fnc_taskCreate;
["Rescue","heal"] call BIS_fnc_taskSetType;
Ignite32Detected = createTrigger ["EmptyDetector", [7146,16423,0]];
Ignite32Detected setTriggerArea [3, 3, 0, true];
Ignite32Detected setTriggerActivation ["ANYPLAYER", "PRESENT", true];
waitUntil {triggerActivated Ignite32Detected};
//More dialog, also works fine - ed
[
IGNITE32,
"Triage",
"\a3\ui_f\data\IGUI\Cfg\holdactions\holdAction_reviveMedic_ca.paa",
"\a3\ui_f\data\IGUI\Cfg\holdactions\holdAction_reviveMedic_ca.paa",
"_this distance _target < 3",
"_caller distance _target < 3",
{},
{},
{T432 = true; Ignite32Triage = _this select 1;"Scripts\Chatlogs\Ignite32.sqf" remoteExec ["execVM", 0];},
{},
[],
6,
1,
true,
false
] remoteExec ["BIS_fnc_holdActionAdd", 0, IGNITE32];
Ugh, I can never post code without Discord flipping out at me T_T
Should work
I mean, it does work, but the doubling of tasks has me concerned that if played in a proper multiplayer setting, it'll do one action added per client, and that's a mess.
how are you adding the tasks?
Also with taskCreate?
Dont remoteExec these
"Scripts\Tasks\T43.sqf" remoteExec ["execVm",0];
Hrn :x What would be the recommended way, for multiplayer compatibility? Calling on the server?
BIS_fnc_taskCreate has global effect, meaning it will already be added to all clients
only call it on the server
Of course x_x it wouldn't happen to be workable to just wrap the tasking scripts in a [xxx] remoteExec ["verb", 2], would it?
I'm dreading I already know the answer. Blah.
What's in the task script?
As above; T43.sqf contains the scripts for establishing the scene, waiting until the player is close (which is probably also going to have to change to a trigger, now that I think about it...), running BIS_fnc_EXP_camp_playSubtitles, creating the task, adding the actions, and completing the task with a global variable flip.
just wrap BIS_fnc_taskCreate in if (isServer)
Good evening, I am wondering if anyone can help. We have a private mod we use for the purpose of editing faces/adding tattoo's to the players body. This mod was working completely fine on the server up until recently, and then suddenly no one was able to load into the mission due to this error:
19:55:08 "DW_fnc_unitInit: init B Alpha 3-3:1"
19:55:08 Warning Message: No entry 'bin\config.bin/CfgFaces/Man_A3/whitehead01.identityTypes'.
19:55:08 Warning Message: Size: '/' not an array
19:55:08 Warning Message: No entry 'bin\config.bin/CfgFaces/Man_A3/m_white_15.identityTypes'.
19:55:08 Warning Message: Size: '/' not an array
CC #server_admins, since I believe it may also be relevant here.
Would you mind walking me through it if I grab the code? Just want to make sure I am doing it right, I am rust with SQF
Ty ty
@cosmic lichen if isServer may have just been the thing, thanks! ๐
Glad I could help ๐
Yup, now onto why it's not loading the second action after the first one runs XC
Is it possible to disable or delete a module with a trigger so it no longer effects the object its synced to?
Trying to set a random bool as true when a trigger is activated, but in a way that it cannot be activated again when other triggers run the same code.
defined in init:
_array = ["TRIG1A", "TRIG2A", "TRIG3A", "TRIG4A"];
triggers activates:
_random = _array select floor random count _array;
_random = selectRandom _array;
_random=true
then something here to delete _random from the array, not sure i can use "deleteAt" for this
any ideas on what to do with the last line that would delete _random from the array?
defined in init:
_array = ["TRIG1A", "TRIG2A", "TRIG3A", "TRIG4A"];
triggers activates:
_random = _array select floor random count _array;
_random = selectRandom _array;
_random=true
_index = _array find _random
_array deleteAt _index
how's that looking? I'm not sure if _index = _array find _random is something that would work
No
But you can disable it so that it never activates in the first place
Umm, wat? The first two are the same. And then _random = true?
use the return value of https://community.bistudio.com/wiki/deleteAt
I've got triggers that have the condition of a side being present and a bool needing to be true. So they can't be completed until the book is true.
Im using this so when another trigger is completed It picks a bool at random to be true and thus one of these triggers becomes completable
Doesn't solve the real problem
It's just doing nothing
Though I obviously don't want it to set a bool that's already to be true to be true again, but pick one that isn't
Why don't you just create the trigger when you need it?
hmm, could just check var status in condition with array of varnames
I don't know how lol. (in reply to making triggers)
private _varValue = missionNamespace getVariable [_varName, false]
Plus I need to create 2 in the same place but that place is picked at random
you would get _varName from a selectRandom on your array of names
So pick the place randomly, and create the trigger there
I uh, have no idea how. and I also have no idea what you're going on about pizzadox lol
hmmm ||thinking hang on||
An array of positions
selectRandom
And then createTrigger to create the triggers there
ok yeah that would work if I was only doing it once. but I want to do it for each point, if i did that I multiple times it could create the triggers in the same place it did before
Basically what's happening is 3 capture points are being created randomly 1 after the other.
If you used a global array and deleted the element after selectRandom it wouldn't
that sounds like my ticket. I just have no idea how to do that lol.
um, i'll take a shot i guess and post back here when i get stuck
@still forum are these new commands "setCombatBehaviour" similar to "setBehaviourStrong" or does the behaviour change according to the group ai logic?
It changes
@little raptor
hang on no I don't want to randomly place triggers at defined spots, I need existing ones to activate.
This is briefly what I'm doing
I was guessing i could create triggers with the condition of Blufor not present.
Then have 1 of 3 triggers randomly spawn with these conditions which would make their respected bool true, but if I'm spawning the same trigger just at random locations that wouldn't quite work.
If it could go to 3 potions each with a blufor unit at one, a indi at another, and a civi at the last or something and depending on what unit side it detected when it got there make a certain bool true it could work, but it seems rather crude.
what i'm doing real quick is:
This is a multiplayer gamemode.
There is 3 terminals on a map.
at the start 1 out of 3 triggers would be activated randomly that would create tasks for each team and show (using hide/show) an object with a hold action at the designated terminal.
The hold action would set a bool to be true (eg TRIG1A), once it was completed by either side 2 more triggers at the terminal would now be complete-able, one for each team, they would be something like this, here's Blufor's one.
Blufor present "this && TRIG1A && !TRIG1GC" triggers. (so when blufor present, trig 1 is active, trig 1 hasn't been captured by indepent)
Once one of those triggers is completed this would start all over again by at one of the remaining terminals.
so yeah,
trying to set a random bool as true, but in a way that the same bool cannot be set as true again and another remaining bool is picked when the same code runs.
defined in init:
array = ["TRIG1A", "TRIG2A", "TRIG3A", "TRIG4A"];
triggers activates:
Trandom = selectRandom array;
Trandom=true
index = array find Trandom
array deleteAt index
so got rid of _ to make it all global, turned _random into Trandom since i assume random is an actual command.
I guess this doesn't work since TRIG1A in the array doesn't count as a bool or something that can be set to true, hmm.
I could define TRIG1A and etc as bools in the init, but then somehow comparing the string i pulled out of the array against the bools to check which one to make true, whew need to look at the wiki more.
wait scratch all of that.
I could set pos a civi to 1 of 3 location randomly, and at each location have a trigger that set's off what I need to.
//init somewhere
TAG_triggerVars = [...];
if (TAG_triggerVars isEqualTo []) exitWith {};
missionNameSpace setVariable [TAG_triggerVars deleteAt floor random count TAG_triggerVars, true];
?
then remove the variable from the array if it gets activated by itself
@little raptor how would you delete specific elements after using them? as far as i can tell it was the same thing i was trying to figure out last time before we figured out it was all bad haha.
allSpawnPos = [ [4783.464,6112.624,3.453],[4728.515,6154.601,4.023]];
randomPos = selectRandom allSpawnPos;
CIVI1 setPos randomPos;
<part that deletes the element that randomPos is currently using so CIVI1 can't be teleported back there>;
array = [1,2,3,4,5];
test = selectRandom array;
array = array - [test];
array
``` @torpid quartz
array = array - [test];
whew baby that's what we're looking for!
I'm still trying to wrap my head around what sharp's code but I appreciate it.
it selects a random var from the array, and sets its value to true
missionNameSpace setVariable [TAG_triggerVars deleteAt floor random count TAG_triggerVars, true];
Variable needs to be string
and it's also deleted from the array
allSpawnPos = [ [4783.464,6112.624,3.453],[4728.515,6154.601,4.023]];
randomPos = selectRandom allSpawnPos;
CIVI1 setPos randomPos;
allSpawnPos = allSpawnPos - [randomPos];
@cosmic lichen ?
it is string
try it
will do
Yup it worked
int:
allSpawnPos = [ [9019.032,10213.902,0],[9035.497,10220.25,0],[9005.021,10208.504,0]];
in the triggers:
hint "trig (trig number) active";
randomPos = selectRandom allSpawnPos;
CIVI1 setPos randomPos;
allSpawnPos = allSpawnPos - [randomPos];
in the initial trigger:
randomPos = selectRandom allSpawnPos;
CIVI1 setPos randomPos;
allSpawnPos = allSpawnPos - [randomPos];
beautiful.
Thanks @copper raven @cosmic lichen @little raptor.
Not the way I was originally thinking of doing this, but teleporting a civi around to set off triggers in random order certainly works haha.
had each trigger on a 1 second delay that popped a colored smoke grenade to make sure
Why not directly activate the triggers randomly?
I would love to and it's what I was trying to do first but got stuck when i figured out the strings in the array are not the same as the bools i needed to activate
so
defined in init:
array = ["TRIG1A", "TRIG2A", "TRIG3A", "TRIG4A"];
triggers activates:
Trandom = selectRandom array;
Trandom=true
index = array find Trandom
array deleteAt index
wouldn't work
Why strings?
but this does so i'm cashing out
triggers are objects, the var names are references to those triggers
oh wait, i don't need "", damn
so i should have the triger vars in the array, and then just have the trigger var pulled out = true or?
no
that's literally what i suggested you to do, have some variable in trigger condition, e.g actualCondition || tag_trigger1_forceActivate, then use the code i sent you to activate those variables randomly
tag_triggerVars = ["tag_trigger1_forceActivate", "tag_trigger2_forceActivate", "tag_trigger3_forceActivate"] #arma3_scripting message
Question is, do you actually need the triggers when you are scripting anyway?
what do those triggers do?
they're synced to hide/show and create task modules plus also set a bool to true
sounds more like something you should script instead of working with triggers.
probably, but this was hard enough to get working.
if I do something like this again i'll give it a got but I'm tapping out of this fight for now
okay
again thanks for the help though, array = array - [test]; was a life saver
can some one tell me where the bracket is missing? i don't get it.
nul = [
recoFob,
[
["B_HMG_01_A_F", 2],
["B_GMG_01_A_F", 2],
"B_CargoNet_01_ammo_F",
"B_supplyCrate_F",
"Box_T_NATO_Wps_F",
"Box_T_NATO_WpsSpecial_F",
"Box_NATO_WpsLaunch_F",
"Box_NATO_Ammo_F",
"Box_NATO_AmmoOrd_F",
"Box_NATO_Grenades_F",
"Box_NATO_Support_F",
"Box_NATO_Equip_F",
"Box_NATO_Uniforms_F",
"Box_NATO_AmmoVeh_F",
"Land_RepairDepot_01_green_F",
["CamoNet_BLUFOR_open_F", 3],
"Land_HBarrier_01_tower_green_F",
"Land_HBarrier_01_big_tower_green_F",
"Land_BagBunker_01_small_green_F",
["Land_HBarrier_01_big_4_green_F", 4],
["Land_HBarrier_01_line_3_green_F", 6],
]
] execVM "R3F_LOG\USER_FUNCT\auto_load_in_vehicle.sqf";
nul = [recoFob] execVM "R3F_LOG\USER_FUNCT\init_creation_factory.sqf";
yes thx!
That code never checks how much ammo is left... More like this:
this addEventHandler ["Fired", {
params ["_vehicle"];
if (_vehicle ammo (currentMuzzle (gunner _vehicle)) == 0) then {
_vehicle setVehicleAmmo 1;
};
}];
I got a question about MP and benefit of using CBA Events vs. remoteExec.
I have been playing around trying to make some custom zeus modules as a clientside mod, and have gotten a bit stuck on understanding what functionality needs executing on only server vs. all clients. I want the mod to work on dedicated servers.
I read through ZEN's zeus modules to learn and found they use the CBA event system to execute code server-side. I have been trying to use [] remoteExec ["function", 2, false]; so far. Is there an benefit of using the CBA events over remoteExec? The different CBA events seems to fit with the different JIP and execution target options with remoteExec anyway.
If I use setPlateNumber and deleteVehicle can I then run it on sever with remoteExec and the server will automatically "sync" the changes to all clients? Or would it be my responsibility to ensure the scripts would be executed on all clients? (Have trouble figuring out what should be executed where for proper display/sync). I can see on wiki that HideObjectsGlobal should work globally itself when executed on server while setPos seems to be able to get triggered locally, but still sync automatically? (Or should that be server too?)
If I use setPlateNumber and deleteVehicle can I then run it on sever with remoteExec and the server will automatically "sync" the changes to all clients?
yes if you set the JIP argument @ true (for the license plate)
deletion is "obviously" JIP-friendly
(and can be made from any machine btw)
Yahoo ๐ guys is there a command how to open bomb/missile bay doors? I am trying to add ShowVehicle blackfoot with bay doors open
try animateDoor or source animation?
Thank you!
is there a list for all blackfoot animations? or some kind of line like this one which will copy it ot clipboard?
""copyToClipboard str getObjecttextures this""
copytoclipboard str animationnames this
Okay, new plan... start a new Staging.sqf, stick it full of my server-side .sqfs, things that spawn units or need to execute on the server etc, and call it from InitServer onto the server instead.
Or... does InitServer have to complete before the mission begins? Or could it be used to stage events instead? o_o
And the units that I'm HideGlobaling turning yellow is kinda throwing off one of my waitUntils, though I could work around it :/
@robust hollow @winter rose thank you guys for help ๐
Okay, it's not that I'm hiding them... these units just start as Empty side o.0
Might be useful
It doesn't have to complete before mission begins tho
That's what I needed to know... got it in my head that the init files run through entirely when the mission loads, so they'd be useless for staging out the mission.
And solved my empty units debacle, seems 'dostop units this' in the init field of the leader wasn't the best choice xD
Yesterday First of April ๐
Thanks!
๐
Hrn... I'm creating a trigger that detects AnyPlayer, and I know the only player - myself - is far enough away that it shouldn't activate, but it is doing so immediately on creation. :/
gestures not working when I try to call them, no errors or anything attempting to do while {alive x3} do { x3 playGesture "GestureCeaseFire"; sleep 2; }
Command doesn't seem to be functional
https://community.bistudio.com/wiki/playGesture
UseplayActionNowinstead
huh weird
Thanks
also, how bad is it to constantly use global variables instead of local ones
I feel like that's going to screw me some day
Depends on the context
Thank you, let me see if I understood this one; currentMuzzle is for checking the shots right? so that been 0 will then run the original code and replenish the ammo?
well remember that my computers global variables can be different from your computers global variables unless set to public variable
also, how bad is it to constantly use global variables instead of local ones
Global vars are not a big deal. Public variables are though
The only issue with global variables is accidentally overwriting them.
Both from your own content and other's content also running.
Current muzzle is because https://community.bistudio.com/wiki/ammo says that the ammo command desires to know which weapon's ammo it is supposed to return.
No idea if the code works by the way, I just puzzled something together from the wiki. Might need some adjustments.
But I can't disable it or enable it during a session?
Wiki says hideObjectGlobal has to be called on server only. I assume it meant I could call it with [_hideTObjs] remoteExec ["function", 2, false]; as that should execute it on the server. But I see no changes on the client calling it. RPT from the server just gives this output:
17:59:36 Setting invalid pitch 0.0000 for L Charlie 1-4:1 REMOTE
17:59:36 Server: Object 8:3 not found (message Type_320)
17:59:36 Server: Object 8:4 not found (message Type_279)
17:59:36 Unit 8:4 not found, cannot update
Have I misunderstood how "server-side" works?
How are you doing it?
And what object?
rmTree = {
params ["_posAGL", "_radius"];
private _hideTObjs = [];
{ _hideTObjs pushBack _x } foreach (nearestTerrainObjects [_posAGL,["TREE", "SMALL TREE", "BUSH"],_radius]);
{ _x hideObjectGlobal true } foreach _hideTObjs;
};
[_posAGL, _radius] remoteExec ["rmTree", 2, false];
Tested with a unit position and hardcoded values for pos and radius. Mainly trying to hide trees. (the function naming is only for testing, I know it should probably use "tag_fnc_name" for good practice)
Terrain objects are not global objects and can't be hidden using that command
Use hideObject instead
hmm okay. It does work in SP and hosted-servers though?
I'll try hideObject instead.
yeah. I get that for hideObject I need to use JIP and target of 0 for remoteExec for global execution. Wanted to use the hideObjectsGlobal as it was created for MP and did the JIP/sync for me, or so it claims ๐
what'd be the quickest way to replace AI voices with with animal noises, overriding sound classes and replacing sound file paths?
now that is a different request lol
just want to do something silly, and have all the AI making silly sounds
No quickest way. Requires a lot of config modification #arma3_config
mmmm, i have to replace all them don't i
If you just want some sounds like pain and stuff you can use event handlers
you "could" do something like mute the AIs radio protocol then create a function that does a random sound class with say3d or playsound3d
by #arma3_scripting, you can set their voice to "empty" and make them say stuff
yea i suppose mute them and play at random times or when interacting with them
would be fastest
that's what i did for taunts one time
speaker might be enough, testing it atm
yea, setspeaker stopped all AI voices as far as I can tell
can any one help
i am trying to make mode for players kill zombies
and here what i did
omg delete that and use pastebin
no one is going to read that format
so now copy the URL ?
thanks
i am trying to make logfile for players kill zombies
and i got problem please let me know
im not familiar with this language
oh ok thanks
someone else probably is. what is it?
@lunar matrix Arma does not take C
sqf my dood
so its not the same as DAYZ
nope
nope, dayz uses enfusion right? which is like C#?
dam
Question what is defined as "Man"?
let me get a good linky for you
lol
A "robot" in simple terms
https://community.bistudio.com/wiki/Arma_2:_CfgVehicles this is arma 2 but its still good, includes animals
Anything that can move by animations
Hmm, so I found my issue then.
thanks for the help
Animals are also men
if you want actual "men" (humans) use "CAManBase"
Thanks. That solves one problem
Now I just need to figure out the other
The problem is that all the AI (rabbits) are not picking their own target to follow.
WAG_animalAttack =
{
params["_ai", "_animal", "_grp"];
_ai setVariable ["WAG_animalAI", false];
while{alive _ai} do {
private _targets = ASLToAGL getPosASL _ai nearEntities ["CAManBase", WAG_animalDetectionRange];
private _target = { if !(_x getVariable ["WAG_animalAI", false]) then { breakWith _x; }; } forEach _targets;
if !(isNil "_target") then {
for "_i" from count waypoints _grp - 1 to 0 step -1 do
{
deleteWaypoint [_grp, _i];
};
private _wp = _grp addWaypoint [_target, -1];
}else{
for "_i" from count waypoints _grp - 1 to 0 step -1 do
{
deleteWaypoint [_grp, _i];
};
};
sleep 0.2;
};
};
hello, I need to know, when Arma stops responding and it falls into black screen territory, locks up my entire Windows session, what can this be? a recursive call? seems to be occurring as I approach an aggressive AI infested sector. AI needs to be dialed back somehow? maybe a recursive call going on? any way to possibly profile that, I think this was mentioned earlier as well. Thank you!
try without mods
if the issue persists report it #arma3_feedback_tracker
because you're constantly deleting the waypoints
also why do you use waypoints?
just use doMove/moveTo
I tried doMove before but it wouldn't work. Maybe it was some other part of the script that stopped it at the time.
if they're agents doMove won't work on them
No it's an invisible AI. A rabbit is attached to them tho simulating a running rabbit
Kinda like the ravage rabbits
then use doStop + moveTo
hmm, well I can probably drop all but CBA for the time being to better diagnose things. CBA is required.
I didn't mean like all the mods. Those that are "trusted" are fine
right okay then. the ones that are loaded I consider trusted, are all signed, etc.
with a module. do i need to have isDisposable = 0 in order for it to fire on a syncedEntity when it respawns?
not signed
but made by professionals
even a kid can sign the mod
it doesn't mean anything
signature is simply used to ensure that the same mod is being loaded in MP
okay fair enough, the ones that are loaded are:
CBA_A3
KP Ranks
Personal Arsenal
Enhanced Movement
Advanced Urban Rappelling
Advanced Towing
Advanced Sling Load
DUI - Squad Radar
3den Enhanced
Disposition towards these?
As I said these are pretty commonly used, I do not see a problem with these.
try it and see if it works. if it doesn't keep taking more off
@fair drum thanks. let's put it this way, what is in question right now is not these mods. I am working on a mission mod that is showing black screen freeze issues as I begin to engage enemy AI sectors.
just wondering how I could begin to profile that.
my only recourse at the moment is to at minimum sign out of Windows and try again, worst case poke it in the eye and force a shutdown.
black screen freeze? you are saying the screen goes completely black?
yes, and Windows will not relinquish control other than the Arma 3 black screen, even while Alt+Tabbing
you can alt tab?
^^ NO
if you are working on config files, usually an error there causes a freeze
define "working with". I am in the middle of verifying HUD overlays. they seem to be working by and large. the issue arises when I approach enemy AI sectors.
so, I think the issue is not in these configs or the supporting scripts at the moment
gut instinct says this isnt a scripting issue
mine as well; I think possibly I need to tune some AI in the game, perhaps; maybe look at some video and/or memory settings. running on an AMD Ryzen Threadripper 2950X, 64 GB RAM, and an NVIDIA GeForce 2070 Super
how many groups total in the game?
and are you doing any scripts that spawn group data type at all?
re: groups, not sure, but I can check
288 groups per side in arma 3 max
that particular aspect of the mission/mod is new to me
288 copy that, I will check, thank you
so if you have 288 individual units in their individual groups, you messed up
that wont cause problems like those that are being observed
and unit max?
no unit max, just group max
WAG_animalAttack =
{
params["_ai", "_animal", "_grp"];
_ai setVariable ["WAG_animalAI", false];
while{alive _ai} do {
private _targets = ASLToAGL getPosASL _ai nearEntities ["CAManBase", WAG_animalDetectionRange];
private _target = { if !(_x getVariable ["WAG_animalAI", false]) then { breakWith _x; }; } forEach _targets;
if !(isNil "_target") then {
_ai moveTo getPosATL _target;
};
sleep 5;
};
};
The AI (rabbits) aren't moving.
okay dokay then appreciate the feedback, these are some clues
What did I mess up?
oh.. wait.. units per group
nevertheless, exceeding the max number of groups just means nothing more spawns, theres no error of any indication its broken
sounds like an infinite loop / recursion (although recursion should crash eventually)
as I told you you're constantly changing the orders.
I have that issue sometimes. A quick reset works
also like I said use doStop and moveTo.
not moveTo alone
oops. I had that in there but must of gotten rid of it for some dumb reason
I do want them to switch their target every once in a while because someone might become closer or the target dies. Even with a sleep is that still breaking it?
No it seems to work. Except their targeting system is still off. I pulled their target away, they ran by the closest guy and went to the second closest.
targets are not sorted
Do you know of any way to sort them?
Hey! in the documentation for the animate command (https://community.bistudio.com/wiki/animate) it mentions that animateSource is better optimised for multiplayer. Does anyone know what these optimisations are? As a dev for a mod that HEAVILY uses animations I would love to take advantage of whatever optimisation it is as much as possible.
you don't need to know - use it ๐ ๐
Oh ok yeah I'll test it when I'm back from work

any chance the sqfbin site could be pinned?
Post your SQF code here: https://www.sqfbin.com/
Then post a link to it to #arma3_scripting
something like that.
If your SQF sample is more than a few lines, please post it to https://www.sqfbin.com/ and paste the link in the channel with a description, thanks
discord is better
not for huge examples ^^
I hardly ever look at something if it has a link
Now we just need a simple bin for cpp files. perfect for #arma3_config
I'm pretty sure 99% of people don't read the channel descriptions and pins
theyre more to reference it instead of pasting the same explanation over and over again.
but now we can say "post your sqf like said in the pinned messages" ๐
works well with the ```sqf example actually
the thing is that animateSource is apparently sending one message for playing potentially multiple animations - therefore it is better ๐
Thank you! I was wondering if it was something to do with latency. I have had latency issues on the order of a second or two for animations being performed on a vehicle by its passengers (vehicle is not local to animate command) and was curious if this would help it
Hey guys, using the following script play an .ogv video file (via trigger [repeatable] radio echo), on a screen (few screens, each screen playing a different video but only one plays)? (maybe one goes white, then back to black);
Note:
- each screen, video all have their own name (e.g screen1, screen2,video1_screen1.ogv, etc);
with uiNamespace do {
_tv = missionNamespace getVariable "screen1";
_tv setObjectTexture [0, "filepath\video1_screen1.ogv"];
1100 cutRsc ["RscMissionScreen", "PLAIN"];
_scr = BIS_RscMissionScreen displayCtrl 1100;
_scr ctrlSetPosition [-10,-10,0,0];
_scr ctrlSetText "filepath\video1_screen1.ogv";
_scr ctrlAddEventHandler ["VideoStopped", {
(uiNamespace getVariable "BIS_RscMissionScreen") closeDisplay 1;
}];
_scr ctrlCommit 0;
};
with uiNamespace do {
_tv = missionNamespace getVariable "screen2";
_tv setObjectTexture [0, "filepath\video2_screen2.ogv"];
1100 cutRsc ["RscMissionScreen", "PLAIN"];
_scr = BIS_RscMissionScreen displayCtrl 1100;
_scr ctrlSetPosition [-10,-10,0,0];
_scr ctrlSetText "filepath\video2_screen2.ogv";
_scr ctrlAddEventHandler ["VideoStopped", {
(uiNamespace getVariable "BIS_RscMissionScreen") closeDisplay 1;
}];
_scr ctrlCommit 0;
};
TEMP EDITs
- : the "" wasnt issue ingame, message amendment, had to edit text for sensitivity
- added an extra field, to give more understanding
Can anyone please advise? ๐
you might need to create another displayCtrl, one for each video
otherwise you simply change the texture of the same control, unloading the rest
ok, makes sense, bruh, but how? lel ๐ข
1100
1101
1102โฆ
done the above, put still only one screen plays? ๐๐
how do i do: _mytaskcount = currentTasks teamMember _totalRunning;
I fear the outputโฆ
i like to count the total number of tasks
BIS_fnc_tasksUnit
Is it possible to somehow find the code for a waypoint?
15 screens alto, what should i do? have checked, crosschecked and verified all variables are correct
please send the end result in an sqfbin linkโฆ
ok, how do i do that
please
see pinned message ๐
worked for you?
worked for you?
I am a bit confused with that.
wait wat, i have 11 triggers activated to repeatable radio echo, each trigger holds the same script, except the final number on each screen and video changes, so screen1-11, displayctrl 1-11*, video1-11 (https://www.sqfbin.com/yekupeyomedezoyujeyu) amended 2
โฆnever thought of factoring your code?
done a quick google to brief me, but no, wouldnt know how to factor my code and make it clean ๐ข
@winter rose I just put waypointstatments [groupname, 1]?
And it will give me what I want?
feed it the waypoint you want
I have been playing around with ORBATS and found this: [missionconfigfile >> "CfgORBAT" >> "3Squ","mil_destroy", [1,0,0,1], 1.2,1.2,45] call BIS_fnc_ORBATAddGroupOverlay; which will apparently change the marker to signify that the unit has been killed but I have no idea where to put this to make it work and the wikis look like Minecraft enchanting table because I have little experience with this kind of stuff. Any Suggestions?
try this, unsure it works because of maybe the same control is used; if it does not, I will try something else
with uiNamespace do {
private _tvFunction = {
params ["_tvName", "_video", "_layer"];
_tv = missionNamespace getVariable _tvName;
_tv setObjectTexture [0, _video];
_layer cutRsc ["RscMissionScreen", "PLAIN"];
_scr = BIS_RscMissionScreen displayCtrl _layer;
_scr ctrlSetPosition [-10,-10,0,0];
_scr ctrlSetText _video;
_scr ctrlAddEventHandler ["VideoStopped", {
(uiNamespace getVariable "BIS_RscMissionScreen") closeDisplay 1;
}];
_scr ctrlCommit 0;
};
[pcs1, "a3im1pv\a3im1pv_pcs1.ogv", 1101] call _function;
[pcs2, "a3im1pv\a3im1pv_pcs2.ogv", 1102] call _function;
[pcs3, "a3im1pv\a3im1pv_pcs3.ogv", 1103] call _function;
[pcs4, "a3im1pv\a3im1pv_pcs4.ogv", 1104] call _function;
[pcs5, "a3im1pv\a3im1pv_pcs5.ogv", 1105] call _function;
};
ok, but will get back to this tomorrow and respond to you in kind then, sorry, but thanks for your assistance so far, heads fried
good reflex to stop instead of forcing ๐
that joke went a million miles over my head lel
@winter rose Do keep [groupone, 1] or replace group one with the group name of the squad that has the waypoint?
although it can be heard as a dirty joke, it is really a good advice to stop when you can't think when coding ^^
what do you want to do?
get a waypoint's statements, right?
oh, so a piece of advice thats used alot in coding?
The code inside a waypoint so I can figure out a few things it does. Not even sure if thats possible though.
yep
when you can't figure it, when you don't know what you do anymore, drop it, have a drink, have a break and a kit-kat, (sleep) then back to it
which code? you can double-click on a waypoint in the editor
well that makes sense* tbf, give yourself a breather, and a kit-kat lol, i heard alot about this 90 min on, 15 min off rule, apparently our brain can only fully focus for up to 90 min, after that, focus quality, keeps dropping, a 15 min break, ensures increased productivity over a sustained period of time, of up 9.5 hours, its quite good tbf, it works, but still need to adapt it fully, easy to get lost in work and go over the 90 min mark
Like this is what is inside the box script inside a waypoint that came with a mod. WW2\Core_f\WW2_System_Curator_F\waypoints\fn_wpParadrop.sqf Where would I find it origin.
it's an sqf file that is in the WW2 addon
Inside the files?
there are websites that provide such assistance, e.g tomato-timer.com
also the rubber duck method is a good thing ๐
yes
lmao notes taken, rubber duck method lol?
(seek pomodoro method too)
rubber duck is: talking to someone/something to explain the problem you face
by saying it out loud, it forces you to conceptualise every item of the chain and consider everything in details
and usually the "oooh wait I figured it out" moment arises
Where would I find the sqf file inside the mod?
in the pbo
What do I edit a pbo with? Could I just use notepad?
PBO manager to unpack it and access the files
Could I just execute this inside of the innit? ```WW2\Core_f\WW2_System_Curator_F\waypoints\fn_wpParadrop.sqf
I'm getting errors with getPosATL and !alive when I added ```sqf
private _target = [[_targeted], [], {_ai distance _x }, "ASCEND"] call BIS_fnc_sortBy;
it looks like their expecting an object now with the addition of selecting the closest of the ``_targets``.
```sqf
WAG_animalAttack =
{
params["_ai", "_animal", "_grp"];
_ai setVariable ["WAG_animalAI", false];
while{alive _ai} do {
private _targets = ASLToAGL getPosASL _ai nearEntities ["CAManBase", WAG_animalDetectionRange];
private _targeted = { if !(_x getVariable ["WAG_animalAI", false]) then { breakWith _x; }; } forEach _targets;
private _target = [[_targeted], [], {_ai distance _x }, "ASCEND"] call BIS_fnc_sortBy;
if !(isNil "_target") then {
doStop _ai;
_ai moveTo getPosATL _target;
};
for [{private _i = 0}, {_i < 11}, {_i = _i + 1}] do {
if (!alive _target) exitWith {};
sleep 1;
};
sleep 1;
};
};
_target is a sorted array
A bit of silly question: how do I place my marker on empty marker position + 100m on X axis I forgot syntax rules w/ brackets ๐
myMarker1 = createMarker ["genMrkName", getMarkerPos "emptyMrk1"];
So now I have to select 0 of the array to get the closest target.
private _markerPos = getMarkerPos "emptyMrk1";
_markerPos set [0, (_markerPos select 0) + 100];
createMarker stuff
don't forget to check that the array is not empty
ty sir
That's what this is for
if !(isNil "_target") then {
you usually check if array isNotEqualTo [] ๐ฌ
before even sorting, saving steps
oh that's a better way to do it
unfortunately didnt work, nothing happened ๐ข not sure what to do, the whole code makes sense too, afaik
How would I delay a modules activation?
are you making a module or using one?
using
just sync a trigger to it and put your activate condition in there
Someone mind giving this a look over?
https://www.sqfbin.com/hupahogixusikazanimo
Rabbit movement and targeting is fine now but they all have the same target. I'm trying to get each rabbit to follow their own target.
(Also this will be MP and ran on a dedicated server so if you could proof that as well I'd appreciate it)
Each rabbit has their own AI that they are attached to for movement
so apparently multiple modules of the same type share module logic?
cause i have variables that i bound to the logic of a module but if I place 2 modules of the same type with different values, one of them overwrites the other, even though the module i'm pulling into a local script space
lol
its jason borne
Would I need to add anything inside the innit for the trigger?
If I just wanted it to enable after a unit reached a waypoint
yeah sure. make the trigger condition something like... !(isNil "wp1"). then in the waypoint attributes go down to on completion area and put wp1 = true
What about syncing it to the waypoint
with the thing called waypoint activation?
you dont have to sync the waypoint if you do it that way
the waypoint activation is to skip that waypoint if its tied to a trigger
so doesn't apply to your case
So for it to activate when it reaches a waypoint just put !(isNil "mywaypoint") Then where would I put the boolean statement?
that is a boolean statement
click a waypoint and go to waypoint expression
under "on activation" put mywaypoint = true
Hey peeps is it possible to use connectToServer with a url?
It seems to only work with an actual ip
That my script?
Looks different
I also still haven't been able to get each rabbit to target their own unit
no
Put that in on activation in the waypoint or trigger?
waypoint
and should I set the trigger to repeatable?
no
Where did you get it from?
unit will walk to waypoint, causing a completion, completion makes mywaypoint = true, trigger picks up that mywaypoint is no longer nil and fires your connected module
Sorry if that sounded like I didn't expect you to be able to make something like that. Said that wrong
And then for the module to enable just sync it to the trigger with a normal sync to?
yes
And to disable it just set the presence to false
no don't touch that
Thank goodness I didn't do that lol.
i feel like you have given me incomplete info on what you want to do if you are wanting things to "disable"
Is it even possible to disable a module in eden?
@little raptor You mind helping me with the targeting part for the rabbit? The only thing wrong is that each rabbit runs to the same target even if they have a closer one.
depends if its considered a disposable module
How do I know if it is or not?
it's because you're supposed to sort all targets
you don't do that
I sorted them now. The rabbits pick the closest unit, but they all run to the same unit
So I have this ai commander mod and it seems to be giving the troops orders which causing the transport plane they are suppose to drop out of to land for some odd reason. So I want to enable the module once the plane drops off the troops for sure so then it can enable and give the troops orders instead of messing up the transport plane waypoints.
The script is here. https://www.sqfbin.com/hupahogixusikazanimo
Maybe I'm calling the targeting portion of the script for all rabbits instead of each one individually.
maybe because they each have that unit as closest
No I made sure each rabbit had a different unit to run to and they all ran to the same one
Not even sure if its possible to do but I am just trying to find a solution to this issue. I have tried a few other ways but they didn't seem to work so I'm trying this one but now I'm not even sure if this one will work.
you over complicated it
just go back to what i told you
actually, i have no idea what this ai commander mod is going to do
so the solution might not even work
so you mean this behavior is wrong?!
Yes. They will all chase the same unit instead of the closest unit to each individual rabbit
trigger: default settings - add !(isNil "wp1") to the activation condition
group's waypoint: default settings - add wp1 = true to the on activation field
sync: trigger to module
no
that's not what my script does at least
if this is your script it's wrong
Should I make the identified wp1?
You mind taking a look at this? It's the current script.
https://www.sqfbin.com/hupahogixusikazanimo
That portion of script is under WAG_AnimalAIFuncs.sqf
it's the same wrong script
private _targeted = { if !(_x getVariable ["WAG_animalAI", false]) then { breakWith _x; }; } forEach _targets;
private _targetsSorted = [[_targeted], [], {_ai distance _x }, "ASCEND"] call BIS_fnc_sortBy;
this is wrong
Mind explaining what is wrong?
you're not sorting anything
you just pick one guy (_targeted) put it in an array and sort it
Oops. So I have to essentially switch them around?
I don't know what you mean by switching around.
something like this will suffice:
_targets = ASLToAGL getPosASL _rabbit nearEntities ["CAManBase", 20];
_targets = [_targets, [], {_x distance _rabbit}, "ASCEND", {!isNull group _x}] call BIS_fnc_sortBy;
Switched around to this
WAG_animalTargeting =
{
params["_ai", "_animal", "_grp"];
_ai setVariable ["WAG_animalAI", false];
_animal setVariable ["WAG_animalAI", false];
while{alive _ai} do {
private _targets = ASLToAGL getPosASL _ai nearEntities ["CAManBase", WAG_animalDetectionRange];
if !(isNil "_targets") then {
private _targetsSorted = [[_targets], [], {_ai distance _x }, "ASCEND"] call BIS_fnc_sortBy;
private _targeted = { if !(_x getVariable ["WAG_animalAI", false]) then { breakWith _x; }; } forEach _targetsSorted;
private _target = _targetsSorted select 0;
doStop _ai;
for [{private _i = 0}, {_i < 110}, {_i = _i + 1}] do {
if (!alive _target) exitWith {};
_ai moveTo getPosATL _target;
sleep 0.1;
};
};
};
};
Right?
idk even know at this point
private _targetsSorted = [_targets, [], {_ai distance _x }, "ASCEND"] call BIS_fnc_sortBy;
private _target = { if !(_x getVariable ["WAG_animalAI", false]) then { breakWith _x; }; } forEach _targetsSorted;
that's it
brain is fried
So I don't need to select the first unit in the array? How exactly does it do that?
it does what you did before
where did you even get the second line?
didn't you write it yourself?
that's what gets the target
uhh
Had some help
well what it does is it goes through the list of targets and picks the first one with !(_x getVariable ["WAG_animalAI", false]) condition
is there a way to optimize this snippet so it works on any angle?
comment "Return array of numbers for setVectorDirAndUp";
vectorPos = [vectorDir (get3DENSelected "object" select 0), vectorUp (get3DENSelected "object" select 0)]; copyToClipboard (str (vectorPos));```
I have an attached object which faces a specific direction because the plane faces that way. For getting the results needed I had to set the angle of the plane to 0 because otherwise I would have gotten weird numbers out of the attached object.
So the question is, if you can counter this so that the starting point of the calculation doesn't need to be zero. Or that it adds/subtracts the angle difference
vectorDir doesn't have much to do with attached and stuff. it should work regardless.
but in any case it requires some vector math
yeah but it calculates based on Z being 0. If I have a object (e.g. plane) and I place some other object there and rotate it so it looks nice when I attachTo it later, then the plane must be facing north (0) in order for the command above to work correctly on that second object
otherwise the values it gets out are based on 0 and rotate the object in weird ways if the base object (plane) was not facing north
I have no idea what you want in the first place 
Hey im wondering if anyone could help me real quick with an audio issue, Im trying to get an audio file to play i set up in my config, and i set it up on four different objects. I had the first trigger play it from a small object and it works great, but as soon as i change the variable name of ONLY the object its playing from and in the code it refuses to work for the other ones.
code?
wait one, sorry im getting it together
also post it with syntax highlighting when you do
see the pinned messages
@little raptor You know what's wrong? I've looked it over a few times but I don't know why the rabbits won't move
WAG_animalTargeting =
{
params["_ai", "_animal"];
_ai setVariable ["WAG_animalAI", false];
_animal setVariable ["WAG_animalAI", false];
while{alive _ai} do {
private _targets = ASLToAGL getPosASL _ai nearEntities ["CAManBase", WAG_animalDetectionRange];
if !(isNil "_targets") then {
private _targetsSorted = [_targets, [], {_ai distance _x }, "ASCEND"] call BIS_fnc_sortBy;
private _target = { if !(_x getVariable ["WAG_animalAI", false]) then { breakWith _x; }; } forEach _targetsSorted;
doStop _ai;
for [{private _i = 0}, {_i < 110}, {_i = _i + 1}] do {
if (!alive _target) exitWith {};
_ai moveTo getPosATL _target;
sleep 0.1;
};
};
};
};
did you use doStop as I told you to?
wait you did
nvm
but the flow of your code is wrong
for [{private _i = 0}, {_i < 110}, {_i = _i + 1}] do {
if (!alive _target) exitWith {};
_ai moveTo getPosATL _target;
sleep 0.1;
};
};
```
what?
@little raptor
Trigger code:
portal say3D "one"
Description.ext code
class CfgSounds
{
sounds[] = {};
class one
{
name = "one"
sound[] = {"sound\one.ogg", 100,1};
titles[] = {};
};
}
That did work previously before your change
that part is just wrong. It doesn't matter if it worked
plus it's your own fault that it doesn't work:
if !(isNil "_targets") then {
https://i.imgur.com/eBFy8M1.png This sums it hopefully up. The drawing shows to planes. One is facing north, the other is not. The green triangle on the planes represents a rotated object that will later on be attachedTo the plane.
If my code above is used while the plane is facing north and thus the rotation of the object is relative to Z being 0 then all is OK. If the plane however faces any other direction, then the rotation of the object is relative to the current nun-null Z of the plane and the code above does not work.
so you want those vectors in model space?
I still don't understand what the result should be?
and what do you want to do with it that it's wrong?
the coordinates array on the "second" plane are wrong. Basically I could always rotate any "plane" to 0 before using the code above. and then rotate it back.
So I kinda just wanted to see if there is a optimization available that would remove the need for rotating back to 0
ok. so what's wrong again? (what should happen?)
I know that
but the question is what do you want to do with it?
this set of code works fine, but when i set up a different trigger to a different object to do the same thing (quadruple checked the variable name), I switched it to "portal2" it refused to work
@hollow lantern
do you want the vectors in plane's model space?
same thing for the subsequent 3 trigger/object combos
does portal2 exist?
well afterwards I do a simple:
C130GUN_L attachTo [SC130,[-1.23071,-5.82861,-3.4]];
C130GUN_L setVectorDirAndUp [[-0.44917,-0.893336,-0.0140649],[0,-0.0157423,0.999876]];```
My code is basically just a helper I use to get the ``setVectorDirAndUp`` coordinates
affirm
so you want the vectors in plane's model space
eh yes, seems like it
[SC130 vectorWorldToModel vectorDir (get3DENSelected "object" select 0), SC130 vectorWorldToModel vectorUp (get3DENSelected "object" select 0)]
did you check if the trigger activates?
I am so infuriated at the moment, I forgot that the player's status of existence is measured from the feet/unit icon position and my trigger was elevated only slightly above this point
it works fine now
to check just put a systemChat in them:
systemChat "trigger1 activated!";
Sorry for wasting your time
@little raptor I found the issue. Something is wrong with _target
I don't know what is wrong with it tho
I already told you what
that's gone
you weren't supposed to remove it
_targets -> _target
that's all you had to change
I overthought it bigtime
@little raptor perfect, works like a charm, Thanks.
End-Product is then:
comment "Return array of numbers for setVectorDirAndUp relative to the base objects position.";
vectorPosRel = [(get3DENSelected "object" select 0) vectorWorldToModel vectorDir (get3DENSelected "object" select 1), (get3DENSelected "object" select 0) vectorWorldToModel vectorUp (get3DENSelected "object" select 1)]; copyToClipboard (str (vectorPosRel));``` if anyone wants it.
comment command 

// works in debug console afaik
yes
plus you might as well use a string literal
"Return array of numbers for setVectorDirAndUp relative to the base objects position.";
yeah, blame my 2010 habbits https://github.com/Aebian/Madley/blob/dev/itsAebian/%40codelist.sqf
Thats where it came from. Since then I just kept onto it because cba to change
since it is nothing special anyways that gets used 24/7
@little raptor _target isn't working even with that change in _ai moveTo getPosATL _target;
what change?
_targets -> _target
what else
Here
WAG_animalTargeting =
{
params["_ai", "_animal"];
_ai setVariable ["WAG_animalAI", false];
_animal setVariable ["WAG_animalAI", false];
while{alive _ai} do {
private _targets = ASLToAGL getPosASL _ai nearEntities ["CAManBase", WAG_animalDetectionRange];
private _targetsSorted = [_targets, [], {_ai distance _x }, "ASCEND"] call BIS_fnc_sortBy;
private _target = { if !(_x getVariable ["WAG_animalAI", false]) then { breakWith _x; }; } forEach _targetsSorted;
doStop _ai;
if !(isNil "_target") then {
if (!alive _target) exitWith {};
_ai moveTo getPosATL _target;
};
sleep 1;
};
};
prob my fault
I told you to remove that for
and you need only one doStop
no need to put it in the loop
you can put it there if you want
won't make that much of a difference
alright
also use agents instead of AI
? Like _agents instead of _ai?
But there still is the problem with _target
I tried this and it worked
_ai moveTo getPosATL player;
createAgent
_ai setVariable ["WAG_animalAI", false];
_animal setVariable ["WAG_animalAI", false];
because the animal is targeting the AI (essentially targeting itself)
did nothing. AI just sat there as it was an agent
this is the main issue:
#arma3_scripting message
what you saw in my script was made using agents
The agents were the ones walking around?
noone walked around
the whole system was simulated
I used a custom velocity system for the rabbits
the agents were simply used for path generation
plus I attached the rabbits to the agents
Makes sense why they were sliding around when they turned
๐ญ ๐ญ ๐ญ ๐ฅณ ๐ฅณ ๐ฅณ IT WORKS!!!!
FINALLY!!!
@little raptor Thanks for the huge amount of help you gave me
np
Now to a part of the code that I actually know how to do. I think
Does BIS_fnc_recompile work for code in a server addon? I assume if it does it'd only work if filepatching is enabled
it has nothing to do with file patching
it requires allowFunctionsRecompile = 1;
and afaik it doesn't work in config.cpp
only mission functions
i need... a downside to always having a mine/ied jammer always on. any ideas?
oooh and the battery can explode
your CQ didn't put the batteries in the freezer so they only charge to 40%
if(A3E_Param_Weather==0) then {
0 setovercast 0;
forceweatherchange;
};
if(A3E_Param_Weather==1) then {
0 setovercast 1;
forceweatherchange;
};
if(A3E_Param_Weather==2) then {
0 setovercast 1;
0 setrain 1;
forceweatherchange;
};
if(A3E_Param_Weather==3) then {
0 setovercast 1;
0 setfog 1;
forceweatherchange;
};
I have this simple script that runs on the server that changes weather and can be adjusted in the parameters. I'd like to have one more random parameter that selects from this list, so I can have a random weather start. How do I do this?
private _weatherParam = if (A3E_Param_Weather isEqualTo 4) then {
floor random 3
} else {
A3E_Param_Weather
};
switch _weatherParam do {
case 1: {
0 setovercast 1;
};
case 2: {
0 setovercast 1;
0 setrain 1;
};
case 3: {
0 setovercast 1;
0 setfog 1;
};
default {
0 setovercast 0;
};
};
forceWeatherChange;
[[2001, 12, 31, 23, 59], true, true] call BIS_fnc_setDate;
So uh how do i make it say 6 hours later not years later..lol and keep it day or late arvo?
is armake2 still the best builder or are there newer stuff
Thank you, I knew there was a simple way to do it and I've seen these kinds of scripts before, but I'm still mostly limited to smashing scripts together until they work.
One thing I noticed however is that it looks like the floor random 3 should be floor random 4 since the random command is not inclusive. I confirmed that with some testing. I tried putting just 2 switches and floor random 2 and it never picked the case 2. Only case 1 and default were selected.
@finite sail does this give me the 6 hours later screen?
no
BIS_fnc_setDate
Im using a trigger n need it to cover up stuff spawning/make it immersive
?
That's the one with the 4 hours later
Uhhh
I see i think
I was just hoping someone can give me the full code to put in the trigger
Cuse i dont understand scripts
Thats where i got it from but again idk how to change it to hours
the examples on fnc_setdate cover most of twhat you need
Ah
Just spend some effort to read the article
Wait so i just get rid of it all in the brackets n put a single number?
[[4], true, true] call BIS_fnc_setDate; ig?
Ah okay
I read but idk if i understand lol
Am not able to comprehend high skill stuff like scripts
[4, true, true] call BIS_fnc_setdate
example 2 on that wiki page skips in hours
example 2 updated, with comment
just add true true for global execution and the fancy transition
oo, well played @cosmic lichen
yep lol
ah yes, 30/60 is accurate
ive never used this... might shoehorn / plot device it into my mission
lol
//initServer //
Sav1 = createVehicle ["Land_Tablet_02_sand_F", getMarkerPos _marker1, [], 1, "none"];
sav2 = createVehicle ["Land_Tablet_02_sand_F", getMarkerPos _marker2, [], 1, "none"];
//initPlayerLocal//
while {true} do{
{
if (player distance _x < 20) then {
[_x, ["tract", 20, 1]] remoteExec ["say3D", 0, true];
};
} forEach [sav1,Sav2];
sleep 6;
};
It only plays the sound for the hosted pc, but when i join on another pc it doesnt work.
I use initServer so it only spawn (createvehicle) once and not duplicates .
Is it possible to get it to work with all clients ??
First of all, use say3D 2nd syntax. It got a range with it.
from say3D [sound, maxDistance, pitch, isSpeech, offset]
and second of all, do not set JIP to true
why even remote exec in initPlayLocal.sqf?
The issue is: only the server knows what are sav1 & sav2
initServer.sqf
publicVariable "sav1";
publicVariable "sav2";
//initPlayerLocal//
while {true} do
{
{
_x say3D ["tract", 20]
} forEach [sav1, Sav2];
sleep 6;
};```
i knw about the distance ...if a player is less than 20 meters away from the device, then it will play the sound .I only did that so it doesn't contentiously play the sound ...might lower fps maybe idk ๐
thanks again๐
i knw about the distance ...if a player is less than 20 meters away from the device, then it will play the sound .I only did that so it doesn't contentiously play the sound ...might lower fps maybe idk ๐
Could be, no clue how the engine handles it.
Creating vehicle not working.
Pull the section of script out, run it in the debug console.
Still not working.
Remove vehicle name.
Works, but crew doesn't teleport in... because the vehicle doesn't have a name.
Return name.
Works as intended x_x
... but it didn't update the name? o.0 Buh.
wut?
ERROR: No info's given; No answer is returned.
@manic sigil code plz
Also check createVehicle's wiki page
Sorry, trying to cram this in before work x_x
InitServer >>> "Scripts\ServerStaging.sqf" remoteExec ["ExecVM", 2];
Taru = createVehicle ["O_Heli_Transport_04_covered_F", getMarkerPos "TaruMarker3", [], 0, "FLY"];
Hydra1 assignasDriver Taru;
Hydra2 assignasturret [Taru, [0]];
Hydra3 assignasturret [Taru, [1]];
Hydra1 moveInDriver Taru;
Hydra2 moveInTurret [Taru, [0]];
Hydra3 moveInTurret [Taru, [1]];
Taru setdir 230;
If I run it in the debug console as Server, it works fine-ish, but doesn't name the vehicle.
Well, doesn't globally name the vehicle.
i spent months try to get that to work and you guys just did that in less than 10sec I.H.M.L๐ญ
We all started there ๐
Hows it going! Been fighting with this issue all morning and i'm at the end of my wit, so im here ๐ Any help is appreciated!
Issue: Building a Stomper follower drone which works well, however i want to add props to the back of the drone, which attach fine, however the Drones AI gets confused and can drive correctly anymore.
I have tried the following to make the items no collided or stop AI from seeing them but no config i put together has worked;
drone disableCollisionWith object;
[drone,object] remoteExecCall ["disableCollisionWith", 0, object];
Im using these objects for testing;
B_UGV_01_F (drone)
HLC_AK_ammobox (box)
And for anyone interested this is the end product im hoping to get working - #screenshots_arma message
Any clues?
what is your initial code? there should be no need for disableCollisionWith
PS: object is (or was?) a sqf command
object is just the "var" name, i was using box as the name
Only thing i'm running is a script to call the AI to my position which works fine without the objects attached
and what is your attach script?
[this, drone] call BIS_fnc_attachToRelative
Running on each of the attached objects
no issue with this
Was getting issues with the almost exact same setup
2 seconds and ill see if i get the same
how are you telling the ai to move?
just with wp?
yep
Ok so, yes it does drive but compare one with no objects and there is a massive diffrence
For example the one i linked to just drives in circles cause it keeps seeing things it trys to avoid
You will notice also that a drone with stuff attached wiggles as it drives but one without will go in straight lines
May be easier to see while its following you
test addAction ["Follow",{_drone = drone10;
while{ alive _drone && alive test } do {
_drone doMove position test;
sleep 2;
};}]
Using that in the players init, and replace the drone10 with the name of the drone will get it to follow you
I assume it was the hit boxes of the items but if you have any other suggestions to make them function like they do unladen i'd be happy to have literally any suggestions at this point
0 issue with that
maybe the issue is sleep 2; it might be too small
I kinda ruled the script out in my head as I had no issues with it on the unladen drone
Will give it a go when I get in
Can you try clipping some objects into the front and sides of the vic your using
See if that causes the issues
same same
the "every two seconds" move maybe
Thats wat it does for me
No clue why
๐
Try an AAF Supply box on the nose
for me the thing only backs up
create a minimalistic repro
Ok so longer time defo helps, i'll work on the script to improve it. Very much apprecated
One step closer to robo dog
Hey I'm trying to write a script that checks how much of an object is visible above ground (in height) but my script is inaccurate
the script:
// cb is object being used here
_wpos = cb modelToWorld (boundingCenter cb);
_bbr = boundingBoxReal cb;
_elevation = _wpos # 2; // Should be center of the obj
_height = abs (((_bbr select 1) # 2) - ((_bbr select 0) # 2));
_aboveGround = _elevation + (_height / 2); // result is inaccurate
hint format["%1 -- ( %2 ) -- ( %3 )", _wpos, _elevation, _aboveGround ];
anyone know what I'm doing wrong?
Hello, i have a script were it would check if someone has been killed using the EntityKilled event handler and it would display a little message with titleText, the only problem is that it would display the message to every player on the server instead of just the killer, does anyone know why?
params ["_killed", "_killer", "_instigator"];
if (isPlayer _killer AND side group _killed isEqualTo east or isPlayer _killer AND side group _killed isEqualTo west or isPlayer _killer AND side group _killed isEqualTo resistance or isPlayer _killer AND side group _killed isEqualTo civilian) then
{
titleText ["<t size='2' font='EtelkaNarrowMediumPro'>You have reached Level 1!</t>", "PLAIN DOWN", -3, true, true];
};```
if you add that script on all clients, all clients will execute that script when someone gets killed
so adding _killer == player to the if statement should fix that
however, since your if statement is a mess it will most likely not work
Hey, or good afternoon bud, checked out that code yday evening before heading offline (#arma3_scripting message)
it didnt work unfortunately sir, 
(isPlayer _killer AND side group _killed isEqualTo east or isPlayer _killer AND side group _killed isEqualTo west or isPlayer _killer AND side group _killed isEqualTo resistance or isPlayer _killer AND side group _killed isEqualTo civilian
???
if (isPlayer _killer AND side group _killed in [east, west, independent, civilian])
although, the side check is redundant @valid abyss
I have a quick question, google hasnt been terribly helpful. How do I disable the music on the mission complete screen?
How to end mission locally for current player
What scripting language is Arma based on?
SQF
Huh, neat
Its to check if the person that is killed is human and not a zombie
@valid abyss What side does a zombie have?
They're agents so none.
Agents can have sides too
You can also use
!isAgent teamMember _killed;
Instead of the side check
Thanks
So i'm wondering on where I could be going wrong.
I've been trying to make get an animation to work on all players at the start of the mission in a multiplayer mission.
I thought I could get away with using
sleep 43.86;``` in the unit Init. But doesn't want to work
so I make a sqf called initPlayLocal.sqf and it should run at the start of the mission?
would i have to change the "player" or is that fine
does anyone know how to disable the end mission music? I just want the UI card that shows up
do a mission event handler for "ended" and put a playMusic "" or 0 fadeMusic 0 in there
I dont know how to do that :/
thank you ๐
@cosmic lichen ?
Right so https://gyazo.com/f9cca5d4e9896c7db420e0c04c77b9a1 I have it set up like this.
When I test the mission it doesn't affect the character.
addMissionEventHandler ["ended", {
params [playMusic "", "BIS_fnc_endMission"];
}];
Im unsure what is wrong.
it wont end the mission at all now
the documentation said to put the endmission type in the _endType string
Did you actually read the params doc?
so are you a brand new coder? if so we have a lot to unpack in that one
im pretty new to arma scripting yes
addMissionEventHandler ["Ended", {
params ["_endType"];
}];
I just kinda replaced things that I had
i dont know
so the params command in this is creating a private variable (exists only in the {} code block) that is pulling in the arguments that the engine is feeding it. In this case, when the mission ends, the engine sends out a argument of what end type was chosen and feeds it to this addmissioneventhandler script. therefore, we want to keep the params command untouched as its giving us information to work with if we choose to.
ah okay, gotcha
because we can do something like...
addMissionEventHandler ["Ended", {
params ["_endType"];
if (_endType == "end1") then {blah blah blah};
}];
so it allows us more control over what we want
so you keep everything as is. but we want to add your code underneath the params area
understood
addMissionEventHandler ["Ended", {
params ["_endType"];
//code here notice its still inside the {}
}];
so try that now
addMissionEventHandler ["Ended", {
params ["_endType"];
playMusic "";
BIS_fnc_endMission;
}];
partially. remember this event only occurs when the game ends. so you can't give the game ending command within it or it will never fire
so you need to send that outside of this handler
oh I understand now, I trigger the endmission and then under this
this triggers on the event
gotcha
Start reading here https://community.bistudio.com/wiki/Introduction_to_Arma_Scripting if you wanna get into scripting
it ended the mission but it didn't disable the music ill try the second method you stated
I will check it out thanks ๐
If you have ace enabled, fadeMusic won't work unless you disable it's automatic hearing volume control.
oh I do have ace
Let me see if I can remember it...
ace_hearing_disableVolumeUpdate = true
"MEZ" call BIS_fnc_endMission;
addMissionEventHandler ["Ended", {
params ["_endType"];
0 fadeMusic 0;
ace_hearing_disableVolumeUpdate = true;
}];
i feel like i did something wrong, I will go look up how to properly do the fademusic
you got to do the ace disable before the fade music
I swear my other coding experience just decides to not exist when I do arma scripting lmao
switched it around, music still exists
and you also have to call the event handler before you stop the mission...
otherwise it doesn't exist when the mission ends = no trigger
you should have a trigger that is the end mission, and the mission event handler goes in an init logic box or init.sqf
think of an event handler as a constant loop that is checking for things. if that loop doesn't exist before you end the mission, how is it going to know that the mission ended?
true. alright
Hi. What is the most efficient way to develop and debug a new mission (which include a server-side) ? Rebooting everything when changing one line of code is boring /:
for configs? gotta reboot afaik. for scripts you don't have to, you can call stuff directly in game
No configs, just scripts. But calling them in console is not very convenient, you can't paste comments, there is no indent etc. I would like to just Ctrl+S my file and test it in game, it is possible ?
in console *
Oh my god nice tool dude
wtf
@cosmic lichen Thanks,but why does it says that filePatching is for unpacking data in arma 2 lol ?
Allow the game to load unpacked data. For more info see CMA:DevelopmentSetup (since Arma 3 1.49+).
I mean the link more info
there is only a section for arma 2
there is nothing about arma 3
Because the biki is a mess
oh
What applies to arma 2 mostly applies to arma 3
where is the init logic box?
just go to modules, hit the flag, and go to game logic. its just an init box when you open it
got it, set it up and the music still plays, could it be the ace line of code?
do this
remove the event handler
["MEZ", true, true, false, true] spawn BIS_fnc_endMission
instead of your current end mission
so
["MEZ", true, true, false, true] spawn BIS_fnc_endMission
instead of
"MEZ" call BIS_fnc_endMission;
yes
@fair drum you are a legend, thank you. I'll go research what each parameter does now lol. Thanks ๐
Hi, is it possible to get better building center than this (getposATL at cyan arrow): https://steamuserimages-a.akamaihd.net/ugc/1727668185568568284/F37B6227B0CDB8AD13BA8B0A8F11AD8E0D97D897/
I'm trying to get guys to move into specific cargo seats of trucks when they get created but for some reason they never end up in the right seats. They always seem to go to the next available seat and not the specified one. Here's what I have:
_truck1 = [ [getMarkerPos "tankMarker", -30, markerDir "tankMarker" ] call BIS_fnc_relPos, markerDir "tankMarker", "O_Truck_02_transport_F", _truckgroup] call BIS_fnc_spawnVehicle;
_truck1 = (_truck1 select 0);
player assignAsCargoIndex [_truck1, 8];
player moveInCargo _truck1;```
Any thoughts? Killzone Kid's comment here seems to imply I'm doing it correctly: https://community.bistudio.com/wiki/moveInCargo
that returns this
oh nvm
I dont know how to read
sameish problem though:
player assignAsCargoIndex [_truck1, 8];```
sorry about the "sqf", didnt mean to include it ๐
so I guess the "correct way" on the biki is not actually the correct way then
or one of the correct ways anway
that worked though. Thank you!
two syntax, you just pick the one you need
the second one doesn't actually do what it says it does though. Talking about the bottom comment on it
ah I see. must be old comment then...
it's for AI. I was just using myself to test because it was quicker than having to look around the interior of a BMP which is what I originally started on but then decided to make sure it wasn't the problem of the modded BMP by using a base game truck
message lou and see if you can get a note on the wiki page if it truely only works for AI
so I have two arrays:
private _jamUnits = [ bunch of objects ];
private _mines = [ bunch of objects ];
i'm trying to get it to take each mine and iterate each jamUnit or vis versa. So I have two iterations happening at the same time. I tried a stacking forEach but the commands I was placing on the inner array were firing on the outer array. Any ideas?
code?
or maybe a short sample
well its gotten a little better now... this is my current thing... working on getting a way to get simulation back on after they leave the distance area. I'm trying to avoid spawning scripts on every unit or mine and just let the server handle it going through arrays.
[_moduleLogic] spawn {
params ["_moduleLogic"];
private _units = _moduleLogic getVariable ["module_units", []];
private _range = _moduleLogic getVariable ["range", 50];
private _explode = _moduleLogic getVariable ["explode", false];
private _classes = _moduleLogic getVariable ["module_mine_classes", []];
while {true} do {
private _nearMines = [];
{
_nearMines pushBackUnique (nearestObjects [_x, _classes, _range]);
} forEach _units;
{
if (_explode) then {
_x setDamage 1;
} else {
_x enableSimulationGlobal false;
};
} forEach _nearMines;
sleep 1;
};
};
i changed to doing mine classes rather than mine objects initially
but the code is still wrong
_nearMines is an array of array of objects
and you didn't need to create a separate array for it
this was the original
{
_vehicle = _x;
{
if (_x distance _vehicle <= _range) then {
if (_explode) then {
_x setDamage 1;
} else {
_x enableSimulationGlobal false;
};
};
if (_x distance _vehicle > _range) then {
_x enableSimulationGlobal true;
};
} forEach _mines;
} forEach _units;
with the variables defined outside of it, but I knew this was wrong
either way, nearestObjects is a slow command
kinda get the idea of what I'm trying to do though then?
yeah
this is the slightly faster (and error free) version of your code:
[_moduleLogic] spawn {
params ["_moduleLogic"];
private _units = _moduleLogic getVariable ["module_units", []];
private _range = _moduleLogic getVariable ["range", 50];
private _explode = _moduleLogic getVariable ["explode", false];
private _classes = _moduleLogic getVariable ["module_mine_classes", []];
while {true} do {
{
{
if (_explode) then {
_x setDamage 1;
} else {
_x enableSimulationGlobal false;
};
} forEach (nearestObjects [_x, _classes, _range]);
} forEach _units;
sleep 1;
};
};
ah so i was on the right track, just had some command issues then
although I'm not sure why you're doing the enableSimulationGlobal
vehicle jamming module, its running only on the server so that's why global
you could get it to work but still it is slow
I mean why enableSimulation?
it looks like it prevents it exploding if run over, but still allows for defusing
at least when I messed with it yesterday
so why are you doing a loop then?
if you're in control of everything ditch the loop
use an "event handler"
cause my vehicle distance is always changing as the vehicle drives around
so what's the point of _explode?
module has an option to tick that when the jammer vehicle gets in range, that it actually just ruptures the mine instead of disables it
kinda simulating a focused RF attack
Is there a way to get the current curatorLogic/object of the one using a zeus-module? I'm using ZEN to register custom zeus modules and it provides the selected _pos and _unit but I can't seem to find a way to get the current curator object that used the module. I can get all curators with the allCurators but not sure how to check and get which one "I am" when I am zeus and calling the module.
getAssignedCuratorLogic player
ugh. Stupid me. Didn't realise player returns the current player object..... Thanks!
I figured if it was possible, filepatching would have to be enabled to allow the addon to be loaded without packing. Thats why I mentioned it. But yeah I guess if it doesnt work with cfgfunctions then it doesn't matter
i am quite a starter scripter. can some one help with that please?
// mybox is the variable of a B_T_Truck_01_box_F in the editor
_mybox = mybox;
{
_x addweaponCargoGlobal ["launch_I_Titan_short_F", 1];
_x addMagazineCargoGlobal ["Titan_AT", 5];
_x addweaponCargoGlobal ["launch_I_Titan_F", 1];
_x addMagazineCargoGlobal ["Titan_AA", 3];
_x addBackpackCargoGlobal ["B_Carryall_mcamo", 2];
_x addMagazineCargoGlobal ["ATMine_Range_Mag", 2];
_x addMagazineCargoGlobal ["SatchelCharge_Remote_Mag", 2];
_x addMagazineCargoGlobal ["16Rnd_9x21_Mag", 5];
_x addItemCargoGlobal ["Rev_darter_item", 1];
_x addItemCargoGlobal ["ToolKit", 1]
} foreach _mybox;
@sacred slate ```sqf
private _boxObject = mybox;
private _lootTable = [
["launch_I_Titan_short_F", 1],
["Titan_AT", 5],
["launch_I_Titan_F", 1],
["Titan_AA", 3],
["B_Carryall_mcamo", 2],
["ATMine_Range_Mag", 2],
["SatchelCharge_Remote_Mag", 2],
["16Rnd_9x21_Mag", 5],
["Rev_darter_item", 1],
["ToolKit", 1]
];
{
_x params ["_xItem", "_xCount"];
_boxObject addItemCargoGlobal [_xItem, _xCount];
} forEach _lootTable;
_x params ["_blah", "_blah"] is the best
Quick quick quick, is there a script to add all Zeus modules to player?
Need it urgent
I think you can only have 1
1 game master then you can have a couple of side kicks i think
No no, we already have the Gamemasters but thhey don't have moduels enabled
We know the fix but we're mid-mission
Are there any code editors with customization like Notepad++ for Android smartphones? I've been using regular note taking apps and they suck lol
oh so they just don't have modules like "heal" or "teleport" and that stuff
just assign it to them then:
unit assignCurator curator_module
(note: server exec)
@tidal ferry allCurators gives you the list of all modules
Amazing, legendary, thanks
Going to try it
Okay, so allCurators fetches the logics
Any way to fetch the Zeus players?
Can't fenagle it atm, juggling missionmaking
that's all of them! ๐
๐ค
if ace is enabled, they can change a setting that allows for zeus creation mid game by either admin player, or open all, etc
would show up in the radial menu
if you gave them names in mission editor, try:
_p = allPlayers select { !isNull getAssignedCuratorLogic _x } apply {[_x, vehicleVarName _x]}
```and find the one which was the Zeus thing
yeah, Logics are zeus1, zeus2, zeus3
Jugglign this and improvising with what we have
not the logics
players

