#arma3_scripting
1 messages · Page 117 of 1
Well
im going to seek help in the altis life forums, maybe they had this problem before
Without checking your code there is nothing we can say other than "fix it yourself"
so this line of code is all i really have to get any info about what functions it calls, etc.
this addAction[format ["%1 ($%2)",localize (getText(missionConfigFile >> "Licenses" >> "rebel" >> "displayName")), [(getNumber(missionConfigFile >> "Licenses" >> "rebel" >> "price"))] call life_fnc_numberText],life_fnc_buyLicense,"rebel",0,false,false,"",' !license_civ_rebel && playerSide isEqualTo civilian ',5];
now i gathered that life_fnc_buyLicense is the function, and rebel (or whatever would be in that spot) is the desired variable
the conditions at the end i have already replicated in my script
i've tried a bunch of things like [rebel] call life_fnc_buyLicense; etc and always get that missing error
missing ; on line X
Let me rephrase: elaborate and tell us every text what the error said
Post entire error message
so i've done some tweaking and made some progress 😄 still have errors though 
at least now i have called my desired function
addAction sends lots of data into the function, not just "rebel"
And that is a string being sent, not a variable
addAction argument parameter gets sent into the function as _this select 3 along other addAction related stuff
So if you want to emulate call to life_fnc_buyLicense as if it was done from addAction, you'll need to do something like:
[player, player, -1, "rebel"] call life_fnc_buyLicense;
Can someone help me try to figure out what this error is? The script works regardless of this error. Just it pops up every time I activate it and is kinda annoying.
call{this addAction ["Reset Targets",
{
{
_x animate ["terc", 0];
} forEach shootingTargets6; titleText ["Sniper Course Has Been Reset","PLAIN", 0.5];
playSound "FD_Finish_F" }]};
Error Undefined Variable in expression: _x
I have 7 other scripts set up exactly like this. The ONLY difference is "forEach shootingTargets<number>" and "["<station> Has Been Reset...]" otherwise everything is set up identically. The trigger this runs out of has the exact same call for everything (different variable names for all the targets as well) . All others work perfectly fine without this pop up.
What is shootingTargets6?
I just shut my computer off for the night. However I will get that tomorrow after I get off work.
Glad you can still decide you want to go bed
setVelocity doesn't work on them?
Speaking of parachute, I was wondering if we could get a command to force parachute to fold as if it landed? Engine logic for it far from ideal, why no let mods\script correct it?
it does (i think), just working on a script to land a crate at a specific position (for instance, in front of the player)
with wind it becomes a challenge
use setVelocityTransformation
IE, drop a crate in front of a player no sooner than 10 seconds after the para is created
so 10 second flight time, calc the in-air spawn pos
given wind and a ??? descent rate
still this 
haha
assuming wind doesn't change, you can use an equation to caculate the descent rate (which is roughly constant) so calculating the position will be easy
_velocity = wind vectorMultiply 0.5 vectorAdd [0,0,-2];
_spawnPos = _targetPos vectorDiff (_velocity vectorMultiply 10);
and then you can just move the chute every frame:
_chute setVelocityTransformation [
_spawnPos,
_targetPos,
_velocity,
_velocity,
[0,1,0],
[0,1,0],
[0,0,1],
[0,0,1],
(time - _startTime) / 10
];
❤️
I think the question was not is there a "set descent velocity" [command] but is there a [descent velocity that has been set].
Can't check to see if it's specified in config right now, but I've got a feeling that parachutes have actual flight models and so it's controlled by that, same as a plane's glide behaviour
I have a beginner question that I can't quite figure out, I have a script using some ace functions
[1,[], {hint "Dismantled"}, {hint "Failed!"}, "Dismantling"] call ace_common_fnc_progressBar;
},{true},{}] call ace_interact_menu_fnc_createAction;
["land_stakes", 0, ["ACE_MainActions"], clearObstacle] call ace_interact_menu_fnc_addActionToClass;```
but for the life of me I can't figure out how to reference the object it's activated on? (if that makes sense) where I have hint "Dismantled", I wanted to use deleteVehicle this. It works when I don't use ace_common_fnc_progressbar, so I assume it's something to do with it being nested?
I tried forEach but that didn't work
see this
So, I'm trying to make a squad like rally point system for my group. I just can't figure out how to get it done. I want it to be done via ace self interact. The player must be a group leader and each time one is placed the old one is replace. Having an issue creating an actual function. I'm quite unfamiliar with c++ but have good knowledge of java so some things make sense and some don't at all.
https://paste.ofcode.org/3933z3rxrZi52zK7gikWFmS
It is 2 seperate files as seen by the comment in the code
Paste from config_makers, just don't know where exactly to put this
that's not C++
thought arma was c++
no
well don't crosspost. delete the one from config makers
Done
The internal language for the game engine is some kind of C flavour, but the languages we use are Arma config (aesthetically C++ like but not actually) and SQF, a proprietary intermediary language specifically for Arma scripting
anyway you don't really need a config for this. are you trying to make a mod for all missions?
oh that works perfectly, thank you, exactly what I needed
Yeah, I want it as a pbo just so it doesn't need to set up for every new mission
All I'll want to do is just have to set up the actual teleport to the object in game, but the whole mechanism to put the rally down I wanna do through a standalone mod
to make a function you should use CfgFunctions
something like this:
class CfgFunctions
{
class DSQN
{
class Category
{
file = "DSQN_RallyPoint\functions";
class spawnRallyPoint {};
};
};
};
then put fn_spawnRallyPoint.sqf in a folder called functions inside your mod folder
the function name will be: DSQN_fnc_spawnRallyPoint so in the action statement you should use "[_player] call DSQN_fnc_spawnRallyPoint";
I see, jesus its so much easier figuring it out with someone who understands it lol
I'll give it a test there now so.
I just couldn't figure out CfgFunctions, since it just sends me to the library
Ah, creating an addon.
How come file doesn't actually specify which fnc file its calling?
Given the right folder/class structure, the game will automatically detect function files with matching names
it's set automatically if you use that structure
Oh that's cool, so the prefix im assuming i'd change to fnc instead of fn?
for the file ^
you could also do it like this:
class CfgFunctions
{
class DSQN
{
class Category
{
class spawnRallyPoint {
file = "DSQN_RallyPoint\functions\fn_spawnRallyPoint.sqf";
};
};
};
};
No, the file must be prefixed with fn_ for detection
I see. Does the Category class HAVE to be category. Sorry for the questions, just want to make sure I kinda understand it
So it's just, there?
yeah. it allows you to structure your functions
If you don't specify a folder with the file = "..."; property, then the category name is used for automatically determining the file path. Otherwise it's just for tidiness
Suppose its a good habit to get into keeping things organised
{
params ["_obj"];
[25, _obj,
{
params ["_obj"];
deleteVehicle _obj;
}, {hint "Failed!"}, "Dismantling"] call ace_common_fnc_progressBar;
},{true},{}] call ace_interact_menu_fnc_createAction;
["hedgeHog", 0, ["ACE_MainActions"], clearObstacleHedgehog] call ace_interact_menu_fnc_addActionToClass;```
last beginner question (hopefully) for now, if instead of wanting to do just individual class names, can I use "hedge" in str _obj where "hedgeHog" is?
no
there is no _obj there as far as I see
and even if there was, it should be typeOf _obj not str
but perhaps you should explain in more detail what you're trying to do
sorry I copy and pasted all of it, then removed the context to it accidentally
The ACE function itself is already doing a typeOf check against the string classname you provide. You can't make a custom condition code, that function only goes by classname
You could make some config lookup code to make a list of classes with "hedge" in them (note this may also catch foliage hedges), and then do the ACE function for each of those classes
that's ok, I was just trying to be a little bit more efficient but I can see now it's only by classname
cos there's like 4-5 hedgehogs, instead of having the same element 4-5 times to enable all types to be cleared
thank you for the help.
if(isNil {Misc_Backpackheap getVariable "RALLYPOINT1"}) then
{
RALLYPOINT1 = "Misc_Backpackheap" createVehicle getMarkerPos "_rallyPOS";
}else{
deleteVehicle RALLYPOINT1;
sleep 3;
RALLYPOINT1 = "Misc_Backpackheap" createVehicle getMarkerPos "_rallyPOS";
}
So I'm trying to make my fn_spawnRallyPoint to check if the object already exists, and depending on that it'd either do one or the other. Found this on the forums saying it could help do that for me, but when I run it nothing happens.
My understanding is that the if condition is checking if Misc_Backpackheap object by variable name RALLYPOINT1 exists
I do have a hint statement just before the first line so i know it is in fact calling the function
also I am testing this on local host server to check if it works on MP
no. it checks if RALLYPOINT1 is defined in the Misc_Backpackheap's var space
Ok so I'd need to also set a varname when spawning the object in I suppose
if(isNil {Misc_Backpackheap getVariable "RALLYPOINT1"}) then
{
ADDED A HINT1 HERE
RALLYPOINT1 = "Misc_Backpackheap" createVehicle getMarkerPos "_rallyPOS";
}else{
deleteVehicle RALLYPOINT1;
sleep 3;
RALLYPOINT1 = "Misc_Backpackheap" createVehicle getMarkerPos "_rallyPOS";
}
I also added a hint here, it shows as activating, but nothing spawns
your code makes zero sense to me
Fair enough
I just searched on wiki for 'how to check if object already exists'
Only result I found
Essentially I want the function, on activation, to check if the object already exists, if it does not, then it will create it, if it does exist it will delete the one placed previously and create a new one. This would be all done on the group leaders location
what type of object is it?
its from cup, just a pile of military style backpacks
you sure the class name is correct?
Yes
Double checked aswell
Could it have anything to do with the fact I'm testing on a local host server?
if (isNull (missionNamespace getVariable ["DSQN_backpackHeap", objNull])) then
{
DSQN_backpackHeap = "Misc_Backpackheap" createVehicle [0,0,0];
};
DSQN_backpackHeap setPosATL getPosATL player;
you don't need to delete the object every time
just move it
You, my friend, are amazing
So now DSQN_backpackheap is just a class in the function itself or is that the varname too?
it's just a global var
Yeah gotcha, my intent is now when this is activated is to also set down the same object on a "respawn_west" marker and then make it a teleporter. So I can just call for this one specifically as DSQN_backpackheap
?
But with this I should be able to figure it out
But again, thanks for taking time to help me out
With what I could try figure out myself I wouldn't have gotten this
do you mean you want to move the respawn_west marker onto the backpack?
Well this mod will be for the unit I'm in, the way we set up our respawns in the mission is just on a respawn_west marker at our 'base'. So my intent is that when a TL or whoever places a rally down near the AO that one also spawns back at the main base, I'll add an addaction to the one at base to allow a TP to the one placed in the AO. The way our medical is set up, with serious injury you can fully die quite quickly. So this will force TLs to place a rally down and I, as zeus, won't have to TP people, nor will aviation have to take years to fly people back and forth
I understand I could just do a lot of this work on the mission file itself, but with mission files changing so often it'd be easier for me to just make it on a pbo where I don't have to worry about it
_pos = [player, 100, 1000, 2, 0, 0, 0, [[markerPos "blacklist", 250, 500, 45, false]], []] call BIS_fnc_findSafePos; trying to add blacklist marker area but doesnt seem to work
Guys, I have a question, I'm looking on the wiki for the argument and effect of BIS_fnc_spawnGroup but it's not documented. Is this because there is a pattern in all the BIS_fnc_ functions that I'm not aware of as I'm a newbie, or have they just not documented them?
Sorry, I think I expressed myself wrong or it's a stupid question hahaha. In this image, for example, it lists that getPos is a Global argument, but in BIS_fnc_spawnGroup it doesn't list anything about it...
BIS_fnc_spawnGroup should be GE
Is this a standard for all BIS_fnc_? because I'm creating a script that uses some other BIS_fnc_ functions that also don't list anything about the command location
No
ok, ty
private _timeUntilSpawnActive = [180, true] call BIS_fnc_countdown;
while(_timeUntilSpawnActive < 1) do{
[DSQN_backpackHeap_Main,["Move to Rally Point",{_this setPosATL "DSQN_backpackHeap"}]] remoteExec ["addAction",0,true];
private _timeUntilRPDespawn = [600, true] call BIS_fnc_countdown;
while(_timeUntilRPDespawn < 1) do{
deleteVehicle DSQN_backpackHeap; deleteVehicle DSQN_backpackHeap_Main;
};
};
Anyone competent able to help me out with how I can set a timer properly here
Tried using the BIS_fnc_coundown
But not sure how to structure it correcty
Giving me an error Type bool, expected code
your code will never exit this while
so: the current error is while (), it's while {}, but
_timeUntilSpawnActive never changes, so the action will be added indefinitely, multiple times per second
so it count downs to 0, then just constantly repeats the first while loop?
meaning the 600 timer keeps getting reset?
the _timeUntilSpawnActive is never changed in this code, it will not "countdown" by itself
So how would I go about getting it to count down. The wiki page for it isn't really helping me out
So i need to call it?
And in that case, if the timer does go to 0 for _timeUntilSpawnActive, would I be better of using an if statement?
Hello all! )
Where can I go to create a role system with premade weapons selection on a server? A bit like the Bad Company server, when you Can only use and see in the arsenal the weapons that are for your role
state your need, not your code - what do you want to do in the end?
So that part of the code is part of a function that spawns in an object, after the object is spawned in i want a time of 180s to go by, then an addaction to teleport to DSQN_backpackheap to appear on DSQN_backpackHeap_Main, then another timer of 600s to start after which both objects are deleted
spawns in 2 objects*
The objects spawn in fine, just the addaction and deleting bits aren't working for me
sleep?
i tried to have 2 of them but it gave me errors
ok
When adding sleep in your while loops?
What error do you get?
ill set it up again and show you, give me 2
|#|sleep 600;
deleteVehicle DSQN_backpackH...'
Error Suspending not allowed in this context
if (isNull (missionNamespa...'
Error Suspending not allowed in this context
File DSQN_RallyPoint\fnc\fn_spawnRallyPoint.sqf..., line 23
Then the code is:
// Spawns RP at Group Leader
if (isNull (missionNamespace getVariable ["DSQN_backpackHeap", objNull])) then
{
DSQN_backpackHeap = "Misc_Backpackheap" createVehicle [0,0,0];
};
DSQN_backpackHeap setPosATL getPosATL player;
sleep 180;
// Spawns RP at respawn_west marker A.K.A. BLUFOR Spawn
if (isNull (missionNamespace getVariable ["DSQN_backpackHeap_Main", objNull])) then
{
DSQN_backpackHeap_Main = "Misc_Backpackheap" createVehicle [0,0,0];
};
DSQN_backpackHeap_Main setPosATL getmarkerpos "respawn_west";
// Set up the AddAction and the deletion of bags after 10mins
[DSQN_backpackHeap_Main,["Move to Rally Point",{_this setPosATL "DSQN_backpackHeap"}]] remoteExec ["addAction",0,true];
sleep 600;
deleteVehicle DSQN_backpackHeap;
deleteVehicle DSQN_backpackHeap_Main;
Line 23 is sleep 600
Yeah.
You need to spawn your code.
See
https://community.bistudio.com/wiki/Scheduler
[PassParametershere] spawn { all your code here}
That's it. If this is a function you can spawn it instead of calling it.
https://community.bistudio.com/wiki/spawn
Take a look at: https://community.bistudio.com/wiki/Arma_3:_Respawn#Loadouts_and_Roles
It allows you to define roles and loadouts at (re)spawn.
Not really a scripting topic though.
thank you SM, this code worked
Thank you very much sir I'll check this out. Should I talk about it in the editor thread of the discord ?
Tho, even if I respawn them with custom loadouts they'll still be able to change theur weapon in the arsenal 😦
So you want people to have a loadout glued to them
I want to have roles (grenadier, launcher specialist...) on the server which ensure that as soon as you connect and arrive on the Map, the only weapons available in the arsenal are those that correspond to your role, and prevent you from recovering weapons of other classes if they are left on the ground for example
Like the system they use in this server : https://www.gametracker.com/server_info/arma.badcompanypmc.com:2302/
but you'd have to assign variable names to each guy ingame. Then blacklist certain items for each variable name
Yeah that's what I thought 😭🤕
I don't have many free Time left... Thinking i'm going to ask a fiverr Guy to do it
It's going to take hours 😭
Indeed
Thx for the information tho 🙏
it would also not work per client, but per mission
Hey, quick question: I am trying to limit a vehicles magazine ammo. After a lot of googleing I figured you cant custom cap a magazine. So I tried with an eventhandler to reset ammo whenever fired and it is above the amount I want to cap (50). I am currently trying it out in editor therfore I am using "this" in the vehicles init. I am not sure why but the hint does not fire. I tried the ammo command on its own, and it works just fine. Any idea what I did wrong?
this addEventHandler ["Fired", {if (this ammo "LIB_2xMG151_FW190" > 50) then {hint "More than 50"} else {hint "Less than 50"}}];
class CfgVehicles {
class MyVehicleClass {
// ... other vehicle properties ...
class TransportMagazines {
// Define the magazines the vehicle carries
class MyLimitedMagazine {
magazine = "YourMagazineClass"; // Replace with the actual magazine class
count = 30; // Replace with your desired magazine capacity
};
// Add more magazines if needed
// class AnotherMagazine {
// magazine = "AnotherMagazineClass";
// count = 20;
// };
};
};
};
?
TransportMagazines is for magazines carried in the vehicle's cargo, not for its own weapons, and count is the number of mags to add, not the number of bullets in the magazine
this works as a reference for the object to add the EH to, but it can't be used in the EH code itself because that's a separate scope.
https://community.bistudio.com/wiki/Arma_3:_Event_Handlers#Fired
In a Fired EH, the unit the EH is added to is available as the first item in the _this array (note underscore), so params ["_unit"]; or _this select 0
Also, while you can't limit the maximum number of rounds a magazine can hold, you can limit the number of rounds it initially holds when you add the magazine. As long as the vehicle doesn't have access to uncontrolled resupply that will automatically add full magazines, you can simply remove all its original mags and replace them with magazines that only have 50 rounds in.
thanks
I want to make a missile strike, but since I have only a V2 missile model (it is not configured to be used as a projectile), I use an B_MBT_01_arty_F SPH to fire at target, then attach the V2 missile vehicle and rotate it accordingly. It works well on local server, but if the carrier projectile spawned on a dedicated server, clients can't see neither projectile or missile, like the latter inherits some projectile settings - because if I spawn the missile on the dedicated server normally, it shows fine.
Is there a way to show the attached missile for players?
Have you modded in the v2 missile model? And if so, is there a reason you dont just make it a projectile
No, I didn't. I'm not so good with configs.
And I have a doubt the projectile could be visible for clients at all. At least all projectile models for artillery which I use are not shown if spawned on dedicated.
what commands are you using? attachTo and setdirandup?
_missile attachTo [_projectile,[0,-5,0]];
[_missile, [-90,0,0]] call OT_fnc_pitchbank;
OT_fnc_pitchbank = {
private ["_dirXTemp","_upXTemp"];
params ["_object","_rotations"];
_rotations params ["_aroundX","_aroundY"];
private _aroundZ = (360 - (_rotations select 2)) - 360;
private _dirX = 0;
private _dirY = 1;
private _dirZ = 0;
private _upX = 0;
private _upY = 0;
private _upZ = 1;
if (_aroundX != 0) then {
_dirY = cos _aroundX;
_dirZ = sin _aroundX;
_upY = -sin _aroundX;
_upZ = cos _aroundX;
};
if (_aroundY != 0) then {
_dirX = _dirZ * sin _aroundY;
_dirZ = _dirZ * cos _aroundY;
_upX = _upZ * sin _aroundY;
_upZ = _upZ * cos _aroundY;
};
if (_aroundZ != 0) then {
_dirXTemp = _dirX;
_dirX = (_dirXTemp* cos _aroundZ) - (_dirY * sin _aroundZ);
_dirY = (_dirY * cos _aroundZ) + (_dirXTemp * sin _aroundZ);
_upXTemp = _upX;
_upX = (_upXTemp * cos _aroundZ) - (_upY * sin _aroundZ);
_upY = (_upY * cos _aroundZ) + (_upXTemp * sin _aroundZ);
};
private _dir = [_dirX,_dirY,_dirZ];
private _up = [_upX,_upY,_upZ];
_object setVectorDirAndUp [_dir,_up];
};
Maybe to create projectiles local to clients, and add a local copy of V2 model?
Have you check to make sure _projectile is valid when you attach it? Also where are those first 2 lines of code executing from
remote Fired doesn't always have a projectile in there, I don't remember all details but it depends on projectile simulation
if its bullets it has fake local projectiles, if its missle it shold be global
Basically log your projectile to see what's going on
Its probably fake remote projectile, so attachTo doesn't broadcast because it attaches to a local entity
Have you check to make sure _projectile is valid when you attach it? Also where are those first 2 lines of code executing from
I checked all the steps, and I sure all working fine because all projectile end effects work, also I checked the missile body - it is attached to the projectile and moves with it. The first two lines are in the Fired EH.
Its probably fake remote projectile, so attachTo doesn't broadcast because it is attached to a local entity
If I'd take, say, ETA - 10 time, and create a local copies of the projectile just te be shown on clients - can it help?
Try having local V2 model attached to projectiles on each client
createSimpleObject with local flag and attach it on Fired EH
There are lots of nuances about Fired EH, locality and such
For example it won't fire at all for some types of shots if your camera is too far away from the shooter on non-server clients
Try having local V2 model attached to projectiles on each client
Hm... Thanks, I'll try.
What am I doing wrong here? I want to punish Blufor by freezing them in place for 2 minutes if they kill a civilian
addMissionEventHandler ["EntityKilled", {
params ["_killed", "_killer", "_instigator"];
[_killer, _killed] spawn {
params ["_killer", "_killed"];
if (!(_killed isKindOf "Animal") && side group _killer == blufor && side group _killed == civilian) exitWith {
_killer globalChat format ["PENALTY! %1 killed a civilian and have been frozen for 2 minutes.", name _killer];
_killer enableSimulation false;
sleep 120;
_killer enableSimulation true;
};
};
}];
You're disabling simulation from server side
Also do your kind of and side checks before spawn'ing a thread
this EH spams threads for every single little thing killed in the game
Question how do you add custom limited arsenal with custom addaction.
I tryied it like this but it dosent work:
private _pos = player modelToWorld [0,1,0];
private _box = createVehicle ["B_supplyCrate_F",_pos,[],0,"None"];
_box setObjectTexture [0, "#(rgb,8,8,3)color(0,0,0,1)"];
_box addAction ["Open NATO Arsenal",{
params ["_target","_caller","_id","_args"];
private _bArray = _args # 0;
private _iArray = _args # 1;
private _mArray = _args # 2;
private _wArray = _args # 3;
[_target, _bArray, true, false] call BIS_fnc_addVirtualBackpackCargo;
[_target, _iArray, true, false] call BIS_fnc_addVirtualItemCargo;
[_target, _mArray, true, false] call BIS_fnc_addVirtualMagazineCargo;
[_target, _wArray, true, false] call BIS_fnc_addVirtualWeaponCargo;
["Open", false] call BIS_fnc_arsenal;
},[_backpackArray,_itemArray,_magazineArray,_weaponArray]];
It only opens empty arsenal. And yea i have arrays filled it would be to big to paste here.
enableSimulation is local, do a remoteExec or something, kinda bad approach for punishment either way
Any way to instantly respawn someone? I have a 2 minute respawn timer set, but at the end of the game I'd like to respawn everyone who is dead so I can reveal something on the map
setRespawnTime is a command, I find it kind of janky though
You can just params instead of four private statements
_args params ["_bArray", "_iArray", "_mArray", "_wArray"];
If _args has more than four elements, you can also just add an extra variable / empty string to catch the rest.
If you're not going to use further elements [at the end of the array] you can ignore them completely. An empty variable name would only be needed if there's one you need to skip between elements that are used.
Yea so i am just confused on how to create a limited arsenal that you can open with custom addaction.
And this example dosent work.
can someone help me understand exitWith?
currently this is the code i have.
if (side player != civilian) exitWith {hint "Only civilians can join the Mujahideen!"};
titleText ["If a hint does not pop-up in the top right, go to Options > Game > and enable Tutorial Hints", "PLAIN DOWN"];
[["Mujahideen", "JoinInfo"], 15, "", 35, "", false, false, false, true] call BIS_fnc_advHint;
Now, ideally I would want that if the first condition isn't met, the script exits with that and ends.
However, it goes through the rest of the script
exitWith should behave exactly like you want it to here.
Is it possible the condition just isn't being met for some reason? Is it displaying the hint it's supposed to show when exiting?
no, i have the same condition setup in another script and it still goes through the whole script
So the same condition is also not working somewhere else? That sounds like it is possible the condition isn't being met
In the snippet you've pasted, if player is side civilian then the second and third lines will not be executed.
Found the issue. It was actually another condition that was breaking causing the script run through its entirety
Hello,
Quick and stupid question, getting "Type string expected object" when I try to getpos on the var, but a hint of _spawnObj returns the var name of an eden placed object perfectly
Where am i going wrong please?
fnc_laptopspawn ={
_laptopNo = param[0];
_spawnObj = format ["laptopSpawnPos_%1", _laptopNo];
_spawnpos = getPosATL _spawnObj;
format ["%1", _spawnpos] remoteExec ["hint", 0];
laptopOBJ = createVehicle ["Land_Laptop_03_sand_F", _spawnpos, [], 0, "CAN_COLLIDE"];
I know this could be much shorter but have blown it out trying to debug it
_spawnObj = missionNamespace getVariable format ["laptopSpawnPos_%1", _laptopNo];
In your code, _spawnObj is just a string. If you want to use it as a variable name then you need to look it up in missionNamespace.
Does anyone have any experience with uiOnTexture? I want to know if this line of code would create a new display/overwrite the existing one, or it would just make another and id be left with 2 displays.
u2 setObjectTexture [_forEachIndex, format ['#(argb,%1,%2,1)ui("RscDisplayEmpty","%3")', 1024, 1024, _uniqueUIName]];
assuming "_uniqueUIName" was an existing display already created with this method
Will create a new one if the instance/name has not created yet
Yes, but it has been already. Simplified it would look like this:
u2 setObjectTexture [_forEachIndex, format ['#(argb,%1,%2,1)ui("RscDisplayEmpty","%3")', 1024, 1024, "Test"]];
u2 setObjectTexture [_forEachIndex, format ['#(argb,%1,%2,1)ui("RscDisplayEmpty","%3")', 1024, 1024, "Test"]];
I want to know what the second line will do, will it create a second display? Will it just apply the existing one that was created the first time? Will it do something else?
Ah think misread your Q
Im finding it impossible to test this because of how displays are returned
NNot sure if it will overwrite. Unlikely I'd say
you're guess is it would create an entirely seperate second one?
I'm guessing will generate the SAME ui
Alright, thats what I think too and am hoping for. Running into performance issues right now with too many rendered displays
It will create a dialog when the name doesn't exist yet. Will reuse if it does
Thankyou for your opinion polpox, I appreciate it!
And basically, reuse it, and show the same tex
So, as long as you have reason to reuse, the same name should do
Hello again,
trying to check if there is a player from a specific side in range of an object
if ({_x distance laptopOBJ < 5} count allPlayers > 0) then works
if ({_x distance laptopOBJ < 5} west countside allPlayers > 0) then does not
Error is "Missing )"
Where am I going wrong?
Thanks,
{_x distance laptopOBJ < 5} west```
This is not valid. `west` does not accept any arguments.
west countSide allPlayers; returns count of players on west.
Yes, that would be functional (albeit not quite what you need) in isolation
But you have the condition argument from the other example's count attached to it, which is not a valid combination
That { _x ... } is not a thing on its own that you can just put anywhere and get the same result. It was written as an argument - a modifier - for count, to tell it what condition to use when counting. It doesn't work independently and will break things if jammed in where it doesn't fit.
// allPlayers includes dead and virtual so collect them differently
private _aliveManPlayers = switchableUnits + playableUnits;
private _filteredBLU = _aliveManPlayers select {side group _x == west};
if (_filteredBLU findIf {_x distance laptopOBJ < 5} > -1) then {
hint "BLU player nearby!";
};```
Thanks man
Condition:
call{this}
Interval: 0.5
On Activation:
nopop = true; shootingTargets6= [target_101, target_12, target_13, target_14, target_15, target_16, target_17, target_18, target_19, target_110, target_111, target_112, target_113, target_114,target_115, target_116, target_117, target_118, target_119, target_120, target_121, target_122, target_123, target_124, target_125];
The trigger referenced above.
One of your target_xxx is nil, thus the undefined variable
Will that make an _x undefined?
0 spawn {{_x} forEach [nil]}
``` => ```
11:52:22 Error in expression <0 spawn {{_x} forEach [nil]}>
11:52:22 Error position: <_x} forEach [nil]}>
11:52:22 Error Undefined variable in expression: _x
0 spawn {{_x} forEach [thisvardoesnotexist]}
```=>```
11:53:09 Error in expression <0 spawn {{_x} forEach [thisvardoesnotexist]}>
11:53:09 Error position: <_x} forEach [thisvardoesnotexist]}>
11:53:09 Error Undefined variable in expression: _x
11:53:09 Error in expression <0 spawn {{_x} forEach [thisvardoesnotexist]}>
11:53:09 Error position: <thisvardoesnotexist]}>
11:53:09 Error Undefined variable in expression: thisvardoesnotexist
```Double error even
So one of the listed target_xxx doesn't exist and that's what throwing the error?
Hm then that might be the issue
Yes
Mhh maybe I'm just stupid atm. but was there an easy way to get CfgVehicles class of a place mine. So for APERSBoundingMine_Range_Ammo -> APERSBoundingMine?
{if(isNil{missionNamespace getVariable _x}) then {diag_log format ["%1 doesn't exist", _x]};} forEach ["target_101", "target_12", "target_13", "target_14", "target_15", "target_16", "target_17", "target_18", "target_19", "target_110", "target_111", "target_112", "target_113", "target_114,target_115", "target_116", "target_117", "target_118", "target_119", "target_120", "target_121", "target_122", "target_123", "target_124", "target_125"];
What do you have to begin with? Magazine class?
Yeah I found the missing target. target_122 had gone under the map and so I didn't see it when I was assigning variables to the targets.
Thanks for the help! I had skimmed over the code for like 2 hours last night trying to figure it out and couldn't because I just thought 122 was there because every other one was in place.
Mine objects aren't CfgVehicles but CfgAmmo btw
Running an foreach loop for all mines so I got the object(s). But once placed it's the CfgAmmo class but want the CfgVehicle class to replace them ^^
Yeah that's my problem becuase createMine wants the CfgVehicles
Worst case I can do a switch block but thought there should be a better way via config ^^
Huh, didn't know there are mines in CfgVehicles 🤔
This command creates objects of the CfgAmmo class named in configFile >> "CfgVehicles" >> _type >> "ammo".
Don't ask me why 😄
_charge = createMine ["SatchelCharge_F", player, [], 0]; typeOf _charge => SatchelCharge_Remote_Ammo
Replace how? Delete the mine and createMine it again?
It will produce the same mine as you had before, createMine ends up creating CfgAmmo projectile
Yeah so addOwnedMine actually works ^^
🤔
Only way I get addOwnedMine to work is with a script placed mine but maybe i'm missing something ^^
addOwnedMine works with createVehicle'd mines
player addOwnedMine createVehicle ["SatchelCharge_Remote_Ammo", getPos player, [], 0, ""];
Properly creates CfgAmmo mine and you have control over it
This createMine command looks like some ancient relic, probably of times when createVehicle couldn't create CfgAmmo projectiles or something
Well that works for me then ^^ But maybe that's the reason for addOwnedMine weirds behavior in the first place
I found this code somewhere it's very useful for any arma 3 player, it shows the actual live mini map on the side screen , although there is an issue with the line "_mmap ctrlMapAnimAdd [0, 0.05, player];" it wouldnt be perfectly centered to the player.
[] spawn {
disableSerialization;
_mmap = findDisplay 46 ctrlCreate ["RscMapControl", -420];
_mmap ctrlSetPosition [-0.6, 0.4, 0.4, 0.4];
_mmap ctrlCommit 0;
while {true} do {
_mmap ctrlMapAnimAdd [0, 0.05, player];
ctrlMapAnimCommit _mmap;
};
};
!code
```sqf
// your code here
hint "good!";
```
↓
// your code here
hint "good!";
Its missing ctrlMapSetPosition which map controls need for map animations to work properly
You saved the day
! thanks to you now the code is a peace of treasure anyone can use, this is how it would look like and you can play with position settings:
Side live mini map on player:
[] spawn {
disableSerialization;
_mmap = findDisplay 46 ctrlCreate ["RscMapControl", -420];
_mmap ctrlMapSetPosition [0,0,0.4,0.4];
_mmap ctrlSetPosition [-0.6, 0.4, 0.4, 0.4];
_mmap ctrlCommit 0;
while {true} do {
_mmap ctrlMapAnimAdd [0, 0.05, player];
ctrlMapAnimCommit _mmap;
};
};
You can even enhance this by using the following code to get exact enemy locations on your side mini map just like "call of duty":
[] spawn {
while {true} do {
{ if(!isPlayer _x && side _x != playerSide) then { player reveal [_x,4] } }forEach allUnits;
sleep 10; } };
Please use code formatting
I wonder what will happen in such case of a lag:
- Player 1 is inside a car that is local to them
- Player 1 is lagging (network dropped) and manages to get out of the car and ran away enough to be unharmed
- Player 2 still sees Player 1 inside a car and destroys car with a single shot from a rocket launcher
Will any damage be applied to Player 1 unit one they unlag and their car gets destroyed?
I assume there can be two sources of damage towards Player 1 unit:
- Rocket hit to car propagates some damage to crew
- Car blows up and kills its crew
I guess second source of damage wont happen since car is local to Player 1 and they're outside and far away by the time it dies
But what about first case? Will this damage reach player Player 1 once they unlag?
Having hard time setting up an experiment for this, can't make one game instance lose connection for the test
So I have this code to spawn a tank off a console
this addAction ["Spawn TX-130SS on Pad 2", {_pad1 = getPosASL Spawn_Pad2;_dir = getDir Spawn_Pad2;_veh = createVehicle ["3AS_saber_super",[0,0,0],[],0,"NONE"];_veh setPosASL _pad1;_veh setDir _dir;},nil,7.1,true,true,"","true",5,false,"",""];
I am trying to figure out how to adapt it to spawn a group with two ai that a player can join and then take command of, too 1 man the tank any help would be appreciated
createGroup a new group or createUnit right into player's group
ok thank you
do I need to chang the _veh at all
Unrelated at all
Use addVehicle to assign vehicle to group, moveInGunner/moveInDriver/moveInCommander to put AI into it
ok
this is not working for me I am also very new to arma scripting so I might just not be understanding properly. Would you be able to show me an example?
Post code
Read docs for commands: https://community.bistudio.com/wiki/Category:Arma_3:_Scripting_Commands
@livid kraken A small addition: I highly recommend to do setDir before setpos, because in some cases turning the vehicle after placing it on the position may cause an unpredictable collision with nearest objects.
This is the only code I have to go off of
this addAction ["Spawn TX-130SS on Pad 2", {_pad1 = getPosASL Spawn_Pad2;_dir = getDir Spawn_Pad2;_veh = createVehicle ["3AS_saber_super",[0,0,0],[],0,"NONE"];_veh setPosASL _pad1;_veh setDir _dir;},nil,7.1,true,true,"","true",5,false,"",""];
You have to try yourself or you won't learn
ok I can do that I will look into it
ok wilco
@meager granite Reporting on latest tests with missiles on dedicated, this works perfectly
// In Fired EH:
if (isDedicated) then {
[typeof _projectile, getposATL _projectile, velocity _projectile] remoteexeccall ["OT_fnc_createdummy",-2];
} else {
private _missile = createvehicle ["v2", [0,0,random 1000], [], 0, "CAN_COLLIDE"];
_missile attachTo [_projectile,[0,-5,0]];
};
// The procedure to run on clients:
OT_fnc_createdummy = {
params ["_type","_pos","_velocity"];
private _projectile = _type createvehicleLocal _pos;
private _missile = "v2" createvehicleLocal [0,0,random 1000];
_missile allowdamage false;
_missile attachTo [_projectile,[0,-5,0]];
[_missile, [-90,0,0]] call OT_fnc_pitchbank;
_projectile setposATL _pos;
_projectile setvelocity _velocity; // Attaching on high-velocity projectile is not recommended
_projectile addEventHandler ["Deleted", {
params ["_projectile"];
{deletevehicle _x} foreach (attachedobjects _projectile);
}];
_projectile addEventHandler ["Explode", {
params ["_projectile"];
{deletevehicle _x} foreach (attachedobjects _projectile);
}];
_projectile addEventHandler ["Deflected", {
params ["_projectile"];
{deletevehicle _x} foreach (attachedobjects _projectile);
}];
};
Don't know if all EHs needed, but I wanted to be sure the V2 model removed in any case.
Also, I did'n see any noticeable drift, but if it were, local projectile can be created in the end of flight.
https://youtu.be/ncecBfBWfVE
I’ve been looking into unit capture and unit play for some of my MP missions in the future. Events that I want “on rails” for story purposes. All tutorials I can find are for single player cinematics and pictures ect.
Anyone know of the feasibility for this in mp along with something to get me started?
AFAIK unit capture is really desynchy on ml
Mp*
anyone know the reason why I can't find the attachTo function in the files? Trying to read the code. Is it named differently?
attachTo is a scripting command in the engine
that would make sense
anyway to read those? or they are probably not sqf aren't they?
No they're binary, compiled, hardcoded
What did you want to know about attachTo anyway?
Well I'm working on a fortifications mod similar to the squad building system and trying to work out if arma can handle one of the explacements where I have some sandbags and a 50cal but I need the 50cal to remain in place but be simulated but attachTo rotates the object 90 degrees and seems to disable the simulation
also trying to not do any custom objects cause I don't want to and am lazy to learn how that stuff works
Attached objects are simulated by the same rate as their parents are
so if you attach a static gun to a building, it will be simulated very slowly
oh I was not aware of that
as for rotation, there are lots of scripts going around that fix the rotation after attachTo
well I'm trying to keep the static in place and not move so are you aware of any objects that are simulated but don't move?
Honestly I'm not sure what would be a proper solution to this, probably have enough space for the object to stay properly so you don't have to do any tricks
I've been using Leaflet_05_F for a different purpose, it might fit here
thx I'll give that a try
thx a bunch that was very helpful information and solved the biggest issue and the rotation is easy enough to fix
Always appreciate the help I get from the community
Hello all,
I have a locality foible and I'd really appreciate if someone could help me untangle it:
I am calling this function on the server using:
[laptopCount, "Func\laptopSpawn.sqf"] remoteExec ["execVM",2];```
laptopCount is a simple incrementing number 1 through 6
```sqf
laptopSpawn.SQF
_laptopNo = param[0];
_spawnObj = missionNamespace getVariable format ["laptopSpawnPos_%1", _laptopNo];
laptopOBJ = createVehicle ["Land_Laptop_03_sand_F", getPosATL _spawnObj, [], 0, "CAN_COLLIDE"];
[laptopOBJ, 0, ["ACE_MainActions"], CheckIntel1] remoteExec ["ace_interact_menu_fnc_addActionToObject", 0, true];
When I run this code on local host, the ace action is added to the spawned laptop
When I run this code on dedi I do not.
I assume this is because clients are not made aware of the variable name of the laptop and therefore the addActionToObject fails.
Please can someone help me validate this assumption and then how I'd get past it.
What's CheckIntel1?
an ace interaction I create in init.sqf
wait one
CheckIntel1 = [
"CheckIntel1",
"Secure Laptop",
"",
{
params ["_obj"];
//While actioning
[1, _obj,
{
//Success
params ["_obj"];
[[side player, _obj], "Func\laptopSecure.sqf"] remoteExec ["execVM",2];
},
{
hint "Aborted";
},
//Action bar
"Securing..."] call ace_common_fnc_progressBar
},
{true},
{},
["_object"],
[0,0,0], 100] call ace_interact_menu_fnc_createAction;```
where do you call that code?
init.sqf
ACE documentation isn't sufficient to answer that question. Potential issue is whether the output of createAction can be passed over the network.
The sensible way to write this is to write a client-side function that does the addActionToObject call, and remoteExec that instead.
Pass laptopObj as a parameter but do everything else on the client side.
Maybe there's some other issue though. Did you check the RPT for server-side script errors?
createAction runs on all clients as the action is created in init.sqf.
Yes, but you're not using the one you create on the client.
You're passing the one created on the server over the network.
No, I'm using the action I create on the client, I am assigning it to an object over the network.
In this line, both laptopOBJ and CheckIntel1 are resolved server-side:
[laptopOBJ, 0, ["ACE_MainActions"], CheckIntel1] remoteExec ["ace_interact_menu_fnc_addActionToObject", 0, true];```
fnc_addActionToObject
The action already exists - it must be created before it can be added
When you put a variable in an array, that's dereferenced immediately and the contents added to the array.
Gotcha
I'm still struggling with that though, as the server is also aware of the action, so it should be conscious of that variable.
That's the unknown part.
I don't know ACE's internals.
Question is whether the results of createAction are valid to send over the network.
As you said, yeah, I'll write a function to add the action and execute that globally.
I have a mission I've made which seemed to run fine for 4-8 players, but seems to break the server during mission load/briefing screen when we get closer to 10 players. I'm suspecting I have some shitty code that causes too much traffic but I'm not smart enough to figure it out, was wondering what would be the best way to get help sorting it out since it's quite a lot of code?
init.sqf code is usually the one in this case
Hmm, the majority of code is in the init field of a Game Logic object, I'm guessing that's the issue then?
I've also got some stuff in initPlayerLocal.sqf
a game logic object is local only to the server iirc, but maybe there is some heavy remoteExec in there too
Hmm, wouldn't call it heavy, but there's 12 remoteExec calls, heres a snippet
indeed, nothing big
Can I share my initPlayerLocal.sqf as a file? it's 2000 characters too big to send as text :/
Or should I just share as snippets
Use pastepin or sqfpin
#arma3_scripting message
Ty, sqfbin didn't work for me, but here is all the code. I don't expect anyone to fix it for me but if there's any glaring issues that severly would fuck with performance, I would appreciate if you could point it out :)
Sorry for interrupting any ongoing question, but I never quite understood this:
What are the implications on setting vars on entities with '#' before it's identifier?
As in player setVariable ["#rev", 1, true] used by Arma 3's embeded Revive system.
Or, you know, when you want to create some particle effects you have to use '#particlesource' as the object type.
I realize this two examples may be about different things, but I just never stumbled upon a clear explanation on why to use it.
Does it make any diference whatsoever or it's just a norm I don't know about?
It's just a bit annoyed about it because we played it and tested with like 7 people previously and I've made very tiny changes since then and suddenly it's not working, it was meant to be a streamed community event for 12 people but it didn't work so we had to cancel
First one: none
second one: something completely different, you have to give it a name, and that is the name
TY
Hello 🇬amers, I'm trying to write a script that detects if two players with variable names RTO and OFC are next to each other (5 units or so?) and outside of the jury rigged IED script my friend has made I don't really have much right now, if anyone could help me figure this one out it would be greatly appreciated.
where does the script go? in a trigger?
yeah it's great until you have to use like any third party library ever and they didn't put the xml documents on their api
So when i run all these in single player it works fine.
But now i have it running on my MP mission and for some reasons, it's not.
I don't get an error - and the rest of the script works fine
_name = name player;
_message = format ["%1 detonated a suicide bomb", _name];
...
[_message] remoteExecCall ["Hint",0];
the function is triggered by the player
Is there a way to emulate Tactical Ping cursor direction?
It doesn't seem to be ray casting weaponDirection nor getCameraViewDirection, since the former points to exact muzzle direction and the latter is restricted to the camera direction, and Tactical Ping seems to follow the middle of the weapon cursor no matter what (even looking away with Freelook or TrackIR).
Also the resulting argument "_this select 1" from a Communication Menu expression ([caller, pos, target, is3D, id]) also seems to follow Tactical Ping cursor direction behaviour.
Where are the unit icons stored? Which pbo specifically or if you could just post the filepath, that would be fine.
And before someone says something about checking myself or configs, my arma is corrupted and has to do a full reinstall.
[getText (configOf player >> "icon")] call BIS_fnc_textureVehicleIcon;```
`"\A3\ui_f\data\map\vehicleicons\iconMan_ca.paa"`
❤️ Now here's to hoping steam has reinstalled that part by now
triggered by the player, but is it run by the player on the player's client?
yes. triggered was bad word to use. this function is called by the player and its dealt client side
Does anyone know how to add code section to zeus? I made new clean mission and added admin zeus. I can place the object and open its edit window, but there is no code execution tab.
I added "ModuleCuratorSetAttributesObject_F" with code checked and synced to zeus, set its owner to zeus module.
sry for the language but as you may notice, theres's no code section
@warm hedge may I ask your help
If you mean weaponDirection is not good enough, I think there is nothing. Where actually you aim (AKA center of the crosshair) is unobtainable via an SQF AFAIK

