#arma3_scripting
1 messages ยท Page 566 of 1
the first event handler I add from mission start, starts at ID 1 but when I removeAllEventHandlers then add it back the ID starts at 0
anyway, does it worry you much? you get your ID, you delete an EH by passing your ID, that's all we users need to know I guess ๐ค
I mean... use it as API
don't worry about decrements as the guy said
yeah, just concerning ... i don't need another onEachFrame event handler running in the background evertime it gets called so its hard to tell with these wack IDs
that could very quickly lead to game crashes
๐ค you don't need it - you don't add it, I don't get it ๐ค
i don't need another onEachFrame event handler running in the background evertime it gets called
Sorry man, every time what exactly gets called? When you call addMissionEventHandler, surely it will add one for you
yeah "i don't need another" as in it would be very bad to have multiple handlers executing the same code EachFrame but as long as its actually being removed and the IDs are just being incremented then its fine
and yeah every time I call whatever function that adds the event handler because its needs to be removed so that the code is not running when I don't need it to run
maybe you could add it once and could just have a toggle/flag to run it or not
if you are going to add/remove them very often, at some point you will reach the float maximum integer
Would not worry too much about that
Unless the Mission is supposed to run for weeks
yeah lol, mine only runs when the player dies so if he dies like 5000000 times in one mission window .. then i hope his computer blows up
all right then ๐ I'd personally prefer it to be added permanently at start and just exitWith at start if conditions are not met, to avoid messing with remembering the ID, then removing the handler, etc
yeah, i agree with that ... but i dunno the performance impact EachFrame has on large missions even when its being exited on the first line of code
Few ms
Again.. Nothing to worry about
and i am removing it from within itself so i dont really have to deal with the handlers removeMissionEventHandler ["EachFrame", _thisEventHandler];
performance impact is none... just make sure that the actual added code to onEachFrame is small, because it might be recompiled on each frame
Few ms
๐ฎ few us I think
๐ ๐ I am overdue to sleeping right now
better tjam me at least
Anyone know a way to temporarily stop an AI from firing? I want AI to keep target info, target to keep enemy status, etc. I just want an AI to lose the ability to fire his weapon for 1-2 seconds. It would be right after a reload, so preferably something to do with loading an empty magazine and giving them a full one after the wait.
unit disableAI "TARGET";
Maybe?
The AI loses targeting info and it takes a while to reacquire the target
I just want a very short amount of time the enemy cannot fire in
will a _unit setAmmo [currentWeapon _unit, 0] prompt a reload?
how often does attachTo sync the position data on MP? was it per frame?
@slim oyster try combatMode "blue"
Per Frame
At least it looks like it, when attached to a player. Instant moving etc.
(as long as the "attachTo parent", it is attached to, has PhysX set up)
No i just want to avoid problems with extdb
You want to prevent people with malicious names from getting to your database, by kicking them?
Thats not the correct way to do security, the correct way is to make sure that your DB can handle weird input correctly @echo yew
"Bobby Tables"
is possible to interact with the AI commend menu via sqf in some way (besides the opening)?
@velvet merlin like these? https://community.bistudio.com/wiki/Category:Command_Group:_Unit_Control . Can u give an example of what u mean?
//config.cpp/bin
class Extended_Killed_EventHandlers
{
class CAManBase
{
class Salmon_heac_killed_eh
{
killed="[(_this select 0), 'dead'] call salmon_heac_fnc_reactHelm; [(_this select 0), 'dead'] call salmon_heac_fnc_reactRifle";
};
};
};
Function reactHelm and reactRifle both just contain(for testing purposes)
systemChat "Helm"/"Rifle"
It works perfectly fine until a unit dies from another. Lets say I shoot AI it'll fire twice.
If AI setDamage 1 then it'll just print systemChat once.
If I respawn then it'll print systemChat once
If I shoot AI then it'll print systemChat twice.
Does anyone know a way around this?
systemChat "Helm"/"Rifle" thats syntax error?
second script won't execute if first script errors.
What's the best way to get a unit by its roleDescription? I'm expanding my TK script to also detect when a UAV teamkills someone. Normally I'd get the player object from the eventhandler but if the thing that teamkills is a UAV I don't get the UAV operator, just the UAV.
@still forum
//config.cpp
class CfgPatches
{
class test
{
name="test";
version=1;
requiredVersion=1.96;
requiredAddons[]=
{
"ace_main",
"cba_main"
};
author="";
authorUrl="";
units[]={};
weapons[]={};
};
};
class Extended_Killed_EventHandlers
{
class CAManBase
{
class test_killed_eh
{
killed="systemChat 'dead'";
};
};
};
In game:
Any unit dies from setDamage 1 prints "dead" once
Any unit kills another prints "dead" twice
oh yea, that works too
Any unit kills another prints "dead" twice
I think ACE team also had that bug, or maybe it was handledamage running twice
Did you guys find a solution? Could you point me in a direction of that discussion if there is one?
ACE Slack, don't think they did. They told me to take a look at it
Hmm.. ok. Going to try with vanilla EH but last time I tried using them they didn't even fire.. :/ Thanks
the solution was to do something like:
params ["_unit"];
if (_unit getVariable [QGVAR(alreadyKilled), false]) exitWith {};
_unit setVariable [QGVAR(alreadyKilled), true];
// ... rest of EH code
I'll try, thanks! ๐
isn't the "issue" because of locality?
@tough abyss yesterday I had issue with vanilla EH firing "killed" twice
solved it with putting a flag on unit after handling killed first time
(yeah I am using ace)
private _handledPreviously = _oldUnit getVariable ["vin_killed_handled", false];
OOP_INFO_1(" handled previously: %1", _handledPreviously);
if (_handledPreviously) exitWith {
OOP_INFO_0(" handled previously, ignoring this call");
};
_oldUnit setVariable ["vin_killed_handled", true];
I'm using a similar solution. I didn't have the ability to test at the time and was thinking someone else must've had the same problem. Thanks for all the help :)
@winter rose I was thinking it had to do with locality too ie killed runs on both attached unit and killer but I wasn't sure. I'm happy with the variable alreadyKilled solution.
From my testing it just looks like it runs twice ^^
well if it is locality, you can fix it with if (local unit)
It happens in sp and editor
then not locality related I'm afraid
at least it doesn't lock your game so that you must Alt+F4
oh weird, I thought ace was causing this since it happened when unit was unconscious for some time then passed out (through ace scripts, that is)
anyway... any idea what's causing it?
no
What in the lord's name this time. How to inflict damage on player with the below when player is in vehicle? Because that just damages the vehicle player happens to be in sqf dmgTrg = createTrigger ["EmptyDetector", position [1,1,0], TRUE]; dmgTrg setTriggerArea [10, 10, 0, TRUE]; dmgTrg setTriggerActivation ["ANYPLAYER", "PRESENT", TRUE]; dmgTrg setTriggerStatements [ "this", "{if (isPlayer _x && alive _x) then {_dmg = 0.1; _x setDamage (damage _x) + _dmg;}} forEach thisList;", ""];
maybe thislist lists the player's vehicle, and you should do something about crew, if _x is a vehicle @forest ore
(italic is not sarcasm from me, I don't know triggers' behaviour on this)
Not sure you can uiSleep or sleep in a trigger statement
true Ryko, probably can't. At one point I had [] spawn there. Forgot to remove the uiSleep from that example of mine.
-showScriptErrors saves lives
Lou, thanks for the suggestion. Reading about crew at the moment and like you suggested I'd probably need to tap into the vehicle's crew array somehow. Well nothing's brewing under the hood so-to-say but maybe something will after a while ๐คท๐ผโโ๏ธ
Hello, I have a problem with UAV, I would like to get some help, it's possible to assign the created crew of uav to player team somehow?
I can try
it say that the crew created will be in vehicle group
my problem is, the killing reward scripts/town activation scritps will not work cos they expect member of player group
I don't know how to get the uav crew to make them join player group
and if it's possible
You can join them as any other unit, but expect funkiness... they will try to enter player group's formation which will destroy any kind of loiter WP
(units uavGroup) joinSilent group player
it's there another way to relate the uavGroup to players ?
I think you need to be more specific for what you want to do
do you want to give orders to UAV crew with the group command system?
no it's not that the goal, I am fine using the terminal, the problem is, when UAV do kills the score system doesn't give bounty to player, cos the system works if it's player killer or one ai of player group killer.
another problem is the drone doesn't activate town
is this in some modded/custom scenario?
now that you have explained the basics someone might figure out how to help you.
but I would wager its the bounty system that needs altering
what you are trying to do does sound like it would break how the UAV behaves
I did ask if was possible to relate the uav to player, if that is not possible without break the uav functionalities of course we need find another route or just give up with the score.
there is something weird still
probably need something to catch the kill (event handler), check if it's a UAV (unitIsUAV) and who the gunner is (UAVControl), and then assign the kill to the gunner.
cos if I use the greyhawk on turret I get the kills it's like recognizing me as gunner and works
instead the land one rcws doesn't
yes Grezvany13, still I don't understand the actual system,
arma engine give me the rating for kill with both uav, but on the greyhawk I get the bounty as gunner , on rcws land one I don't
that seems to be an issue with the custom scripting, not with Arma
the turret of the two drones are working differently
or maybe
I had multiple drone connected, I need try it just with the RCWS
but you can only operate one gun at a time, so that shouldn't be an issue
and since it works correctly in the killcount of Arma itself, it must be somewhere in the scripts of the mission/scenario/mod which handles the kills
I can't do more tests right now cos we are about to start daily 9pm game but from previous test made the greyhawk the flying one I killed vehicles with missiles and got the reward without problem so all working, with the land rcws I did same killed some ai but I only get the rating (arma engine) and not the kills, btw the command you listed will help me in my goal so I want to tank you a lot
unitIsUAV and UAVControl ๐
what is targetAge?
Probably the length of time since unit A detected unit B, it's considered in a number of different contexts
How are script handles generated?
How many of them are there?
Are they recycled? I have a plan to spawn lots of scripts, but after previous have been terminated.
Hi guys, could someone help me work out whats wrong with this script I have on a mission?
I'm getting this error:
'21:11:06 Error in expression <h) then
{
_x setVehicleLock "LOCKED";
};
} foreach _lockveh;
};
while {true} d>
21:11:06 Error position: <;
} foreach _lockveh;
};
while {true} d>
21:11:06 Error Missing )
21:11:06 File mpmissions__cur_mp.Tanoa\vehicleLock.sqf..., line 19
21:11:06 Error in expression <h) then
{
_x setVehicleLock "LOCKED";
};
} foreach _lockveh;
};
while {true} d>
21:11:06 Error position: <;
} foreach _lockveh;
};
while {true} d>
21:11:06 Error Missing )
21:11:06 File mpmissions__cur_mp.Tanoa\vehicleLock.sqf..., line 19'
and the pastebin is the script itself ^
Sorry, I'm just dumb and I couldn't interpret the error layout it was giving me
thank you!
yeah it is pretty awful
I recommend using code blocks so your code is readable
I tried, I think I made a mistake with that
in discord that is
```sqf
your code here
```
thanks, will remember that in future
were all the other errors related to that missing parenthesis
find out
will do a test
to be fair, I actually am not sure where the parenthesis should go on that line
It looked like everything is closed to me
Feeling pretty stupid, I have dabbled with this stuff before not sure why i can't see it
either behind typeOf _vehicle or they arent needed
will try one there
can't paste image here :/
if ((typeOf _vehicle in _lockveh) then
^^ ^
should be
if ((typeOf _vehicle) in _lockveh) then
now each open paren has closing paren to match
the inner ones aren't actually necessary though
if (typeOf _vehicle in _lockveh) then
this should work as well
will try that ^
so i understand that there's a system in place that fails or succeeds a mission if too many of a particular side are killed
but what im trying to do is create a system that leads to mission failure in the event the player's side kills too many civilians, and likewise play an audio notice across the entire world every time a civilian is killed
I currently have a system in place that counts the number of dead civilians and plays an audio notice on the local client that indicates a civilian is dead, but that doesnt differentiate between a civilian that dies by falling off a mountain versus the player's OPFOR faction that actively kills a civilian intentionally.
this is what i currently have in every CIVFOR's init field to count the number of civilians killed by OPFOR and play an audio notice
this addEventHandler["Killed",{deadCivCount = deadCivCount+1; playSound "CivilianKilled"}];
this is what was suggested to me by a colleague, but it's not working...
this addEventHandler ["MPKilled",{if (side (this select 1) == OPFOR) then [deadCivCount = deadCivCount+1; playSound "CivilianKilled"]}];
anyone able to steer me in the right direction?
https://forums.bohemia.net/forums/topic/202715-who-killed-the-civilians/
I did find this however, but I'm not looking to reveal who actually made the kill
use that script, but remove the line with hintSilent format["...
alrighty
@astral dawn
How are script handles generated?
They are just the memory address of where the script instance is.
How many of them are there?
on 64bit arma on windows 10 home with 128GB of memory there are... 2.21428571*10^9 possible script handles.
Or if we assume there is some padding. 1,937,500,000 possible handles.
Are they recycled?
uh.. somewhat, but more by accident than deliberately.
I am slightly concerned about this idea of yours now @astral dawn ๐
Just curious.. With regards to the addWeaponTurret thing where an imaginary gun is added to a particular seat such as the driver or pilot ones, how can I reposition the "turret" to be in front of a real gun attached to the vehicle?
I know its not that necessary, but I'd love to have a few grenade launchers on the wings of a small prop aircraft instead of one being fired from the center lol
@bronze lotus it is I believe linked to a memory point in the 3D model itself, so you cannot do much script-wise
you could teleport the fired bullet with an EH though
Ah I see @winter rose, but how do I use the EH?
I never heard of an EH, that could work haha
It will be fine @winter rose , worst case is that it will crash the game after several days of running
Ah I see, event handler. Is there a way to detect the 30mm grenade with an event handler if that's what you mean @winter rose?
Yeah I saw taht @ebon citrus, but I want to know how to select the round also.
*that.
_this select 6 should be your ticket
or if you use params ["_unit", "_weapon", "_muzzle", "_mode", "_ammo", "_magazine", "_projectile", "_gunner"];
then it's the _projectile
Ah fair enough, and is there a script which teleports objects?
setpos
So I can teleport that, thanks for helping me also.
Ah cool, thanks and will it reset the projectile's ballistics or leave them?
setvelocity
Sorry, I'm quite new to scripting lol
But will do if it somehow resets the ballistics.
no worries
Ah cool.
im not tipsy today
Fair enough lol
Yeah true.
However, do I use the event script on the vehicle with the turret commands or the player?
Yeah no problem.
you can get the vehicle with vehicle player
But yeah, I'm basically making a Caesar prop aircraft have a few AGS grenade launchers lol
yep
FiredMan can be attached to the player directly
and will return the projectile fired
i am noit entirely sure about the locality of these event handlers
Yeah true, I saw that and what you mean by locality?
whether it fires on remote or has to be local where the object is local
it's about multiplayer stuff
if youre not planning on using this in multiplayer, it doesnt matter
Although I likely will, I'll see how it goes haha
But yeah, the amount of stuff I can do in Arma's amazing xD
yeah
well about a after a month's work, you should have a grasp on the general limitations
although rather open, it is nearly not perfecty and all powerful
Oh of course, I know scripting is still limited but its pretty interesting still lol
certainly
and with being open, it ofcourse brings its own bunch of security issues
might want to read this, if youre thinking of doing multiplayer scripts: https://community.bistudio.com/wiki/Arma_3_Remote_Execution#Security
Fair enough and all good, I'll take a look. Although I'll likely use this just for a Zeus Insurgency server but its okay.
if it's a private milsim group or something like that, you can jsut turn off battleye and be done with it all
Its public but all good.
With regards to the "setpos" script, do I select the projectile by just using "_projectile" in the object section of the script @ebon citrus?
yes
as detailed in the Biki article: projectile: Object - Object of the projectile that was shot out
Ah all good, sorry about that. I weren't sure if it'd select all projectiles on the map or something lol
no worries
#define TRY_(args) \
[] call {
private _retArray = []; \
private _scriptHandle = [_retArray, args] spawn { \
params ["_retArray", _args]; \
_args params args;
private _retVal = [] call
#define CATCH_ ; \
_retArray set [0, _retVal]; \
}; \
waitUntil {count _retArray > 0 || scriptDone _scriptHandle}; \
if (count _retArray == 0) then
// It crashed mid-way somewhere
#define ENDTRY_ \
else { \
_retArray[0] \
} \
}
_val = TRY_(_a ARG _b ARG _c) {
_a + _b - _c
} CATCH_ {
3 // fallback value
} ENDTRY_;
I didn't test this yet, looking for someway to really catch exceptions (crash) in script in a recoverable manner. Is this it, or is there a better way?
Me and billw, we want to replace call in our framework with spawn and wait untill script done or has crashed
If the script depends on _this, then it won't work in there
why go to such effort and add such a overhead to all your stuff, if you could just do proper error checking in your scripts and have them just not crash
lol
Yes with SQF... without debugger or anything... (except for call stack dumps, but still crashes happen on users without ADE)
perhaps you didn't see how much script we have, "just don't make mistake" isn't real advice, if it was all software wouldn't have bugs
regardless i don't suggest using this on all stuff, but on high level places were we can make bugs in the script recoverable rather than catastrophic
So far main thread crashes most, so... it will be in main thread, and it does most amount of mission logic
are you trying to say you dont know how your script works?
arma 3 has a very crude debugger built into it, but have i ever had the need for anything better? no, not really
so i'm going to have to be with Dedmen here
your best bet is to just write sqf that doesnt crash in the first place.
arma 3 has a very crude debugger built into it
It doesn't. Debug console is not a debugger
perhaps you didn't see how much script we have
ACE also has lots of script, and they can manage
I don't think you are being constructive this time (with all respect to you programming skills)
your best bet is to just write sqf that doesnt crash in the first place.
without error handling or anything useful provided by arma itself, I might agree
@still forum in terms of "debugger" i meant the script error messages that pop up in runtime
It's close enough to a debugger in the way that it gives you a slight hint if what's going wrong... usually somewhat around the block. So i'd say it's a debugger. Not a very sophisticated one, but debugger regardless
And never did i mention the debug console. Way to construct a strawman right there ๐
Dedmen's callstack dump thing is closer to debugger than the default arma error msg
a error message is not a debugger
Like, 100x closer
a error message tells you after the fact: "Something went wrong"
a debugger tells you right there "Something is wrong right here right now, please look at this now"
Regarding ACE, they are doing different things, and they therefore can run that synchronously to the game (aka unscheduled)... asynchrony in our code gives some problems too
with some creative thinking you can do everything unscheduled.
Albeit for your oop game logic related stuff it would end in writing custom "scheduler" most likely ๐
But you have already written oop on top of functional language, so why not go deeper 
Albeit for your oop game logic related stuff it would end in writing custom "scheduler" most likely upside_down
Yes, adding more script, and more error possibility, removing asynchrony, reducing error possibility... IDK if gain will be positive or negative :(
Have you tested your mission on longer running sessions? In my experience after some time scheduler goes bonkers and everything executes so slow.
@still forum that's a syntax check. A debugger is usually operated when the code is running. Not before
The error message in arma is just a simple trap
A debugging feature
The execution of the script reached a point from which it cannot continue.
exactly
but there is no debugger operated while the code is running in arma
it just has a crashhandler, thats not a debugger
It is a debugging feature
The handling of crashes and displaying/logging them and their location is debugging
Important information, what, where, why
a crashlog is a feature that helps debugging yes, but its not a debugger, and not part of one either
It is not a debugger, but a debugger feature, indicating that there is a debugger behind the frames
indicating that there is a debugger behind the frames
but there is none
There is a debugger interface, but its disabled in release builds.
in release builds there is no debugger anywhere
ArmA doesnt offer built in features like memory browsing or breakpoints out of the box, but having the debugger indicate the important information of "what, where, why" is already an indication for a debugger
There is a debugger for scripts
There isn't.
Besides my externally added one, and the BI internal one
Btw the games name is Arma
Which one?
I've seen all 3 ways used
ARMA, Arma and ArmA
And we might want to stick to topic discussion
ArmA is Armed Assault, a game from 2006.
Arma 3 is Arma, which is not a abbreviation for Armed Assault anymore. Its Arma, a latin word.
Which one?
which debugger you mean?
Arma 3 offers tools suitable for debugging, right?
Any example? Don't know of any. Not sure what you mean
Like you can write logs with diag_log, but thats not a debugger.
Arma 3 had a debugger interface once, but the backend for that was still disabled, and that interface was removed when people missused it for cheating
My goal is to teleport 30mm grenade projectiles to the muzzle of an AGS-30 attached to a vehicle. Can anyone point out any issues with this script applied to the vehicle init?
Codeblocks, please
Oh sorry, how do I do that?
this enablePersonTurret [[-1], true];
this addWeaponTurret ["RHS_weap_Ags30", [-1]];
this addMagazineTurret ["RHS_mag_VOG30_30", [-1]];
this addMagazineTurret ["RHS_mag_VOG30_30", [-1]];
this addMagazineTurret ["RHS_mag_VOG30_30", [-1]];
this addMagazineTurret ["RHS_mag_VOG30_30", [-1]];
this addMagazineTurret ["RHS_mag_VOG30_30", [-1]];
this addMagazineTurret ["RHS_mag_VOG30_30", [-1]];
this addMagazineTurret ["RHS_mag_VOG30_30", [-1]];
this addMagazineTurret ["RHS_mag_VOG30_30", [-1]];
this addMagazineTurret ["RHS_mag_VOG30_30", [-1]];
this addMagazineTurret ["RHS_mag_VOG30_30", [-1]];
this addEventHandler ["Fired", {params ["_projectile" setpos ("_projectile" modelToWorld [1.5,0.27,0.75])]}];
So, anything wrong with this script for what my goal is?
Oh rip lol
So close the params command first
Then close the code
And then close the addEventHandler
Remember ; where necessary
Wait
This looks real weird
Let me get a syntax editor
All good.
your problem is msot likely
this enablePersonTurret [[-1], true];
this addWeaponTurret ["RHS_weap_Ags30", [-1]];
this addMagazineTurret ["RHS_mag_VOG30_30", [-1]];
this addMagazineTurret ["RHS_mag_VOG30_30", [-1]];
this addMagazineTurret ["RHS_mag_VOG30_30", [-1]];
this addMagazineTurret ["RHS_mag_VOG30_30", [-1]];
this addMagazineTurret ["RHS_mag_VOG30_30", [-1]];
this addMagazineTurret ["RHS_mag_VOG30_30", [-1]];
this addMagazineTurret ["RHS_mag_VOG30_30", [-1]];
this addMagazineTurret ["RHS_mag_VOG30_30", [-1]];
this addMagazineTurret ["RHS_mag_VOG30_30", [-1]];
this addMagazineTurret ["RHS_mag_VOG30_30", [-1]];
this addEventHandler ["Fired", {params ["_projectile" **HERE**
setpos ("_projectile" modelToWorld [1.5,0.27,0.75])]}];```
Yep, all good.
this enablePersonTurret [[-1], true];
this addWeaponTurret ["RHS_weap_Ags30", [-1]];
this addMagazineTurret ["RHS_mag_VOG30_30", [-1]];
this addMagazineTurret ["RHS_mag_VOG30_30", [-1]];
this addMagazineTurret ["RHS_mag_VOG30_30", [-1]];
this addMagazineTurret ["RHS_mag_VOG30_30", [-1]];
this addMagazineTurret ["RHS_mag_VOG30_30", [-1]];
this addMagazineTurret ["RHS_mag_VOG30_30", [-1]];
this addMagazineTurret ["RHS_mag_VOG30_30", [-1]];
this addMagazineTurret ["RHS_mag_VOG30_30", [-1]];
this addMagazineTurret ["RHS_mag_VOG30_30", [-1]];
this addMagazineTurret ["RHS_mag_VOG30_30", [-1]];
this addEventHandler ["Fired", {
params ["_unit", "_weapon", "_muzzle", "_mode", "_ammo", "_magazine", "_projectile", "_gunner"];
setpos ("_projectile" modelToWorld [1.5,0.27,0.75])
}];```
herre
Oh thanks haha, I was about to ask if a new line would work lol
"_projectile" can't modelToWorld from a string
you want _projectile the variable, not "_projectile" the string containing the name of the variable
also
also setPos is missing your left argument
your setPos command is incorrect
check the syntaxc on that
you haven't actually declared what youre moving
only the position
One of y'all able to just type out the line I need?
Oh okay.
Well, I'm trying to move the _projectile.
I assume
_projectile setpos (_projectile modelToWorld [1.5,0.27,0.75])
?
I'll try it.
OH, wait.. Are the brackets at the beginning supposed to be closed first?
Instead of the closest ones to the end?
I think its the other way around but I'm just making sure lol
not sure which you mean
params?
Actually.. How's this?
this addEventHandler ["Fired", {params ["_projectile"] setpos (_projectile setpos (_projectile modelToWorld [1.5,0.27,0.75]))}];
I tried to follow it, sorry.
Yeah, I'm not very good at this.
you want to define all of the parameters for params
the names you give them are just... names
but the order at which you define them is important
so you want to do them all
Oh, do I need all the other options aside from _projectile also?
Read the wiki pages for all the commands you are using, to find out how to use them
https://community.bistudio.com/wiki/params
params returns a boolean, you are giving a boolean as left side parameter to setPos.
Look at setPos wiki page
https://community.bistudio.com/wiki/setPos
setPos takes Object as left side argument, not boolean, giving it a boolean can't work
you want to define all of the parameters for params
no need if you don't need the others, and the order is correct (The order isn't correct tho)
params ["0", "1", "2", "3", "4", "5", "6", "7"];
And how would I select 6 which is for projectiles?
you can just use "" if you don't need them
if you want just one, you can use _projectile = (_this select 6)
OH okay, thanks.
I want to start that line again if that's okay?
Just so I can eliminate potential mistakes and I'll be back in a minute since I need some water.
params ["" /*0*/,"" /*1*/,"" /*2*/,"" /*3*/,"" /*4*/,"" /*5*/,"_projectile" /*6*/];
or
private _projectile = _this select 6;
Okay, now I'm back and no worries.
๐
we were all there one day
despite our backgrounds, everyone started from something and asked the same questions and made the same mistakes
Fair enough, I know what you mean.
Thanks for being understanding also.
But yeah @still forum, do I use the private line after the params box or in it?
And I think I put "" in the [] box before that right?
By code blocks where two seperate examples
it's "or"
two lines of code, completely seperate
so you use one or the other that dedmen provided
Yeah I know they are, I meant how to implement them in my code.
Since params is required.
Ah all good.
you use
params ["" /0/,"" /1/,"" /2/,"" /3/,"" /4/,"" /5/,"_projectile" /6/];
or
private _projectile = _this select 6;
the first line would be retrieving the parameters. You can do that by having the first line be params (as above) or _this select (as above)
I'll show what I mean guys.
after that, you do the next step in the next line
all good
You don't need to use params (the wiki page just shows that as example as its the most sensible thing to do)
sometimes, it's better to show, not tell
Oh never mind, so I can delete Params?
yep
you can use _this select 6 instead
holds the same information
Yeah all good.
if you need more than one parameter, or you control how many are passed, "params" is the best option
Ah okay.
But yeah; with regards to SetPos, do I only need a space seperating that and the select command?
;
setPos goes onto a new line
Ah all good.
a line ends with semicolon
Oh okay, will do.
and line feed for readability
Ah true, I admittedly don't do that enough xD
setPos goes onto a new line LIESSSSSSSSSSSSSSSS
Lol
Unreadable code is best code!
It's like you're going to force him to use proper spacing as well, I bet you're some python nerd
who needs obfuscation when even you cant read the code
/s
Python is good practise for readable code
But fair enough on a serious note lol
https://github.com/overfl0/Pythia just use this
wait, really XD
What's this? Lol
Lol
๐คฃ
I see its an extension but its all I know lmao
sqf scrubs wont be able to read my chad python
wait what! POOP! IT HAS SUPPORT FOR CYTHON!
Cyka blyat
Yeet
pip some socket in here
I'm confused lol
just pass it
However, do I use 6 or _projectile for the variable in the SetPos command? Lol
ok, you need ot understand what parameters are passed to the eventHandler
when it gets called
it receives 8 parameters
in order
as an "array"
Oh my bad, I forgot to read its article.
so you want to get the 7th value in that array
this is done in 2 ways, both of which dedmen already referenced well enough
but what you want to do, if youre using a parameter that is passed with the call multiple times
is to create another mroe readable variable for it
this is why private _projectile = _this select 6;
_projectile is easier to remember and read than _this select 6
both of them hold the same information
here we are defining the variable we want to use: private _projectile
Yeah I know, I just didn't feel it was necessary for me in this case.
and here we insert whatever is on the right side of the equation onto the left side:
= _this select 6;
you can...
but you shouldn't
youre going to get a bunch of angry cats and litter on you if you do
Now I'm back and fine, I'll make a variable for it xD
Surprisingly also.. I actually killed a cockroach with a shoe despite being really afraid of them lmao
I somehow even picked it up to throw out lol
*throw it out
It was off-subject, but that's why I was AFK for some time so yeah.. They're scary to me lol
@ebon citrus if you prefer C you might aswell use Intercept directly
i prefer C, but i also like the rapid development nature of python
@bronze lotus F-word violates the rules, please edit that out :u
Ah fair enough.
keeps the conversation on topic and mature
Although I tend to swear regardless of the situation, I understand how it could help.
@ebon citrus you know where I'm missing a semicolon?
this addEventHandler ["Fired", {_this select 6;
private _projectile = _this select 6;
_this private _projectile setpos (private _projectile modelToWorld [1.5,0.27,0.75])}];
I'm not sure because its included in the ends of these statements from what I can see.
here*
_this private _projectile setpos (private _projectile modelToWorld [1.5,0.27,0.75])
and nto a semicolon
remove _this private
_this is the current namespace
private means youre attempting to DEFINE a private variable within the current namespace
Oh okay, my bad.
but youve already befined the variable
so just scrap everything else and go for the variable already prepared
_projectile setpos (_projectile modelToWorld [1.5,0.27,0.75])
private _projectile = _this select 6;
_projectile setpos (_projectile modelToWorld [1.5,0.27,0.75])
That want you want yep?
I obviously kept the addEventHandler thing.
_this is the current namespace
its just a variable
that correct
_this within a called function is the variable passed when calling the function
my mistake
Goddamnit @still forum xD
But its okay, and thanks also y'all ๐ The teleportation works now ๐
Although its positioned a meter high, I can fix that easily and I appreciate the help.
Though, is it possible to duplicate the script I made into the same init as long as I change setPos coordinates and the variable?
how to change the selected waypoint for unit? also how to create a waypoint to be first so I don't have to remove the older ones?
That's okay, I don't mind in that regard but sorry I confused you lol
so in what youre asking, no
However, I'm not sure how to script that sorry @astral tendon.
you might aswell just duplicate the projectile to both sides
less hassle
or have it fire sequentially
left-right-left-right
I wouldn't mind doing it sequentially haha, although I was going to duplicate it but it'd use the same amount of ammunition it has.
alright
then jsut make a check
how i would do it
- pull how many rounds the weapon has left
- if the number of ammo devided by 2 floored is comparable to the number of ammo devided by 2, shoot left
if not, shoot right
Ah okay.
so
_ammoCount = (_unit ammo _muzzle);
if ((floor(_ammocount/2)) == (_ammocount/2)) then {
//shoot left
}else{
//shoot right
};```
something like that
didn't actually check the syntax, so use at your own risk
but in this case, if the ammo was 13, the results would be false, because 6 != 6.5
if it was 12, then it would be true, because 6==6
Ah all good, and I'll think about it.
But actually, I'll just put the grenade launcher on top of the plane since it looks better haha
or below
grenades fall fast
or rather
they have low muzzle velocity
there's a reason why missiles, weapons and such a like are hung UNDER the plane
also, remember to sync it with your propeller XD
or give it enough clearance
It weren't an issue for me actually haha, the AGS-30 seems to be zeroed at 25m and the muzzle is probably about half a foot higher than the top of the propellors lol
It was working earlier at least when I tested it with an AI gunner xd
just attachTo an automated 40mm onto the bottom fo it and call it a day
you can even remote control it from the passanger seat
I would've, but I love the idea of the pilot firing it too xD
fair enough
Yeah lol
Want to see a screenshot of the aircraft? Lol
I should also mention that its great for dive "bombing" haha
sure
mount it on the nose of the plane so you can use the gunner sight XD
I actually did that earlier LOL
Maybe I should xD
Although I couldn't aim through the optic anyway, it looked cool lol
i remember doing it once with the m2
you seen this guys.,.. Banned Inc. videos?
Look within my screenshots and you'll see a huge truck with so many guns on it hahahaha
And yeah I have, I kind of got inspiration from it lel
I even made my own battlebus APC xd
With concrete armour and two Dshkms inside :DDD
good ol' wasteland arma 2 days
I hadn't played much of that a while back, but I did for a bit.. It was quite interesting lol
But yeah, I love the military and political memes Banned.Inc uses.. Especially the UN memes xD
And the Slav ones actually lol
If game has debugger bu has interface disabled, why not have a separate build with interface enabled
They have profiling and performance builds already
And one more debug build I think?
Hey, I got a quick question about faction editing. How do I customize the subfaction-category Like "Men", "Tanks", "Planes", etc. in a custom faction. And assign the different vehicles/Loadouts to those? The Alive orbat Editor uses only the Basic class names.
And one more debug build I think?
You'd still need a UI for the debugging. And we are at the same state if not further with my debugger backend already
Started to doubt myself: does this if (!isServer) exitWith {}; on top of a script file make any other than the server (or player host) exit the file immediately?
That would be the point, yes
Obviously if it's inside a control structure it would just exit that structure
@forest ore ^
What is the issue there?
I was reading KK's info list (here https://community.bistudio.com/wiki/isServer) on different isXXXX and probably started to overthink the whole thing. For example we have if (!isServer) then { // run on all player clients incl. headless clients but not player host }; but yeah.. should probably have thought twice since that example is for if-then case
anyone who's good at scripting and eden mind talking with me for a few seconds. Trying to get something simple to work and banging my head against a wall.
If you have a question just ask. Asking for someone to help you personally with an unknown issue is not going to work.
Is there a way to add some position randomization or offsets within BIS_Fnc_spawnGroup if its calling from an array of differing squad sizes? It doesnt seem to have the placement radius randomizer built into createUnit.
I think it spawns the units according to their formation in the config, so if you want them to spawn in any other kind of formation you'll have to re-place them after they've spawned
that just answered my real problem. I'm feeding new units into the config that dont have formation data... THAT is why they are all coming in at 0,0,0 and 'fusing' until split apart via zeus. ๐
Well the command returns the group, so you could run some simple code to reposition them after they've come in
in the end, a tiny offset to each should do it
_group = [_position, east, 5] call BIS_fnc_spawnGroup; { _x setPos (_x getPos [random 10, random 360]); } forEach (units _group);
thanks! that'll drop right in ๐ much appreciated
my units defending the supply crate were spawning inside the crate ๐
@jagged trout so, what's your issue? If I may ask you to ask ๐
I'm trying to run two unitplay recordings with a set delay in between
and?
I figured it out. sorry, I was testing.
@echo yew
Diag_Log Format ["FPS: %1 | entities : %2 | vehicles : %3 || players : %4", Diag_Fps, (Count (entities [[], [], true, true])), (Count Vehicles), (Count AllPlayers)];```
If you need a loop with this:
[] Spawn {
While {True} Do {
Diag_Log Format ["FPS: %1 | entities : %2 | vehicles : %3 || players : %4", Diag_Fps, (Count (entities [[], [], true, true])), (Count Vehicles), (Count AllPlayers)];
UiSleep 120;
};
};
From a scripting perspective, how do I detect respawn points that are vehicles? This would include vehicles that have been made so by zeus mid mission. I imagine it'd be something like:
vehicle getVariable ["respawnPoint", false]```
but I don't know what that variable would be if so
As far as I know does a vehicle not "know" it's a respawn location.
You should be able to find all locations with
BIS_fnc_getRespawnPositions
And check if there are vehicles in there
thank you
thanks @exotic flax I was unaware of that function. I've just been using entities and the classname for respawn modules
it's actually used by the Respawn Modules, so that's how I found it ๐
@celest fossil if youre using the editor, you can set time and date in the top bar in "attributes" -> "environment"
When running MP (local or dedicated) I noticed that some waypoint statement codes (like _wp setWaypointStatements ["true","this remoteExecCall ['OT_fnc_addtogarrison',2]"];) hit twice. Is this a known problem, and how to deal with it? I made some brutal workaround by defining new variable for passed objects in script, to avoid launching it twice, but idk if is it a good way.
remoteExecCall 2?
What's wrong with it? I thouth it should run on the server only.
Have you checked the note on https://community.bistudio.com/wiki/setWaypointStatements ?
@unreal scroll
it should be sqf if (isServer) then { ... };
Quick question: How do I make it to where a helicopter spawns on the ground using BIS_fnc_spawnVehicle?
@winter rose Thank you.
@jaunty ravine I have a feeling that both BIS_fnc_spawnVehicle and BIS_fnc_spawnGroup have built in "features" which spawn the helicopter as "FLY", if you want to spawn it on the ground you'll have to do it yourself, ie:
_crewGroup = createVehicleCrew _vehicle;
Alright, thank you, I'm gonna try that now.
Works beautifully, thank you, @worn forge.
๐
Hey folks, anyone know off-hand if there's a command that lets you know the maximum # of players that can connect to the mission?
@worn forge maybe count playableUnits
Nope, just gives current # of players
oh wait, there is disableAI then. Well, @ruby breach to the rescue!
I'm good for something at least ๐
I was about to say to read the CfgHeaders' maxPlayers entry ๐
That's perfect, thanks.
hi guys! Fast question: is it possible to make high command module and headless client work together on a dedi server? So ai groups will be under control of headless client but players can control them via high command module still
Yes, iirc there are event handlers for high command units creation
could you please guide me where can I read about those EHs?
https://community.bistudio.com/wiki/ @warm blaze
Search top right: Arma 3 event handlers
is it at all possible to manipulate UAV camera through script commands?
What do you mean "manipulate"?
Turn the camera? Yes
Postprocessing? Not that im aware of
You can always apply PP to the unit when they are in the camera view and then remove it when they exit
I once did a grainy filter thingy for when the UAV is too far away
Sort of to simulate direct radio static
who knows how to realize the effect of color blindness of the playerโs camera?
it is widely used in training missions
A2 OA
rummaged through all source codes, found nothing worthwhile
If you just need a simple black & white.
Thanks, I try it
can you make something execute in main menu via cfgFunctions?
or just preInit for missions
preStart = 1; //1 to call the function upon game start, before title screen, but after all addons are loaded (config.cpp only)
does this also work with
-skipintro
-world=empty
-noLand
?
preStart always runs
That is pre-main menu tho, if you want main menu directly... I guess you'd have to replace one of the Vanilla CfgFunctions which you know is called in main menu.
so also for directly loading to editor mission or autotest?
yes, preStart always fires
no, its just parsed/processed in initFunctions, which doesn't execute code it just parses the file paths and compiles them, and takes care of preStart/preInit/postInit
although, you can execute code in a number config entry in CfgFunctions.. but... why would you
@velvet merlin onLoad in the config of the menu/display*
Not sure if i need to ask this here cuz itz config (remoteexec) related but im having a slight problem with a few functions that need to be executed from the client to my server.
Multiple entries on the cfgremoteexec seem to work untill i add a few new ones. Those don't get executed on the server and ive got a error in the rpt saying its not allowed to execute that. Even tho its added to the CfgRemoteExec Functions config, target = 2.
Now that im reading up on the wiki for the first time on it, it mentions that some functions may need to be white listed ? If so, how would one go and whitelist it? ๐
{ class Commands
{ mode = 1;
class hintC {allowedTargets = 0;};
class deleteGroup {allowedTargets = 2;};
};
class Functions
{ mode = 1;
class BIS_fnc_execVM {};
};
};```
I think mode = 1 means it's whitelisted
Well, ```
Operation modes
Operation mode is numeric value describing how functions or commands should be treated on server on client.
0: remote execution is blocked
1: only whitelisted functions/commands are allowed for remote execution
2: remote execution fully opened
i got it like
class CfgRemoteExec
{
class Functions
{
mode = 1;
jip = 0;
class fnc_AdminReq { allowedTargets=2; }; // infiSTAR AntiHack
class fn_xm8apps_server { allowedTargets=2; }; // infiSTAR xm8apps
class ExileServer_system_network_dispatchIncomingMessage { allowedTargets=2; }; // ExileMod
class plant_message { allowedTargets=1; };
class plant_remove { allowedTargets=1; };
class plants_fnc_plants_create { allowedTargets=2; };
class plants_fnc_plants_remove { allowedTargets=2; };
};
class Commands
{
mode=1;
jip=0;
class addAction { allowedTargets = 1; };
};
};
But im still getting:
๐
hmmm
This is so weird, i made other stuff with it on a different server but these 2 last functions dont seem to wanna be fired
So your situation is a player runs a command with plants_fnc_plants_create and nothing happens, that error shows up in rpt
Maybe remove jip = 0
That's the only thing that's different from my use
Yeeh but how come the other functions that need to be executed on the server with target 2 do work?
That's what's puzzling me
How are those functions created? With a hpp file? Because that might rename them
run copyToClipboard str (allVariables missionNameSpace) and see if you find plants_fnc_plants_create
For someone entirely new to arma, how hard would making a script to detect explosives in a backpack (both grenades and other) and to explode when shot/damaged?
@true hull anything else to add?
don't react, peeps. Let Darwinism (and mods) do their job.
I'll take this constructive criticism as a warning against attempting such a project as an introduction and start a smaller project as an introduction into scripting.
it would be quite difficult, for a beginner.
@ebon palm you can do it with a couple of commands yes; has iirc, and the type of explosives you want to check
!purgeban 622116952420122655 30d spammer
*fires them railguns at @true hull* ร_ร
๐
and also if you want to detect hit on the backpack that gets more tricky
But what about checking damage while both on the player and dropped
dropped?
getting slow with age @still forum ๐
Yeah
don't ping me while I'm busy :U
Filling the bag with grenades and using it as a redneck satchel charge
oh you didn't mean a soldier-held backpack, but one on the floor - my bad
well scripted yes, but in specific conditions then - and not an all-situations script
Both
probably easier but also not sure if groundholders take damage at all
You could still put a "Hit" eventHandler on it
does it register hits
so basically an custom user action that is active if bag is full of grenades and places them down along with fake target that has the hit logic added to it
cant remember if theres inventory events for dropping stuff
that would be more universal place to tie it to but also more complex
OpenInventory eventhander @young current
You might also look into https://community.bistudio.com/wiki/Arma_3:_Event_Handlers#InventoryClosed
More useful in your case
both probably would need to be used to compare if a backpack has been dropped and if it had grenades in it
Nope
Only inventory closed
Tricky thing would be to make sure the bag inventory isnt opened twice
So you could just make the wepaonHolder non-interactable
@ebon palm so yeah, no, not easy ๐
Tbh, i would personally use addAction to create an explosive bag on the ground
I dont see how that works for players inventory and if you drop a bag
Ofcourse you dont
The _container in the example returns the container you just closed
perhaps you oh superior mind will elaborate then
So if you drop a bag, the container will be the groundweaponholder
Check that container for the items and their conditions you want
If true, turn it into an explosive bag
Ofcourse you dont
Uncalled for? ๐ @ebon citrus
And create all the necessary groundwork for it, like detecting hits, and so on
TBH, it's more hassle than it's worth doing it this way, and instead you could make it so that a player just turns their bag into a satchel charge through addAction or ace interactive menu
And that stachel is immediately placed on the ground
Using vanilla-assets to create a hit-detection for groundWeaponHolders is tricky and not all that rewarding
Instead of shooting it, you could consider a timer, which would make it more simple
Or bomb-touchoff style mechanic
@worn forge That between quotes should be the completely renamed function after creating them within a config.cpp but ill run a check anyways, thanks for the usefull snippit ๐
Shooting it to blow it up is probably the main goal though. Like in the movies.
Hate to be a stickler for reality but I'm not sure shooting explosives would actually set them off
Well, it's something you can experiment with
A good one for a first project
Gets you thinking
So, after some testing.
The killed eventhandler fire twice if I binarise my config. If I keep it cpp the "fix" for it firing twice makes it fire 0 times. Thx arma lol
https://community.bistudio.com/wiki/Arma_3:_Event_Handlers#InventoryClosed is probably your best bet on detecting if a backpack is dropped through the normal inventory interaction. This does not detect swapping bags though
Your other option is to start messing with the GUI, and i wouldn't call that at all beginner friendly
@tough abyss probably more a #arma3_config issue but sounds like you might have 2 killed eventhandlers stacking up
And i'd personally say
Your first project should'nt really be anything that specificly works
But more so experimenting with the environment and the tools at your disposal
@young current I only tested this once but I was running 99% vanilla arma 3 with CBA (only other mod) and made a simple mod that adds a cba eh on killed. When I binarise my test mod it fires twice. When I keep it cpp it fires once. Weird..
how are you binarizing your addon?
and probably best to continue on #arma3_config
no
No I deleted the cpp
Hey folks I have some questions about unitcapture that I can't seem to find answer to online
I'm trying to make a test/practice mission and I'd like programmed transport helis to fly to a city, land, and leave again
Is there a way to make the helis respawn with unitplay enabled?
Also, is there a way to loop the unitplay if they are still flying after the leave the city?
Does it have to be unitplay? Waypoints are not enough?
And yes, unitplay is enabled by default on units, if i recall correctly. Just spawn the unitplay function
You can loop the unitplay by teleporting the unit to the start position and restarting the unitplay function with the same parameters
Well I've noticed that the AI pilots flying waypoints are usually dunces that don't come close to even a mediocre player's skills
Would it be possible for you to explain the spawn unitplay thing a bit more? I use the radio commands to activate them at the moment but how do I make it start by default?
I put it in the init field of the heli but it didnt do anything
Also, what should I do to get the thing to respawn?
delete heli, spawn heli where you want it, unitplay again?
Apologies for being ultra noob but - I tried to spawn it with a radio trigger that does [[23181, 18686, 53], 180, "B_Heli_Light_01_armed_F", west] call bis_fnc_spawnvehicle; but it say invalid num in expression or something
How should I go about spawning a heli then doing unitplay on it? I looked for it online but again, nothing that helps
(I know it's shitty to ask for code but could you just provide a basic example that I can tinker with? I'm pretty damn clueless atm)
Honestly I think unitPlay isn't a simple place to start, why do you want to use that specifically?
If you make your waypoints with the CARELESS behaviour then they won't care if they're being shot at
@worn forge I'm making a practice mission for pretty high-level gunning intended for an environment like KOTH, with super speedy landings and such
I've tested using waypoints but they just set down slowly, in a straight line to LZ
I can manually fly pretty well so I think it's best to work with unitplay despite its difficulty
Well at the very least you'll need a variable that defines your spawned unit, so
_vehicle = [[23181, 18686, 53], 180, "B_Heli_Light_01_armed_F", west] call bis_fnc_spawnvehicle;
Then you can do something with BIS_fnc_UnitCapture
I got the recording and playback part down by yt tutorials but, how do I make it respawn after it dies and how do I reset them?
Like
[_vehicle, duration, FPS, firing, startTime] spawn BIS_fnc_UnitCapture, according to the wiki, but I've never used it so you're on your own
I can make the path files no problem at this point - its just about actually using the paths
Respawning after it dies would be pretty easy, just put a Killed eventhandler
so like this addeventhandler killed... then what?
When it dies, it'll spawn again
so I don't need _vehicle if it put it in the init field? because it says local in global space
no local var in global space indeed
ideally nothing in the init field either, unless for testing / you know what you are doing
oh hey it respawned!
But I can't do unitplay on it again apparently
I cant attach images but theres a little box that says
'rec = [] |#|spawn wp1;'
Error spawn: Type array, expected code
yeah its a sqf file of the path and [heli1, wp1] spawn BIS_fnc_Unitplay;
uh what does spawning code mean?
I'm gonna try putting it in curly brackets then lol
oh now it doesn't play in the first place rip
oh wait nvm i'm dumb
wait, you don't know what you are doing
I do not know what I am doing
as I said above I'm pure idiot when it comes to this stuff
Please do I can't find much about this online that would help a lot lol
so: what is it exactly that you want to do:
force a helicopter to drive the path you drove, and if it explodes/dies/whatever, respawn and do it again?
Yeah the idea thing is - radio trigger to spawn heli that flys my path which will respawn and do it again if it dies, and if it goes through the whole path it'll delete itself
if that makes sense
yep, got it
And right now I only got manual playback to work
But thatโs it
How should I approach this?
on Event "Killed", delete the helicopter, create a new one and turn its engine on, make this chopper call unitPlay
on "unitPlay" completion, just delete the helicopter
So I would make two event handlers? Where should I do that if init field is not a good place
sqf script file?
init.sqf is a file that will always be called on mission start. in MP, it will be called on every - single - machine though.
Ohh so donโt want that if I will be hosting this for mp
Good to know good to know
you can want that, but with some safeties
What do you mean
like ```sqf
if (isServer) then {
/* something */
};
this โ๏ธ is assured to run only once, on server on mission start
Oh excellent, that makes sense
so the file will still be executed for every machine, but only the server will access this portion of code.
if you want to dedicate an init file only for the server, initServer.sqf is the one - no client will ever execute it.
Also uh I plan to make like 3 to 5 helis, is there a way to do this without copying code a bunch
Thanks! Iโll read through them right now
Holy smokes thereโs a ton of init sqf things
yes, but you hopefully don't have to use them all ๐
Wow the different event scripts are really cool I just got some ideas I should look into in the future
Right lol
just pick the one that fits your usage and build from it
And uh about the multiple helis
Do you know if thereโs a way to make it simpler than copying the code a bunch of times?
it is doable, but you have to have multiple unitPlay data nonetheless
(unless this is the exact same route you want?)
Oh no Iโll be doing different paths, so I guess I could just copy and paste with different variable names
Thank you so so much btw Iโll try to do this in about 40 minutes when I get home
have fun, keep us posted
Will do, thanks again.
bohemia forums down for just me?
nope, happened right now
dang this thing is fragile these days. is it the temperature or what ๐
gibs help
bad gateway
Community down? Check whether Community.bistudio.com server is down right now or having outage problems for everyone or just for you.
@wary lichen NO CROSSPOSTING #rules ๐
just use google's cache
rip when I want to get started on the thing wiki is down
big oof
so @winter rose how do I attach an event handler that's in an sqf file to a heli?
if I put this in the init field it seems to work but I know you said it's not good to use init
this addEventHandler ["Killed", {
params ["_unit", "_killer", "_instigator", "_useEffects"];
deleteVehicle _unit;
}];
There's nothing "wrong" with using the init field
If you say so
also
this gives me an error with expected object not array
this addEventHandler ["Killed", {
params ["_unit", "_killer", "_instigator", "_useEffects"];
deleteVehicle _unit;
_helithing = [[1000, 1000, 1000], 180, "B_Heli_Light_01_armed_F", WEST] call bis_fnc_spawnvehicle;
[_helithing, wp1] spawn BIS_fnc_Unitplay;
}];
when i blow it up of course
and it does get successfully deleted
Because BIS_fnc_spawnVehicle returns an array, not an object
Returns - Array format [createdVehicle, crew, group]
So technically you needed to have as your last line
[(_helithing select 0), wp1] spawn BIS_fnc_Unitplay;
I assume you have created a waypoint called wp1
Rather, you have some data called wp1 which is related to unitplay
oh shoot thank you I see now
and yeah wp1 should work, in theory
thank you very much
omg omg omg it's working
but uh, since I put the thing in the init field it doesnt respawn the second time after I kill the heli that got spawned in by the first one
is there a way to like, transfer the contents of the init field?
There's nothing "wrong" with using the init field
There is in certain cases, see https://community.bistudio.com/wiki/Multiplayer_Scripting @worn forge
wait... now I understand what's causing an annoying bug
I set up inf. ammo helis that have stuff in their init field
and sometimes only I can use the inf ammo feature...
that must be why
also uh @winter rose how do I give the heli that just got spawned in the same event handler? and how do I add the contents of a separate wp1.sqf file as an array?
grab the reference of the new helicopter, and add Event Handler to it ๐
wait yeah but once the new one gets destroyed it doesn't add another event handler anymore
give me 5s
this is what I have so far... it's in the init field sorry
this addEventHandler ["Killed", {
params ["_unit", "_killer", "_instigator", "_useEffects"];
deleteVehicle _unit;
_helithing = [[1000, 1000, 1000], 180, "B_Heli_Light_01_armed_F", WEST] call bis_fnc_spawnvehicle;
private _wpdata = [A BIG BUNCH OF NUMBERS aka THE WHOLE PATH FOR UNITPLAY]
[(_helithing select 0), _wpdata] spawn BIS_fnc_Unitplay;
}];
ouch
It sucks I know :(
Don't worry we'll get it fine :)
It's only wrong if you don't know what you're doing ๐
It doesn't "suck", you are learning / approaching - and so far you made it progress
so it's a proof of concept
woo go me \o/
except I can't help but notice how little I know regarding this
also like - I guess it's fine if it doesn't respawn itself
so maybe a radio command just spawns a wave of helis
...do you think that would be easier to implement
Can you give me a hand?
My campaign broke
define broke
uh I don't really understand what you mean
this is a custom mission that you're making?
okay what am I doing I should let someone else take care of this lol
oh I mean... why are you planting explosives
sounds like that's like an intentional thing
where you cant harm friendlies or civies or something
@fallow hawk wrong channel, i assume
yep
This is for creating scripts, not troubleshooting the campaign
@winter rose
so maybe a radio command just spawns a wave of helis
...do you think that would be easier to implement
and how would one go about doing that?
How do I add a virtual garage to my mission?
@faint fossil ping me tomorrow if you can, I will take a look at that. I have to go for now ๐
Hi .. I am trying to get some AI to board my heli in multiplayer ... of course the SP version (below) does not work. Could anyone suggest how I can make this work in MP
_myHeli = (vehicle player);
_HELI1ATL1 = (getPosATL _myHeli) select 2; // this checks heli altitude
_meters = _myHeli distance [15141, 17176]; // this checks how far away the player's heli is from the main pickup point
// if player's heli is on the ground and near the pickup zone, units will auto-board
if ((_HELI1ATL1) < 1) then {
if ((_meters) <50) then {
{ _x assignAsCargo _myHeli; [_x] orderGetIn true; } forEach units deployedGroup;
// state transition
readyToBoardState = false;
readyToDisembarkState = true;
};
};
run this from the server, and instead of vehicle player use a named vehicle variable @rough dagger
hey man .. thank you
I was using a named vehicle before, but I wanted to give the players more choice of heli
the named asset works great ... should I only use named assets in this situation?
if you got to go, no worries ๐
ideally yes, because referring to player can be very random, depending if the script runs on the player-server, dedicated server, client etc
thank you Lou
would there be a way to determine the vehicle name of a heli when a player enters?
that way i could ID the particular heli in play, and script accordingly from there
you could do vehicle thisSpecificPlayer , but then you have to know which player has a vehicle. I suppose you have other criteria
๐ that is a good steer Lou, thank you ... I will see where this lead takes me ... nice one
is there a way to execute (via cfgFunctions) a script in the root of the addon folder without specifying the prefix?
file = "myFile.sqf";
looks for game root/scripts folder
is the only way to have a define+include to set it in a separate file?
?
Like executing a file outside of the addons/Arma folder, wich is not in any .pbo?
nope
you have to specify where the sqf to be executed is located, otherwise the game looks at game root or scripts folder as said
however if you dont want to hardcode the path, its usually done by definition in separate file via define/macro+include
for missions there is a way for dynamic path determination
i am asking if there is also such thing for a addon
CBA
class preStart {
preStart = 1;
file = PATHTOF(fnc_preStart.sqf);
};```
nope
as said this is the define/macro+include way
i am looking for a native sqf/preproc way
as linked
file = "\PATH\file.sqf";
PATH = not hardcoded, but determined dynamically/on runtime
most likely its not possible
but same was thought with mission root and people found ways
But why? The addon is packed anyway, when it calls to compile cfgFunction for example
same reason as CBA/ACE does it - to not hardcode the PATH, but define it separately/not define it
in a mission you also just want to execute [] execvM "dummy.sqf" and not specify the path/name of the mission
If a path is just string, then surely you could concatenate the different parts of the dynamic path together right? Itโs not quite what you are after but I am wondering if a dynamic path could be built up in this way...
Sorry to chime in, but I saw something on JavaScript recently that did something similar...
FILE doesnt work for this. so it would be via some sqf command but seems not doable
@tough abyss can't read the error on mobile
It seems there is an error either in your usage or the scriptโฆ
what does the error say?
contact the author then
if you did as he said and it breaks, it's his
so it seems
might as well tell him first
@tough abyss giving you a little out-of-band warninig, please remove and refrain from the f-word and similar swearing words here
here #rules apply, in any case
you could try https://community.bistudio.com/wiki/BIS_fnc_UnitCapture. Also check see also. There are several functions
I see
I tested it with multiple units and it works
I used the example provided with the script
just created a second unit and executed it
no error
they both run and do stuff
I keep that
[unitvar] spawn "play.sqf";
Where are you executing that? From within Eden Editor?
hmm
I only get the error you describe when I execute the script from within Eden
In preview it works fine for 3 units
You sure the unit variable names are correct? No typo?
Weird
Glad it works now @tough abyss
Hello people, does anyone have any insight if it would be possible to use the Eden editor eventhandler 'OnToggleMapTextures' as a normal eventhandler during a mission?
@velvet merlin
without specifying the prefix?
no.
CBA/ACE:
as linked
file = "\PATH\file.sqf";
PATH = not hardcoded, but determined dynamically/on runtime
No, actually its hardcoded, the macro is resolved when the config is binarized.
guys. How do I determine how many items I can put in my backpack?
@fleet hazel each item has has their own "size". If you know the item size, then use
https://community.bistudio.com/wiki/loadBackpack
If you dont, but know the item, then use
https://community.bistudio.com/wiki/backpackSpaceFor
I hope that makes sense
If you want to get the backpack space in general without counting items in there, use
So you need to be a bit more specific on what exactly you want to do
There are still some outdated Config Entrys floating around (something like maxMagazinesCargo (or so) for Items and Weapons too), wich are not in use in A3! So the only way is to get the size of your backpack, get the weight (mass) of the magazine (getNumber from Cfg Entry for example) and do some simple math
BackpackSpaceFor maybe?
@ebon citrus loadVest player shows me = 40
getContainerMaxLoad vest player = 140
Vest is a vest
Backpack is a backpack
Those 2 commands return different valies
Read their description
Always read the description and notes for scripts you use, dont be like me ๐
Ok ๐
