#arma3_scripting
1 messages · Page 542 of 1
Using ACE, I am reading the events documentation.
I am wanting to see what capture state a unit is in
I know how to set the state, but what do I need to get the state.
IE, is unit surrendered, handcuffed, etc.
Wait
I got it
Need to pass the event handler a function and make a new one.
params ["_unit", "_state"];
if (_state) then {
systemChat format ["%1 was handcuffed.", name _unit];
} else {
systemChat format ["%1 was released.", name _unit];
};
}] call CBA_fnc_addEventHandler;```
ooo.
you don't pass a function to a handler
you are adding a handler
just like the function name says
Well shit.
If that wasn't an aha moment.
Thanks.
So, if I wanted this eventHandler to only be added to a unit.
set unit*
if (_unit == X) then
In the handler? So there is no way to isolate it to the unit at the creation point, I have to deduce if the event firing is from the intened unit.
yes
Okay
So, if I plan to make a few of these
Is it wise to group them in one place, and set them all up at once.
some sort of jay_setupEventHandlers.sqf
As I am sure my little coop framework will have more.
when you add eventhandlers makes no difference
I was mainly thinking about the best way to keep my project organized.
Don't know if you have any best practices tips for that.
There is any way to associate a projectile to a unit making the HandleDamage EH have this unit as source?
Hi so im looking to implement a script which allows people to carry/drag wounded to safety and drag dead bodies out of sight and was wondering if some script like that was in arma 3 like a lost feature or do i have to port the a2 dragging/carry scripts to arma 3?
There are still dragging, carrying, and unconscious state (while being dragged and not) anins.
So just attach the body to the dragger
@high marsh you can use those animations in dead units (ragdoll)?
Is there a way to control the sun light intensity via scripts? I want to experiment with creating an EDF like explosion effect where the sun essentially gets turned off and the lighting comes mostly from the explosion. It's not realistic in any way, but I really like that effect.
Taro maybe check out colour corrections? they are used in the A bombs to get that "burning sky" effect
actually I want the opposite, I want the sky to turn black
burning sky is most likely just an aperture tweak to blow out the light
did anyone figure out how BI made the sky so bright in the arma 3 contact campaign? or was it purely just the engine doing work
@plain urchin aparture, you can experiment with it in splendid camera
sadly aperture tweaks don't work when NVGs are on
ohhh
that explains why no NVGs in the mission huh
interesting, thank you! i'll check that out
there are NVG scopes though
How can I get all ACE itens in the CFG so I can put it available in the arsenal?
You want all the classnames?
Hey guys, how can I check to see if a certain function is running?
I feel like I saw some code for this somewhere, using waitUntil {}.
@astral tendon
https://ace3mod.com/wiki/framework/arsenal-framework.html
I. Spawn the same amount of units as you have loadouts, give each unit one of them
II. Start the mission then press ESC once loaded
III. Clear the debug console then enter the following:
private _items = allUnits apply {getUnitLoadout _x};
_items = str _items splitString "[]," joinString ",";
_items = parseSimpleArray ("[" + _items + "]");
_items = _items arrayIntersect _items select {_x isEqualType "" && {_x != ""}};
copyToClipboard str _items;
IV. Paste the created array from your clipboard into the space where the items are listed CTRL+V. The array is created with brackets.
Thats not what I want, I want to get all class names from ACE so in case the player plays my mission with ACE it adds all items of ACE so he can use it.
^ Go to ace documentation
Class names are there.
@astral tendon
This is what you want.
That is anoying dificult to get, also its going to be a problem if ACE adds new stuff and my mission is outdated, so I would like to get a array of their class names in game.
Yeah, you can't just parse the class names of a mod in game via script.
How does the arsenal get those arrays?
Arsenal is engine built in
It reads mod config files.
Which is all or nothing.
Your two options are. Setup limited arsenal for ace, and limited arsenal without ace, if running ace spawn ace aresenal, if not spawn other.
Or, use that page to set it up.
I have not found a way to exclude a mod from arsenal yet.
Although that would be very useful, I am gonna look into it more.
Can you ping me if you find a solution on your end?
Fine, I will.
Sorry we are not all wizards who know the engine. Not like we built it. We all read the same docs you do man.
only way i know of would be to scan each class name and look for 'ace' etc and that may not work + will probably be laggy and slow
Unless if is a one time scan since there is no other reasion to keep checking.
ofcoursei ts ao ne time scan but its a lot of config operations and will probably lock the game up
atleast for a moment
and it might not even work, and might not even get everything
@hearty plover There is a DLC = "Something" in the configs, that may help filter stuff.
dont think ace use it
but you can also check if the author is the ace team string
otherwise it'll be configName + find
_arr = [];
{
_Configname = configName _x;
if (getText (_x >> "author") == "Red Hammer Studios") then {
_arr append [_Configname];
};
} forEach ("true" configClasses (configfile >> "CfgWeapons"));
_arr;
@hearty plover looks like thats it, I get a array of all RHS itens here, so we can use this kind of filter for ACE too.
ace classnames start with ACE_
Anyone know of a way to control access to zeus slots? Currently using a whitelist but it seems to be causing some adeverse effects for some players, namely having to respawn to be able to access zeus. Whitelist:
``params [
["_player", objNull, [objNull]],
["_jip", false, [false]]
];
_uid = getPlayerUID _player;
_slot = vehiclevarname _player;
_whitelistedSlots = ["zeus1", "zeus2", "zeus3", "zeus4"];
if ((_slot in _whitelistedSlots) && {!(_uid in whitelistedUIDs)}) then {
["End1"] remoteExec ["endMission", _player];
};``
this is in initPlayerServer
with the uid's defined in initServer
@jagged elbow Order of initServer and initPlayerServer is not guaranteed
https://community.bistudio.com/wiki/Initialization_Order
What is the diference in initPlayerServer and initPlayerLocal?
one executes stuff on the server machine, one on local player machine of the player who joined
https://community.bistudio.com/wiki/Event_Scripts
how would you recomend i initialize them?
try to put both the list and code into initPlayerLocal
ill give it a go
I'm not sure, but it could work.
if the uid is defined in initServer you can use init.sqf since is the last to be cheked, or make a waituntil the variable is set.
@jagged elbow And you can check https://community.bistudio.com/wiki/onPlayerConnected as well
Awesome thanks for the help
which eh can i use if a player leaves to the lobby and comes back into game? MPRespawn or onPlayerConnected?
i want to check if a player is relogging and add a script to him,if
as in changing the role without leaving server?
do it serverside. with respawn EH
for example.or combat logging during an event,thats my purpose
store players UID in an array, if UID is already in array on his spawn. then he went back to lobby. or legit respawned
for legit respawn detection you could use killed eh
its for relogging only
i have mpkilled eh already made up and working
will respawn fire on relog?
mpkilled fires globally, probably not a good idea for this
respawn will fire if players respawn on start
instead of spawning into existent AI
what the whole thing does is: on an event that happens on the server and lasts 2 minutes the server will set a pubvar containing the ticktime and setvariable this in a DB var on the player.if a player will relog before the event it stores when he did it that way.now i want the players to relog,getvariable and if var < var + 3 minutes itll know the player has logged out a minute before the event to avoid it.so punishment will follow.
MPKilled -> serverside https://community.bistudio.com/wiki/Arma_3:_Event_Handlers/addMissionEventHandler#EntityKilled
You could try out when PlayerConnected/Disconnected fire
Or HandleDisconnect might also be interesting
playerconnected: Executes assigned code when client joins the mission in MP.
"joins the mission"
oh bughemia^^
Dialog question from me: You wouldn't happen to know how I can scale a UI so text size and pictures scale proportionately. Currently using SafeZone in UI editor at 1080p results in skewed Pictures, and text size seems constant when testing a 4:3 resolution.
Hello, if one is leaning left or right, is there a way to force him upright via script ?
player control
@still forum well playerconnected doesnt fire when just relogging it seems
Dialog question from me: You wouldn't happen to know how I can scale a UI so text size and pictures scale proportionately. Currently using SafeZone in UI editor at 1080p results in skewed Pictures, and text size seems constant when testing a 4:3 resolution.
Solved my problem by deducing element sizes from SafeZoneH.
@sturdy cape Could set a server variable with playerDisconnected, and have the client call a serverside function to check against that variable on initPlayer.
interesting idea
nah,the event itself sets the var already and its written to db on disconnect
the problem IS the actual function on connection
but you brought me to something
initclient file in the addon will most probably run on join
yo ho ho anyone know of a script that:
creates dynamic garbage on streets in front of players and deletes it behind them? kind of like the engima civilian traffic but not civ untis but trash.
i always struggle with laying roadside IEDs in missions bc i cant fill the streets with enough trash to make it not look obvious. i want trash on the street to be the normal thing.
Yo, does alive have a discord or slack?
They have a discord linked in #channel_invites_list
Question. I have an event handler that replaces every bullet a player fires with a given object.
I want to have an event handler that replaces every submunition spawned by every bullet a player fires with a given object. (Specifically shotgun pellets).
Is this possible?
Can i avoid agents to opens doors?
so how would i go about having four boats, one of which the player is in, start moving before the mission starts so that the player doesnt hear the squad lead telling the driver where to move to?
actually come to think about it, is there any way to just supress the squad leader move commands?
There's a command to turn off AI radio protocol on dev branch (sadly not stable yet)
I think there's another way but I'll need to look it up
this setSpeaker "NoVoice" will make them silent but I think the text still appears
that'll work, any ideas for the boats?
Waypoints will make the boats move. Just be careful with their placement so the AI doesn't have to take corners too tight (they will ground themselves). There's not really a reliable way to make them move before the mission starts because...well, the mission hasn't started.
If AI are set to move straight away they can sometimes move while the player still sees a loading screen, but I don't think that can be reliably reproduced (and the player still gets audio)
alright ill just have the audio fade in so the player cant hear the engine start
Is there a way how to spawn an animal in editor ? I know that zeus can do that but i need it in editor for animations
@upper cliff add a mission fade in effect and you will get the cnematic feel you want too.
@slender geyser use the module
To see it's animations, open debug, click animations, filter the faction the the animal and view it's animations
@slender geyser if you dont want to use the editor module, you can spawn one in with createAgent or createUnit
@sturdy cape what does relogging mean? If you leave mission and connect back without leaving server it should fire
Yeah I’ve already got that covered, my problem is more what to do with the 7 or 8 seconds of black
Okay, anyone got any idea what the deal is with the Wildcat's camera turret? I've tried using lookAt on the gunner with the aimPos of another object, but I can't actually get the gunner to turn the camera at all.
it doesn't even work if I try and just look at the object either.
I'm trying to get the camera (and its searchlight) to follow a location I can set with another script, but so far it only occasionally looks at hostiles when it feels like it
Anyone here know anything about alive.
Trying to add some eden units as cas
setup the syncing, put the cas lines in the init
chopper shows up in the intel thing, but it says unit is combatineffective.
Its a crew MH60
does it have any forward-facing guns?
@upper cliff Use BIS_fnc_EXP_camp_SITREP or BIS_fnc_typeText (or a couple of other similar functions) to show a mission title or a time/location over the black screen
Right. I'm trying to make a temporary speed buff that refreshes its timer every time you fire. I've got the "temporary speed buff" part working, and I think I've cracked the "refreshes its timer" part.
I just need a quick sanity check on what I've got so I can go to sleep happy and implement it in the morning.
// in a "FIRED" EH
// Start the buff
(_this select 0) setAnimSpeedCoef 1.5;
// Increment the buff stack counter
(_this select 0) setVariable ["speedBoost",(_speedBoost + 1),false];
// Spawn a thing so I can use sleep
(this select 0) spawn {
sleep 20;
// Decrement the buff counter
_this setVariable ["speedBoost",(_speedBoost - 1),false];
// If the buff counter runs out, turn off the buff
if ((_this getVariable "speedBoost") <= 0) then {
_this setAnimSpeedCoef 1
};
};
Is there a counting function that emulates the unique varname renaming in the editor? VarName -> VarName_1 -> VarName_2, etc?
Loadout contains non-arsenal item 'novoice' so players must have a voice now if they want to save/load loadouts to arsenal?
Enemy vehicles without any sensor(passive or active) are too sensitive with missile.
When I shoot missile, enemy vehicles just pop smoke after second.
How can I change this? I want to make them to evade missile with random chance.
I'm not familer with AI so please give me a hint.
@hallow mortar the private var _speedBoost won't be defined inside the spawn scope, you need to pass it as an argument
Hey ACE folks.
How could I add a ACE Arsenal Interaction in an area.
Not in an object.
If in area, can ace arsenal.
Tried setting up a trigger, or something.
Didn't work cause the add action didn't seem to work.
@hallow mortar
I want to have an event handler that replaces every submunition spawned by every bullet
There is a mod config only ammo eventhandler which fires on submunition deploy. That might be able to do it.
@hearty plover
If in area, can ace arsenal.
addAction onto player himself, and add a distance check in condition. The distance check will run every frame tho, so perf and such. Or you add/remove the action on trigger enter/leave
Is the trigger any better?
On perf?
I can delete the trigger, which is nice.
Ment to be a sort of gear up phase after a breifing, so once that phase is done it can go away.
you can remove the action too
I think it'd be roughly the same...
maybe the trigger would check less often than the addaction condition would
Can anyone post function code of BIN_fnc_attachChemlight ? apparently it is in new DLC according to @pierremgi. I don't have Contact DLC yet.
can someone point me in the direction of how to disable action to treat AI wounded? I want to add my own custom one.
ACE probably does that somehow, you might look into their medical or ask on their Slack.
They don't, AFAIK you cant disable this action, they just replace FAKs and Medikits with another items that are not treated as medical items by engine.
hey, i got myself a marker and made it tell me the objects of all trees in it (on takistan) but i cant read the trees classnames. why is that?
[169053: b_pinusm1s_ep1.p3d,169031: t_populusf2s_ep1.p3d,169047: t_populusb2s_ep1.p3d,169026: t_populusb2s_ep1.p3d,169090: t_populusf2s_ep1.p3d,169089: t_populusf2s_ep1.p3d,169029: t_populusf2s_ep1.p3d,169054: b_pinusm1s_ep1.p3d,169044: t_populusb2s_ep1.p3d,169046: t_populusb2s_ep1.p3d,169030: t_populusf2s_ep1.p3d,169045: t_populusb2s_ep1.p3d,169087: t_populusf2s_ep1.p3d,169088: t_populusf2s_ep1.p3d,169057: b_pinusm1s_ep1.p3d,169027: t_populusf2s_ep1.p3d,169043: t_populusb2s_ep1.p3d,169086: t_populusf2s_ep1.p3d,169015: t_amygdalusc2s_ep1.p3d,169092: t_ficusb2s_ep1.p3d,169058: b_pinusm1s_ep1.p3d,169028: t_populusf2s_ep1.p3d,169093: t_ficusb2s_ep1.p3d,169055: b_pinusm1s_ep1.p3d,169056: b_pinusm1s_ep1.p3d,168990: t_ficusb2s_ep1.p3d,168987: t_populusb2s_ep1.p3d,169091: t_ficusb2s_ep1.p3d] //array of _trees = nearestTerrainObjects [_MarkerPos, ["tree"], 150] select {_x inArea _MarkerName};
//typeOf _x returns: ""
They are simple objects and have models only.
does that mean i can not spawn them via script?
they are terrain objects, they don't have classes
eh the whole point is im to lazy to place small forests in editor so im gonna fill a marker with said trees.
finding each models classname defeats the purposes of being lazy.
Will try createsimpleobject
okay it works, uh but my trees spawn buried in the ground. Assume model center is somewhere up in the tree. suggestions how to read and fix this offset?
solved it. will post how to soon
How to get trees on an arma map and spawn them with correct z offset via script:
//place a marker on the map over the forest you want to get the tree types from
//---------------Get all trees and their respective model paths in this marker:
_MarkerName = "marker_27";
_MarkerPos = getMarkerPos _MarkerName;
_classList = [];
_pathandPos = [];
_trees = nearestTerrainObjects [_MarkerPos, ["tree","bush"], 150] select {_x inArea _MarkerName};
{
_info = getmodelinfo _x;
_zOffset = getPos _x select 2;
if !(_info in _classList) then {
_classList pushBack _info;
_pathAndPos pushback [_info select 1,_zOffset];
};
} forEach _trees;
copyToClipboard str _pathandPos;
//returns something like this:
[["ca\plants_e\bush\b_pistacial1s_ep1.p3d",2.31839],["ca\plants_e\bush\b_pinusm1s_ep1.p3d",0.960999],["ca\plants_e\tree\t_populusf2s_ep1.p3d",13.7293],["ca\plants_e\tree\t_ficusb2s_ep1.p3d",9.57343],["ca\plants_e\bush\b_amygdalusn1s_ep1.p3d",0.966705]]
//-----------------------------------spawn these trees (in a line just for demo purpose)
_treeArray = [["ca\plants_e\bush\b_pistacial1s_ep1.p3d",2.31839],["ca\plants_e\bush\b_pinusm1s_ep1.p3d",0.960999],["ca\plants_e\tree\t_populusf2s_ep1.p3d",13.7293],["ca\plants_e\tree\t_ficusb2s_ep1.p3d",9.57343],["ca\plants_e\bush\b_amygdalusn1s_ep1.p3d",0.966705]];
for "_i" from 0 to 20 do {
_pos = getPosASL player;
_treeInfo = selectRandom _treeArray;
_tree = createSimpleObject [_treeInfo select 0, _pos];
_treePos = getPos _tree;
_tree setpos [(_treePos select 0) + _i*5,_treepos select 1,_treeInfo select 1];
};
hope someone can make use of it on future 😃
Guys, for my health system I'm showing amount of Health while player is alive and "You died" if they are dead. UI part is controlled by while do loop. The thing is I'm using exitWith {//code that changes "health: nnn" for "you died"}. But on player Respawn the exitWith scope stays and Health UI is not getting reset, stuck with you died for some time. If I'm using while { alive player } the UI resets OK, but it never shows "you die" string as it is shown on if (_health <=0) so it's just don't work because while loop exits immediately on player death. Any recommendations? Thanks!
Ok, fixed it trivially.
if (_health <=0) then {// show "you died"};
if (!alive player) exitWith {};```
Returning to the refreshing speed buff I was trying to make last night. I'm now (I think) passing variables to the spawned script correctly. But, the buff isn't being removed when the timer runs out. No script errors, just...not slowing down again.
_unit addEventHandler ["Fired",{
// Define variables
_shooter = (_this select 0);
// Start the buff
_shooter setAnimSpeedCoef 1.5;
// Increment the buff stack counter
_shooter setVariable ["speedBoost",((_shooter getVariable "speedBoost") + 1),true];
// Spawn a thing so I can use sleep
_buff = [_shooter] spawn {
// Define variables for inside the spawn
_shooterS = (_this select 0);
sleep 10;
// Decrement the buff counter
_shooterS setVariable ["speedBoost",((_shooterS getVariable "speedBoost") - 1),true];
// If the buff counter runs out, turn off the buff
if ((_shooterS getVariable "speedBoost") <= 0) then {
_shooterS setAnimSpeedCoef 1
};
};
}];```
have you tried adding diag_log's everywhere so you can see what's going on?
that'll be the next step, I guess
I don't do a lot of this
well, I put in a couple of diag_logs to get the value of speedBoost at key points, but...there are no corresponding lines in the rpt after testing
the only relevant error I see is some "Client: Nonnetwork object" stuff, but I can't tell if that's actually relevant
I know the script must be running up to the point where speedBoost is first defined, because the line before that is the one that turns the speed boost on, and I do go faster
not relevant
maybe your changes adding the diag_logs didn't get into the game
maybe still running old code
I reloaded the scenario, still nothing
well something has to be logged ¯_(ツ)_/¯
14:40:01 Starting mission:
14:40:01 Mission file: fa3_a28_the_crucible_v2
14:40:01 Mission world: Enoch
14:40:01 Mission directory: C:\Users\Lawrence\Documents\Arma 3 - Other Profiles\NikkoJT\mpmissions\fa3_a28_the_crucible_v2.Enoch\
14:40:03 soldier[B_W_Soldier_AR_F]:Some of magazines weren't stored in soldier Vest or Uniform?
14:40:03 soldier[B_W_Soldier_LAT_F]:Some of magazines weren't stored in soldier Vest or Uniform?
14:40:03 soldier[B_W_Soldier_LAT_F]:Some of magazines weren't stored in soldier Vest or Uniform?
14:40:03 soldier[B_W_Soldier_AR_F]:Some of magazines weren't stored in soldier Vest or Uniform?
14:40:03 soldier[B_W_Soldier_LAT_F]:Some of magazines weren't stored in soldier Vest or Uniform?
14:40:03 soldier[B_W_Soldier_LAT_F]:Some of magazines weren't stored in soldier Vest or Uniform?
14:40:04 c:\bis\source\stable\futura\lib\network\networkserver.cpp NetworkServer::OnClientStateChanged:NOT IMPLEMENTED - briefing!
14:40:07 Sound: Error: File: a3\sounds_f\vehicles2\armor\shared\add_layers\rattling_03_ext.wss not found !!!
14:40:07 Mission id: b17562108f04eca3609b5d6618c4b10bcbc28553```
and then a one minute gap until I end the mission and return to the editor.
then you eventhandler doesn't run
if it would run, it would log
if it doesn't log, it doesn't run
I trust a machine's doings more than a human stating what he's doing
Skynet thanks you
I can tell you straight up it runs. The first thing it does after I fire is increase my movement speed by 1.5. I can tell I'm running faster.
Hell just for you I'll make it a multiplier of 5 and take a video
@hallow mortar disable EH, retry, check
maybe you re looking into the wrong rpt
There's only the one from today
@still forum https://streamable.com/oji7f
Things I'm logging:
- the AnimSpeedCoef immediately after I set it
- the speed boost counter immediately after I set it the first time
- the speed boost counter immediately after I set it the second time
- the AnimSpeedCoef immediately after I reset it to 1
Things that are being printed:
- the AnimSpeedCoef immediately after I set it
_unit addEventHandler ["Fired", {
params ["_shooter"];
// Start the buff
_shooter setAnimSpeedCoef 1.5;
// Increment the buff stack counter
_shooter setVariable ["speedBoost",(_shooter getVariable ["speedBoost", 0]) + 1, true];
// Spawn a thing so I can use sleep
private _buff = [_shooter] spawn {
params ["_shooter"];
sleep 10;
private _speedBoost = _shooter getVariable ["speedBoost", 0];
_speedBoost = _speedBoost - 1;
// Decrement the buff counter
_shooter setVariable ["speedBoost", _speedBoost, true];
// If the buff counter runs out, turn off the buff
if (_speedBoost <= 0) then {
_shooter setAnimSpeedCoef 1;
};
};
}];``` corrected and formatted
dont log the effects, directly put ```sqf
diag_log "Hello this is script x im at line 5"; ```" soemwhere
I'll try that corrected version
what's the purpose of the change to the getVariable bits?
(fixed)
just in case a setVariable was never set before, the right value defines the default value that should be returned
Does terminate work on an execfsmed script as well?
what does the biki say?
Terminates (aborts) spawned or execVMed script.```
execFSM returns a number, so no
Are you sure about this part?
if (_speedBoost - 1) <= 0) then {```
i.e. shouldn't it be just `if _speedBoost <=0`
or does `_speedBoost` just not get automatically updated when the variable is decremented?
not updated
Right, makes sense then
ta-da, unset variables yep
with pleasure!
also, try prefixing your global variables (like NIK_speedBoost or something)
...when you say the variable is "global", you mean "globally visible but still tracked uniquely to the unit it's set on", right? Because this is supposed to work in multiplayer and not cause everyone to go faster when one guy fires
yeah no the prefix is made in order for your code not to interfere with someone else's script potentially using the same var name
for example, if I publish a script with SUCCESS = true for my operations, it may trigger your scripts if you do the same. if we have LMS_SUCCESS vs NIK_SUCCESS it's all fine 👌
Anyone got any idea how to control where a turret gunner is looking? lookAt doesn't work, and they don't seem to respond to doTarget or doWatch either.
doWatch works fine, it is arg Local, though, so you may not be running it correctly.
How would I run it correctly?
How are you running it now? in what environment?
Where is this running? _copilot is a local (scope, not locality) variable. If you just run it in debug console it means nothing.
I use this
//look here
private _u = (curatorSelected select 0 select 0);
private _p = screenToWorld [0.5, 0.5];
[_u, _p] remoteExec ["doWatch", _u];
Zeus select a unit (eg gun truck), and run local.
Oh copilot camera turret might be a different thing. setPilotCameraTarget ?
No, tried that. That affects the Pilot Camera, which in the Wildcat (in this instance) is a downward-facing camera for sling-loading.
crew _helicopter outputs the copilot as [Turret, [0]]
So I'm getting the _copilot using _copilot = searchHelo turretUnit [0];
It's outputting his information correctly using systemChat (name _copilot) so I have the right guy.
But he doesn't respond to lookAt, doTarget or doWatch for actually changing where the turret faces.
try running doWatch on the vehicle, not the copilot unit.
Only seems to affect the pilot.
Works fine on a Mora, but not with the Wildcat.
I know said turret is armed with a laser designator, could I 'force' the AI to look where I want it to by getting it to lase a specific location?
Okay; I get a twitch out of the camera using the commandTarget function. Is there a disableAI argument to control where an AI looks?
I think the AI is currently overriding any watch commands.
I think you might have to work around making it point the camera and just script the end result.
Possibly. Interestingly enough, the AI seems happy to track targets on its own; the only way I've found to get it to change targets is by simply removing its current target from LOS for long enough.
Maybe try reportRemoteTarget and then doTarget? on the vehicle so the pilot/group leader isn't ordering copilot to look at original target.
He shouldn't with doTarget anyway.
Interestingly, you can't even control where he's looking in-game by being his group leader and using the "watch there" commands.
Okay, I can't get a gunship to adjust its turret to 'look' at a specific target either, be it by doTarget or lookAt.
Doesn't work for the helo. I don't know if the turret is named "MainTurret" though, is there a way to identify them?
I've only got the path at the moment ([0])
glanceAt also does nothing.
quick one: code for creating a groundweaponholder containing X items?
sounds strange but couldnt find that quickly
nvm found it now^^
@ivory jetty I am in front of my PC now. Which helicopter are you trying to turret-turn?
Hellcat.
the cam turret I suppose?
@ivory jetty "obsturret" / "obsgun" I suppose (from animationNames)
trying right now
nope.
Yeah, was looking at the co-pilot's observer camera with the spotlight and laser designator.
well IDK, but even with a tank it doesn't seem to work. I might be missing something
seems you can't this way, only with the UGV so far
@ivory jetty …doTarget works
I didn't get it working when I tried.
If the copilot already has a target, he won't switch.
does init.sqf run locally once on all machines?
ie. is the difference to initPlayerLocal.sqf is that init.sqf will be run on the server as well?
ye
ofc the order is also different
one runs before the other, if that matters to you
Quick question the HMG on the offroad is a separate turret from the vehicle if so does it have a classname?
PLZ HELP, players are getting this message all the time now. "loadout contains non arsenal item 'novoice'". This started happening after i allowed all items in the arsenal to fix loadouts being grayed out. players no dont get grayed out loadouts but some get this error message instead. plz plz help.
hello, is possible to change model and model.cfg and load it with diag_mergeConfigFile?
@still forum they are saying that they can load their load out that is producing the error on other servers. Does that rule out an arma bug?
no
that is the bug
wait
well maybe
It depends on an item, that you cannot add to a limited arsenal
but might be included in a full arsenal
anythoughts on common cuases for why some loadouts dont work
whatever, that "novoice" thing is part of the bug. Definitely.
ok
ACE arsenal works if you happen to have that
no i dont use ACE. i just put this in the init of my ammo box.
["AmmoboxInit",[this,true]] spawn BIS_fnc_arsenal;
@still forum is that good or bad method?
hmm
besides the fact that sometimes items are not allowed in Arsenal at a specific server (parameters of BIS_fnc_arsenal, mods, etc), there's currently also a bug with the Arsenal and certain items (most known are the TFAR radios)
i got players with basic simple loadouts and owning all dlc and getting the error.
there is a script to fix tfar radios in saved loadouts
i got to be doing something wrong. cuz its a lot of players aleast a dozen or so
and 4 of them are on right now and use the loadouts on other servers with no problem
what dumb things do scripters like me do to cause problems with arsenal, and ill go see if im doing them. really i dont do anything at directly with arsenals except put that code in the init. maybe something in the descriptions file or something???
as I said, Arma bug.
ok
hi partyppl. i need a script were the AI mans the statics automaticly when build. who can help me?
Hello there, guys i've run into some problem, let's start with litlle backstory here: we had problems with desync on our server, after few weeks we removed broken mods but realized it was only half of the issue. There seems to be some clunky fired eventhandler added to player. Basicly when player shoots on his side it's perfectly fine, but on the other he is teleporting, and firing with like 1 sec cooldown betwen shoots. He is still shootin even if he lowered his weapon and empty his mag. We used simple russian enginering techology and added " player removeAllEventHandlers "fired"; " in our init.sqf for mission yea it fixes 90% of problems but we don't want ot break ACRE or ACE functionality so is there a way that will show me what eventahandlers and from where they came from on unit?
@austere silo well, either place the statics with a crew (in editor or Zeus), or use moveInTurret to make AI man a static.
If it's for some custom game-mode with building, you might need to handle some kind of build event and make a script around that
ok thx for the quick answer
i want to place it manned with a crew but not working. idk why
doesnt matter i will try it out
not a big deal
i thought there is a ultimate script for that
@devout wolf perhaps better to first identify which mod is causing the issue, or if it's the mission or even server causing the issue.
Normally mods like CBA, ACE and ACRE/TFAR won't cause such issues
i know, idk which mod we got like 500· PBO files to check
i think it's local eventhandler because as soon as player stops shooting everything is back to normal
removed some supress and shit pbos and still no difference
- disable all mods, check server
- add 1 mod, check server
- add another mod, check server
- repeat 3 till issue found
- remove/fix mod, continue with 3
Yeah I have done that once with a 20 mod modpacj
Took two days about 16 hours total.
damn
Quick question the HMG on the offroad is a separate turret from the vehicle if so does it have a classname?
every eventhandler has added it's own id?
as i remeber
like if i spam some eventhandlers it will be id like 1,2,3,4,5 etc?
or something?
@dusk badger no, it's a different vehicle (eg. B_G_Offroad_01_F vs B_G_Offroad_01_armed_F)
Ok thank you @exotic flax
@devout wolf as far as I know there is no function to retrieve all (active) event handlers in vanilla arma.
For CBA you could try:
_events = allVariables cba_events_eventNamespace; // this should contain all CBA events
Hey guys, I'm looking to create scripting tutorials. First thing I'd like to go over is "External Engine Files" init.sqf / initserver.sqf / onplayerrespawn.sqf etc
Where can I find a comprehensive list of all the accepted file names?
Thank toy
What's the ALiVE classname respawn for civ? ALiVE_SUP_MULTISPAWN_INSERTION_CIVILIAN_F ? no idea how to call it (yet)
does anyone know the exact setAperture and time of the missions in arma 3 contact?
Nope, as the missions are ebo'd
dePBO them?
You can extract them with loadFile. 😬
I know we have createSimpleObject to create objects dynamically, but is there a command to delete objects? Or to create dynamic objects?
deletevehicle doesnt work?
deleteVehicle does work
That was an answer for @ivory jetty question
yes. And me answered your questionmark
Perfect 
Could I use that to create something like a huron container?
@granite falcon During Contract campaign: daytime: 22.4004, date: [2039,7,3,22,24] Trying to get aperture right now
R3vo you’re a legend appreciate you bud
you proved me wrong you dirty— congratulations guys! :D
@cosmic lichen @hollow thistle
It's quite easy
Just use a mod which enables debug console everywhere 😃
As it happens, I made such a mod years ago
Viewdistance seems to be limited to 2000 on the lower end.
yet 30 FPS top, here
||There are 163 units placed in the second mission||
Disabling simulation and hiding them give me +10 - 15 fps
@cosmic lichen why you tag me?
Hi I use BIS_fnc_establishingShot as mission intro works like charm for years now but I'm missing one thing different vissions like NVG or thermal, does anyone know a way to add that or do I need to make my own establishingShot to add that feature?
You can excuted true setCamUseTI 1; directly after you spawn BIS_fnc_establishingShot and see if that works.
will try that, thanks
setCamUseTI and camUseNVG
seams to work, it's a little bit darker then I expected but much better then nothing. thank you
Hi guys! What is the best way to attach icon to the player model relatively?
This way works semi-excellent but, when I sit up or jump the vertical align stays the same 2 meters, which looks awkward
onEachFrame {
_pos = player modelToWorldVisual [0, 0, 2];
drawIcon3D ["", [1,1,.5,1], _pos , 0, 0, 0, name player, 1, 0.05, "PuristaMedium"];
};
That set the icon text far away from me
Like that far: https://monosnap.com/file/HAfoDQUNR0gA1DD92VYcDklY4R9Nnl
Oh, got it fixed with _pos = _x modelToWorld (_x selectionPosition "camera");
Thanks @copper raven!
@still forum what did arsenal break in ace?
What tab they are in?
none
scope=1
they are hidden
Also the switched weapon laser attachment
is also scope=1
So you could not load loadout with them in?
yes
How do you add one
Player or AI
AI should work too I think
Or use the visible laser light attachment on weapon.
Then switch it over to visible mode, that will replace it with the scope=1 version
Is there a cfgdogtags or something?
Derived from?
@cosmic lichen did they actually just not use enabledynamicsimulation or just disable sim? is that one of the reasons why the performance is so bad?
Hmmm, unsure if this is a scripting thing or not. But what would one need to display diary records on a screen in cTab's android.
Is the cTab author still active enough to ask?
@plain urchin I don't think AI is the main issue, even after disabling and hiding all of them, performance isn't great
radio frequency scripts maybe
There is a lot of stuff going on scripting wise in the campaing for sure.
They've created 3 DLLs/Extensions just for it. (take a look in Contact folder)
They would not need them for simple scripts 😉
has anyone figured out how to disable the electromagnetic spectrum map/other mapmode on the Arma 3 contact map screen? :L
also its such a bummer that theres so much content and stuff that mission makers could use in MP (animations, the cool new map/task system) and its all locked in singleplayer and only accessible if you have the DLC loaded 😦
figured out how to hide certain maps, it's the BIN_fnc_showMapOptions function
Question. With sqf how can I somehow maybe write a book that can call to a node.js server with some text payload or maybe a request.
Hook*
@hearty plover extension
I saw it. I about came in my pants.
Bless you arma community you beautiful bastards.
All together, our pants are stronger
What's a good place to put the CBA add setting function when making an addon?
Just found it, thanks
Is there way to get side of uniform? no side is not working.
yes
CfgVehicles >> uniformclass >> modelSides
array of sides that the uniform supports
isn't there a BIS fnc that does it already?
Guys, is there any list of AI features in Biki or smwhr else? Like the ones that go with checkAIFeature. Thanks.
//Measure text box size and put array to text box. And resize with text height and width.
private _text_box_size = ctrlPosition _preset_contents_text;
_preset_contents_text ctrlSetStructuredText composeText _preset_contents;
private _text_input_width = (ctrlTextWidth _preset_contents_text) + 0.01;
private _text_input_height = (ctrlTextHeight _preset_contents_text) + 0.01;
_text_box_size set [2, _text_input_width];
_text_box_size set [3, _text_input_height];
systemChat str _text_box_size;
_preset_contents_text ctrlSetPosition _text_box_size;
_preset_contents_text ctrlCommit 0;
https://www.youtube.com/watch?v=6cAqDmZdmCw
This code doesn't work reliably...
I really don't know why. Please help...
@ivory jetty this list looks unfinished, because if you'll go to the checkAiFeature there are things like AwareFormationSoft which are not in the list
@manic bane https://community.bistudio.com/wiki/ctrlPosition returns position and size?
@dull drum ah that's the only ones
Returns the current position of 2D control as [x, y, w, h] array
@winter rose Oh. Thanks.
I really confused.
Did anyone have a good mess with AI tweaking? FSM and stuff? I'm trying to create a unit that will be controlled RTS style and it should be dumb simple, like go and kill, no smart ass covering, evading fire, lying down and shit 😃
@dull drum you should use agents then 😉
@manic bane [x,y,w,h] - position x, position y, size width, size height
@cosmic lichen Okayface.jpg
That code gets original [x,y,w,h] and modifies that with text width and height.
so it sets w into text width and h with text height.
Unrelatedly, can a switch case have multiple conditions? i.e.
...
case ("condition_one" OR "condition 2") : {thing}```
yes
thanks
@manic bane why use
private _text_input_width = (ctrlTextWidth _preset_contents_text) + 0.01;
private _text_input_height = (ctrlTextHeight _preset_contents_text) + 0.01;```
if you want `_preset_contents_text` dimensions… use `ctrlPosition`?
😕
I think I need another approach. Thx
But width and height from ctrlTextWidth and ctrlTextHeight is diffrent between ctrlPostion result. They gives me 'text' width and height.
So I can adjust RscStructuredText size properly so RscControlsGroup makes scroll bar properly.
do you want width from the control's text or from the control itself?
text
width is fine but height is problem
Please watch this test video. ctrlTextHeight doesn't give reliable results.
Then you are doing something wrong
It should go like this
ctrlSetText
ctrlTextHeight
ctrlSetPositionH <acquired new height>
ctrlCommit
Okay I gonna try that.
ctrlSetPositionH this looks good
Still need ctrlCommit
//Measure text box size and put array to text box. And resize with text height and width.
_preset_contents_text ctrlSetStructuredText composeText _preset_contents;
private _text_input_width = (ctrlTextWidth _preset_contents_text) + 0.01;
private _text_input_height = (ctrlTextHeight _preset_contents_text) + 0.01;
_preset_contents_text ctrlSetPositionH _text_input_width;
_preset_contents_text ctrlCommit 0;
_preset_contents_text ctrlSetPositionH _text_input_height;
_preset_contents_text ctrlCommit 0;
Like this?
ctrlSetPositionW for width
oops
It only makes control taller
Because when text is long, I want horizontal scroll bar
You need to put it in controls group maybe, or use different type of control, there are options but some may not be available to scripts only config
You can use non break space to stop wrapping too I think
What control type is that?
it is StructuredText
The question is, why not simply increase the whole width of the dialog, instead of fiddling around with workarounds
and that structured text is within a controlGroup?
yes
Is your width of the structuredText larger then you width of the controls group?
make it smaller and you have your scrollbars
I'm trying NBSP now
Performance warning: SimpleSerialization::Read 'qgzgufeognklzi' is using type of ,'CONTROL' which is not optimized by simple serialization, falling back to generic serialization, use generic type or ask for optimizations for these types
can we have optimizations for controls and displays? 😃
don't think so
as serializing controls rarely makes any sense
No sense in transferring over network because other clients won't have same controls ever.
No sense in storing into savegames as displays aren't kept open afaik
@minor lance
(…) getVariable ["tag_varName", defaultValue]; // in case it was never set```
hmm
You are mixing up isNull and isNil I think
isNil is for checking undefined right.
i use isNil for dialogs
if your variable is not defined, the getVariable returns nil. Which will make isNull error and also return nil, which will make ! error and also return nil, which will make waitUntil error and exit
null is a value, nil is undefined.
yes
That's how I tried to rember it.
🤔
! can only ever return bool.
So when you give it nil and it errors, it returns a nil of type bool
wish it just said error expected bool got undefined type bool
or even better nil type bool
so... !isnil {(uiNamespace getVariable "ada_hud")}
Dedmen, are you in the ACE slack?
yu
Can ya get me a invite please.
already told them about broke slackin
yesterday actually. responsible guy was notified
I think only he can also manual invite, not sure
That would be great.
I had some questions about adding actions to civ's, as well as I am working on a idea I think may be okay for ACEX, I would like to see the diary used more, and wanted to move it to a item you hold, and then via self interaction you get a dialog / gui of a basic diary you can read.
Making obtaining intel a bit more immersive.
Flow would be something like... has diaryObj, ace self interact -> checkNotes -> renders diary and task info.
This would make tasks / diary entries more useful for milsim mission makers who disable those kinds of hud / gui elements like waypoints / markers etc.
I know it's probably a bit niche however.
I'd love more immersive intel stuff. But then please also add zeus module to place such intel 😄
and you need to think about how you make "has intel" because if you make ever "note" so to say an item, you'll need unique items that you can identify
like the dogtags you'd have a thousand items probably
I have not seen a use for them and am wondering if I can disable that feature, as I imagine it generating all that is heavy.
Oh, okay.
To id a body.
no generating them is not heavy at all
they are actually only generated when you grab the dogtag from a body
Ooo, smart.
But yeah, I just feel intel is not used very well.
I would like the notebook to be private to the player, and leave it up to them to share intel.
Creating a new reason to communicate up / down the comms pipeline.
Conducting AAR's would be a bit more involved.
In the intel zeus thingy that my group uses (I guess it might be from Ares) only the guy who finds the intel can see the text
I like that idea allot.
But needs some way to share your intel with the team/squadlead
like, you walk up to him and use ace interaction to "give intel"
which then get's added to his diary
I am going to write up a overall design spec, and then make sure nothing I am doing is too out of scope to be considered for acex
is ace menu not included in basic ace?
yes
by yes you mean no, not included?
Oh
it is in basic ace
Maybe not have items for intel afterall. Just have an item for a diary that you need to have to be able to open it and add entries to it.
The intel things are objects on ground that have a "Take Intel" ace action on them. That way you don't have the intel items in inventory you just virtually add it to your diary
how do you bring it up because I couldn't and it said somehwere that it is dependend on ace advanced menu or something
is it win key based?
yes
oh I use that key already
windows or ctrl+windows (or shift? dunno, I just do it I don't think about what key :D) for other remote menu
you can just rebind in addon key settings
How can I remove part of string?
I tried splitString but since each characters are used as a separate delimiter,
I cannot solve problem like this,
"PYLONBAYRIGHT1" splitString "PYLON";
What I wanted :
["BAYRIGHT1"] or "BAYRIGHT1"
Result :
["BA","RIGHT1"]
Is there any solution for this?
Syntax 3 (You can couple with things like find to locate whatever you want to split)
If I make it to select everything after N, it will return "BAYRIGHT1".
But what if same script encounter string like "BAYRIGHT1PYLON"?
"PYLONBAYRIGHT1" select[("PYLONBAYRIGHT1" find "BAYRIGHT1"),count("BAYRIGHT1")];
Thx!
alright so here's my problem, I have two ai doing an executionvictim_loop animation
in the editor the z rotation value is 48
but in game they end up at like 273 or something
So I understand when CBA Extended_PostInit_EventHandlers and Extended_PreInit_EventHandlers are ran, but what kinds of scripts should I put in a PreInit versus a PostInit?
Well I have sometimes used the initialization line of objects to "tag" them for particular purposes... For example: this setVariable ["MF_HasIntel", true]; ... Then a post-init or some other script reads that an apply appropriate processing to those objects. This would not work in pre-init.
so for example with pre init I would do stuff like add a CBA key bind or do stuff that doesnt depend on any object, and post init would be for say adding a Event Handler to a vehicle
I generally use pre- unless I have a particular need for post-.. But I think most (all?) of my usage of preinit postinit that is not "attached" to a particular vehicle class got replaced when CfgFunctions got preInit and postInit.
yes. Generally use preInit, unless you need post for some reason
Though looking over the BIKI one advantage of XEH PostInit might be that it is unscheduled (if I recall correctly) where as CfgFunctions's postInit is scheduled.
all XEH is unscheduled yes
but postInit still makes the game wait till you're done
so if you need unscheduled you have to spawn manually anyway
ah thats nice
@still forum Yeah, I didn't want a "Take Intel" action at all, I wanted it to be a bit more natural.
There is a "9line & notebook" mod. I am gonna reach out to them.
See what advice they have
alright i think my problem comes not from the animation like I thought, but rather that the AI are somehow rotating around a certain point
Is scripting using the "Extended Debug Console"?
Anyway, I asked this in #arma3_config yesterday, and was directed here.
Is there a way to equip/add the Guided/Laser Guided munitions to the Mk6 Mortar? I know it already has them as possible magazines, but the loadout does not use them.
https://community.bistudio.com/wiki/Category:Scripting_Commands_Arma_3 remove and add magazine commands could do the trick
And that would be using the "Extended Debug Console"?
if you cant edit the mission itself then that proably is a good way to do it
Well, that took an hour to figure out...
vehicle player addMagazine ["8Rnd_82mm_Mo_LG",8];
Is what I ended up using, which gives the mortar I am currently in 8 rounds of the Laser Guided munitions.
Is there any way to set it to give all mortars, even those I'm not in, the rounds?
put it in the init field of the mortar and replace vehicle player with this
How/what is the init field of the mortar?
I tried this (and _this) several times, and never seemed to get it to work.
Anyone know the setHit string for hull?
hull of what?
helicopter
you should be able to find it with this
@tall mural perhaps you need to start over and explain what you are doing. are you making a new mission, are you spawing the mortars on the fly with some method?
In a mission (well, various ones), mostly from LAN/self hosted stuff solo.
Mortars are ones I find (loot)/buy/build (from backpacks) and place myself as the mission goes on.
Just interested in giving the mortars the ability to launch Laser Guided munitions. I'd prefer if I could have all mortars spawn with them, or somehow have them "update" with the appropriate ammunition as I got working for the one mortar I was in, but I'm good with this.
@tall mural How/what is the init field of the mortar? What's the problem? This returns the mortar. Just checked with hint typeOf this;
So, if I get the various inits of the mortars, I can loop through them to give them the ammunition?
@tall mural the init field is a text entry field in the object's attributes window in the Editor. (If you cannot or do not want to open the mission in the Editor, you are going to have a bad time with this.)
Trying to execute code on an arbitrary unit using only the debug console, without knowing the unit's variable name, is...possible, with some limitations, but complicated. If you can open the mission in the Editor you will find it much easier.
Well, the missions aren't exactly ones I can open (other people host them and such), so... 🤷
But I got it working for the mortar I get into, so it's simple enough for me to do now. Not like I spawn dozens of mortars...
Thanks to all of you who helped me out on this!
{_x addMagazine ["8Rnd_82mm_Mo_LG",8];} forEach (vehicles select {(_x hasWeapon "mortar_82mm")});```
This _should_ (someone else may point out an error) add ammunition to all mortars in the mission.
If you are playing a mission hosted by someone else, make sure you have their permission before executing console commands.
ok, I'm trying to get into the eden editor a bit
how can I give assignments to a tank platoon in the eden editor for them to execute on launch
Select the group and place an appropriate waypoint
Waypoints are in the footprint tab on the right, or you can do some combo of shift or ctrl + click/rightclick (I forget which, it should be displayed in the bottom right) to place a basic move waypoint
thank you
@hallow mortar That works! Thanks a bunch!
(And yea, I always check about doing this stuff in other servers.)
hey need some assistance in locailty of EH. I have a "firednear" Eh that i add to civilians which checks a bunch of stuff and writes down times when a shot is detected. from that it decides if it was a warnig shot or if its an "actual shooting" going on so the Civ flees. Now problem is i add the EH to all clients bc EH need to be local and bc each client detects each shot, 1 shot is always read as "multiple shots" -> panic is initiated.
if i only add the EH serverside do i run into problems (all other Civ scritps also run server side)?
what exactly is the reason for EH need to be local?
just trying to understand "EH locality needs" here bc technically i only need to detect the shot on the server, not the players client.
and the civs themselves are also local to the server since they are spawned by script or editor placed
@spark turret you want to use "firedNear" on the civilian? Therefore on the server, yes.
so the only thing that decides the locality of the EH is which machine wants to read it?
well, it will fire on the machine it has been added to yes
i cant remeber why i added the EH to all clients in the first place. it used to be all serverside
"effect local" doesn't mean "it has to be executed on client", "effect local" means "it will fire where it has been added"
kk
"it will fire where it has been added"
Or it will fire where the event happens, usually that.
Though that is usually also/maybe written as arg local. Though you can add it to remote units too, just doesn't do much.
wiki stuff be confusing
ah now thats where i could run into a problem
a non-server-local unit firing next to the server-local civilian with the server-local "firednear EH " wont make the EH fire?
where is the "firing" event local if a player fires?
according to biki:
General information about locality
about player:
a player's unit is always local to the (human) player's machine
does that mean the serverside civilian eh can detect a players shots?
"civilian server eh"?
if the player is not the server, then the server won't see players fired stuff
so can the server detect a player shooting with an EH "firednear" added serverside?
i guess thats the reason i added the EH to all clients.
will need to run some tests bc my problem should not exist in the first place. if the EH can only detect shots fired by machine local units than multi-detection of a single shot shouldnt exist
how do i tell what scripts need to be run server side and what ones can be local
@tough abyss depends on what you want to do with them. 95% should be serverside and only EH stuff that needs to be local to players should be
okay tested the EH stuff on dedicated. FiredNear event has to have a client local EH to be detected BUT the problem is the event is deteced twice. i have no idea why, the EH is only added once but it fires 2 times for each shot
is basicly anything related to the players should be client side and anything the ai has command of should be serverside
not really. except for really specific stuff that requires client locality everything should be serverside
changing a players loadout f.e. should be serverside
well it doesnt really matter, just make sure it only runs on one machine when you add stuff to an inventory otherwise you end up with 4 grenades * 20 clients in your backpack
and the easiest way to only run on one machine is the server by putting: if !(isServer) exitwith {}; in your script
just im new to the whole mp scene i can do some basic scripts but i have no clue how to work them into mp
eventhandlers, animations and sounds need client locality also ace damage
other than that, all can be serverside afaik
what kind of scripts do you run?
and esiest way to do that is wtih the code you pasted right
yes i have that on top of each script:
//SAFTEY FUNCTION TO ONLY RUN AFTER GLOBAL VARIABLES ARE INITIALIZED===========================
if (!isServer) exitWith {};
_GlobalVarsInitialized = missionNamespace getVariable ["IRON_globalVars", false];
waitUntil {
sleep 1; _GlobalVarsInitialized = missionNamespace getVariable ["IRON_globalVars", false];
_GlobalVarsInitialized
}; //BY IRONSIGHT
//=============================================================================================
you can scrap the global vars stuff, thats personal shit but the If is server thing will exit the script if its not local to the server
so the script can run in a. singleplayer b. computer hosted multiplayer and c. on dedicated
know any good tutorials for scripting i can do some basic stuff but not the overly complex stuff
its important to have such failsafe stuff. scripts that run multiple times can kill a server. George floros bloodsplatter script did once bc it ran on each client and we had 5000+ blood splatters spawned after a truck exploded and killed only 5 dudes
lol
well i dont have any tutorials but i guess you can set a goal and then use the Biki and this discord to get help
ah true
but you can use youtube to get into it for real basic stuff like "what is a variable"
this is the basics of what i can do
ah also make yourself familiar with the sqf missionnamespace setvariable ["variablename",value,publicboolean];function for more failsafes
well thats all you need to know already. only that "player" doesnt work in MP except when run locally on the players machine
in which case id just name the guy in the editor and use that instead of player right
you need to get the players unit through other means like
yeah that should work
or use something like allplayers select {_x inarea "thatmarkerForPickup"}
yeah im still wraping my head around _x command it gets me confused sometimes
or you run the script from a trigger and pass the list of players in the trigger to the script
sorry _x variable
_x is a dynamic varialble in a function that checks an array. so f.e.
{_x globalchat "Hi"} foreach allPlayers;
will make each player say hi. the function runs once "for each" position in the array, in this case for each player and _x changes every time to that specific value of the position
so every time it runs _x is the unit of the specific player
also another thing that confuses me is when i have to call a group in a command
{_x globalchat "Hi"} foreach [1,2,3,4,5,];
_x will be 1 and make 1 say hi, then will be 2 and make 2 say hi etc etc etc
group names are ID numbers for groups just like the unit names
you get the name by running
_groupName = group _unit;
_unit needs to be any member of that group
ahh ok
so as long as i change _unit to the name of one of the guys in the group il get the code
yeah or you somehow get the guys name / ID in your script
like running the script from the guys Init in editor, _this will be his ID
im assuming by your color coding anything in green can be whatever i like yes
yeah the orange stuff are variables
so _groupName can be _groupOne
yeah you can name it whatever you like
ah orange sorry partialy colour blind
lol
whelp thats another colour i can add to the list i get mixed up
only variavles you can not name after your liking are the magic ones.
https://community.bistudio.com/wiki/Magic_Variables
like _x
502 bad gateway 😦
nice
btw darklight, you might want to name your markers differently than "marker2". bc if you have more than that 1 script you run into problems fast. name them with timestamps:
_MarkerName = "marker2_" + str round time; //returns "marker2_694"```
yeah i would have that was just a practice script to see if i could get it wroking
alright bud lol
fat fingered the dam cps lock
IM NOT YELLING
is
if (triggerActivated "trigger2" = true ) then insert code here
the corrrect way to check a trigger activation via script
booleans dont need = true.
if (triggeractivated "trigger2") then {} checks for true
See also Multiplayer Scripting on the wiki
given that triggeractivated "trigger2" is the correct way to get true
ah ok
if !(triggeractivated "trigger2") then {} ```// will check for false
for mp
if(!isServer) exit with {};
wait until
{
if (triggerActivated "trigger2") then {unit1 joinSilent unit2}
}
yeah thats basically 90% of what you need to know
whats up with the waituntil?
not isNull player most probably
to this day i do not know how to check for undefined varialbes 😃
isNil
isNil?
isNil.
isNil "myVar"
if(!isServer) exitwith {};
waituntil
{
if (triggerActivated "trigger2") then {unit1 joinSilent unit2}; //code run every waitunlil loop
sleep 5; //sleep 5 for spam avoid
(triggerActivated "trigger2") //boolean value for exiting loop, no ;
};
if (isNil "myVar") then { hint "myVar is not declared"; };```
noticed and noted lou. will add to my Howto
@spark turret so the second (trigger activated) exits the loop
it a boolean. it it = true then the script will exit, yes
last line of the waituntil needs to be a boolean. took me like a week to figure that out lol
do i need the wait until though could i not just run
if(!isServer) exit with {};
if (triggerActivated "trigger2") then {unit1 joinSilent unit2};
yeah you can but then it will only check once
thats fine for the script i was running
if you want to constantly check you need a loop. either a while {} loop or a waituntil loop
the trigger only needs to flip once
from where do you initialiste the "if trigger" script?
the init no?
this is just me being theoretical mind you i currently have it set up in the actual triggers on activation box in the editor
the unit joinsilent bit i mean
which init
remeber your code will check only once when it runs for the trigger. if the trigger is not active at that time, nothing will happen
the mission init
but trigger on activation sounds good for it.
mission init wont work bc it will run on mission start
ah ok id have to run it through execVM right
i havnt a clue
can i have a hint
Do i run it from the triggers on activation box via execVM
so in the trigger on Activation box id put
Null =[] execVm "scriptFolder\joinscript.sqf";
hey im getting an error with the
if(!isServer) exit with {};
its saying im missing an ; after (!isServer)
how should it be then
oh i was using it how Iron sight put it ok
whoops
Hi guys. Any help for getting a right-click event in the 3d world? I've tried this
waitUntil { !isNull findDisplay 312 };
systemChat str findDisplay 312;
(findDisplay 312) displayAddEventHandler ["MouseButtonUp",
{
params ["_control", "_button", "_xPos", "_yPos", "_shift", "_ctrl", "_alt"];
systemChat format [_control, _button];
}];
but apparently it's only for Controls, not for Displays (on the contrary to what Biki says)
Well, to be fair at the end of the UI EH page Biki says also
Since Arma 2, most control-specific events now work for both displays and controls
But why it doesn't work though.
Nope, it's ok. It worked with a systemChat str "PRESSED" there is something wrong with logging the param to the chat.
It's a Zeus display.
waitUntil { !isNull findDisplay 312 };
(findDisplay 312) displayAddEventHandler ["MouseButtonUp",
{
params ["_control", "_button", "_xPos", "_yPos", "_shift", "_ctrl", "_alt"];
systemChat str (_this select 1);
}];
did work well actually
systemChat format [_control, _button]; is incorrect
systemChat format ["%1 %2",_control,_button]; is correct
hey question
do things like flyInheight, limitSpeed or ambient combat animation scripts that are written into a units init box or waypoints ok for MP or do they need to really be in a script with (!isServer)
To be safe, I advise you limit the use of init boxes.
You have to check on all the calls really to understand if something is MP safe or not.
its all on ai controled stuff
Ohh
afaik, init boxes on AI units are local to the server.
As they are owned by the server. Unless that unit is in a players group, or that unit is spawned later via a script called from a remote machine.
I could be wrong about the second part. I really should test that when I get home.
would a chopper the player is in the cargo of count as in the players group
the choper is a seperate unit not controled by the player
I don't think cargo counts.
Also something worth testing.
KK Had a blog about this.
I am gonna see if I can find it for you.
thanks
This is a must read if you are doing any MP stuff.
This one too.
Both explain locality, and how to look at a call and see if it's MP safe, understand where it happens / etc.
Yeah, another good one.
Thank you Lou.
Unwise of me to assume people read the wiki haha.
I mean I wrote it, I may as well advertise it :p
Hey guys, I am trying to make functions for zeus? Is this the right place to ask for help?
You mean Modules?
I have made the module it appears, trying to make the function to execute for example when it is placed on the unit/object
I try to make the wiki a central nexus for all the needed info, ideally without external links
Thank you Jay ❤
Hey, if you ever need help with that let me know. I have been wanting to expand on the wiki for a long time, but have never really known how / didn't want to do a shitty job.
Is this the right area @hearty plover or?
Yeah, I just want to be sure. You want to add a draggable module
For the zues meno
That does some function correct.
Yes correct mate
So I've created the addon and created a module which can be seen by zeus. I have then tried to make CfgFunctions and it is telling me the "misc" function can not be found
Before anything, I've created a few fncs in the misc sqf
Yes mate
I know this is a pain in the ass.
But can you upload what you got to github or something
Send me a link, so I can get a look at it.
Of course mate give me 2 secs
@hearty plover you can ask for an account in #community_wiki to Dwarden 🙂 thanks!
Hey everyone, How can i make a cutscene that is in first person view, and the player character is moving forward but isn't controllable? I am new to scripting so i need a hand :)
https://community.bistudio.com/wiki/BIS_fnc_garage
The exemple of BIS_fnc_garage_data seems wrong, I cant type the config.bin/CfgVehicles/C_Offroad_01_F or make it in strings that the garage still fully opem
what goes wrong?
everything
BIS_fnc_garage_data = [
//CARS
[
//model
"\a3\soft_f\offroad_01\offroad_01_unarmed_f",
//config paths of classes that use above model
[
config.bin/CfgVehicles/C_Offroad_01_F,
config.bin/CfgVehicles/B_G_Offroad_01_F
],
"\a3\soft_f\mrap_02\mrap_02_gmg_f",
[
config.bin/CfgVehicles/O_MRAP_02_gmg_F
]
],
[], //ARMOR
[], //HELIS
[], //PLANES
[], //NAVAL
[] //STATICS
];
Paste that into the debug console and it does not work.
obviously
config.bin/CfgVehicles/C_Offroad_01_F
should be
configFile >> "CfgVehicles" >> "C_Offroad_01_F"
etc.
BIS_fnc_garage_data = [
//CARS
[
//model
"\a3\soft_f\offroad_01\offroad_01_unarmed_f",
//config paths of classes that use above model
[
configFile >> "CfgVehicles" >> "C_Offroad_01_F",
configFile >> "CfgVehicles" >> "B_G_Offroad_01_F"
],
"\a3\soft_f\mrap_02\mrap_02_gmg_f",
[
configFile >> "CfgVehicles" >> "O_MRAP_02_gmg_F"
]
],
[], //ARMOR
[], //HELIS
[], //PLANES
[], //NAVAL
[] //STATICS
];
["Open",true] call BIS_fnc_garage;
yet, still show all vehicles.
["Open",true]
what does true mean?
good question.
it is not a question
its params, but the page never says what params can be changed.
0 (Optional): BOOL - true to open full Arsenal, with all categories and items available (default: false)
anyone help with this script im getting an error sayin im missing a ]
BootsOnTheGround setTriggerStatements [ [insert1] in thisList,
//Activation
insert1 animateDoor ["DoorL1_Open",1]; insert1 animateDoor ["DoorR1_Open",1];,
//Deactivation
insert1 animateDoor ["DoorL1_Close",1];insert1 animateDoor ["DoorR1_Close",1];];```
@astral tendon
params: BOOL - (Optional) true to open full Arsenal, with all categories and items available (default: false)I will make the page more readable.
But change it to false does not do anything.
@tough abyss use
```sqf
your code
```
Im having an issue with the loadouts where players get this message when trying to load their saved loadouts. loadout contains non arsenal item 'novoice'
We also have an issue where players faces dont load. are these issues linked and if do is there something i dont wrong in my server configuration?
@tough abyss also, BootsOnTheGround setTriggerStatements [ [insert1] in thisList, is missing something yes
Yep, looks like it is always full
could be a bug
report
@winter rose can you point it out
Im having an issue with the loadouts where players get this message when trying to load their saved loadouts. loadout contains non arsenal item 'novoice'
should be fixed in hot fix
hot fix that is coming or already released?
i know that arsenal loading saved loadouts issues have been around, can someone give me a list of fixes or issues from the past so i can rule out that this is not something ive done.
wait for the update
you open two, you close only one @tough abyss
OKay boys and gals.
// Argument 0 is module logic.
_logic = param [0,objNull,[objNull]];
// Argument 1 is list of affected units (affected by value selected in the 'class Units' argument))
_units = param [1,[],[[]]];
// True when the module was activated, false when it's deactivated (i.e., synced triggers are no longer active)
_activated = param [2,true,[true]];
// Module specific behavior. Function can extract arguments from logic and use them.
if (_activated) then {
// Attribute values are saved in module's object space under their class names
_bombYield = _logic getVariable ["Yield",-1]; //(as per the previous example, but you can define your own.)
hint format ["Bomb yield is: %1", _bombYield ]; // will display the bomb yield, once the game is started
};
// Module function is executed by spawn command, so returned value is not necessary, but it's good practice.
true
Looking at the docs for https://community.bistudio.com/wiki/Modules
I am trying to understand how arguments are passed into a module function.
For example, dropping a module from zues on a unit, inputing via the diag.
@winter rose it only looks that way cause i splitt it apart to add the notes to what is what
@tough abyss conditions are STRING, too
yeah the bwiki says i can use string
@winter rose Any idea on how to limit the Garage?
@tough abyss without comments, and with ```sqf , what are you actually trying?
@astral tendon I am not in front of my PC right now, sorry
ok i cleaned up the script a bit think im still doing somthing wrong
_doorClose = insert1 animateDoor ["DoorL1_Close",1];insert1 animateDoor ["DoorR1_Close",1];
BootsOnTheGround setTriggerStatements [ "[insert1 in thisList];", "_doorOpen;", "_doorClose;"]```
im trying to have the doors on my ghost hawk open when they reach the lz and close when they leave
Can you ping me latter?
@astral tendon will look into it tonight, yep
Thanks.
@tough abyss can't use private vars in trigger statements
so make em public then
doorOpen = insert1 animateDoor ["DoorL1_Open",1]; insert1 animateDoor ["DoorR1_Open",1];
doorClose = insert1 animateDoor ["DoorL1_Close",1];insert1 animateDoor ["DoorR1_Close",1];
BootsOnTheGround setTriggerStatements [ "[insert1 in thisList];", "doorOpen;", "doorClose;"]```
this look right to you @winter rose
not the first statement "[insert1 in thisList];"
should simply be "insert1 in thislist"
also, your code won't run. you define code such:
doorOpen = {
insert1 animateDoor ["DoorL1_Open",1];
insert1 animateDoor ["DoorR1_Open",1];
};```
```sqf
doorClose = {
insert1 animateDoor ["DoorL1_Close",1];
insert1 animateDoor ["DoorR1_Close",1];
};```
and `"call doorOpen"` / `"call doorClose"`
doorOpen = insert1 animateDoor ["DoorL1_Open",1]; insert1 animateDoor ["DoorR1_Open",1];
doorClose = insert1 animateDoor ["DoorL1_Close",1];insert1 animateDoor ["DoorR1_Close",1];
BootsOnTheGround setTriggerStatements [ "insert1 in thisList;", "call doorOpen;", "call doorClose;"];```
im assuming the trigger in game has to be set to activate on bluefor
aswell
I would say so, yes
that or link the trigger to the vehicle
but why not creating a trigger itself?
Eden > F3 > double-click > ??? > profit
oh in game i thought you meant via script i have one
in eden im just trying to limit my scripting in game to activating external scripts
then don't use triggers
creating a trigger via script is rarely a good thing unless you know what you are doing
im not creating a trigger via script
im setting the peramiters of a trigger in the mission via script
THEN, set the values in Eden! do you recycle this trigger?
private _helicopter = insert1;
waitUntil { not alive _helicopter || _helicopter distance myHelipad < 30 };
_helicopter animateDoor ["DoorL1_Open", 1];
_helicopter animateDoor ["DoorR1_Open", 1];
waitUntil { not alive _helicopter || _helicopter distance myHelipad > 30 };
_helicopter animateDoor ["DoorL1_Close", 1];
_helicopter animateDoor ["DoorR1_Close", 1];```
no the trigger will be used once
the reason im hesitant to do it in eden is i dont know what codes will mess up mp
then right what is needed into it, or don't use it at all
don't make it half here, half there
as long as you make the trigger Server-only, it's fine
so most triggers should be srver only ?
yep
Also that code above is that put into the on act and on deact respectively
of the trigger
or is that a script run from init
the code block above could be spawned from init yes, getting rid of the trigger entirely
but you need a myHelipad reference (or anything else)
question wouldnt the not alive part mean the script wont fire unless the helicopter is dead
it's an or, meaning if it's dead it won't stay in the waitUntil
(and fire the instructions but the heli is dead, sooo…)
Haha, no one likes modules.
uh prob stupid question but should init script have if (!isServer) exitWith {};
im going to assume no
nope. but you can add this to the script I gave you
yeah already did that
hmmmmm the doors still arnt opening
would it be because im testing in sp
yeah i just tried it in MP via lan the doors still dont open
do you have a myHelipad reference, aka the landing H?
yeah
did you set my code in a spawn block in init.sqf?
is Null=[]execVM the right way to execute the script from the init
…no.
ok how do i do this
playMusic "Music1";
cutText ["", "BLACK FADED", 999];
[] Spawn {
cutText ["“I learned that courage was not the absence of fear, but the triumph over it. The brave man is not he who does not feel afraid, but he who conquers that fear.”― Nelson Mandela","BLACK FADED"];
titleFadeOut 20;
sleep 5;
// Info text
["Operation White Knight",
"UXO Site Bravo, Borek ",
"Time 10:00, Date 16, Sep, 2024"] spawn BIS_fnc_infoText;
sleep 3;
"dynamicBlur" ppEffectEnable true;
"dynamicBlur" ppEffectAdjust [6];
"dynamicBlur" ppEffectCommit 0;
"dynamicBlur" ppEffectAdjust [0.0];
"dynamicBlur" ppEffectCommit 5;
cutText ["", "BLACK IN", 5];
sleep 40;
playMusic ""
};``` this is my init script
in init.sqf:
if (isServer) then {
[insert1, myHelipad, 30] spawn {
params ["_helicopter", "_helipad", "_distance"];
waitUntil { not canMove _helicopter || _helicopter distance _helipad < _distance };
_helicopter animateDoor ["DoorL1_Open", 1];
_helicopter animateDoor ["DoorR1_Open", 1];
waitUntil { not canMove _helicopter || _helicopter distance _helipad > _distance };
_helicopter animateDoor ["DoorL1_Close", 1];
_helicopter animateDoor ["DoorR1_Close", 1];
};
};```
@winter rose thats a big negotory good sir the doors dont open I say again the doors dont open how copy
and yes i have the my helipad reference
no errors just doors wont open
@tough abyss do you have the -showScriptErrors flag?
no probably help wouldnt it
yyyup, every time you create content
where do put that in the arma 3 launcher perameters
yes
heli, not pilot or group or anything
only difrence between your code and mine is the name of helipad and i changed that in the script
and distance
oh its under authors not creators
my bad then
[insert1, BootsOnTheGround, 5] spawn {
params ["_helicopter", "_helipad", "_distance"];
waitUntil { not canMove _helicopter || _helicopter distance _helipad < _distance };
_helicopter animateDoor ["DoorL1_Open", 1];
_helicopter animateDoor ["DoorR1_Open", 1];
waitUntil { not canMove _helicopter || _helicopter distance _helipad > _distance };
_helicopter animateDoor ["DoorL1_Close", 1];
_helicopter animateDoor ["DoorR1_Close", 1];
};
};
playMusic "Music1";
cutText ["", "BLACK FADED", 999];
[] Spawn {
cutText ["“I learned that courage was not the absence of fear, but the triumph over it. The brave man is not he who does not feel afraid, but he who conquers that fear.”― Nelson Mandela","BLACK FADED"];
titleFadeOut 20;
sleep 5;
// Info text
["Operation White Knight",
"UXO Site Bravo, Borek ",
"Time 10:00, Date 16, Sep, 2024"] spawn BIS_fnc_infoText;
sleep 3;
"dynamicBlur" ppEffectEnable true;
"dynamicBlur" ppEffectAdjust [6];
"dynamicBlur" ppEffectCommit 0;
"dynamicBlur" ppEffectAdjust [0.0];
"dynamicBlur" ppEffectCommit 5;
cutText ["", "BLACK IN", 5];
sleep 40;
playMusic ""
};```
are you sure these are the proper door animation names though 😄
yup
(which heli btw?)
how have you established those animate commands?
??? there the ones in the config files
ive used these commands before with a pelican from the halo mod
obviously with difrent codes for the doors that i got from the config
difrence was i had the commands attached to an add action
just that it makes not sense that theres diffrerent animation to open and to close the doors
it should be same animation just 0 or 1 phase
door_l or door_r
ta-daaa , that's "door_L" and "door_R". should work
1 to open, 0 to close
@tough abyss ?
indeed just looke up the model.cfg for it
hang on games a loading
also it would be better to use the animateSource command
hmm no? I think animateDoor is specifically made for doors (buildings & vehicles)
to play all the anims like door handle etc.
nope doors still dont open
source does the same if all the door animations are configured for same source
@tough abyss not "Door_L_Close", "Door_L"
itsunder user actions Your finding this right
?
yeah no im a fuckin idiot
you right
huzzzah now how do i dissable the landing gear from lowering
you tell the helicopter to hover, not land
Any tips on improving pip quality. Like having the object in the sky with less to render in background ect?
"unload" waypoint should do iirc
what 5ft off the ground thou
nah unload he still drops his gear
hang on let me check somthin
I am trying to make it easier to fire from gunner from VTOL, but when you are flying the bullets/projectiles are flying way off. To ease this I tried to slow down VTOL on loiter, but even with 10-15 km/h you need some offset. Is there a "fire where you are shooting" idea that can help me?
even with ranging?