screenToWorld [0.5, 0.5]?
Ah solved
hmm. Is the issue that weaponDirection is correct but you need the gun position too, or is weaponDirection not correct?
weaponDirection gives me the exact vector the muzzle is pointing, where Tactical Ping does not quite work like that
weaponDirection is where your gun is aiming. Which means fatigue or such are involved
For example, if I'm running (weapon pointing downwards) and I ping a wall 1km from me, the ping will appear on the wall
With weaponDirection the ping would appear at my feet where the gun is pointing
Neither
(which is actually head direction, allegedly)
Through SQF I can account for almost all. The running, being in freelook, the lack of a weapon... everything but fatigue and stamina, which still play a role in the end
Yeah it is one of the lacked command I think
Quite a bummer since I'd love to be able to replace the ping HUD element with something else I've already developed
Aiming related commands are really needed, at least getter
Setters are denied by Bohemians before, after concerns of use in cheats. But who can think this is a valid concern if one can access to SQF already?
request them again now we have sensible bohemians
you can, just disable the tactical ping in difficulties and use they UI event (keydown or user action) to trigger your own
camera is better to use than object, since player has more control over their camera than their avatar
or screen
the code section for Zeus is with the zeus enhanced mod
You don't need mod
Hey all! Thanks for all the answers!
Unfortunately I already use all of those in my code to try and achieve the closest possible to Tactical Ping behavior.
I'm not on my PC now, but in the morning I'll paste my code here and see if someone can light my way. Or not.
Nevertheless I'm already in terms with this for months now 😅
Just trying my last resort here with you guys.
Thank you again for helping!
Hey it's me again! So I have this script for ACE 3 that was working and now that it's updated it's broke. Can someone help me convert it to vanilla addAction or fix the ace functionality? By it's broke I mean it doesn't even appear as an option for the laptop I have it sitting one when I hold my interact key. I don't understand ace scripting and someone else made this for me but I can't get in contact with them anymore, so I was hoping I can get some help here.
private _action = ["Mission_SpawnTank", "Spawn Car", "", {
params ["_target", "_unit", "_params"];
private _min = 50;
private _max = 500;
private _distance = _min + random (_max - _min);private _position = _unit getPos [_distance, getDir _unit];
private _vehicle = "B_KEF_UCMC_MRAP" createVehicle _position;
}, {true}, {}, []] call ace_interact_menu_fnc_createAction;[this, 1, ["ACE_SelfActions"], _action] call ace_interact_menu_fnc_addActionToObject;
If it's ACE_selfActions, isn't that a self-interact rather than something you'd add to a laptop?
You'd think but it wasn't showing there either
hmm, works for me.
Just stuck that code chunk (except with 0 & ACE_MainActions) in the init box for a vehicle and it worked.
So this?
private _action = ["Mission_SpawnTank", "Spawn Car", "", {
params ["_target", "_unit", "_params"];
private _min = 50;
private _max = 500;
private _distance = _min + random (_max - _min);private _position = _unit getPos [_distance, getDir _unit];
private _vehicle = "B_KEF_UCMC_MRAP" createVehicle _position;
}, {true}, {}, []] call ace_interact_menu_fnc_createAction;[this, 0, ["ACE_MainActions"], _action] call ace_interact_menu_fnc_addActionToObject;
Yes.
Okay that worked... huh I wonder how it got changed to a SelfAction because I definitely did not make that change and it's worked previously
But thank you for the help. Even if it was something really simple I should've been able to figure out myself.
how do you determine if an object has the potential for fuel cargo?
i'd think ((getFuelCargo _obj) > -1) would work, but there are a lot of props which have getFuelCargo _obj // 0
nm i guess it is transportFuel = 300;
yup
private _fuelCapacity = getNumber(configFile >> "CfgVehicles" >> typeOf _object >> "transportFuel");
Pretty broken tho, some vehicles work with the system and some others not.
I think ACE has "ace_refuel_fuelCargo" instead, because they zero the vanilla values to remove the actions.
yea im just looking for a generic getter of "this asset can store fuel"
for killed explosion
unfortunately im getting fuel explosion when sandbags get destroyed, since BI configure fuel cargo > -1 for many props
canItStoreFuelHashmapCache getOrDefaultCall [typeOf _vehicle, {getNumber(configOf _vehicle >> "transportFuel") > 0}, true];
````getOrDefaultCall` is perfect for these kind of config checks
Quick question how do you create Eagle. Is it like a agent or unit ?
I tried it like this but it dosent work ?
private _pos = player modelToWorld [0,5,0];
private _eagle = createAgent ["Eagle_F",_pos, [], 0, "NONE"];
_eagle setVariable ["BIS_fnc_animalBehaviour_disable", true];
Probably camCreate
It is thank you.
Hello, I have a question. This script reduces damage and if I wanted to know how to change it, did it increase damage?? this addEventHandler ["HandleDamage",{damage (_this select 0)+((_this select 2)/15)}];
arma3
thx mate
which number should I edit to increase the insult?? 2?? add or remove?
/ to divide * to multiply
Wishing once and once again we had array commands that return operated array so stuff can be written in a single statement AND returned from the function
pushBackRet, setRet, appendRet, etc.
Do you mean you want both the array and copy of it?
No, operate the array and return it so another operation can be done with it in the same statement
If pushBack returned _art after adding the 0 then yes
Needs a new command though
So for example I can build an array of important alive vehicle units (minus FFV and passengers) like this:
allTurrets _this apply {_this turretUnit _x} pushBackRet driver _this select {alive _x};
Its useful when you want to store the index elsewhere
Like in hashmap for example because it doesn't have indexes or ordering
Many applications
private _pos_xy = getPosWorld player resizeRet 2;
vs
private _pos_xy = getPosWorld player;
_pos_xy resize 2;
```and even 3rd line if you want it returned
getPosWorld player setRet [2, 0];
```vs
```sqf
private _pos_xy0 = getPosWorld player;
_pos_xy0 set [2, 0];
_pos_xy0;
so it should look like this? this addEventHandler ["HandleDamage",{
params ["_unit", "_selection", "_damage"];
_curDam = call {
if (_selection == "") exitWith {
damage _unit;
};
(_unit getHit _selection)
};
((_damage-_curDam)*2+_curDam)
}] ;
I'm just starting the game, but it takes a long time because I have a lot of mods. thank you for your help
https://community.bistudio.com/wiki/nearestTerrainObjects
There is no command to return object type used in this command, right?
namedProperties
Thanks!
Hello there! So this is my code:
private _weapon = currentWeapon player;
private _initPos = eyePos player;
private _weaponDir = player weaponDirection _weapon;
private _vectorDir = vectorDir player;
_vectorDir set [2, _weaponDir select 2];
private _finalDir = [_vectorDir, getCameraViewDirection player] select (_weapon isEqualTo "" || {freeLook || {!isNull objectParent player}});
private _line = lineIntersectsSurfaces [
_initPos,
_initPos vectorAdd (_finalDir vectorMultiply viewDistance),
vehicle player,
player
];
if (_line isEqualTo []) exitWith {};
[_line select 0 select 0] remoteExecCall ["SERGIO_fnc_ping"];
}];```
With this I can almost emulate total Tactical Ping behavior, but not quite, since I'm stuck using a mix of player direction for yaw and weapon direction for pitch.
The latter is where it's at. I don't know any pitch-related position getter other than the exact weapon muzzle vector (`weaponDirection`), which is not optimal.
Thanks for the attention!
Is it possible to use a script to open a box inventory while sitting in a vehicle?
I tried player action ["GEAR",box_1], it works on foot, but not if you are inside a vehicle.
Hello! how do i make it so that nobody can die and there is a fail state if everyone is unconscious?
do anyone know tfab scripting
@wispy crest HandleDamage EH. It's fairly tricky.
whats that?
Hi guys,
is there a way to display images in Arma 3 in certain places. Does anyone have an idea how I can do this without using the RSC classes?
uh, you never need to use the Rsc classes. You can just write your own.
what do you mean?
Have you done any Arma UI coding at all?
No, that's the problem
That is indeed a problem. I don't think there's a good introduction page.
I've already done a bit of research but haven't found anything right and what I have found seems a bit too complicated
Do you have any ideas where I could start?
Find someone else's simple UI code and figure out how it fits together tbh.
I don't think there's any basic UI guide in the wiki.
want to add images to objects (billboards, etc..)? or to UI
Although I thought that for mods too and I just hadn't found it.
UI
what u plan to do add a watermark?
I actually want to build my own HUD where I can show different images in certain places
If a player dies, for example
The general principle is that you build the thing with config definitions and then display it with... probably cutRsc for a HUD.
simplest way via scripting its using https://community.bistudio.com/wiki/ctrlCreate creating ctrls on display 46
Do I then have to create a separate config definition for each image where the exact position is stored?
Ah yeah, that's also an option.
(ctrlCreate on display 46)
Depends, you can also mix & match config definitions with ctrlCreate. Hardcode some stuff, then create some controls dynamically.
It will probably come down to this.
Do I then have to use the RscPicture class?
better to use the one that keep aspect ratio i think
so the image doesnt look like shit
i dont remember the name
Do you know if I can also use it to specify the position?
RscPictureKeepAspect
If you're using ctrlCreate then normally you'd use ctrlSetPosition followed by ctrlCommit to place/size it.
For ui you cna do a couple things:
- Create a ui layer, wich doesnt stop a player from moving. (https://community.bistudio.com/wiki/ctrlCreate)
in your case:
(findDisplay 46) ctrlCreate ["RscStructuredText", 100];
_pic = (findDisplay 46) displayCtrl 100;
_pic ctrlSetPosition [_x, _y, _w, _h];
_pic ctrlSetStructuredText parseText format ["<img image = '%1'></img>", "\ca_picture.paa"];
_pic ctrlCommit 0;
- Create a layer wich stops the player from moving (https://community.bistudio.com/wiki/createDialog)
option one is probably your go to option
this will create a picture wich doesnt stop a player from moving
altough im not 100% if it will create a mouse cursor or not
but you can probably change its interactability pretty easily
option 2 requires you to make predefined classes
this is usually something you do for a group menu screen, settings screen, welcome screen, stuff like that
Okay, thanks for the help. I'll just try it out a bit
i recommend you try and find the picture you want to display, then find how to display it on screen, doesnt matter where. as long as you understand its pos on the screen and the coordinates, and then start moving it around to the prefered position on screen
Good idea. Thanks again for your help
I have now had a look at the Wiki article. What is meant by the classnames and where do I store the location of my image?
class is things like: "RscText", "RscStructuredText", "RscVideo" these are just different classes, depending on what you want to do with your display class
what do you mean by location of image?
- On screen location
- Folder location
I meant folder location
where ever your mission folder is, can be next to your description.ext
Okay with _pic ctrlSetStructuredText parseText format ["<img image = '%1'></img>", "\ca_picture.paa"]; I define that the class "RscStructuredText" should have the format of the following image?
if i think what ou mean then my answer is yes, and just like you have image = '%1' there is also size = '1'
so you can change its size
_pic ctrlSetStructuredText parseText format ["<img size='1' image = '%1'></img>", "\ca_picture.paa"];
or size 0.8 etc
Does it not overwrite
_pic ctrlSetPosition [_x, _y, _w, _h];
well it'll just be the size within the width of the text square im pretty sure.
Okay, I'll try that in Arma now
When I try this, I don't get an error message, but nothing is displayed. Could it be that the image is being shown on the wrong display?
could be that the image is shown outside of your screen
I used the GUIEditor from 3den Enhaced for the position and adopted the position for the X and Y values. Could this be the error or how else can I find out the correct position?
_pic ctrlSetPosition [((safeZoneX + (safeZoneW / 2)) - ((safeZoneW / 10) / 2)), ((safeZoneY + (safeZoneH / 2)) - ((safeZoneH / 15) / 2)), (safeZoneW / 10), (safeZoneH / 15)];
try this position
and also send a copy of your code
to see if there is something wrong maybe
okay wait
(findDisplay 46) ctrlCreate ["RscStructuredText", 100];
_pic = (findDisplay 46) displayCtrl 100;
_pic ctrlSetPosition [((safeZoneX + (safeZoneW / 2)) - ((safeZoneW / 10) / 2)), ((safeZoneY + (safeZoneH / 2)) - ((safeZoneH / 15) / 2)), (safeZoneW / 10), (safeZoneH / 15)];
_pic ctrlSetStructuredText parseText format ["<img size='1' image = '%1'></img>", "briefing.paa"];
_pic ctrlCommit 0;
I still don't get an error message but nothing is displayed either
your picture should be a directory
so if its in the root folder do "\briefing.paa"
if its in a folder wich is in the root folder do: "\folderName\briefing.paa"
I had that at the beginning but then I got the message that the image was not found
_pic ctrlSetStructuredText parseText "<img image='\briefing.paa'/>";
try this line
okay
i edited it
Still nothing
gonna quikly finish my raid
maybe someone else answers
in the meantime
okay, died. how are you excecuting the code?
Via the debugging console
good luck 🙂
0 spawn {
disableSerialization;
_pic = (findDisplay 46) ctrlCreate ["RscStructuredText", 100];
_pic ctrlSetStructuredText parseText "<img image='\briefing.paa'/>";
_pic ctrlSetPosition [((safeZoneX + (safeZoneW / 2)) - ((safeZoneW / 10) / 2)), ((safeZoneY + (safeZoneH / 2)) - ((safeZoneH / 15) / 2)), (safeZoneW / 10), (safeZoneH / 15)];
_pic ctrlCommit 0;
};
try this in debug console, and does it throw any errors?
No error message and nothing is displayed
hm what i assume is happening is the image is beeing displayed outside of the screen wich is very annoying
let me get a screen pos of one of my images and see if your img then mvoes correctly
Yes, I think so too. Which value is responsible for this?
x and y prob
0 spawn {
disableSerialization;
_blockW = safeZoneW / 1000;
_blockH = safeZoneH / (1000 / (getResolution # 4));
_displayW = _blockW * 180;
_displayH = _blockH * 54;
_displayX = safeZoneW + safeZoneX - _displayW - (_blockW * 10);
_displayY = safeZoneH + safeZoneY - _displayH - (_blockH * 50);
_pic = (findDisplay 46) ctrlCreate ["RscStructuredText", 100];
_pic ctrlSetStructuredText parseText "<img image='\briefing.paa'/>";
_pic ctrlSetPosition [_displayX + (_blockW * 88), _displayY + (_blockH * - 30), _blockW * 40, _blockH * 16];
_pic ctrlCommit 0;
};
what does this give? img should be around bottom right
Still the same problem. Have you tried it on your system?
only thing diff is the img
ill send a screenshot of what it looks like for me
with my img
yes
and the code attached to it
waituntil {!isnull (findDisplay 46)};
_blockW = safeZoneW / 1000;
_blockH = safeZoneH / (1000 / (getResolution # 4));
_displayW = _blockW * 180;
_displayH = _blockH * 54;
_displayX = safeZoneW + safeZoneX - _displayW - (_blockW * 10);
_displayY = safeZoneH + safeZoneY - _displayH - (_blockH * 50);
_scale = (0.8 call BIS_fnc_WL2_sub_purchaseMenuGetUIScale);
_start = missionNamespace getVariable "gameStart";
private _ctrlBackgroundTimer = findDisplay 46 ctrlCreate ["RscStructuredText", 4567];
_ctrlBackgroundTimer ctrlSetPosition [_displayX + (_blockW * 88), _displayY + (_blockH * - 30), _blockW * 40, _blockH * 16];
_ctrlBackgroundTimer ctrlSetStructuredText parseText format ["<img size = '%1' color='#ffffff' image='img\timer_ca.paa'></img>", _scale];
_ctrlBackgroundTimer ctrlCommit 0;
private _ctrlTimer = findDisplay 46 ctrlCreate ["RscStructuredText", 45671];
_ctrlTimer ctrlSetPosition [_displayX + (_blockW * 105), _displayY + (_blockH * - 29), _blockW * 90, _blockH * 16];
while {(36000 - (serverTime - _start)) > 0} do {
_ctrlTimer ctrlSetStructuredText parseText format ["<t size = '%2' color = '#ffffff'>%1</t>", [(36000 - (serverTime - _start)), "HH:MM:SS"] call BIS_fnc_secondsToString, _scale];
_ctrlTimer ctrlCommit 0;
sleep 0.5;
};
so this is a code wich just displays a clock icon and a countdown timer
this is my directory, so in the img folder is the image
if you understand this you should be able to make this work for you aswell
in theory ofc
Okay, I'll try to get this working
Thanks for your time. Maybe I'll get somewhere with it
BIS_fnc_WL2_sub_purchaseMenuGetUIScale:
(_this / (getResolution # 5)) * 0.7
Have you defined that?
okay thanks
How can i make health shared between several components? i've got an awful technical i've made but i want the m2 and the ammo crate to be damaged at the same rate as the truck, so that destroying the truck also destroys the ammo box and the m2.
If you want to share the death between the things, Killed EventHandler. If you want to share the damage percentage, HandleDamage
most have it
trying to setUnitRank but I do not see the corresponding rating happening...
trying to set an 'officer' class which in editor not sure why the default is "PRIVATE" but whatever...
officer setUnitRating "lieutenant";
assuming I can persuade a correspondence, manually perhaps, using addRating, how does that work for enemy units?
https://community.bistudio.com/wiki/addRating
https://community.bistudio.com/wiki/ArmA:_Armed_Assault:_Rating_Values
I need to aim for the positive values?
now trying to also addRating, but I do not see that is having any effect, either.
fnc_setRating = {
params ['_unit', '_rating'];
private _delta = _rating - (rating _unit);
if (_delta > 0) then {
_unit addRating _delta;
};
};
What are yout rying to do anyway?
trying to set an AI unit rank. preferrably in a way that is measurable after the fact.
it seems like setting the rank, zeroes the rating, regardless. which is odd.
that 'gets' the rank, yes.
at least in one case, I find the "B_officer_F" class does not seem to specify a default officer rank. so I am trying to set that.
but the rating does not seem to set. maybe I am missing something about the Rating Values (?)
https://community.bistudio.com/wiki/setUnitRank Doesn't this say that rating is always set to 0 with this command?
may not be reading the table right then, i.e. Arma 3 (ca 2015) versus Arma 3...
does rating even serve a purpose then?
anyway, I can set the rank, easy enough.
I don't think it does anything but changes you into an enemy side if you have it below -2000
Ancient hardcoded gameplay mechanic
Hmm, apparently its used for something else too
It is used to tell how good your performance is in the debrief, but... not sure what else we have other than -2000
no worries, working with what I got
rating is used for AI target prioritization
Is it? Wasn't it config's "cost"?
higher rated targets get attacked first
“rating” is a dumb term, should be “threat”
AI will target negative threat targets on their own side, and prioritize high positive rated targets on enemy sides
I have an MQ_4A UAV which loiters around the map during mission, when a player uses all its ammo the MQ automatically begins to RTB. so far havent found any way to stop the MQ from automatically returning to base. any idea about this?
player addItem "theuniform";
player assignItem "theuniform"```, ive tried randomly having it select a uniform and apply it to the player. No error. Does not apply uniforms. Ive also tried other commands such as ForceAddUniform with no luck. Any ideas? Anyone?
Remove quotes
theuniform is the variable name you want to use, "theuniform" is just a string
@sudden yacht
player forceAddUniform selectrandom ["U_B_CombatUniform_mcam","U_B_CombatUniform_mcam"];
Unless you need this particular global variable.
i got it, ty i had to use call bis select random for it to work
i had to use call bis select random for it to work
Makes no sense
BIS_fnc_selectRandom has no functional difference from selectRandom in this context. selectRandom is strictly "the same but better" and was not the source of the problem.
@warm hedge Thats what i said!
?
BIS_fnc_selectRandom vs selectRandom was not why it didn't work. Something else was wrong
I have a script which calls this file fn_wpLand.sqf and it is said to be located in A3\functions_f\waypoints\fn_wpLand.sqf but I cant find the folder / file location on my pc. Or is this created / located in the mission folder somehow?
Your game already has that
Its just not working correctly, I wanted to check anything that could be an issue
if the vehicle isnt landing (using fn_wpLand.sqf) what could be wrong?
It does work very finely for me. What vehicle you want to let land?
here's the script. I copied from a youtube video. Im a noob at scripting. I'll post the link to video ```sqf
if (isServer) then {
_nearestUnits = nearestObjects [(getPos ZelenskyysRevenge),["Man","Car"],500];
_nearestTargets = [];
_badGuySide = east;
if((_badGuySide countSide _nearestUnits > 0) AND (ZelenskyysRevenge ammo "BombDemine_01_F" > 0)) then {
{
_unit = _x;
if(side _unit == _badGuySide) then{_nearestTargets = _nearestTargets + [_unit]};
} foreach _nearestUnits;
_targetUnit = selectRandom _nearestTargets;
_wpDroneDrop = (group ZelenskyysRevenge) addWaypoint [getPos _targetUnit, 0];
_wpDroneDrop setWaypointTimeout [2, 2, 2];
_wpDroneDrop setWaypointCompletionRadius 1;
_wpDroneDrop setWaypointType "MOVE";
_wpDroneDrop setWaypointStatements ["true", "execVM 'orkbane.sqf'"];
} else {
_wpDroneDrop = (group ZelenskyysRevenge) addWaypoint [getPos dronebase, 0];
_wpDroneDrop setWaypointType "SCRIPTED";
_wpDroneDrop setWaypointScript "A3\functions_f\waypoints\fn_wpLand.sqf";
};
};```
!code
```sqf
// your code here
hint "good!";
```
↓
// your code here
hint "good!";
What vehicle the groupZelenskyysRevenge has?
demining drone civ IDAP
the drone lands but not at the position of the dronebase which is an invisible heliport marker
In this video we will be scripting an autonomous drone which will search for and drop munitions on targets it finds. For this we will be using the vanilla de-mining drone since it comes pre loaded with an impressive fragmentation grenade like bomb which is very effective against infantry.
NOTE: Because of the rules around characters that can be...
would this help? sqf _wpDroneDrop setWaypointPosition [getPosASL dronebase, -1]; ??
I love hashmaps 🥲
Anyone know if there is any way to catch a script error in order to prevent a script from fully crashing? Shame that try-catch doesnt.
Or can scriptDone/isNull consider an errored out script completed? It doesn't seem to in my testing.
hmm. Should do. What's your test?
Am trying it out in the debug console atm so I think I may have an issue with timing with testing it. Is the local exec in debug console a call or spawn?
It's unscheduled.
well, that would do it.
Write the script handle to a global variable and check it later.
But a script handler does indeed show as null if a scheduled scrip errors out?
Seemed to for me.
yeah, seems a global var shows a null
now if only there was some way to detemine if an error had occured or not
_unit addEventHandler ["Killed", {
params ["_unit", "_killer"];
deadcounter = deadcounter + 1;
if(westcounter isEqualTo deadcounter) then {
{
deleteVehicle _x;
} foreach unitarray;
end=false;
};
}];``` Can someone help me i need a wait/sleep above the delete vehicle
Wrap the executed code in brackets and use spawn to run the code scheduled. Pass the arguments through and then you can add any sleep delays you want. Or you can just use it for the deletevehicle part.
ooh, havent seen that one before. Thanks.
They'll dump into the RPT too. I'm guessing you're doing something weird where you want the errors in realtime for some reason.
Does also anyone know how to spawn ai on a marker via script
@noble comet https://community.bistudio.com/wiki/createUnit
Nah, can probably cover my usecase with using scriptDone/isnull and the handlers. Will allow me to prevent a script error from crashing out the entire timing function and allow the system to recover as a script error occurring in that function would not be fatal in the long run. And when it comes to handing units that are being spawned/deleted while it running, errors can occur.
It's generally not that hard to write crashproof SQF.
When you delete an object, vars referencing it become objNull rather than nil.
Normally I would agree, but for some reason it always seems to find a way, be it through array lengths changing while iterating and stuff like that. Usually it is due to users connecting/disconnecting and the EHs handing those things updating arrays and ai groups being deleted and such though those become null so it can be handled.
And since it occurs separate from the scheduled processing loops, that introduces the possibility of such issues.
I still need to find and resolve such issues, but using scriptDone adds some redundancy to prevent the system from failing outright in the meantime for end users
is there a command like getclientState / getclientStateNumber but then for the server to see if the briefing has ended?
or do i just server exec this
I think time stays at 0 until the briefing has been clicked past.
On the wiki getClientState and getClientStateNumber is explicitly described to also work on dedicated server.
Thank you, i did not read that properly.
this works far better ```sqf
_wpDroneDrop = (group ZelenskyysRevenge) addWaypoint [getPos dronebase, 0];
_wpDroneDrop setWaypointPosition [getPos dronebase, 0];
_wpDroneDrop setWaypointType "MOVE";
sleep 3;
while { alive ZelenskyysRevenge && not unitReady ZelenskyysRevenge } do
{
sleep 1;
};
if (alive ZelenskyysRevenge) then
{
ZelenskyysRevenge land "LAND";
ZelenskyysRevenge setVehicleAmmo 1;
};
Q: when you have a createGroup with auto-GC enabled i.e. deleteWhenEmpty, then assign some waypoints, when that group is deleted, the waypoints go with it? what happens to the remaining units?
https://community.bistudio.com/wiki/createGroup
https://community.bistudio.com/wiki/Category:Command_Group:_Waypoints
when that group is deleted, the waypoints go with it?
yes
what happens to the remaining units?
what remaining units?
Maybe he meant the bodies?
Typically dead units are in their group for a some period of time (up to minute or so), even if there are no other units alive, after that the group removed by the engine (if not restricted), and "group _body" returns null group.
im working on something, i need some ideas on how i can do something
i have a position, and a bearing shooting off from that position drawing an imaginary line across the map
i need to find the closes point on that imaginary line to me
If BIS_fnc_interpolateVectorConstant can be used to generate an array of positions between two other positions (I think it can, but check), then combining that with BIS_fnc_nearestPosition should do it
The closest point will be on a 90 degree perpendicular line from you to that line. If you have the two points that make up the first line, you can use this function I made by making the last two arguments the unit pos and a pos +/- 90 deg the angle of the first two. It doesn't matter if they don't touch, it uses the slopes to calculate the intersection (in 2D) : (one sec while I get a link)
sqfbin.com not working for me. I'll see what else I can do. Edit: here is link to github page https://github.com/XPS-Group/XPS_A3/blob/main/addons/pathfinding/functions/lineIntersect2D.sqf
Question -
Is it possible to log everything thats happening in the game?
Scripts etc..
I have a case where I transition units from one group to another, for objective reasons.
so the previous group would go away when fully vacated.
late to this conv but I would assume Waypoints get GC'd along with the group. The waypoints belong to the group, not the units themselves. Do you need them?
i managed to figure something out, gpt is getting pretty good
but it feels like im talking my grandma through debugging
There is most certainly a better way using geometry to find the intersection with only three points but, I am bad at that stuff. The function I posted would certainly work though providing you had a fourth point.
gpt tried to do something similar to you, but i had a feeling vectors is what i needed and managed to nudge it that way and got this
// Step 1: Define the Line
_lineStartPos = [1000, 1000, 0]; // Example starting position
_lineBearing = 45; // Example bearing in degrees
// Step 2: Calculate Line Direction and Normalize
_lineDirection = [sin _lineBearing, cos _lineBearing, 0];
_lineDirection = vectorNormalized _lineDirection;
// Step 3: Define Your Position
_yourPos = position player; // Example: get your current position
// Step 4: Calculate Closest Point
_diffVector = _yourPos vectorDiff _lineStartPos;
_dotProduct = _diffVector vectorDotProduct _lineDirection;
_closestPoint = _lineStartPos vectorAdd [(_dotProduct * _lineDirection#0), (_dotProduct * _lineDirection#1), 0];
_closestPoint;
iv got no idea what im doing with vectors myself but this works
its not precise perfect
but its good enough to a few points that its dosent matter
It should be precise perfect. Algorithm is correct.
last part could be better written as _lineStartPos vectorAdd (_lineDirection vectorMultiply _dotProduct)
It's a common algorithm so it's the sort of thing that GPT is capable of regurgitating.
everything that you have created depending on how you write the logging system, yes.
13:20:05 ---------------------------------------------------------
13:20:05 "Frame 118332: HandleDamageVehicle: rhsusf_m1a1fep_wd"
13:20:05 ["207c0f18080# 1814387: m1a1fep.p3d (rhsusf_m1a1fep_wd)","light_r",1.17593,"B Alpha 1-2:1 (Sa-Matra) (rhs_t80u)","rhs_B_762x54_Ball",35,"B Alpha 1-2:1 (Sa-Matra) (B_Soldier_F)","#light_r",true]
```Getting this log for `HandleDamage` on RHS tank. `#light_r` is obviously not a `HitPoints` config class, what is it then?
Oh, I see. Doesn't seem to be documented much.
I guess this string is built from
getText(configFile >> "CfgVehicles" >> "rhsusf_m1a1fep_wd" >> "Reflectors" >> "Right" >> "hitpoint")
```=>`"Light_R"` ?
Well, there is hit point index in HandleDamage now at least
Guess its not documented because hit point name is a semi-recent thing in HandleDamage
Hello! I have a question. I am having trouble destroying the "Land_DragonsTeeth_01_4x2_new_F" dragon teeth and I think they cannot be destroyed. I've looked at "HandleDamage", "MineActivated" and "HitExplosion" Eventhandlers but I'm not entirely sure how MineActivitated and HitExplosion works. HandleDamage didn't work as the damage of the object stayed at 0 and never went up. My goal is to just delete these once explosives charges have been used on them. What I've tried:
this addEventHandler ["HandleDamage", {
params ["_unit", "_selection", "_damage", "_source", "_projectile", "_hitPoint", "_instigator", "_hitIndex"];
if (_damage >= 0) then {
deleteVehicle _unit;
};
}];```
```sqf
_projectile addEventHandler ["HitExplosion", {
params ["_projectile", "_hitEntity", "_projectileOwner", "_hitSelections"];
if (_hitEntity isKindOf "Land_HBarrier_01_line_3m_F") then {
hint "Barrier hit by explosion!";
deleteVehicle _hitEntity;
}
}];
Any ideas?
yeah the main issue is if someone uses
https://community.bistudio.com/wiki/setHitPointDamage
and expects Light_R to destroy a light it might only destroy the light or flare of the light, as a lot of vehicles separate the flare and the actual visible light into two to avoid the light drawing on the vehicle it self
as setHitpointDamage just finds the first hitpoint with that name and sets the value
What shocks me is that there was nothing but setHit up until A3, core gameplay damage mechanic barely accessible through scripts.
Thank god for setHitIndex/getHitIndex
You'll probably need HitPart event handler added to it
You can use Explosion but it doesn't provide much info about kind of explosion so you won't be able to tell a grenade from a satchel charge
HitPart is very complicated but you can achieve your destruction through it
Speaking of HandleDamage, how come its called for destructible buildings but not for Land_DragonsTeeth_01_4x2_new_F? Both are simuation = "house". What's the trigger for the EH to work? Existence of HitPoints class?
Or destrType? 🤔
Yeah, guess HandleDamage doest work for destrType = "DestructNo"
100% works!
this addEventHandler ["Explosion", {
params ["_vehicle", "_damage", "_source"];
deleteVehicle _vehicle;
}];```
Thanks!
Beware though it will destroy it with ANY explosion
Grenades, HE shells, anything that has indirect damage
Yea, thats fine for now. Its a very targeted event within a mission I have. So it should be fine.
How can I make my army guy shoot rapid fire instead of tap firing long distance?
You can script force him, but he probably won't hit much. Otherwise I have no idea, not an AI guy
Okay I didnt know if there was a straight forward dev mode or debug mode that would display in real time whats being executed
Have a handful of things I'd like to finally fix - Mainly compatibility issues causing some things to be executed multiple times and some mission initialization issues
One thing for example the mission I use might have its own initialization script but since its loaded with mods, the missions loading screen ends but the player isnt actually initialized and loaded in yet since all the mods and stuff are loading. I am not familiar with init stuff so I was hoping I could see the process unfold and work from there.
Is it possible to prolong a loading screen?
you don't have to. so if you need your init script to depend on if the player is initialized, do a check for !(isNull player), or if you need the player to be alive, (alive player)
hi guys. any ideas why a AI unit would get out of setUnconcious true after a few seconds then back to it.. then stay in the state?
@pliant stream its a common problem that most documentations are either not existing or horrible
mods
yupp- dead and hit animations. luckly he was kind enough to provide the variables to disable it on units. thanks!
damn it, that wasn't it.
thanks... sorry what, do I need what?
Q: if I am assigning driver, cargo, and ordering in, for AI units in a group, do I still need to addVehicle for the group?
and on the flip side, if, for whatever reason, units must eject the vehicle, because it has been disabled, etc, is there any converse to that?
oh, I was referring to the waypoints. I wasn't sure if you were merging to a new group but trying to preserve the prev group's waypoints to the new one.
I dont think it is necessary if you are doing all of the assigning. If I am reading this page correctly: https://community.bistudio.com/wiki/AI_Group_Vehicle_Management
And leaveVehicle might be what you are looking for at group level or moveOut on the unit level
no, it is intentional, I am dropping the group for exactly that reason, because the objective goals are changing, so the waypoints can go away.
just did not know if I needed to do any GC in addition to that.
thanks, cheers 🍻
at an AI group level, but individually the units may not have fully loaded...
just depends upon when the conditions are seen...
Question, I have this in an if statement
(isNull(_uv80 getVariable ["marki_var_strobeLightRight", objNull])) && {isNull(_uv80 getVariable ["marki_var_strobeLightLeft", objNull])} && {isNull(_uv80 getVariable ["marki_var_strobeLightBack", objNull])}
But I want to replace it with "either one" instead of "all of them"
you can replace & & with ||
I understand I need to replace && with || right? But do I need to change syntax?
nope 🙂
Okay thanks. The thing is I dont know where the first init script is taking place that lets the player move around in a black screen while the mods / mod scripts load in. I think I'll just leave it alone
Q: bit off topic perhaps, and I'm not sure it is a modeling or config question, but, for an RHS Ural transport vehicle, reporting typeOf, fullCrew roles, and hit points, how does this thing have EIGHT wheels? or is it loosely based on a HEMTT base platform, perhaps?
curious, especially if I am interested in watching wheel damage status, for disruptions, dismount triggers, etc.
[
"RHS_Ural_Open_MSV_01"
, ["driver","cargo","cargo","cargo","cargo","cargo","cargo","cargo","cargo","cargo","cargo","turret","turret","turret","turret"]
, [
["hitlfwheel","hitlf2wheel","hitlmwheel","hitlbwheel","hitrfwheel","hitrf2wheel","hitrmwheel","hitrbwheel","hitspare","usespare","hitfuel","hitengine","hitbody","hitglass1","hitglass2","hitglass3","hitglass4","hitrglass","hitlglass","hitglass5","hitglass6","hithull","#l svetlo","#l svetlo","#p svetlo","#p svetlo","#l svetlo","#p svetlo","#searchlight","#l svetlo","#p svetlo","#cabin_light"]
, ["wheel_1_1_steering","wheel_1_2_steering","wheel_1_3_steering","","wheel_2_1_steering","wheel_2_2_steering","wheel_2_3_steering","","spare1","","hit_fuel","hit_engine","karoserie","glass1","glass2","glass3","glass4","","","","","","l svetlo","l svetlo","p svetlo","p svetlo","l svetlo","p svetlo","searchlight","l svetlo","p svetlo",""]
, [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]
]
]
Oh so you're talking about if you're using a mod that is running an init script how to work with that? Some mods have either a variable or a scripted event handler that will fire when all of its init is completed. If not, you'll have to find out someway to detect that it is completed by digging through their code. What mission/mod are you looking to use?
So I got this working pretty good! But, I'd like to make it to where only certain classes are able to destroy the object.
this addEventHandler ["Explosion", {
params ["_vehicle", "_damage", "_source"];
if ((_source distance _vehicle) < 10) then {
deleteVehicle _vehicle;
};
}];```
How can I find out what `_source` is?
or like, how can I findout what is returned in _source?
You test it, I guess.
lol yea I get that, but how would I test that? I assume maybe a variable?
I prefer diag_log. Some people prefer systemChat. They are wrong.
bluh = this addEventHandler ["Explosion", {
params ["_vehicle", "_damage", "_source"];
if ((_source distance _vehicle) < 10) then {
deleteVehicle _vehicle;
};
}];
ohhhh
lmao I totally could of just done
hint format ["Object: %1", _source]
hello newbie here.. is there a way to make this artillery unit with unlimited ammo in zeus???
I kinda want to curate a mission with non stop artillery barrage
Try with this code
this addEventHandler [ "fired", {(_this select 0) setvehicleammo 1} ]
Hey. Im writing a draw event handler for the map screen. Any one have any reference for what a good runtime for the function is (or rather how long the function runs)?
Nevermind, thought _source is shot parent. Makes things much easier then.
what is _source? :P
Tested it, its a projectile
Could use an update in wiki
I wonder if my recent ticket to fix missing projectiles from HitPart also fixed it for Explosion
If it's a vehicle explosion then the vehicle instead?
You mean FuelExplosion?
FuelExplosion its a projectile too, I think you can catch it in HitPart as well
The one where they go pop when killed, whatever that is :P
getText(configFile >> "CfgAmmo" >> "FuelExplosionBig" >> "simulation") => "" 🤔
Tested, EH gets null object, but it might be fixed in dev
12:29:43 =========================================================
12:29:43 "Frame 173426: HandleDamageMan: B_Soldier_F (ALIVE=true)"
12:29:43 ["B Alpha 1-2:1 (Sa-Matra) (B_Soldier_F)","",0,"B Alpha 1-2:1 (Sa-Matra) (B_Soldier_F)","FuelExplosionBig",-1,"<NULL-object> ()","",false]
12:29:43 ---------------------------------------------------------
12:29:43 "Frame 173426: Explosion: B_Soldier_F (ALIVE=true)"
12:29:43 ["B Alpha 1-2:1 (Sa-Matra) (B_Soldier_F)",0,"<NULL-object> ()"]
(allowDamage false)
Nope, not fixed
Interesting that this fuel explosion doesn't trigger HitPart but does trigger Explosion
SmallSecondary does trigger everything properly and appears in Explosion on dev build (not sure if it doesn't on stable, didn't test yet)
12:54:34 #########################################################
12:54:34 "Frame 92661: HitPart: B_Soldier_F"
12:54:34 ["B Alpha 1-2:1 (Sa-Matra) (B_Soldier_F)","<NULL-object> ()","1814749: empty.p3d (SmallSecondary)",[23513.3,18237,2.23831],[0,0,0],["leftfoot"],[5,2,5,1,"SmallSecondary"],[-0.790335,-0.612675,-0.000232657],0.103592,"a3\data_f\penetration\meat.bisurf",false]
...lots of HitParts...
12:54:34 =========================================================
12:54:34 "Frame 92661: HandleDamageMan: B_Soldier_F (ALIVE=true)"
12:54:34 ["B Alpha 1-2:1 (Sa-Matra) (B_Soldier_F)","",0,"<NULL-object> ()","SmallSecondary",-1,"<NULL-object> ()","",false]
12:54:34 ---------------------------------------------------------
12:54:34 "Frame 92661: Explosion: B_Soldier_F"
12:54:34 ["B Alpha 1-2:1 (Sa-Matra) (B_Soldier_F)",0,"1814749: empty.p3d (SmallSecondary)"]
You can script-create SmallSecondary though but not FuelExplosion or FuelExplosionBig though
Some hardcoded magic again I assume
yeah fuel explosion is hard coded, no idea why its missing a simulation tho
smallSecondary is only spawned via script (even vanilla) it's one of the killed eventhandlers
whats the easiest way of determining if an entity is an enterable vehicle
right now working with ```sqf
((crew _v) isEqualTo []) && // if false then its obviously a vehicle with crew
{((_v emptyPositions '') isEqualTo 0)} // no empty positions and also empty
Enterable, as in? It is a vehicle, not a prop, neither a drone?
i guess ya
Guess checking its config or something is not really better than your solution
count fullCrew with include empty turned on?
unless that also catches drone crew, but I don't know whether that's the case
There's unitIsUAV command as well. Maybe faster than manual config lookup...maybe?
ah true, forgot about it 😄 yes will be faster 🙂
Hey guys. I used Atom with the ace package for a while. Now i decided to look around for a new script Editor. What can you recommend?
I think I can recommend VSCode
there is all this https://community.bistudio.com/wiki/Category:Community_Tools#Code_Editing , but I do recomment VSCode and SQF plugins yes 🙂
@obtuse crescent if you are using that execute box from ZEN, you have to use _this instead of this
OOS will get enums with next version <3
Thanks I will give it a shot
also some other thingy auto s = "foo"; s = s.append("bar"); //s now contains "foobar" ^^
Maybe a weird question but.. is it possible to get AI to throw smoke while running? I can get them to throw smoke while stationary but not while running? Cheers 😄
You can spawn the smoke manually 
Hey mate 👋
I do a fair bit of that currently too 🙂 but I’m trying to get the AI to secure (with smoke) a position they are running to.. with animations etc
How do you force them to throw?
iirc forceWeaponFire did work while they were running
_unit addMagazine "vn_m18_white_mag";
[_unit, "vn_m18_white_Muzzle"] call BIS_fnc_fire;
I don't know, I can check when I'm back on the pc
Good steer, thanks, I'll take a closer look there 🙂
Hi, is there an event of some kind to check if the player has changed weapons? (Between primary and secondary, etc...).
This is for a test script related to radio jamming, in which the player is supposed to equip the spectrum device and it should automatically (no actions involved), execute the jammer code.
Thing is, I cant really see where can I check if the player switched weapons to the jamming device.
I took a look at SlotItemChanged but its not really what im looking for.
I could probably get away with it by doing a while true type of code, but its not really optimal
There is no "weapon changed" EH in A3, but you can use CBA_fnc_addKeyHandler: add the handler to a needed weapon switch key, and inside it check if the current weapon is what you need.
if CBA then use this for for weapon changed https://cbateam.github.io/CBA_A3/docs/files/events/fnc_addPlayerEventHandler-sqf.html
Hey guys
I'm trying to understand how to create this and I need a bit of direction
Arrows show that vehicles have square that marks them as potential targets, without even marking them on my own (CUPs non-radar Apache) via radar or something. They are marked automatically.
I wonder if there's any command that allows this feature to be applied on other air assets like drones.
I've been trying to check several commands here, but no luck and I think I'm looking at the wrong place. Is it even vanila thing or CUPs scripted thing?
https://community.bistudio.com/wiki/reportRemoteTarget
i know those overlays exist in vanilla (the blackfish and maybe blackfoot have them iirc), but i can only guess that it's defined in the vehicle's config... some time ago, i manually rendered icons using a Draw3D event handler and getSensorTargets _vehicle, which you might be interested in
https://community.bistudio.com/wiki/getSensorTargets
Awesome, thanks man. I'll try to play with it
I'm having trouble with this code.
{ if (locked _x == 0) then
{setVariable ["haveTransport",true,true];}
} forEach synchronizedObjects thisTrigger;```
It says "expected Boolean and got nothing" or thereabouts
I'd like to check each synchronized vehicles for when they lockpick them
You don't have a name space to set the variable to
_x setVariable ["haveTransport", true, true]
Okay
Fixed that, still says "Type Nothing, expected Bool"
{ if (locked _x == 0) then
{missionNamespace setVariable ["haveTransport",true,true];}
} forEach synchronizedObjects thisTrigger;```
(updated Code)
Check to see what synch'd objects returns.
I suppose
missionNamespace setVariable ["haveTransport",true]
Also, you can use the object's namespace with _x if you wish
?
yeah if locked is 0 on _x, we want it to run the trigger
if any of the vics are unlocked?
I'm getting the sense that ForEach doesn't work so well with Trigger conditions
If the synchronized objects is empty, locked will fail because you didn't give anything
Right, but we did sync items
we're just gonna add eventhandlers to the vehicles
seems simpler
Random - are you using a thermal mod? That looks really good... I despise the new one implemented by BI
Thank you for the idea! I finished my project for now:
this addEventHandler ["Explosion", {
params ["_vehicle", "_damage", "_source"];
minestring = str _source;
minevalue = (minestring regexFind ["satchel|rhsusf_m112x1_e|rhsusf_m112x4_e"]) select 0 select 0 select 0;
if (!isNil "minevalue") then {
if ((minevalue find "rhsusf_m112x1_e" >= 0) || (minevalue find "rhsusf_m112x4_e" >= 0)) then {
if ((_source distance _vehicle) < 5) then {
deleteVehicle _vehicle;
};
};
if (minevalue find "satchel" >= 0) then {
if ((_source distance _vehicle) < 10) then {
deleteVehicle _vehicle;
};
};
};
}];```
This will only delete the dragon teeth depending on the type of mine used to get around ingeneral explosion handler!
Does anyone have an idea how to remove faces voices and insignia from Ace 3 Arsenal?
you just don't want players to change them? there should be a ACE setting in addon settings that makes those menus untouchable
give us some feedback if u got anything successful on this, im also interested for this
Yeah, A3TI mod
anyone have a shop/shop menu script with an example for each object like vehicles, weapons and items im new to scripting so a heads up on where to paste would help i use VSC for scripting
it worked thank you so much 
do you know any script that disables sprint for AI?
limitSpeed I believe
ok i try, thx mate
I found it 🙂 but thanks for the reply player allowSprint true;
ah crap yes :D mb, old ways die hard 😄
glad you found it 🙂
🙂
🙂
Q: I have a use case for an AI group to be given a 'move to' waypoint. the raw case is, they may be on foot, so literally marching to said WP. that's easy.
the more elaborate second and a half of the use case is, the group may be ordered into a vehicle. assuming once they have all loaded, should I delay the waypoint until they have all loaded? i.e. so driver does not take off without them.
the half use case after that is, when the vehicle asset is disabled within thresholds for any reason, I want for the group to dismount and continue on foot.
with either of these cases, negotiating the space between ordering in and/or leaving the asset, and their actually negotiating that request.
so the underlying question beneath all this is, disposition towards waypoints in general. or would it just be simpler to regroup the units and issue fresh 'move to' waypoint?
the group may be ordered into a vehicle. assuming once they have all loaded, should I delay the waypoint until they have all loaded? i.e. so driver does not take off without them.
if AIs, they will wait until the vehicle is optimally loaded (filled || everyone on board) then go
the half use case after that is, when the vehicle asset is disabled within thresholds for any reason, I want for the group to dismount and continue on foot.
they will
hmm okay, so if I understand correctly, best to defer until all in, then send the waypoint.
you can send the waypoint at any time
iirc, if they have a waypoint then are assigned a vehicle, they will board then continue toward the WP
(I might be wrong, AI is not a science but more like magic 😄)
understood fair enough. will tinker with it. thanks...
Known bug. UAV's cannot be made to take off again once they've landed
Does anyone know if the player object exists while in the respawn screen?
Like would this return true if the player has died and is waiting for a respawn time waitUntil {!isNull player};?
hmm.. it seems to think the player still exists
alive player = false if null, false if dead
Smart Lou 😂
aight guys, im stuck. I want this piece of script to check if other teams have more than the min player count (_minPC) before allowing the purchase of a vehicle class, but this is just telling me not enough still when there are more than enough. any ideas? heres my example
_sideWest = west countSide allPlayers;
_sideEast = east countSide allPlayers;
_sideGuer = independent countSide allPlayers;
_pilotArray = ["B_Plane_Fighter_01_Stealth_F"];
_minPC = 1;
if (_class in _pilotArray && ((_sideWest <= _minPC && playerSide != west) || (_sideEast <= _minPC && playerSide != east) || (_sideGuer <= _minPC && playerSide != independent))) exitWith
{
hint "Not enough players on at least one opposing team to buy a jet!";
playSound "FD_CP_Not_Clear_F";
_price = -1;
};```
oh maybe its the ORs...i'll have to rethink it
i think i needed >= so it is false when enough people are on and it passes to the rest of script
One other team or all other teams?
If just one then yes, you need to swap for >= check
i think i figured out my error, i didn't have anyone on indie when i tried so of course its true && true - it was working as intended.
oopsies
Why does removeBackpack creates a ground weapon holder? 🤔
addMissionEventHandler ["EntityCreated", {diag_log ["EntityCreated", _this, typeOf _this]}];
removeBackpack player;
```=>
12:16:48 ["EntityCreated",2afbba3eb00# 1823200: dummyweapon.p3d,"GroundWeaponHolder"]
Only if you have a backpack, but still
I wonder if its because of the separate container that the player uses as the backpack needs to be emptied, so they have it create a ground weapon holder, store the stuff in it, then delete it. does the holder have any items that frame?
Yes, it has that backpack there
Is there a way to easily get the max range at with gunfire from a particular gun is heard? I'm looking at the configs now but it's a mess of sound shaders and sound sets, and it's not something standardized I think. I want to make a solution that will work for any and all weapons.
the range of the SoundSet is the highest range of all SoundShaders used in SoundSet. So if one SoundShader has a range of 50 and another SoundShader has a range of 1800 - 1800 will be the range of the SoundSet.
Just select highest range maybe?
Yeah. It seems to be the only way. I go through all of the sound shaders and check the range and select the max one, then I get if silencer is on and get the audio multiplier. Seems to work.
You need to get soundTypeIndex from muzzle, then pick index from weapons's sounds, go into that subclass, walk through each shader, select max range.
Should pretty easy
Also cache it in hashmaps so you don't have to do it each time
By weapon-muzzle pair or something like that
Good point on caching the results.
there a command to detect if a player is transmitting voice? vanilla.
I don't think so, you may get it by hooking on UI but that would be janky
off to request a EH for it lol
I think getPlayerChannel player works
even if you have VON toggled but player is transmitting nothing, it will be -1, otherwise >= 0
gameValueToJson this will work in A3?
greetings, im trying to use test addEventHandler ["Fired",{params ["_unit", "_weapon", "_muzzle", "_mode", "_ammo", "_magazine", "_projectile", "_gunner"]; if (_this select 1 == "launch_NLAW_F") then { "guidedlauncher" setMarkerPos getPos _unit; };}]; To move a marker at place where guided launcher is fired. How can i include a list of launcher classnames to look for instead of using one classname?
nope
no
If you've done that params then you don't need to use _this select 1, you can use _weapon since you've already given it that nice tidy variable name with params.
You can use in to find out whether a string (e.g. the weapon classname) is in an array of strings (e.g. a list of classnames), but beware it's case-sensitive. You can sort out the case-sensitivity by forcing everything to be lowercase. So:
if ((toLower _weapon) in (["array", "Of", "classNames"] apply {toLower _x})) then {
// do stuff
};```
meh...
(If your array of classnames is unlikely to change, you can define and toLower it once at the beginning with a global variable, so it doesn't have to be re-processed every time the EH fires)
if you get your class names from config you don't need to use toLower, since the case is consistent (also even if you had to use toLower use toLowerANSI which is 2x faster)
You can potentially detect the UI icon indicator, next to the chat
On the subject of toLowerANSI, do you know what it does if you give it a string with a character it doesn't support? Does it just leave that character as is or does it throw an error?
should leave it as it is
it doesn't throw error tho. worst case scenario, the returned string is corrupted
yeah it gets corrupted
toLowerANSI "AФ" returns "a��"
Interesting
hi, how can i play a custom sound for just one player on a server?
Thank you! this worked like a charm
quick question
whats the best way to teleport something
I want a thing to teleport to a point when trigger goes on
havin issues with setPos
it is indeed not recommended - https://community.bistudio.com/wiki/setPos (plz don't crosspost, I deleted in #arma3_scenario thx)
Hello, im getting this error while using uiOnTexture. It seems to only happen on a server when a client renders a display that was already rendering
my gpu is not running out of memory, and my ram isnt either
Its dumping this over and over into the rpt file
maybe its my pagefile?? Weird tho since I have plenty of ram
Whats better?
@opal zephyr Dedmen might be interested.
I think it was in fact the pagefile... very odd. The rpt even mentions that there is 11 gb free of ram, I wonder why its using a pagefile (I didnt have a pagefile before)
increasing pagefile fixed it lol
I can drop this info in #perf_prof_branch
Windows always uses the pagefile when something's allocated and not used yet.
uh my emergency free message is working.
Pagefile ye
So am I just stressing it too hard that its running out of memory or something? Is there a solution to prevent hard crashes for people who might not have a lot of memory or a pagefile? Like creating a buffer that loads things individually for example
depends on what you have and what you need
setPosATL = Above Terrain Level
setPosASL = Above Sea Level
@opal zephyr Nah, I think that's just how default textures work in D3D11. When you allocate space on the GPU, it also allocates "backing memory" in case of a task switch.
So fundamentally you need a good chunk of pagefile.
Hey, is createHashMapObject currently broken on stable or is there something that I don't get? The following code (directly copy pasted from one of the biki examples) errors,
_self set ["MyVehicle", _newVehicle]; -> error type string, expected number
private _temporaryVehicle = [
["#create", {
params ["_vehicleType", "_vehiclePos", "_lifetimeSeconds"]; // handle constructor arguments
private _newVehicle = _vehicleType createVehicle _vehiclePos;
_self set ["MyVehicle", _newVehicle]; // Store the vehicle inside the object for later
// because _self is passed as parameter, it will be referenced by the spawned script until it ends.
[_lifetimeSeconds, _self] spawn { params ["_lifetimeSeconds", "_self"]; sleep _lifetimeSeconds; };
}],
["#delete", {
deleteVehicle (_self get "MyVehicle"); // delete the vehicle when we go away
}],
["MyVehicle", objNull] // placeholder, this is not needed
];
// create a temporary RoadCone, at player position, that will delete itself after 5 seconds.
createHashMapObject [_temporaryVehicle, ["RoadCone_F", getPos player, 5]];
All textures go in there. If players don't have enough space, then your handful of extra ui textures won't be much extra
there are a few issues that are now fixed in dev branch. Mostly concerning scheduled VS unscheduled use of that command.
Im using this line of code _screen = createSimpleObject ["J3FF_screenTest", AGLTOASL positionCameraToWorld [0,0,0], true]; to create a simple object, later in the same scope I delete it with deleteVehicle _screen. However some/all of the objects dont actually delete... Does anyone have any guess as to why? I cant replicate it when using the console
I'm fiddling with a mission and I'm getting a "mapsize" error. I know this is vague but I don't know what to include.
is it a black error that pops up on screen? If so, screenshot it and send it
normally the error that pops up on screen is pretty specific
ok.....
Hard to say without seeing the actual code
Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.
there was a bug in the constructor which has been fixed. try the dev branch to see if that was the issue
ya thats pretty specific, it means the variable is undefined, like it says. So somewhere in your fiddling you have either removed where it gets defined or re-ordered it so that it happens after
Did you verify that the deleteVehicle line runs at all?
Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.
Its part of a foreach and the rest of the code runs fine, so yes, it gets past it
this doesnt help, it just prints the same error thats displayed in your screenshot
ok, well, all I know is how to remove/replace something that is aready there to change something in th emission but scripting, el losto!
How many scripts are there?
Easier way to answer that is, it is the Pilgrimage mission. I have been playing for many years but sometimes I like to just tweak (simple) things
I have no idea what the pilgrimage mission is
Your game preference? MP or SP?
I pretty much just mod nowadays
Wish I could
if there wasnt many scripts it would be easy to find the problem
It's quite extensive actually
the mission part is quite small but all the scripts go on forever
Alright. If there is a preinit somewhere in the files then maybe the variable is cba based and defined through the menus
Well just to be sure, store the deleted objects in an array, then check if anything in that array is not null
arr = [];
{
...
arr pushBack _screen;
deleteVehicle _screen;
} forEach...
Alright
You can use Notepad++ or VSCode to search for that var in all scripts
I did this and it looks like the first 80% return null, and the last 20% are objects... hmm very odd
ok I verified with a counter after deleteVehicle. out of 260 loops, it only reaches the end the FIRST 160 times, after that it doesnt
Its getting stuck in the waitUntil {!isNull (findDisplay _uniqueUIName)}; section
Stuck as in?
_selectLoot = selectRandom _lootPool;
_triggerPos = getPos damLoot1;
_lootPos = _triggerPos vectorAdd [0, 0, 1];
_spawnedLoot = createVehicle [_selectLoot, _lootPos, [], 0, "NONE"];
hint format ["Loot spawned: %1", _selectedLoot];```
I'm trying to make a single item spawn within this large array of items in the same position as a trigger I have placed on the ground, but this error pops up and no item spawns at all, but my hint shows "Loot spawned: any".
I may need some help.
@opal zephyr would you be interested in looking at a mod that I find would be cool
as in it never returns true and exits the loop
Then you're misunderstanding something
What does this mean? Like is it broken or are you just asking if I want to see it
just asking if you want to make it...from scratch
for one the hint variable is _selectedLoot but you are using _selectLoot everywhere else
idk if misunderstanding something is the right word here... findDisplay isnt that complex and its being created in the same way
no
Not sure about your intention there, is it ui2tex attempt?
yes, this is the code portion https://pastebin.com/KwMiNcqA
Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.
lmfao you are correct, the hint now correctly shows a random item, no errors, but i dont think the item even spawns, i went into zeus and used "Update Editable Objects" so I should(?) see it as zeus if i did that?
I am not sure about RscDisplayEmpty. I mean it is a vanilla class but I forgot where it is. I think ui2tex only accepts a display class that is located in root (eg configFile >> "RscDisplayEmpty")
the only thing I didn't understand is why vectorAdd? so it appears 1m above ground? what happens if you just eliminate or comment out _lootpos and just use _triggerpos? unsure about the zeus thing
^
For some context, the script runs correctly a number of times before stalling on the wait loop. So something is happening along the way, or my _uniqueUIName definition is messing up
here is how its created:
_uniformString = (toLower (uniform _unit)) regexReplace ["[^a-z0-9]","x"];
private _uniqueUIName = format["%1_%2_%3", getObjectID _unit, _forEachIndex, _uniformString];
One thing is it is a case sensitive to pick a display using unique name
But as you might already guessed I don't think that's a case
Its stored in a variable in the same scope, and doesnt change before getting to the display creation or find display.
so it appears 1m above ground?
pretty much, i was afraid it was gonna clip underground or something
what happens if you just eliminate or comment out _lootpos and just use _triggerpos?
gave it a shot, no dice, i even put the trigger on a flat surface and i still couldn't see it
i think i know where I messed up
Nevermind, still not working lol
There a way to keep an objects texture but change the transparency or alpha channel of the object? So it is slightly see through
This needs a note: the waypoint "TR UNLOAD" is broken for vehicle spawned with CreateVehicle, it work with BIS_fnc_spawnVehicle
https://community.bistudio.com/wiki/setWaypointType
Source here and I also tested it: https://forums.bohemia.net/forums/topic/167810-heli-scripted-waypoints-tr-unload-getout-not-working/
Hello! Getting mad with this. Tried everything I know and helo or just stops in ground without unloading troops or as soon as it lands, flies away: _pad = createVehicle [Land_HelipadEmpty_F, _landpos, [], 0, NONE]; _grupo = [_orig, EAST, (configfile CfgGroups East OPF_F Infantry OIA_InfSquad...
Only if original texture on the model had any transparency, otherwise it will just get blacker
So in short - no. In practice there are rare exceptions
Got this working. Its very odd since it only happens to specific uniforms, and the display is actually valid, however its returning as invalid in the loop. I fixed it by breaking out of the loop after 200 frames, and the rest of the code which relies on a valid display, runs correctly. Proving the display is valid. Very confusing all around
You must be doing something wrong, ui2tex is pretty coherent
To avoid these waitUntils, create your own display that does onLoad so your display is ready right away after ui2texture goes into action (you see the texture in game)
To pass arguments I use a hashmap with key being that unique display name
