#arma3_scripting
1 messages · Page 549 of 1
I might be wrong, but can't you modify the class of the object to trigger some event handler when it's created?
init
How do you run a script when CBA setting is changed? I have troubles figuring this one out and the instructions i found aren't all that clear in this regard.
@thorn saffron you might want to look at how CBA is handling changes in the settings, which if I'm correct is done in https://github.com/CBATeam/CBA_A3/blob/master/addons/settings/XEH_preInit.sqf (line 47-63)
Does too many weapon holders can be bad for performace?
Too many of any objects will hurt performance.
they usually dont have physics, I tough that weapon holders would not be too much of a problem, I was about to do a actually arsenal with allot of weapons and magazines around, but I had to put each individual, it would be good to have only the model as reference.
What is the least resource intensive way to constantly check for a certain simple object being created? Right now im using a FrameHandler from CBA
If you have CBA, you can just use a init eventhandler which fires on any object being spawned.. tho.. I don't know if simple object counts as "any object"
im constantly searching for ace_drop's which are created in the createBlood part of ace 3
Oh that? Just use the eventhandler that fires when a bloodDrop is created... only fires on server tho but don't think that's a problem.
https://github.com/acemod/ACE3/blob/b2f4b8ea20489df05e366683f6ddf34a2eeb1daf/addons/medical_blood/functions/fnc_createBlood.sqf#L29
@surreal peak
@thorn saffron right here: https://github.com/CBATeam/CBA_A3/blob/master/addons/settings/XEH_preInit.sqf#L78
just put few items into them?
Is there a way to return the owner of a waypoint?
afaik no, as a waypoint is "just" an array
@waxen tendon setAmmoCargo
@cosmic lichen
https://community.bistudio.com/wiki/Waypoint
you have the group in there
your question is quite vague @cosmic lichen who would you consider an owner?
the group the waypoint was added to.
But I fixed my issue differently now. So it's fine.
yes you can get the group as waypoint is array consisting of group and index
Right, thanks
Hello, guys, may i have a quick question?
How can i offset a distance from the view direction of a player? I try to combine
_edir = eyeDirection player;
_cpos = (_edir vectorMultiply PZNhrange);```
with something, but cant find propper script command to that
vectorAdd?
the line from a code gives relative position, i need absolute
i thought that vectoradd combines two vectors
and how can i get absolute position on world coordinates?
getPosWorld
getpos of a vector?
oh wow
i think i got it
so i just use vectoradd to relatively just add numbers from vectormultiply part to a coordinates
yes
thank you) I am rather bad at geometry stuff so i was thinking of that vector commands like some magical things
Also, may be i can get another advice? I am trying to hide large amount of objects outside of player fov, so would it be apropriate to get them with that command?
_on = pzn_rocksarray inareaarray [_cpos, PZNrange, PZNrange, 45, true];
_off = pzn_rocksarray - _on;
that feels not very optimized
ha ha, it just hangs the arma
inareaarray is very optimized
@calm bloom the engine should not be drawing that stuff so you should not need to do that on your own
its probably more inefficient to hide/unhide stuff than what you gain if you gain anything from it
well, it really helps if i hide the bodies, i wanted to try same trick
I would say you do not save CPU nor GPU by hiding map objects
bodies though, they have some impact (AI, actions, etc)
Eye of the Tiger plays in the background
Bodies take a lot of performance, and even disabling simulation does not help much with them.
i am just hiding them at some range
like 200 meters
gives maybe 5 fps for 200 bodies
We have addon at ArmaForces that converts bodies to simple object / ace body bag at distance. xD
"body cache", saves a lot of fps. Also removes them after some time.
Looks a bit wonky but works.
We could use "dead men" simple object 🙈
yet no one got my Eye of the Tiger joke 😢
AGC - Advanced Garbage Collector is the name.
well, you can get antitank weapon from the fallen at squad for example
also, you can see the spot of last gunfight
200 in the same spot… 't's a lot
they are not in the same spot usually
anyways, it was an experiment, just like the one we discussed earlier, and it kinda worked
when you fight on the battlefield with wrecks and corpses from the day earlier it makes game more immersive
well in these conditions you have to deal with performance issues and improvements then yeah :D
but good job 👍
btw speaking of bodies, you can save them in mission sqm like the vehicles, not like units
soldier gets full custom equipment config and have ragdoll animation of dying, but it has no group and all stuff
Yes, it's the same like doing a "createVehicle" with unit class. It's lighter as there is no AI.
anyone know some decent inidbi2 example mission or script that works on dedi?
Quick Question: What does QGVAR mean in the context of SQF code? When I read the ACE3 source code on the github I am seeing it quite a few times, e.g.
[QGVAR(bloodDropCreated), _bloodDrop] call CBA_fnc_serverEvent;
which is found here: https://github.com/acemod/ACE3/blob/b2f4b8ea20489df05e366683f6ddf34a2eeb1daf/addons/medical_blood/functions/fnc_createBlood.sqf#L29
Also thanks Dedmen for telling me about the bloodDropCreated server event, didnt think about that!
It's a macro definition, if you check includes you will find it in some #define
@surreal peak GVAR turns GVAR(bloodDropCreated) into something like CBA_medical_blood_bloodDropCreated and QGVAR turns it into "CBA_medical_blood_bloodDropCreated"
ah so by Quoted it means it is a string?
yup
that's sweet, thats gonna make reading the code a heck of a lot easier
@surreal peak https://ace3mod.com/wiki/development/coding-guidelines.html#2-macro-usage more help
I'm trying to set 2 different endings of scenario depending if one of the 2 factions has no alive players
but as soon as I start the game the first ending istantly activates
https://imgur.com/a/4nkTzoe
maybe add time > 20 && to condition
I'll try
@still forum
it works alone but there is still a chance that even if the faction has alive members the triggers would activate anyway
I'll check it in 2
@still forum it always plays the blufor winning scenario, even if there are no blufor alive and indfor players still alive
is indfor the right definition for the independants?
If I were you I'd just check the wiki 😄
https://community.bistudio.com/wiki/Category:Scripting_Commands_Arma_3
CTRL+F indfor -> setWindForce
weird I checked on the Biki and I saw Indfor somewhere
maybe in a comment, but shirley not as a command
it seems to work now
#define indfor independent
I am trying to track down some badly behaved waitUntil errors, is there an easy way to work out which mod/source file is causing the problem?
explain what kind of "error" ?
nil return error
Doesn't give where it comes from just the context
if it doesn't print source location then maybe it itself doesn't know where it is
could try ArmaDebugEngine's callstack dump, maybe that knows where it is
If you create this object "Land_FuelStation_Feed_F" server side, players will not be able to use it. If you create it on client "A" machine, client "A" will be able to use it. Can i make it works server side?
@tough abyss What are you trying to "use" with that object?
@robust brook a vehicle half fueled
@tough abyss how do you create it?
@green solar VA = Virtual Arsenal?
@young current i create it with createVehicle.
Try setOwner of fuel station to the owner of the player
I added a HandleDamage event handler on this object "Land_CanisterFuel_F" to make it explode when shoted... but the EH never triggers! Why?
@tough abyss try "Hit" EH
because it doesnt have andy hitpoints?
It is PhysX object you can add EPEContactStart EH
Hey guys, I got 1 question for all of you. Is there a way to disable the vanilla minedetector with scripts?
remove it from inventory
@winter rose already tried hit 😦
@tough abyss but, the bullet impact will trigger this EH?
yes but all PhysX related shit in Arma is semi-FUBAR
@tough abyss this means this EH can fails sometimes?
Why they choose to use PhysX? NVIDIA Inposition?
It fires like once per second and the damage value is unusable, shit all around
Other PhysX eh can fire just because you threw grenade in any direction and it never hit the object. Total crap.
@tough abyss but in this case the _force will be zero (grenade near)?
also, seens _object2 is allways objNull
Why dont you add this EH and test it, I am sure you will find answers to all your questions
i'm doing that
i found that _object2 is allways objNull
I can't detect what collided
@tough abyss btw, thanks for your help.
I can't detect what collided
told you, it is shit
@tough abyss i just passed with a vehicle near and the EH triggered.
I'm using another object, the fuel barrel, for this one the HandleDamage EH works.
Hello guys good afternoon, im currently working on a scrip where i have to simulate a train tunnel being demolished, but at first you have to get into the tunnel, so placing the debris just wont work. Ive used the Hide objects module to hide the Debris, the thing is that i want a trigger to disable/change the hide module and make the debris apprear, is that even possible? i think this is pretty easy but im sitting duck here. Anyone got any idea?
if theres any other way to achieve this, jsut let me know
is there any way to get if player is using remote control over any unit? getConnectedUAV returns nothing if you are using the remoteControl command. vehicle player returns the original "body" of the player, not the currently controlled unit.
I got a dumb idea of checking if player is remotely controlling something by checking the camera postion and the eyePos of the player vehicle. In theory if they are very different the player is controlling something, if so you could take the nearest object to the camera position
Fun fact: eyePos player is not the same as positionCameraToWorld [0,0,0] in first person, the Z is different
Obviously in 3rd person it is way back
not that much though, still I was kinda surprised the positions arent almost the same in first person
@tough abyss Of course removing it would be the easiest, however, I got one modded item that "enables" this mine detector screen. So I was wondering if there was a way to disable it.
If a vehicle is using dynamic simulation and that vehicle is not being simulated will it not be able to receive an eventhandler?
From my perspective it seems like CAManBase is able to take an EH while offline but LandVehicle is not for some reason.
I'd approach it like this
Just make sure that the EH is being received by mine at all when it's simulated
Then do _mine enableSimulation false; and test it again
Hey all, just got a quick question, I have made a security desk and when placed on the map in the editor it will spawn 4 cameras which it does but for some reason I can't move them around in the editor, is there something else I have to add to my script to be able to move it around in the editor. Thanks
did you create the camera-spawning script?
Yes i used a event handler in my desk cofig to spawn the security cameras then camcrate then attached it to my cameras, my four cameras are showing the images but I cannot move them in the editor once they are spawned from the desk.
editor = Zeus?
if i have the string of a variable name how do i get the variable its self from the string? from the server?
@winter rose thanks for the help. Its create3denentity comand, create vehicle or crate unit doesn't work if you spawning from a config as far as I can tell
@exotic tinsel missionNamespace getVariable
its not working for some reaosn. i have the varrible name/string of an ai but its not giving me the obj of the ai. here is my code
private _ai_varname = _x select 0;
diag_log _ai_varname;
private _ai = missionNamespace getVariable [_ai_varname, objNull];
again im doing this on the server.
nvm i got it.
Is there a way to grab the box of a vehicle? I need dimensions, height, length, width, that sort of thing.
also, is the Contact DLC HEMTT Flatbed an everyman vehicle? i.e. available to all?
perfect, thank you.
re: boundingBox, what's the difference between that and boundingBoxReal? Is that analog to cropping whitespace around the vehicle to the hard edges?
boundingBoxReal is closer to the real size yes
there is also an alternative syntax since v1.92
https://community.bistudio.com/wiki/boundingBoxReal
which brings me to a follow up question, what does the clipping actually do? 0 visual is the only clipping that seems to matter. 1 shadow? 2 geometry? does not really explain.
I don't know more, it relates to the 3D model
to be precise, I am trying to gain a fair estimate, or even actual, dimension, that I could use to establish attachTo points for purposes of loading KP Liberation crates into new transport vehicles. so the more precise, or otherwise predictable, I can determine, the better.
boundingBoxReal should do, I think that's what is used for A3's vehicle in vehicle feature
thanks, appreciate the response. 👍
HEY GUYS
im making a mission and need a video intro featuring a warlord that is the main objective in the mission. i want it to be a quick little vid of a execution and i want to use the stock arma animations you see in the debug console. how do i script those into the init box in the unit attributes? ive already looked at videos and tuts but they cant help. help pls?
check the media - screenshots_arma chat in this server for images if u dont know where im coming from and search for {SCRIPTING REFERENCE}
thanks for the help guys
is there a more efficient way to convert BBCode to html tags by going through each character in the string, and in case of special character check the few following for matches of BBCode tag?
Is there anyway of dumping guns or cars etc classnames for a mod to clipboard?
@blazing sentinel At one point in time I needed to assign individual costs for units that could be placed by Zeus during a mission. For this I had to create a "custom cost table" of such units and for this there's a scripted function with which it is possible to create a spreadsheet containing all the units be it vanilla A3 or some mod you are using. See: https://community.bistudio.com/wiki/Arma_3_Curator#Using_Cost_Tables
The spreadsheet is created in ODS file type so you need OpenOffice to open the file. Aaand while it is possible to export the data to Excel XLS the formatting gets completely busted during the process so I've personally always exported as ODS and used OpenOffice to open the file.
And on to a question: currently I've got this to determine a position for stuff a player can spawn
_def setPosATL ([getPosATL player, 8, direction player] call BIS_fnc_relPos);
How to add some height so that it would then be player position + x meters?
oh that looks good 👍
_pos= [getPosATL player, 8, direction player] call BIS_fnc_relPos;
_pos set[2, (_pos select 2) +3];
_def setPosATL _pos;
You can use getRelPos and vectorAdd
how can I add animations to my script which are cancelable if you move? Similar to how ace does it with their medical system
There are animations that are cancelable when you move, so add those
Thank you Chuck BCHF and M242 for showing the way 🙏🏼
@tough abyss should I use playMove/switchMove ? Or is there a different command I should use
Has anyone ever experienced addItemCargoGlobal creating broken items? i'm getting these weird results where I get an item with some of the content present but things like the icon don't work + in this case with weapon attachments they don't.. attach, either
i think i must be calling it with some rather broken stuff :(
🙈 okay yeah i just checked the logs
weapon bipod_02_F_hex"
seems legit
yes bipod is a weapon. ?
wait, really? I thought a loose bipod would be an item? well i guess the mystery continues
with filePatching can you modify existing file X and inside it call compile new file Y (Y being in the "file system" and not the PBO)?
https://i.imgur.com/KjF7tbF.jpg example of broken items btw
yes a bipod is an item
items are weapons
@errant jasper no
you need to use the pbo path, and have the file in same path in arma directory
Hmm, darn.. Is there some non-obtrusive way to write script addons without restarting all the time when adding new files?
items are weapons
weapons are items*, no?
I mean, I can run much via. a mission, but then having to modify the structure for addon would be obtrusive.
weapons are items*, no?
no. items are weapons
without restarting all the time when adding new files
afaik it requires the files to ALSO be present in pbo, before it can load it via filePatching, so afaik no
it's so frustrating to see how many garbage scripts are floating around the internet
right now I'm trying to fix a script someone else got from the internet for an altis life server and it wasn't even indented
life
Sturgeon's Law
also the script removes the action from the NPC and then creates a new one when it's done, so you have to keep the parameters in sync or the text will change after the first time the action is used
how do people upload garbage like this and nobody even tells them to stop?
ugh...
Sturgeon's Law
I didn't realise life servers were 90% of Arma
private["_rip"];
// ...
if (_rip) exitWith { hint "blah blah already being robbed blah blah" };
// ...
_rip = true;
I'm questioning my own sanity right now
I'm not going crazy, right? that variable does absolutely fuck all, right?
I mean, it's script local, so what's the point?
Depends on what it is script local to.. The guy attempting to rob someone, then it is "fine".
Or is someone trying to use _rip as a global?
it might be modified by functions that are called from that function
a very weird instruction pointer you have there :kappa:
Hi. Try to get list of supply crates, that on Eden under Supply - Ammo.
If I correctly understand I should iterate classes under configfile >> "CfgVehicles" and check if _x isKindOf "ReammoBox_F") ?
How can i have an addAction only show up for a specific squad/group ?
Currently have this:
tp_board addAction ["Teleport to C130",
{
_pos = getPosATL c130_static;
player setPosATL [_pos select 0, _pos select 1, (_pos select 2) + 0.5];
}, [], 6, false, true, "", "(_target distance _this <5) && ()"];
NyteMyre,
would there be a way to wrap it into a IF-statement where you ask if these units are from the specific groups/squads you want them to be and then do the addAction?
i guess 😛
"_target distance _this <5 AND groupID _this == reconGroup"];
Something like that
Okay already got it
groupID should be simply group
is it possible to detect, to witch mod belong class?
configSourceMods
check wiki
@quasi thicket why that distance check? addAction already has a distance parameter?
@still forum thank you
on default it was a bit far
Yeah but why not use the "radius" parameter?
NyteMyre, Dedmen probably meant that there is a parameter baked into the addAction, see radius @ https://community.bistudio.com/wiki/addAction
tp_board addAction ["Teleport to C130",
{
_pos = getPosATL c130_static;
player setPosATL [_pos select 0, _pos select 1, (_pos select 2) + 0.5];
}, [], 6, false, true, "", "(condition)", 5];
private [
"_unit"
,"_cacheRadius"
,"_crewList"
,"_crewInventoryList"
,"_crewSkillList"
,"_crewVarNameList"
,"_debug"
,"_exitTrigger"
,"_firstLoop"
,"_gaiaParameter"
,"_gaiaZone"
,"_infantryList"
,"_infantryInventoryList"
,"_infantrySkillList"
,"_infantryVarNameList"
,"_initString"
,"_initialDelay"
,"_lives"
,"_newGroup"
,"_newVehicle"
,"_pauseRadius"
,"_reduceRadius"
,"_respawnDelay"
,"_respawnDir"
,"_respawnMarkers"
,"_respawnPos"
,"_special"
,"_tmpGroup"
,"_tmpRespawnPos"
,"_tmpZone"
,"_trigger"
,"_unitGroup"
,"_unitSide"
,"_unitsInGroup"
,"_vehicleHitpointsDamageList"
,"_vehicleHealthList"
,"_vehicleFuelList"
,"_vehicleList"
,"_vehiclePositionList"
,"_vehicleItemList"
,"_vehicleLockedList"
,"_vehicleMagazineList"
,"_vehiclePylonList"
,"_vehicleWeaponList"
,"_vehicleBackpackList"
,"_vehicleMaterialsList"
,"_vehicleTexturesList"
,"_vehicleAnimationNames"
,"_vehicleAnimationPhases"
,"_vehicleVarNameList"
,"_waypointList"
,"_synchronizedObjectsList"
];
Check out this UNHOLY code...
D:
Who, WHO PUTS the damn , on the LEFT!!!
If it is a "configuration list" meant to be edited... For example defining an enemy composition for a mission, then I do.
Though that is not mine, since I would indent the first entry to match up
Who, WHO PUTS the damn , on the LEFT!!!
Just easier when you have this many stuff.
Can just ctrl+leftclickdrag to set all commas
@hearty plover Actually, I do. It makes great formatting sense when you stop to analyze it. Takes it bit of getting used to, but then you always know that a new list item is coming when you see the comma. Similarly with logical operators on a new line.
Some people just don't understand the crap that they copy paste and continue doing the same nonsense that they saw some other unable developer write
then you always know that a new list item is coming when you see the comma
What?
It would make it WAY easier to fix a extra trailing comma
Unrelated question, I know you can add variables to object instances. Is it possible to add class variables? that is, I want to add variables or properties to the class itself.
However. It's still UNHOLY
@hearty plover I'm not asking you to adopt that stylistic philosophy.
Most languages do support trailing commas
@tough abyss Actually, most languages support ignoring the whitespace between the items, punctuation marks, etc. Some tooling enforces trailing commas, but that is a tooling issue, not a language issue.
What’s your point?
@tough abyss Point is, do whatever floats your boat where stylistic philosophies are concerned.
I have difficulty understanding what you are saying
You probably never worked in a team if you say shit like that
@tough abyss I build and run my own teams, thank you very much.
If you allow teams write as they pleased without any coding guidelines, then you are probably a bad manager
And no need to tag me every time
@tough abyss I did not say that. But then again, I'm not interviewing you, never mind considering your consultation beyond for what it's worth.
@tough abyss Really, you call me out publicly, if you have something to say privately, I would be happy to discuss if you want.
@floral dew Point is, do whatever floats your boat where stylistic philosophies are concerned. I must have misunderstood you
Im using disableAI "AUTOCOMBAT"; but the AI still swich to combat afther gettin shot, whats wrong?
that's not unholy, that's smart.
Hello everyone
Okay, I have a model and trying to make it function in arma 3 but don’t know how I start editing the config file
Could any one give advice please ?
Try #arma3_config
Okay, thank you for fast responding I’ll go there @tough abyss
the header, the in-code comment, both?
Hahaha, ascii art to make your file weight twice
Probably intentional, to take attention away from bad code
or to add more lines to brag about how many lines is in his mission making it seem more complex?
I don't mind the header to be cool, but come on the big "don't touch"… duh
“Don’t look”
Was hoping I could get some help cause I'm having a bit of trouble with some code. regarding holdActionAdd getting the action on my object goes fine but I'm having an issue with carrying the arguments over into the script. I get an error for an undefined variable _target when I the code called looks like ```if isServer then {
params ["_target","_caller"];
deletevehicle _target;
};``` I feel like I must be missing something very obvious.
how are you calling that? it would probably be best to put it in a function to call (only expose the function to the server if you only want the server to run it)
MyFunc =
{
if (IsServer) then
{
Params ["_Target", "_Caller"];
DeleteVehicle _Target;
};
};
//call it like so
[_Target, _Caller] Call MyFnc;
currently I've called it from the init of a spawned object using [ intelobj000, "Hack Tablet", "\a3\ui_f\data\IGUI\Cfg\holdactions\holdAction_connect_ca.paa", "\a3\ui_f\data\IGUI\Cfg\holdactions\holdAction_connect_ca.paa", "_this distance _target < 3", "_caller distance _target < 3", {}, {}, {["Scripts\phase000_intel000.sqf"] remoteExec ["execVM",2];}, {}, [], 30, 0, true, false ] remoteExec ["BIS_fnc_holdActionAdd", 0, intelobj000];
your not passing in anything to phase000_inteo000.sqf
so _Target and _Caller are nothing
checkout the ExecVM syntax for arguments. thats where you would put your parameters
so something like this
{[[_this, _Target], "Scripts\phase000_intel000.sqf"] remoteExec ["execVM",2];},
```sqf
you can do sqf highlight too
```
ooh I didn't know that was a thing thanks Dedmen
so I guess where I got thrown off where is says passed arguments its not an automatic thing you have to add them before calling the script still?
just looked up HoldActionAdd. so HoldActionAdd has 4 arguments under the CodeCompleted part(where you have your RemoteExec)
params ["_target", "_caller", "_actionId", "_arguments"];
what we want to do, is take _target and _caller to your phase000_intel000.sqf script so they know what they are. to do that we do this
//first we add the params like so
[
intelobj000,
"Hack Tablet",
"\a3\ui_f\data\IGUI\Cfg\holdactions\holdAction_connect_ca.paa",
"\a3\ui_f\data\IGUI\Cfg\holdactions\holdAction_connect_ca.paa",
"_this distance _target < 3",
"_caller distance _target < 3",
{},
{},
{
//lets store the arguments in some variables in CodeComplete like this
params ["_target", "_caller", "_actionId", "_arguments"];
},
{},
[],
30,
0,
true,
false
] remoteExec ["BIS_fnc_holdActionAdd", 0, intelobj000];
then we need to take those params, and pass them to your .sqf file like so
[
intelobj000,
"Hack Tablet",
"\a3\ui_f\data\IGUI\Cfg\holdactions\holdAction_connect_ca.paa",
"\a3\ui_f\data\IGUI\Cfg\holdactions\holdAction_connect_ca.paa",
"_this distance _target < 3",
"_caller distance _target < 3",
{},
{},
{
//lets store the arguments in some variables in CodeComplete like this
params ["_target", "_caller", "_actionId", "_arguments"];
//passing _target and _caller to the sqf file
[[_target, _caller], "Scripts\phase000_intel000.sqf"] remoteExec ["execVM",2];
},
{},
[],
30,
0,
true,
false
] remoteExec ["BIS_fnc_holdActionAdd", 0, intelobj000];
now phase000_intel000 should know what _target and _caller is
also im not 100% sure thats the right syntax for RemoteExec with execVM and passing in arguments, hopefully it is
Question:
I would like to run a script when a player spawns/respawns, so I can modify it's gear/insignias/etc. All this is done within a mod (not mission!) and I have CBA available.
I already tried calling the script through Extended_Init_EventHandlers and Extended_PostInit_EventHandlers, but all I get are errors regarding getVariable (although are most likely caused because there is no unit object available)
What is the correct place and method to trigger on spawn/respawn?
I think that makes sense to me now. I can reference the wiki on the remoteExec if that doesn't quite work, I appreciate you helping me understand that better @tame socket
onPlayerRespawn.sqf and initPlayerLocal.sqf should work. is that what your asking?
np, goodluck!
no, since those are mission specific. I'm looking for event handlers I can use in a mod.
doesn't seem to do anything at all (both SP and MP)
but again, I might do something totally wrong
is it firing? and is it being assigned to units?
class Extended_Respawn_EventHandlers {
class ADDON {
init = QUOTE(_this call FUNC(onPlayerRespawn));
};
};
This should run on everything, but due to limited resources on the wiki it's a bit hard to figure out how the respawn events work...
Dedmen would you happen to know how one would go about getting that sqf highlighting onto my own discord?
do this for sqf
https://gyazo.com/e461d9a4955b7bff5598a93a687d4f69
that works on any discord?
just tried it on my friends and it worked
oh cool, I figured it was proprietary enough that it wouldn't be out of the box supported, thanks again Cody
np
@exotic flax does this seem right?
class Extended_Respawn_EventHandlers
{
class ADDON
{
class Gear_ADDON_respawn
{
init = QUOTE(_this call FUNC(onPlayerRespawn));
respawn = "_this call SomeFunction";
}
};
};
from reading the git
https://github.com/CBATeam/CBA_A3/wiki/Extended-Eventhandlers
derp, scroll down further for a respawn example
class Extended_Init_Eventhandlers
{
class Man
{
class SLX_XEH_RespawnInitMan
{
onRespawn = true; // Run this even after respawn
init = "_this call My_Respawn_InitEH";
};
};
};
"This guide is outdated. Please refer to this guide instead!" at the top of the page 😉
but I will try it out
-_- dangit
hmmm... I see that ACE uses
class Extended_Respawn_EventHandlers {
class CAManBase {
class ADDON {
respawn = QUOTE(_this call FUNC(handleRespawn));
};
};
};
Might be an idea as well...
possibly
just annoying that both the BIKI and CBA don't have a proper documentation about event handlers... and it takes a lot of time to test small changes when working on a mod...
@exotic flax I think there is an ACE addon template on github which lets you develop your addon without reloading the game
although I don't remember how they achieve this
@astral dawn the ACE addon template can only build PBO's for you (either for development or for release), and ArmA always requires you to reload the game after making changes to the PBO's
no... I'm pretty sure I could change configs while the game was running
there is some special arma binary which does that
plus the file patching command afaik... let me check 🤔
https://community.bistudio.com/wiki/diag_mergeConfigFile this might be useful
I remember something where you could call a mod from the P: folder in Arma2, but I'm not sure how to do that through the Arma Launcher
Yeah you see they mention file patching here
https://ace3mod.com/wiki/development/setting-up-the-development-environment.html#file-patching
I might be wrong, you might need to remake the pbo and then relaunch the mission though, or maybe not, IDK, totally forgot that 😦
hmmm... it seems to load the PBO's correctly, now let's see it also patches the files on the fly
https://sqfbin.com/abudenegutetafigohiv Excuse me, the first line is the player's display text in the center of the screen after saving money. I want to record it in the database, so the second line is what I wrote, but there is no record in the database. What's wrong?
Might still need to https://community.bistudio.com/wiki/diag_mergeConfigFile @exotic flax
@runic quest well... that depends on what happens in UnionClient_system_numberText and DB_fnc_AdvancedLog.
Do you get any errors in your RTP, or in the DB logs?
Hey, does anyone know if one can via script open the closest door to the player.
So lets say the house have 10 doors and I would like to open the closest one to the player when the script is executed.
I have the name of all the doors, issue I am having is figuring out if its possible to compare distance to the door themselfs
@exotic flax Sorry, but the log is delayed. It succeeded. Thank you!
@mellow obsidian you might have luck with https://community.bistudio.com/wiki/selectionPosition , which will return the position of an "object" inside an object (like a door in a house)
You know what, that might actually do the trick. Many thanks Grezvany13
well i dont think theres another way to do it haha. loop through the buildings doors positions and put each of them in an array, then loop through that array to see which one is closest?
question, is this a reliable way to get the missions path for all clients for loading textures and such? ive had one friend join and the texture had changed properly, but not for another friend. i have it set to print out the path but for my friend that has issues(only he was able to test a bit) it doesnt display a hint. credits to KillZoneKid for the mission path
SetNoShootTextures =
{
Params ["_Targets"];
_Root = call
{
private ["_arr"];
_arr = toArray str missionConfigFile;
_arr resize (count _arr - 15);
toString _arr;
};
_Path = _Root + "Textures\Target_NoShoot.paa";
hint _Path;
{
_x setObjectTexture [0, _Path];
} ForEach _Targets;
};
heres how im calling it (from the server)
[_NoShoots] RemoteExec ["SetNoShootTextures", 0, true];
You shouldn't need absolute paths for textures.
In CBA we can use Extended_Init_EventHandlers. Is there a vanilla Arma 3 option like that? I'd like to add script to every init of unit via description.ext and not via scripts. Example:
class Extended_Init_EventHandlers
{
class CAManBase
{
class EventHandlers
{
init = "diag_log format ['init: %1', _this];";
};
};
};
@finite dirge you are correct, it would have worked the first time with how i had it before but when i tested it i did not export the mission, instead i hosted the editor version which was apparently the problem. thank you!
@real tartan no that's not possible through mission files. It would need an addon.
Can anyone explain to me why I can create a chemlight with createVehicle ["Chemlight_blue",[3701.74,3809.01,50]] but not an IR strobe createVehicle ["B_IR_Grenade",[3701.74,3809.01,50]] Both are classes from CfgMagazines.
"Both are classes from CfgMagazines." no they arent
createVehicle creates a vehicle, vehicles are CfgVehicles or CfgAmmo (projectiles)
Chemlight_blue is a CfgAmmo class
B_IR_Grenade doesn't exist
there is B_IR_Grenade CfgMagazines tho, which has ammo type of B_IRStrobe which you can spawn
configfile >> "CfgMagazines" >> "B_IR_Grenade" configfile >> "CfgMagazines" >> "Chemlight_blue"
So the issue is that Chemlight_blue exists in CfgAmmo and CfgMagazines and can therefore be created, but B_IR_Grenade only exits in CfgMagazines right and that's why createVehicle doesn't work.
Yeah right.
Kinda a bummer because CfgAmmo does not have a displayName defined so I have to check cfgMagazines to get that.
Oh well, I can get the ammo class name from with CfgMagazines and use that to spawn it.
Thanks for the clarification.
Yo, Do you guys know if the effect of BIS_fnc_taskSetState is local or global? I'd like to execute it server-side
It's global
It executes BIS_fnc_setTask and this function executes globally by default.
thx
Here's a rare one: I want to get rid of custom gear upon being killed/respawning and use the gear assigned at the beginning of the mission. I've already tried unticking "Save loadout" in Multiplayer attributes. Should it be of interest I am running RHS and ACE with 3den Enhanced.
@jaunty ravine
//initPlayerLocal.sqf
Params ["_Player", "_DidJIP"];
_Gear = GetUnitLoadout _Player;
_Player SetVariable ["SpawnLoadout", _Gear, false];
//onPlayerRespawn.sqf
Params ["_Player", "_Killer", "_RespawnDelay"];
_Gear = _Player GetVariable ["SpawnLoadout", []];
if (Count _Gear > 0) then
{
_Player SetUnitLoadout _Gear;
};
Thank you! @tame socket Greatly appreciated!
np
Hi guys! Does anybody know where one can get list of set3DENAttribute's?
Nevermind. Found it on Get3DENAttribute page: https://community.bistudio.com/wiki/Eden_Editor:_Setting_Attributes#Attributes
I've got a couple healing scripts that used to work for ACE medical. Couple weeks ago, they simply stopped working. Anyone experience anything similar?
[objNull, this] call ace_medical_fnc_treatmentAdvanced_fullHeal;```
Doesn't heal players in a trigger anymore?
Used to work, that's what's bothering me.
It shouldn't have ever worked
you need to iterate through thisList
and fullHeal also doesn't take array
funnily enough, I have a memory where it worked in OFP, I may be mistaken though
what else makes the AI swich to combat? I already used the disableAI "AUTOCOMBAT" and the AI still swicth it to combat once under fire
So I need to also use disableAI "FSM"?
IDK, maybe
seems to work but looks like with out the FSM seens to broke other things to.
Set them careless?
they will not fire
…yeaaah ?
what is it you are trying to achieve
because it sounds like something that isnt quite logical
The objective here is to make the units still move, when they are in combat they froze in place and just became target pratice to the players
…don't disable any AI?
and they still do it.
{
_x disableAI "AUTOCOMBAT";
_x disableAI "FSM";
_x setUnitPos 'UP';
_x getSpeed "FAST";
_x setSkill ['aimingAccuracy', 0.1];
_x setSkill ['aimingShake', 0.1];
_x setSkill ['aimingSpeed', 0.1];
_x setSkill ['spotTime', 0.1];
_x removeAllEventHandlers "Hit";
_x removeAllEventHandlers "HitPart";
_x removeAllEventHandlers "HandleDamage";
_x removeAllEventHandlers "Dammaged";
_x removeAllEventHandlers "Explosion";
_x addEventHandler ["Reloaded",{
_unit = _this select 0 ;
_mag = _this select 4 select 0 ;
_unit addMagazine _mag ;
}] ;
_x addEventHandler ["Killed", {
params ["_unit", "_killer", "_instigator", "_useEffects"];
[] spawn CreateEnemySquad;
}];
} forEach units _Group;
with this sething they are now doing what is suppouse to do.
_x getSpeed "FAST"?
yup
GETspeed?
yup
this line does nothing, you can remove it.
nah, aready did too many coding with that, not wort the time to remove it in other lines.
well, good luck ¯_(ツ)_/¯
you leave possible errors in your code, you cant be helped.
as in any code I made and get no feedback in game.
suit yourself then.
It does.
.
So! Have you guys checked the brand new https://community.bistudio.com/wiki/Arma_3_Task_Framework_Tutorial page yet? It's gorgeous!
While you're on it, I think it's worth mentioning that the task framework does fail for JIP players sometimes, cause unknown.
dang! any repro steps maybe?
No... just we had it in the antistasi for lot of time without ever finding ways to fix it.
Although it seemed to be used as advertised 🤷
welp
But the page looks nice indeed
if you have seen people at this discord "why do my missions auto-fail in antistasi help", yes that's it
nevah seen it, but maybe will
if it's only antistasi people that mention the issue, it might be mod related 👀
IMO it MIGHT be related to having the same mission tag (the unique string or what it's called) and reusing it multiple times
I'd bet on improper cleanup of variables in mission namespace in BI code, but not sure
oh em gee, of course
it has to be unique!
IDK if the previous task has been deleted you can create one with the same ID, but I wouldn't risk it
So... no way to delete a mission with tag "mytag0" and then create a new one "mytag0" with state "just started" (or how is it called...)
ah yes, task, sorry for using the wrong term
I don't know; but indeed, it might be that
if we can confirm this (would you maybe not mind testing?), I will gladly add a big red warning on the page
nah I don't feel like testing it any more, I even looked at BI code and it seemed to work, but also the Antistasi code seemed to use the API as needed, so 🤷
As with many other BI's scripted systems, finding fails or unfinished things here and there is a known thing, so I'm not entirely surprised
Anybody got an example of a vehicle GetIn event handler working? Was it changed with Contact DLC? I can't get it to fire off at all.
what is your code @vernal venture ?
[_Vehicle, _Unit] spawn{
private _Veh = _this select 0;
private _Man = _this select 1;
_Man setdamage 0;
[objNull, _Man] call ace_medical_fnc_treatmentAdvanced_fullHeal;
}];```
try this?sqf this addEventHandler ["GetIn", { hint "It Works!"; }];
Let me rephrase. It's another script that used to work, and now doesn't.
params ["_Vehicle", "_Role", "_Unit", "_Turret"];
[_Vehicle, _Unit] spawn{
private _Veh = _this select 0;
private _Man = _this select 1;
private _bExit = false;
waitUntil{
if(!(alive _Man)) exitwith{_bExit = true; true};
if(!(alive _Veh)) exitwith{_bExit = true; true};
if(!(isEngineOn _Veh)) exitwith{true};
if(!(_Man in (crew _Veh))) exitwith{_bExit = true; true};
false
};
if(_bExit) exitwith{};
sleep 30;
if(!(alive _Man)) exitwith{};
if(!(alive _Veh)) exitwith{};
if(!(_Man in (crew _Veh))) exitwith{};
_Man setdamage 0;
[objNull, _Man] call ace_medical_fnc_treatmentAdvanced_fullHeal;
};
}];```
And I've been removing stuff, trying to get it working again.
so the event itself works
Even this addEventHandler ["GetIn", { hint "It Works!"; }]; doesn't work
then something seems wrong indeed
btw, you can use the following for sqf formatting:
```sqf
/* your code */
```
Okay
did you try the event in Vanilla game?
No, but now I'm thinking it's the vehicle respawn module causing the problem
I just tested in the editor and it works fine (even from the init field)
It works if I unsync it from the respawner module
surely nobody cares but the EH works for me, too
cool story bro 😄
@vernal venture https://community.bistudio.com/wiki/Arma_3:_Event_Handlers#MPRespawn use this to add the EH on each vehicle respawn
I'll give that a try
Nope, that didn't work. I suspect I have to add some code to the module itself.
Smart Person, Stupid Question:
configFile >> "CfgFunctions"
I was expecting something here 😄 where is it
Well it's there, it returns:
bin\config.bin/CfgFunctions
Armagic
I have several script running on respawn (through Extended_Respawn_EventHandlers) and I can see in my RPT files that they are running (since I placed diag_log all over the place).
However for unknown reasons the result of the code is not visible in-game (MP mission in 3den).
If I run the functions manually through the debug console everything is executed and also visible in-game.
for example I set an insignia with BIS_fnc_setUnitInsignia based on a variable (set/get with _unit setVariable [var_name, var-value], which can be retrieved again (with BIS_fnc_getUnitInsignia), however no insignia is placed on the unit...
sounds to me like a locality issue
I already placed some stuff to prevent that (because I did notice that the code executed at the wrong places):
if (!local _unit) exitWith {false}; //XEH should only be called on local units
if(!hasInterface) exitWith {false};
if(isDedicated) exitWith {false};
waitUntil {!isNull _unit};
waitUntil {isPlayer _unit};
// rest of script
But still no effect
Timing issue maybe?
can only rly do the guessing game here
if this solves your problem:
[] spawn { sleep 1; /* whatever */ };```
you know, it is indeed a timing issue
Bis_fnc_setUnitInsignia is global, you can call it on any unit from anywhere
technically it could be possible that the scripts run before the unit is there, which would break it again...
You cannot call it in the same frame unit is created though
so perhaps it's a timing issue... testing with the example from X39 now
It could be possible that they run too early, hence do what X39 suggested. You don’t need sleep, just spawn will do
My server isnt kicking players with high ping or desync issues. Is the following code from my server cfg configured properly?
maxdesync = 150; // Max desync value until server kick the user
maxPing= 300; // Max ping value until server kick the user
maxPacketLoss= 50; // Max packetloss value until server kick the user
kickClientsOnSlowNetwork[] = { 0, 0, 0, 0 }; //Defines if {<MaxPing>, <MaxPacketLoss>, <MaxDesync>, <DisconnectTimeout>} will be logged (0) or kicked (1)
kickTimeout[] = { {0, 0}, {1, 0}, {2, 0}, {3, 0} };
I suppose #arma3_config or #server_admins
i have the option enabled in a bunch of my action menus to show when incapacitated but they dont show up. i have disabled force respawn as well. how do i get the action menu to be visible when incapacitated?
i just said i have that enabled
well there is no magic; either you have mods that f this up, or it's broken
vanilla Arma?
@winter rose sorry was afk. not exactly, we have our own server side addon with lots of features.
here is an example of one that is not show up when incapacitated
[_player,
[
"Request Mission",
{
params ["_target", "_caller", "_actionId", "_arguments"];
_caller removeAction _actionId;
[getPlayerUID _caller] remoteExec ["feature_1_fnc_state_1_apply", 2];
sleep 10;
[getPlayerUID _caller] remoteExec ["feature_1_fnc_state_6_apply", 2];
},
[],
-3.1,
false,
true,
"",
"true",
-1,
true
]
] remoteExec ["addAction", _player];
maybe the negative radius? idk, it's a blind try
anyway make it work in vanilla first
rgr
I try to assign voice to unit.
voice.sqf
params ["_unit"];
if (!local _unit || !(_unit isKindOf "CaManBase")) exitWith {};
_voices = ["male01ger", "male02ger", "male03ger", "male04ger", "male05ger", "male06ger"];
if (isServer) then
{
[_unit, selectRandom _voices] remoteExec ["setSpeaker", 0, _unit];
};
initServer.sqf
{ _v = [_x] execVM "voice.sqf"; } forEach allUnits;
but when I am in game, OPFOR still uses farsi language, not my defined (GERman) one
do you have a German voice addon?
yes, voices are from IFA
does that happen in sp or only in mp? I also replace units speaking voices. however I do it 0.5 seconds after the unit has been spawned
everything should be in the initServer.sqf
private _voices = ["male01ger", "male02ger", "male03ger", "male04ger", "male05ger", "male06ger"];
{ [_x, selectRandom _voices] remoteExec ["setSpeaker", 0, _x]; } forEach allUnits;```
not going to happen
AIs might be local to server
not everywheeere
what was wrong:
- you checked on the server if the unit was local
- you use execVM for each allUnits which is baaad for performances; at least give it allUnits
@real tartan I updated the remoteExec code
https://discordapp.com/channels/105462288051380224/105462984087728128/620975574533537802
- you checked on the server if the unit was local
Well that's no problem if they are AI's. And I think he wants to change voice of AIs as humans don't talk that much
players may be group leaders
{
if !(isPlayer _x) then {
[_x, selectRandom _voices] remoteExec ["setSpeaker", 0, _x];
};
} forEach allUnits;
just exclude players
voices.sqf have more code in it. I am changing there also gear and some behaviour. part of that gear replacement is to change also speaker, so preferable to have it in voices.sqf for individual units (AI's) than set it in initServer.sqf
give it allUnits, or at the very least preprocessFileLineNumbers it to load it in memory ^^
or at the very least preprocessFileLineNumbers it to load it in memory
execVM stores the file in cache too
preproc doesn't change anything on that
well, if I change the file in the editor it changes the output so I don't think it is?
unless it's based on the file's hash or something
Excuse me, I want to write a killing reminder, such as a player killing another player or a player killing AI, and display the corresponding text in the upper back corner. How can I do that? Thank you.
well, if I change the file in the editor it changes the output so I don't think it is?
guess you're not a programmer. when you change a file the changedate/size changes
that's what I meant, does the cache check for only the file name or a checksum 🙄
@still forum didn't you say that execVM doesn't cache the code itself, and still process it?
yes
currently nothing caches
besides the filesystem backend
but the scripting cache is maybe coming back soon
but if you "compile preprocessFile(LineNumbers)", it gets compiled as code and therefore is faster?
yes but you said "it caches file's content", a.k.a string
if you multi-execVM, it compiles everytime, no?
as it caches every file
yes it does
execVM is just an alias for "spawn compile preprocessFile"
so sqf _myCode = compile preprocessFile "myFile.sqf"; then spawning _myCode is still better than sqf execVM "myFile.sqf" (given it's called more than one time)?
no yes as you only compile once
🤔
myabe if I try [_unit, selectRandom _faces, selectRandom _voices] call BIS_fnc_setIdentity; but I don't know if function have global or local effect
Look it up in functions viewer?
@real tartan local, as the description says here
https://community.bistudio.com/wiki/BIS_fnc_setIdentity
editing this page right away, it mentions BIS_fnc_MP…
hmm, units respond via "radio" in german, but when they shout for some contact, they use native (farsi) language
weird. did you remoteExecute it from the server?
yes
I have no clue then! it did have an effect, but not a full one.
I am curious if someone can elaborate more on _unit disableAI "RADIOPROTOCOL";
about?
Stops AI from talking and texting while still being able to issue orders – Available since Arma 3 v1.95
meaning: no heard orders, but orders are still given (get in, get out, target etc)
@real tartan
Guys, is it possible to insert additional buttons into the ESC menu? Say, intercept the ESC key, find the menu display and insert a button?
yes
@quartz pebble once paused, see https://community.bistudio.com/wiki/findDisplay and code 49
@winter rose thx; 49 - is what I needed 🙂
you might enjoy
https://community.bistudio.com/wiki/Description.ext#onPauseScript too @quartz pebble
Oh, didn't know it exists. Thank you again!
is it bad practice to pack a bunch of functions into an sqf?
uhm ... what?
what is a sqf?
into a file?
and like this:
foo = {...};
bar = {...};```?
yeah, like take a couple dozen scripts, convert them to functions and then pack it all into a .sqf-- is that a bad idea?
why would you want to do that?
so I don't have a bunch of loose script files
for SQF it is fine ... your "functions" are just variables that get converted by a script afterall
but it is maintance hell to kill of the actual folder structure
it seems like a common thing for people to do, consolidate functions, is there a standard practice for this?
you do not want to consolidate functions ... but files
one file per function is the common practice
using CfgFunctions highly recommended
I'll never forget the dsl.sqf in official ArmA1 missions 😢
it was basically a big switch with a lot of scripts inside 😄
answer is, use CfgFunctions.
Then you don't have "loose" script files, but clearly organized script files
thanks Dedmen
thanks all
class CfgFunctions
{
class myTag
{
class myCategory
{
file = "myPath";
class myFunction {};
};
};
};
This is probably the one for me? Just add my file path and create a class name?
in short your example will work without any problems, as long as the path is relative to the root of the mission/addon, and the filename of the function is fn_%classname%.sqf
great, thanks Grezvany!
and using that, your functions can be executed with myTag_fnc_classname
I'm setting it up now, I'll be back to report (likely failure) complete success soon.
Seeing a completed example will probably increase my chances of success. Any links?
@hot kernel this is in the github repo from Achilles: https://github.com/ArmaAchilles/Achilles/blob/master/%40AresModAchillesExpansion/addons/functions_f_achilles/cfgFunctions.hpp
thanks again!
although they use a rather complex way for setting up their functions, because it's in a seperate addon
https://community.bistudio.com/wiki/Functions_Library_(Arma_3)
this actually contains complete examples though ..
class CfgFunctions
{
class "FTA";
{
class "FlyTanoaAir";
{
file = "missions\ 0_tanoaAir.tanoa\ features\ fn_FlyTanoaAir.sqf";
class FlyTanoaAir {};
};
};
};
like that?
that filepath is invalid
spaces
just like any normal filepath
if it is in mission's description.ext, it is relative to the mission directory
no need to repeat it
okay, so put this in description.ext and don't include the missions\mission folder
class CfgFunctions
{
class "FTA";
{
class "FlyTanoaAir";
{
file = "\features\fn_FlyTanoaAir.sqf";
class FlyTanoaAir {};
};
};
};
more like this?
I appreciate the help. I won't come back asking stupid questions about this same topic. Next time it will be stupid questions about a different topic 😄
I think what jshock says here is what I'm trying to do,
https://forums.bohemia.net/forums/topic/175975-registering-function-via-descriptionext-cfgfunctions/?do=findComment&comment=2758273
specifically,
call compile preprocessFile "inlineFunctions.sqf";
but now I'm confused as to why one would do one or the other
Or even how preprocessFile is different than just loading the .sqf in the init.
file = "missions\ 0_tanoaAir.tanoa\ features\ fn_FlyTanoaAir.sqf";
WHY???
Why one would possibly want to add spaces after \? Because it looks cool? Because letters are too tight and need some space for comfort? Why?
Yup, just so I could see what I was doing
ironically because I didn't want to make a mistake 😄
Or even how preprocessFile is different than just loading the .sqf in the init.
what mean by loading
Like just execVM the inline functions file
which is what I have been doing and I feel it's probably not best practice
I have an .sqf file with 30 or so functions, some waitUntils, a while true or two, and trigger creation. All the stuff to run the mission. It seems like that's maybe not the correct way to do it.
displayParent ctrlParent (_this select 0)....
HA! Take it SQF!
../../control basically
I'm sorry, M242 but I have no idea what to make of that
which is what I have been doing and I feel it's probably not best practice
correct. It works. But is not really nice as people don't really know where to find the functions inside that
whereas for CfgFunctions you have a file for each
oh, well if that's the only reason I built a table of contents in the function library 😄
that's fine for Fly Tanoa Air, it's only ever going to be a .pbo anyway-- as long as it doesn't affect performance which is what I'm after. I just want the mission to run efficiently.
@still forum you're the reason I'm even here. You said if I'm going to provide examples they should be good examples. I'm trying to determine best practice so that my modules and compositions are quality.
performance isn't affected by from where the code comes
just the content of the function affects perf
and how you call it. Like execVM is very bad. call/spawn are "on par"
that makes sense. So initially loading the library via execVM isn't great but after the functions are loaded they will be as fast as my poor scripting allows.
cool, thanks
Looking to get into scripting anyone know any good resources (other than the wiki) My final goal for this month is to make a airstrike script.
hi. need help with UI scripts.
How i can remove all existed values from ComboScrollBar?
Hello everyone. looking for some help getting extended base mode recipes to be displayed in the xm8, went through and got the mod installed and the hardware traders displays the items. Whats the next step? thanks in advance..
When using nearestLocation will [getPos _player, "NameLocal"] get me airports / airbases or will other stuff be in there also?
other stuff
heck is there any location i can use for just airbases on altis. I know you can use airport on tanoa but think it only works on that map
yeah wiki says airport only works on tanoa
why not just hardcode it? altis wont change anymore
Im not too sure how i would do that tbh just started this kind of stuff. Would i just get the coordinates of all the possible places i want it to spawn at and just get the closest of the list?
yeah
getting closest is not the easiest thing tho. Gotta have to go now.
Keywords:
sort, distance, getPos
It would probably just be easier to spawn the helicopter at the terminal airport and just get it too fly from there as it is kinda central to the map
I also got to find out how to get it to slingload a car and drop it off for the player but thats a challenge for another day
Hi, i'm trying to achieve this
https://community.bistudio.com/wiki/Arma_3_Debug_Console
"To whitelist (multiple) users with a mod, if enableDebugConsole has already been defined, use the delete keyword:"
however i'm getting the error ".enableDebugConsole: Member already defined." on game startup. The mod works fine if i remove enableDebugConsole from my mission description.ext and remove the line delete enableDebugConsole; from my mod. Can someone help me please?
My code;
delete enableDebugConsole;
enableDebugConsole[] = {"steamid"};
@still forum if i was to go into a editor session and spawn in at the desired locations entering getPos(player) would give me the correct coords or is it more complicated?
@opal ibex did you put delete enableDebugConsole in Description.ext or in your mod?
@winter rose in my mod, description only has enableDebugConsole = 0;
it seems like the delete keyword is just ignored in the code. I tried delete[] and it gave the error "'[' encountered instead of ';'" so it's like delete is not even there and the line is just [] enableDebugConsole;
@lapis ivy you don't have to use the player. Put an object helper (arrow) at the point you want co-ordinates.
coordinates=getpos (_object);
systemChat format ["%1", coordinates];
That should do it.
I got the point now and i just got a vehicle to spawn when i use the action menu so im very happy but still alot to do 🙂
oh and the crew are in it thats nifty
I should prob only allow one to spawn cause now i have a field full of chinooks
lol
@lofty spear
How i can remove all existed values from ComboScrollBar?
Better ask that in #arma3_gui
i already found, lbClear
Anyone know a good way to script a heli slingroping a car? I have no idea where to start on this one
- sling load
i know im going to have to use setSlingLoad but not sure how to get it to fly to the right alt above the car
remember that object we just got the position of...
yeah
could attachto car and use as reference point
but maybe slicker to use memory points
in the vehicle
sorry im new to all this what is a memory point?
where can i find these points?
there's a lot of them... and in czech or something nonetheless,
https://forums.bohemia.net/forums/topic/166473-selectionsmemory-points-dump/
that's a list from the forum
thank you 🙂
I think there's a list per object somewhere, too
Some times AI refuses to do the doMove, only two members of the group move to their possitions, the others just stand there doing nothing. that changes trough buildings
what else can be?
vanilla cars have slingload points defined already
yeah, there ya go!
you just need to use the correct command
do note that not all modded vehicles work with this though if they are poorly configured
so would sling = heli setSlingLoad prowler be correct for getting the heli to load the prowler?
try it out
yeah the problem is im still trying to figure out the flying 😄
need it to fly over first
but for that you said i can just offset the known position of the car i think
you can just place stuff in editor and run it
to test different commands
you dont have to make it complete and fully working the first time
test parts
then combine
no i have just been on the wiki
join the forum and make a topic, there's an army ready to help with your scripting
i shall in the morning its getting late but want to finish this bit off before i sleep
have fun!
any other command better than doMove that the AI actually follows? im having troubles with AI not woving at all and they dont want to get inside buildings especially when there is AI already inside it.
@astral tendon , what behavior do you have them set to?
_wp setWaypointBehaviour "AWARE";
This is their last waypoint
if you want them to behave you can set them to CARELESS but expect they won't respond to fire or enemy
depends on the situation whether that's appropriate
what about safe?
they will toggle out of safe anytime they get, uhm, stimulated 😄
they won't stay in SAFE but they will stay CARELESS
yeah, forcing safe they are just as dumb
hey guys!
trying to put a array of markernames within a variable and cannot get it to work, getting some weird errors.
I have created several markers on the map called klt_aopos klt_aopos_1 klt_aopos_2 etc. all the way to klt_aopos_20
I want to take all the markers with the name klt_aopos and put it into an array but I have no clue why this does not work..
if (combat_readiness > _CombatReadinessLimit) then {
_MarkerArray = [];
{
if ("klt_aopos" in _x) then {
_MarkerArray append _x;
}
}foreach allMapMarkers;
Thanks
Because string in string is not yet in the game
anyway to go around that? ^^
Use find: https://community.bistudio.com/wiki/find
Check that it isn't -1.
oh thanks @finite dirge , I knew about find but I just thought of a cool way to use it!
How do you check to see if a player has a item in the slot that your watch goes in?
So it seems like binarizing the mod got rid of the error on launch however the code does not work and i'm not sure how i can troubleshoot why it doesn't work.
Just to be clear this is my config.cpp
{
class Mymod
{
name = "Name";
author = "author";
version = 1.0;
requiredVersion = 0.1;
requiredAddons[] = {};
units[] = {};
weapons[] = {};
};
};
delete enableDebugConsole;
enableDebugConsole[] = {"steamid"};```
And inside the mission .pbo description.ext enableDebugConsole = 0; is set
Edit: I'm running a dedicated server on my machine with the said mission and connect to it.
Mission config overrides mod config @opal ibex
@tough abyss I'm not really sure how it all works in order but the wiki says otherwise
https://community.bistudio.com/wiki/Arma_3_Debug_Console
"To whitelist (multiple) users with a mod, if enableDebugConsole has already been defined, use the delete keyword:"
1.Mission param is checked. If is not defined then...
2.description.ext param enableDebugConsole is checked. If is not defined then...
3.Eden attribute option is checked. If not defined then...
4.Global/mod param enableDebugConsole is checked.
it should delete the variable when it's checking mod param, and override description.ext
Or maybe it just stops checking at the 2nd step because it found it
but then why would it write that in the wiki
If mission param not defined then it carries on checking other places including mods. You defined it in the mission so mod config is ignored
That still doesn't explain the wiki. It says if you delete it in the mod it should override it
Once again, mod config only relevant if you haven’t defined it in mission
Deleting is related to mod config
Okay, thanks. The wiki is referring to defining between mods it seems like. It is also logical to not allow overriding description.ext since every modder would have access to debug console with their own keys.
is it possible from scripts, if player uuid on list that allowed to login as admin without password?
Afaik only 1 admin can login at the same time.
Yes just #login
nope, in sqf
However debug console works for everyone inside the param enableDebugConsole
If you are whitelisted in the server config
Why are numbers at the start of classes allowed (eg. class 123Classname), but not as functions (eg. 123Classname_fnc_functionName)?
because after changing the TAG in my mod I get the following errors:
23:37:24 Error in expression <_this call 123Classname_fnc_onPlayerRespawn;>
23:37:24 Error position: <Classname_fnc_onPlayerRespawn;>
23:37:24 Error Missing ;
classes are configs, variables are varnames
you could be forbidden to use numbers for your classes, be happy 😄
i have one question
USbox setPos getMarkerPos "Marker2";```
this is my script to move 1 box from A to B. the problem: its not spawning always at my pos, sometimes at friendly player pos.
why?
why use a marker to set/get the position?
USbox setPos (getPos player);
or even better
USbox setPos ((getPos player) findEmptyPosition [0, 25]);
btw... the reason why it sometimes spawns at the wrong place is most likely because the script doesn't know who player is, especially when it's not you who called the script
yea dude this making sence. iam nooby with that stuff but thx for the quick answer, i will try it out!
yea its working. thankyou! may i ask why the parameters 0, 25?
0, 25 is minimum distance and maximum distance from the players position
all right-thx
Hey I need help setting up a flag teleporter to teleport to a platform 10,000 meters in the sky
I find the KK_fnc_setPosAGLS script but I am unsure on how to implement it
this AddAction ["Teleport",
{
Params ["_Timer", "_Caller", "_actionId", "_arguments"];
_Caller SetPos _PositionOfPlatform;
}];
okay sorry but how do I use that
which are variables sorry new to scripting but I have some programming knowledge
do you want to add an action to or flag or what?
in other words, how does one activate the script?
@hazy timber you could put an arrow helper on your platform named "exitHere" and use this,
call
{
if (tp1==0) exitwith {
tp1=1;
exitThere= createVehicle ["sign_arrow_blue_F", player getPos[ 0, getDir player ], [], 0, "CAN_COLLIDE" ];
hideObject exitThere;
titleText ["Teleporting", "BLACK FADED", 0.2];
_veh= vehicle player;
_veh setpos (getpos exitHere);
playsound ["Orange_PeriodSwitch_Pre_01", true];
sleep 0.5;
titleCut ["", "BLACK IN", 5];
};
if (tp1==1) exitwith {
tp1=0;
titleText ["Teleporting", "BLACK FADED", 0.2];
_veh= vehicle player;
_veh setpos (getpos exitThere);
playsound ["Orange_PeriodSwitch_Pre_01", true];
sleep 0.5;
titleCut ["", "BLACK IN", 5];
deleteVehicle exitThere;
};
};
You'll also need to add a line to the init file, or in the mission init properties: tp1=0;
This will allow you to teleport back to wherever you teleported from.
Have fun!
@hazy timber , you might want this, too
player addAction ["teleport", "teleport.sqf"];
I used the last one @hot kernel however since the platform is in the air did not go there but rather the ground below it I wish their was a way to simply edit that command to include the z axis
the last one?
no z axis necessary just put a helper arrow named "exitHere" on your platform where you wish to arrive
you can use a can of tactical beans if you want just name it and hide it
we could save the player position as a variable but this is easier
thanks that fixed it
karmic balance achieved
Hey guys
does anybody have a script for paradroping landrovers and troops out of a c-130 ? i know it can all be done manually but i want to start the mission while were already in the air and have the trucks land in one spot and troops further away and run to the trucks once we land for a cool fire fight. can i have the vehicles already loaded and in the air and ready to drop once we hit the drop zone? much appreciated boys
i cant do much else on the mission except the paradrop
pls help
@opal ibex
it seems like the delete keyword is just ignored in the code.
You need to delete and re-add in multiple mod configs. Afaik can't do in the same.
@obsidian violet
_MarkerArray append _x;
append takes array, not string. You actually want to useselectthere instead of forEach.
@exotic flax
Why are numbers at the start of classes allowed (eg. class 123Classname), but not as functions (eg. 123Classname_fnc_functionName)?
Because that's how it is. I think numbers at start in classnames is just an afterthought. As in C++ classes which inspired the config syntax, that's not allowed either.
In sqf, variables starting with numbers... Are numbers with Text
Aka: tokenizer goes crazy
In Config, there is a special keyword telling that a classname is following
You can create function variable that starts with number in sqf
missionNamespace setVariable ["123my_fnc_function", {}];
not access it wouthout getVariable tho
what would prevent my action menu items from showing up when incapacitated even though i have the parameter in the action menu set to true for unconscious?
Condition returning false
Does anyone have a solution for why this isn't working? (Specifically that the vehicle does not move to the waypoint)
(1_QRF_BTR select 0) setVehicleVarName "Rwy_Bridges_1_QRF_BTR";
_wp1 = 1_QRF_BTR addWaypoint [(getMarkerPos "Rwy_Bridges_1_QRF_WP1"), 0];
Rwy_Bridges_1_QRF_WP1 setWaypointType "MOVE";
1_QRF_BTR deleteGroupWhenEmpty true;```
Looks like a couple of issues. Global variables should not start with a number (they can, see discussion above, but is not recommended).
Second, you want to add the waypoint to a group, not an array. The group should be in (1_QRF_BTR select 2) according to the docs for bis_fnc_spawnVehicle.
Also this variable is not set somewhere, rather it seems to be the name of a marker, Rwy_Bridges_1_QRF_WP1 .. You probably meant _wp1 setWaypointType "MOVE"
Thank you, @errant jasper, this really helped me on my way, however now I'm getting a different error Error Missing ) for line 2.
I don't really know what line 2 is... But try manually counting the parentheses.. Whenever you see a '(' add 1, and when you see a ')' subtract one.. You should end up with 0.
I figured out the problem, I was being retarded and applying the solution to the wrong problem.
Now I just need to fix the infantry spawning into the BTR :p
Thanks alot @errant jasper, greatly appreciated!
I admit defeat. Can anyone explain what I'm doing wrong here? (Intended behaviour is to automatically, without animation, load the squad into the previously mentioned BTR)
Rwy_Bridges_1_QRF_Inf assignAsCargo Rwy_Bridges_1_QRF_BTR_Veh;
Rwy_Bridges_1_QRF_Inf moveInCargo Rwy_Bridges_1_QRF_BTR_Veh;
(Rwy_Bridges_1_QRF_Inf select 2) deleteGroupWhenEmpty true;```
what's the error @jaunty ravine
https://community.bistudio.com/wiki/assignAsCargo
https://community.bistudio.com/wiki/moveInCargo
both take a unit, not a group
(Rwy_Bridges_1_QRF_Inf select 2) ``` da heck is this?
(Rwy_Bridges_1_QRF_In select 2) was just an experiment, not meant to be in the code.
If you have the time, could you explain how I solve this problem? I have no idea how to make it work, I've tried a bunch of different things.
I'm extremely inexperienced with sqf.
oh, okay then.
are you familiar withforEach?
Nope, not in the slightest.
private _groupUnits = units Rwy_Bridges_1_QRF_Inf;
{
_x assignAsCargo Rwy_Bridges_1_QRF_BTR_Veh;
_x moveInCargo Rwy_Bridges_1_QRF_BTR_Veh;
} forEach _groupUnits;```
here ya go 🙂
Thank you!
I'm still getting an error (Undefined variable in expression: rwy_bridges_1_qrf_btr_veh). This is the script as it is right now, I must've messed something up:
private _groupUnits = units Rwy_Bridges_1_QRF_Inf;
{
_x assignAsCargo Rwy_Bridges_1_QRF_BTR_Veh;
_x moveInCargo Rwy_Bridges_1_QRF_BTR_Veh;
} forEach _groupUnits;```
well it seems you don't have any Rwy_Bridges_1_QRF_BTR_Veh vehicle
That's in a different sqf file
So if I add sleep 5 for example between BTR spawn and Inf spawn it should work?
Rwy_Bridges_1_QRF_BTR.sqf =
Rwy_Bridges_1_QRF_BTR = [ getMarkerPos "Rwy_Bridges_1_QRF_Spawn", 0, "rhs_btr70_msv", EAST] call BIS_fnc_spawnVehicle;
(Rwy_Bridges_1_QRF_BTR select 0) setVehicleVarName "Rwy_Bridges_1_QRF_BTR_Veh";
_wp1 = (Rwy_Bridges_1_QRF_BTR select 2) addWaypoint [(getMarkerPos "Rwy_Bridges_1_QRF_WP1"), 0];
_wp1 setWaypointType "TR UNLOAD";
(Rwy_Bridges_1_QRF_BTR select 2) deleteGroupWhenEmpty true;```
Rwy_Bridges_1_QRF_Inf.sqf =
```sqf
Rwy_Bridges_1_QRF_Inf = [ getMarkerPos "Rwy_Bridges_1_QRF_Spawn", EAST, (configFile >> "CfgGroups" >> "East" >> "rhs_faction_msv" >> "rhs_group_rus_msv_infantry" >> "rhs_group_rus_msv_infantry_squad")] call BIS_fnc_spawnGroup;
private _groupUnits = units Rwy_Bridges_1_QRF_Inf;
{
_x assignAsCargo Rwy_Bridges_1_QRF_BTR_Veh;
_x moveInCargo Rwy_Bridges_1_QRF_BTR_Veh;
} forEach _groupUnits;```
I called it from the debug console
through execVM
```sqf
// your code
```
A while back I went through a phase experimenting with attaching different kinds of lights to vehicles. Everything I tried lagged behind the vehicle and made the light effect "blink" like crazy. Only object lights, like a construction lamp, seem to update at the same rate (almost/more-or-less/probably dependent on FPS) as the vehicle. But of course this means duct-taping a construction lamp to my jet...
Can I create the construction lamp light without the object model? Or is there something else I missed?
@jaunty ravine
either put that all in the same file, '''or'''
private _scriptHandle = execVM "createVehicle.sqf";
waitUntil { scriptDone _scriptHandle; };
execVM "createGroupAndPutInVehicle.sqf";```
but it seems silly to have these two in two different files 😐
I'll put them in the same file and get back to you
👍
Rwy_Bridges_1_QRF_BTR = [ getMarkerPos "Rwy_Bridges_1_QRF_Spawn", 0, "rhs_btr70_msv", EAST] call BIS_fnc_spawnVehicle;
(Rwy_Bridges_1_QRF_BTR select 0) setVehicleVarName "Rwy_Bridges_1_QRF_BTR_Veh";
_wp1 = (Rwy_Bridges_1_QRF_BTR select 2) addWaypoint [(getMarkerPos "Rwy_Bridges_1_QRF_WP1"), 0];
_wp1 setWaypointType "TR UNLOAD";
(Rwy_Bridges_1_QRF_BTR select 2) deleteGroupWhenEmpty true;
Rwy_Bridges_1_QRF_Inf = [ getMarkerPos "Rwy_Bridges_1_QRF_Spawn", EAST, (configFile >> "CfgGroups" >> "East" >> "rhs_faction_msv" >> "rhs_group_rus_msv_infantry" >> "rhs_group_rus_msv_infantry_squad")] call BIS_fnc_spawnGroup;
private _groupUnits = units Rwy_Bridges_1_QRF_Inf;
{
_x assignAsCargo Rwy_Bridges_1_QRF_BTR_Veh;
_x moveInCargo Rwy_Bridges_1_QRF_BTR_Veh;
} forEach _groupUnits;
Rwy_Bridges_1_QRF_Inf delteGroupWhenEmpty true;```
Still doesn't work. Still `Undefined variable in expression: rwy_bridges_1_qrf_btr_veh`
well, of course
you only did "setVehicleVarName"
this ^ doesn't set the variable pointing to the object; do rwy_bridges_1_qrf_btr_veh = (Rwy_Bridges_1_QRF_BTR select 0)
Words can't properly express my gratitude, @winter rose, it works now. Thank you a lot.
Good luck in the future; the wiki always greets you arms wide open!
beware, it is the slope of no return 😄
Haha, lucky I'm starting a programming course soon through school
this channel is the first level of SQFHell; the wiki the last one?
it's a cycle
Hi guys. I realize that it could be a kinda stupid question. But why my server doesn't broadcast part of mine global vars pack even for it's internal sqfs? Like I have this sqf script, that contains mainly things like "RK_zombie_hp / RK_launcher_rate_of_fire" and stuff. And this script runs first string from initServer.sqf. My debug console is "on for all" on server so when I put RK_zombie_hp there it just shows nothing. And of course all scripts based on that are ruined. I did a publicVariable stuff to solve it but it does nothing.
you need to publicVariable on each and every change @dull drum
These are static.
you trigger the value's broadcast with this command, but not the auto-sync of it
It's just a balance stuff, modifiers. I don't change them, only read them.
What makes me really angry is that part of them actually works sometimes
Does the CuratorObjectPlaced work if assigned to all curators on server or does it need to be assigned to each curator on their own client?
Each, @wispy cave
so, in initServer.sqf:
RK_zombie_hp = 666;
publicVariable "RK_zombie_hp";```
and from a connected player:
```sqf
isNil "RK_zombie_hp"; // returns true?```
(maybe you forgot quotes around the public'ed variable?)
Yup, its true
Performed locally
and globally
Nope they all are in quot marks
I've also tried
balanceSettings = [] execVM "server\balanceSettings.sqf";
waitUntil {scriptDone balanceSettings};
without any good results
@hot kernel
Can I create the construction lamp light without the object model? Or is there something else I missed?
sure, you can create your own model 😄
unset such as RK_zombie_hp = nil, in an "unload script" or anywhere else; it might be that the script gets triggered first
yes execVM it means the script is started, but in no way it means it's done
can you show us the publicVariable part?
@dedmen, yeah but I don't want the model... I want the light.
unset such as RK_zombie_hp = nil, in an "unload script" or anywhere else; it might be that the script gets triggered first
No I'm pretty sure that I don't nil them.
Also it works in singleplayer.
There are light cones available in the editor.
that's fine though, if that's the answer. I need the construction lamp light attributes as a model without the actual model. If that's the answer, so be it.
@winter rose
// bullet types and zombie bullet speed
RK_zombie_bullet = "B_127x99_Ball";
RK_demon_bullet = "B_45ACP_Ball_Green";
RK_zombie_bullet_speed = [0, 0, -1000];
RK_pistol_bullet = "B_9x21_Ball";
RK_rifle_bullet = "B_65x39_Caseless";
RK_launcher_rocket = "R_PG32V_F";
publicVariable "RK_zombie_bullet";
publicVariable "RK_demon_bullet";
publicVariable "RK_zombie_bullet_speed";
publicVariable "RK_pistol_bullet";
publicVariable "RK_rifle_bullet";
publicVariable "RK_launcher_rocket";
@still forum thanks
@hot kernel maybe you can inherit the lamp in a mod config, and just set the model to something invisible
looks totally fine;
you shouldn't need to iirc, but you can still waitUntil { not isNil "variable" }; to be sure you receive them at init stage @dull drum
Yup, that sounds good, I'll try that.
Thanks @winter rose
@still forum that's the kind of idea I had. I'll get to researching that type of solution instead of scripting-- if you want a good laugh I'll post my workaround for this 😄
I will also try to move them to the serverInit just in case
I was convinced the publicVariables were synchronised for JIP players, seems I was wrong 😶
They are
The strangest moment of all is that the scripts that run on server do not receive these vars. But do if it's a singleplayer, of course. I think I'll beat my kill dedic-save-export to MP-start dedic-join record today
wha… the server doesn't have its own vars? ><
@hot kernel
There are light cones in the editor that might be useful in this situation.
but it seems you have to wait for them
Dunno what you mean
waitUntil { not isNil "myPublicVar"; };``` I thought JIP publicvariables were already loaded before evn reaching the init.sqf stage
They are
@verbal saddle I'm not sure where but yeah, that does sound useful? Where are light cones in the editor?
Guess what, @winter rose. The waitUntil { not isNil "myPublicVar"; }; just did the job. All wonders of all worlds to you, sir.
You can’t make your assumptions on some comments you read here @winter rose
People post all sorts of rubbish, only testing it yourself can give you the answer, do not trust anyone, trust the game
Gentlemen, I think the issue was based on the standalone sqf file that was run from initServer and the scripts just need to be waited for. If it was just the init file everything could go better from the beginning.
@tough abyss I try to never assume anything, thanks
I think I read that on the biki though. And that's bad.
@hot kernel search 'cone' in the empty side
They were added in contact dlc to base game
Only 100% repro otherwise ignore
@verbal saddle okay, I thought I knew every object in there!
You can then attach them to your vehicle and it shouldn't stutter
of course, everytime I read something I repro it first before anything else --'
nuh-huh.
@verbal saddle thanks!
👍
I was convinced the publicVariables were synchronised for JIP players, seems I was wrong 😶
You were not but this is what I’m talking about
oh wait - you meant "I shouldn't be wrong before someone states something here"
my bad then.
https://community.bistudio.com/wiki/Multiplayer_Scripting#Join_In_Progress
^ here is the one: many information synchronised (…) by the game before accessing the mission itself.
I mean don’t throw away things you know because someone told you so without any proof
yes yes, I got it the other way "don't believe what you read on the biki" x)
publicVariables have to sync before everything just like functions have to exist before everything
https://community.bistudio.com/wiki/formationTask
https://community.bistudio.com/wiki/setFormationTask
This also does not work in Arma 3, needs note
@tough abyss
```sqf
/* your code */
```
_mark2 = _this select 1;
_mark3 = _this select 2;
grp = CreateGroup West; //Indepentent
unit = grp createUnit ["VTN_USMC_MARW_XO",getMarkerpos _mark1,[],0,"CAN_COLLIDE"];
sleep 2;
_moveWP = grp addWaypoint [getMarkerPos _mark2,0,1];
_moveWP setWaypointCompletionRadius (1);
[grp,1] setWaypointTimeout [0,0,0];
[grp,1] setWaypointStatements ["unit == this;", "grp setCurrentWaypoint[grp,1]"];
[grp,1] setWaypointSpeed "LIMITED";
[grp,1] setWaypointCombatMode "RED";
[grp,1] setWaypointBehaviour "SAFE";
_moveWP = grp addWaypoint [getMarkerPos _mark3,0,1];
_moveWP setWaypointType "MOVE";
_moveWP setWaypointCompletionRadius (1);
[grp,1] setWaypointTimeout [0,0,0];
[grp,1] setWaypointStatements ["unit == this;", "grp setCurrentWaypoint[grp,1]"];
[grp,1] setWaypointSpeed "LIMITED";
[grp,1] setWaypointCombatMode "RED";
[grp,1] setWaypointBehaviour "SAFE";
unit addEventhandler ["Killed",{if (alive(_this select 1))then {["mark1","mark2","mark3"]execVM"patrolAi.sqf"} spawn AIunitRespawn;}];
sleep 10;
while {true} do {
{
deleteVehicle _x;
sleep 0.01;
} forEach allDeadMen;
sleep 10;
};````
_mark1 = _this select 0;
_mark2 = _this select 1;
_mark3 = _this select 2;
grp = CreateGroup West; //Indepentent
unit = grp createUnit ["VTN_USMC_MARW_XO",getMarkerpos _mark1,[],0,"CAN_COLLIDE"];
sleep 2;
_moveWP = grp addWaypoint [getMarkerPos _mark2,0,1];
_moveWP setWaypointCompletionRadius (1);
[grp,1] setWaypointTimeout [0,0,0];
[grp,1] setWaypointStatements ["unit == this;", "grp setCurrentWaypoint[grp,1]"];
[grp,1] setWaypointSpeed "LIMITED";
[grp,1] setWaypointCombatMode "RED";
[grp,1] setWaypointBehaviour "SAFE";
_moveWP = grp addWaypoint [getMarkerPos _mark3,0,1];
_moveWP setWaypointType "MOVE";
_moveWP setWaypointCompletionRadius (1);
[grp,1] setWaypointTimeout [0,0,0];
[grp,1] setWaypointStatements ["unit == this;", "grp setCurrentWaypoint[grp,1]"];
[grp,1] setWaypointSpeed "LIMITED";
[grp,1] setWaypointCombatMode "RED";
[grp,1] setWaypointBehaviour "SAFE";
unit addEventhandler ["Killed",{if (alive(_this select 1))then {["mark1","mark2","mark3"]execVM"patrolAi.sqf"} spawn AIunitRespawn;}];
sleep 10;
while {true} do {
{
deleteVehicle _x;
sleep 0.01;
} forEach allDeadMen;
sleep 10;
};```
How can i repeate the waypoints?
When the AI arrives the last marker, that they go back to the first one!
I need only change "_ moveWP" to "_cycleWP"? _cycleWP = grp addWaypoint [getMarkerPos _mark2,0,1]; _cycleWP setWaypointCompletionRadius (1); [grp,1] setWaypointTimeout [0,0,0]; [grp,1] setWaypointStatements ["unit == this;", "grp setCurrentWaypoint[grp,1]"]; [grp,1] setWaypointSpeed "LIMITED"; [grp,1] setWaypointCombatMode "RED"; [grp,1] setWaypointBehaviour "SAFE";
no. create a new "CYCLE" waypoint.
Yes, mean it so!
_mark2 = _this select 1;
_mark3 = _this select 2;
grp = CreateGroup West; //Indepentent
unit = grp createUnit ["VTN_USMC_MARW_XO",getMarkerpos _mark1,[],0,"CAN_COLLIDE"];
sleep 2;
_moveWP = grp addWaypoint [getMarkerPos _mark2,0,1];
_moveWP setWaypointCompletionRadius (1);
[grp,1] setWaypointTimeout [0,0,0];
[grp,1] setWaypointStatements ["unit == this;", "grp setCurrentWaypoint[grp,1]"];
[grp,1] setWaypointSpeed "LIMITED";
[grp,1] setWaypointCombatMode "RED";
[grp,1] setWaypointBehaviour "SAFE";
_moveWP = grp addWaypoint [getMarkerPos _mark3,0,1];
_moveWP setWaypointType "MOVE";
_moveWP setWaypointCompletionRadius (1);
[grp,1] setWaypointTimeout [0,0,0];
[grp,1] setWaypointStatements ["unit == this;", "grp setCurrentWaypoint[grp,1]"];
[grp,1] setWaypointSpeed "LIMITED";
[grp,1] setWaypointCombatMode "RED";
[grp,1] setWaypointBehaviour "SAFE";
_cycleWP = grp addWaypoint [getMarkerPos _mark2,0,1];
_cycleWP setWaypointCompletionRadius (1);
[grp,1] setWaypointTimeout [0,0,0];
[grp,1] setWaypointStatements ["unit == this;", "grp setCurrentWaypoint[grp,1]"];
[grp,1] setWaypointSpeed "LIMITED";
[grp,1] setWaypointCombatMode "RED";
[grp,1] setWaypointBehaviour "SAFE";
unit addEventhandler ["Killed",{if (alive(_this select 1))then {["mark1","mark2","mark3"]execVM"patrolAi.sqf"} spawn AIunitRespawn;}];
sleep 10;
while {true} do {
{
deleteVehicle _x;
sleep 0.01;
} forEach allDeadMen;
sleep 10;
};````
again, it's
```sqf
code
```
Sorry
and, no, just changing the variable name will not change the waypoint type. see setWaypointType
_cycleWP = grp addWaypoint [getMarkerPos _mark3,0,1];
_cycleWP setWaypointType "CYCLE";
_cycleWP setWaypointCompletionRadius (1);
[grp,1] setWaypointTimeout [0,0,0];
[grp,1] setWaypointStatements ["unit == this;", "grp setCurrentWaypoint[grp,1]"];
[grp,1] setWaypointSpeed "LIMITED";
[grp,1] setWaypointCombatMode "RED";
[grp,1] setWaypointBehaviour "SAFE";
Sorry again for the wrong posting, i had do it how you had write! And thanks for the advice!
groups are considered objects?
No they are groups
Does anyone know how to whitelist individual slots to specific UIDs?
group is a type in arma
@spiral compass In the init you can just kick them or end the mission if they don't match the UID you are looking for.
I want it to be automatic. Where they can't use a specific slot, unless it is their slot. That removes the possibility of trolling, if/when server is empty
Right, so do what I said then? Add a CfgDebriefing for what end you want and https://community.bistudio.com/wiki/BIS_fnc_endMission them if they don't match the UID.
I guess I misunderstood. I thought you were telling me to just kick ppl who aren't in the correct spot. But I'm not 100% on how to do all of that
Gimmie a Sec and I'll write something up for you.
Description.ext:
class CfgDebriefing {
class NotWhitelisted {
title = "Not Whitelisted";
subtitle = "You aren't Whitelisted";
description = "You are not Whitelisted to use this slot.";
pictureBackground = "";
picture = "";
pictureColor[] = {0,0.3,0.6,1};
};
};
initPlayerLocal.sqf:
waitUntil {!(isNull (findDisplay 46))};
private _uidArray = [["slot_name1", "76561197960287930"], ["slot_name2", "76561197960287931"]];
private _notWhitelisted = true;
{
if (str(player) isEqualTo _x select 0 && {getPlayerUID isEqualTo _x select 1}) then { _notWhitelisted = false; };
true;
} count _uidArray;
if (_notWhitelisted) exitWith {
["NotWhitelisted", false, true] call BIS_fnc_endMission;
sleep 40;
(findDisplay 46) closeDisplay 0;
};
Not tested, but that should work.
I'm really new to scripting and I've tried a hundred ways to do this today. I just want to pass a couple variables to a function scope that's inside of [] spawn. Specifically _newDistance and _unitOpf.
_unitOpf = "O_Soldier_F" createVehicleLocal position player;
_newDistance = 10;
_COMmouse = findDisplay 46 displayAddEventHandler ["MouseZchanged","[_this,['_unitOpf','_newDistance']] call COMScrollWheel"];
COMScrollWheel = {
private ["_toggle","_r","_f"] ;
_r = false ;
_f = true ;
_toggle = (_this select 1);
if (_toggle > 0) then {
_newDistance = ((this select 1) + 10);
_unitOpf setPos (player getRelPos [_newDistance, 0]);
_unitOpf setVectorUp surfaceNormal position _unitOpf;
_r = true;
};
if (_toggle < 0 ) then {
_newDistance = (_newDistance - 10);
_unitOpf setPos (player getRelPos [_newDistance, 0]);
_unitOpf setVectorUp surfaceNormal position _unitOpf;
_r = true;
};
};
};```
[_newDistance, _unitOpf] spawn {
params ["_newDistance","_unitOpf"];
```sqf
code
```
To format scripts properly.
After doing that as the pass in you just move the code for determining those values above the spawn line.
ok, its that time where i need help again.
i want that whenever a unit is spawned or initialized, to execute a code on said instance.
{
_unit addEventHandler ["Init", {
_unit additem "itemwhatever";
systemchat format ["unit init'ed"];
}];
} forEach allUnits;
i dont know what's wrong.
is it my code or my testing that im fucking up?
@rotund otter Try this
["CAManBase", "Init", {
_unit additem "itemwhatever";
systemchat format ["unit init'ed"];
}] call CBA_fnc_addClassEventHandler;
@tough abyss thank you 100%
edit: if anyone tries to search for my question, you will need CBA (the mod)
-so, it works, it will systemchat, but it will not add the item.
i have tried changing _unit to _x and _this but it leaves a "generic error expression" error
player works though.
which item are you adding
NVGoggles
if (!hasinterface) then {{if (side _x == resistance) then
{if (_x IsKindof "Man") then
{
_items = assigneditems _x;
if !("potato_fakeNVG" in _items) then
{
_x assignitem "potato_fakeNVG";_x linkitem "potato_fakeNVG";
};
};
};
} forEach allUnits;
You can adapt that. I'm sure there is a way to do it with an evh though
assignItem will do the linking already.
i dont care if its assigned or not. i just want a proof that every time a unit is initialized, i can have a snippet of code that will only affect that single unit, and only that unit.
im not great at scripting so adding an item using additem is an easy way to test for me
assignItem will do the linking already.
It is other way round
Linking includes assignment
i got this
["CAManBase", "Init", {
(_this select 0) addItemToVest "whatever";
systemchat format ["unit init'ed"];
}, true, [], true] call CBA_fnc_addClassEventHandler;
it works , but the player gets init'ed twice
do you know what format does?
Okay so I've been trying a few things here and none have worked yet.
_unitOpf = "O_Soldier_F" createVehicleLocal position player;
_newDistance = 10;
[_newDistance, _unitOpf] spawn {
params ["_newDistance","_unitOpf"];
_newDistance = (_this select 1);
_unitOpf = (_this select 2);
_COMmouse = findDisplay 46 displayAddEventHandler ["MouseZchanged","[_this,["_newDistance","_unitOpf"]] call COMScrollWheel"];
COMScrollWheel = {
_r = false ;
_f = true ;
_toggle = 1;
if (_toggle > 0) then {
_newDistance = (_newDistance + 10);
_unitOpf setPos (player getRelPos [_newDistance, 0]);
_unitOpf setVectorUp surfaceNormal position _unitOpf;
_r = true;
};
if (_toggle < 0 ) then {
_newDistance = (_newDistance - 10);
_unitOpf setPos (player getRelPos [_newDistance, 0]);
_unitOpf setVectorUp surfaceNormal position _unitOpf;
_r = true;
};
};
};
I'm not sure I'm using
[_this,["_newDistance","_unitOpf"]] call COMScrollWheel"];
``` correctly
Still getting #getrelpos expected number from _newDistance
you need to escape those " with a \ more than likely as its meant to be a string. So something like (please don't butcher this!)
"[_this,[\"_newDistance\",\"_unitOpf\"]] call COMScrollWheel"
butchered
No
"Blah" ""Blah Blah"" or "Blah 'Blah Blah'"
"string ""escaped"""
It's not escaping anything if it's already ended?
"Blah" ""Blah Blah""
🤦
Explain
Put it in debug console
This is not valid string "Blah" ""Blah Blah""
Huh? It looks like one example and after or there is second example
Ah okay I'll try that
You can either
a)
Double quote to escape,
b)
Single quote to escape
So something like this?
["MouseZchanged","[_this,[""_newDistance"",""_unitOpf""]] call COMScrollWheel"];
Or use {} code not a string
That'll work but code works too
Damn still not passing the var.
iirc all the UI EH's accept code
Banging my head on the table at this point
format the string
Undefined vars apart from _this
Wait what?
Your variables do not exist inside event handler, only _this
And global function variable
Okay I got it. So if I want to pass the var's that are not defined to the function can I do [var1,va2] myfunction = {yadadada }; or can I just do params and then select?
That's my problem so far. I really don't understand how _vars get passed down to other scopes.
[_var,_var1] spawn and then params makes sense to me. But why is the child scope not seeing it?
Depends what scope. If it is child scope they get inherited if it is new scope they don’t get passed. Spawn and call can take params and pass arguments in _this, event handlers don’t take params (apart from one, but it irrelevant here)
Spawn makes new scope
Event handlers make new scope
Okay so ComScrollWheel is not a child scope, it's a new scope then which is why it's not picking up the prior variables.
Bingo
@finite dirge sorry. Been extremely busy. Thank you. I will test it out, as soon as I can
i have a map icons script that shows all bluefor stuff on the map. it works greate, however it doesnt show Incapacitated players. can some one please take a look at it and tell me what im doing wrong?
https://pastebin.com/d3nWNMbi
are you still allowed to swear in #arma3_scripting? i see someone got in trouble in #general_chat_arma
i am shit at scripting
Maybe bad words embedded in code don't count, just don't make many syntax errors; #⃣
@exotic tinsel
Incapacitated players will most likely be on the 'civilian' side
Use "side group _x" to get around the issue.
It looks like your also missing some brackets around your array on line 45
Hello, excuse me, I want to show a player's savings in the upper right corner by remoteExecCall, but there is no display and no RPT error found. I hope I can get help. Thank you!
What's the easiest way to make a unit look in the opposite direction to something? I'm spawning units just outside a building and want them to face outwards
obviously i can make them look at the building with lookAt but that's not much good :/
getDir setFormDir setDir
👍
OMG ARMA! so allplayers on the server contains all players, incapacitated, dead, and alive. but on the client it does not contain incapacitated! someone please put that on the wiki!
it does show you if your incapacitated but not other players
In player hosted game, the complete array of allPlayers may get delayed at the start. Use BIS_fnc_listPlayers if you need it earlier? or is it something completely different
me is biki worky boi, me can fixy
hosted server. and no i waited 60 seconds.
wait maybe for 5 mikes, it might be that
I need a full detailed behaviour before changing the biki (pretty please)
arg scratch that im a tart. lol
what? why?
my test code was bad.
been up 36 hours.