#arma3_scripting
1 messages · Page 454 of 1
Since the 3rd element is false, the condition returns false, and is not counted.
Or I'm dumb
i tested it, it works.
I tested after i asked.
ah
Anyone familiar with call BIS_fnc_reviveOnState; ?
no, but I can be
« Used to execute specific code localy on every client whenever unit's state changes. » @tough abyss
Any way to make it work in MP? I'm trying to make something call it for a player other than the person using it.
there is reviveOnStateJIP, but IDK if it would work like that
reviveOnState:
Parameters:
_this select 0: STRING - Variable that carries the state value over the network, defined by macro VAR_TRANSFER_STATE.
_this select 1: SCALAR - State.
_this select 2: OBJECT - Unit to set the status for.
same for the JIP version
Hmm
if you want to execute the code on the machine, use remoteExecCall
["param0", param1, targetedUnit] remoteExecCall ["BIS_fnc_reviveOnState", targetedUnit];
Think it would work for what I'm doing? I'm having a vehicle execute the code on an injured player in the revive state.
no idea sorry.
I'll find out here in a bit, gotta find a second player or boot up two armas lol
Anyidea to know what unit the AI is aiming at? assignedTarget still returns when the AI have no visual on the unit and also when its dead.
what for?
You still around @winter rose ?
Soon™ not, but shoot
those param0 and param1 of the remoteexeccall you posted, that would be the parameters I had before right? And where did you find the info for the reviveonstate?
I can't find much on it
googled it
trying to find a solution to revive people the same way holding enter does using the vanilla revive
it was in a snippet someone posted and it did what i needed lol but beyond that i havne't seen a wiki page
But it's cucking me, I can't figure out how to make a drone revive someone lol
setUnconscious false?
I tried that but it didn't seem to work
BIS_fnc_reviveOnState was the closest thing to work so far, it acts as if a player sat and revived you
I just can't figure out how to make it run off a vehicle.
not sure I understand what you are trying to achieve
aaa?
You have a clue about the BIS_fnc_reviveOnState ?
Never seen it, neber heard of it.
😦
What the hell is targetAge?
Also, assignedTarget does not work with UAV units, its returns <NULL-object> even though he is aiming at a enemy unit but have orders to hold fire.
how I can retrieve a variable name from a outer scope?
like, executing [obj1spawnready] execvm "spawn.sqf"
and inside spawn.sqf have a _activation = _this select 0 but retrieving the variable name rather than if it's true or false
Pass them as argument. Variables carry over into child scopes. Your problem is it being a different script instance.
what im trying to is to have a while inside the execvm to see if obj1spawnready became true
at some point of the mission
but without knowing the exact name of obj1spawnready beforehand, it could be any variable name
i need to use format or something? getvariable from missionnamespace?
"obj1spawnready" spawn {
params ["_variable"];
waitUntil {missionNamespace getVariable _variable};
};
oh i see, will try it, thanks
it worked without issues, thanks
@wary vine There is already a wiki bot. But it's secrit
These places running 255 slots how do they really get away with it? Assuming there is some combination they are using in server.cfg
Like.. Just setting available slots to 255 is easy.. You just place that many playable units and you're golden
Ah wrong chat but I meant highly script intensive both on the client and server and without a lot of lag
run all scripts scheduled and your scripts won't lag out anything
The scripts themselves that is. If the scripts spawn hundreds of objects everywhere they will still lag stuff
Is there any way of getting the position of the shit + click map marker? I didn't find anything on the onMapSingleClick page nor it's listed in the allMapMarkers array.
I know I could just get the location from the _pos parameter
Someone asked that same recently. Can't remember seeing a answer
but you can move the marker later on
oh
well... I'll try to find some way around it 😛
I use this code: (nearestBuilding _position) allowDamage false; to protect building where the task object is placed . Nevertheless, the building is sometimes destroyed by tank, launcher, explosive charge or CAS. Is there stronger protection to keep the building alive?
Hit or HandleDamage eventhandler maybe
you mean, _object addEventHandler ["HandleDamage", {0}] something like that.. ?
where do you execute this? make sure
1/ it's the good building that is targeted (setDamage to 1 for example)
2/ that allowDamage is executed on the server
https://community.bistudio.com/wiki/allowDamage
allowDamage should work for buildings. There also may be a module to allowDamage, I'm not sure
Thx, allowDamage is executed on the server, just after the object for task is placed. no SetDamage 1 , the building is destroyed by player by mistake or unintentionally.
yes but I want you to try if this is the proper building; (nearestBuilding _position) allowDamage false; may target like a road sign or a shed, so be sure that it returns the building you really want first
well, according to BiKi Finds the nearest building to a given object or position. A "building" is defined as an object that is of class "House" and contains a path LOD.
But it's still good to be sure 👀
This command doesn't return any house or building placed in editor (with createVehicle). Use nearestObjects instead
Oh, I see. actually the '_position' is the location where the object is placed. _position comes from buildingPos .
combinedspawner = {
switch (_condition) do {
case "Uniform":{
_selected = lbData [2222, lbCurSel 2222];
_TomWalker_Player = player;
_TomWalker_Player addUniform _selected;
};
case "Vest": {
_selected = lbData [2222, lbCurSel 2222];
_TomWalker_Player = player;
_TomWalker_Player addVest _selected;
};
case "bag": {
_selected = lbData [2222, lbCurSel 2222];
_TomWalker_Player = player;
_TomWalker_Player addBackpack _selected;
};
case "head": {
_selected = lbData [2222, lbCurSel 2222];
_TomWalker_Player = player;
_TomWalker_Player addHeadgear _selected;
};
case "Item": {
_selected = lbData [2222, lbCurSel 2222];
_TomWalker_Player = player;
_TomWalker_Player linkItem _selected;
};
case "Glass": {
_selected = lbData [2222, lbCurSel 2222];
_TomWalker_Player = player;
_TomWalker_Player addGoggles _selected;
};
case "Vehicle": {
_selected = lbData [2222, lbCurSel 2222];
_TomWalker_Player = player;
_selected createVehicle position _TomWalker_Player;
};
case "Weapon":{
_selected = lbData [2222, lbCurSel 2222];
_TomWalker_Player = player;
_TomWalker_Player addWeaponGlobal _selected;
};
};
};``` i got this Switch function but how do i get it working like should i make it into a button or just call it when the meu is opened?
i got a RscList for each gear
@quasi rover
what? no
nearestBuilding _thePositionFromWhereYouLookAround;
_building buildingPos 1; // finds a pos inside a building
@molten folio unsure what you want really
@molten folio you should run that whenever you want to run that.
_TomWalker_Player = player;
_TomWalker_Player addWeaponGlobal _selected;
What is that? Why are you creating that useless variable?
and _selected is also always the same. That script could be 3x smaller
_selected is the selected thing in the RscList
It's always the same though. In each switch case
got one list for all Gear , Gear are switched by buttons
Why do you duplicate the same code everywhere
so i just put it at the top?
combinedspawner = {
private _selected = lbData [2222, lbCurSel 2222];
private _TomWalker_Player = player;
switch (_condition) do {
case "Uniform": { _TomWalker_Player addUniform _selected; };
case "Vest": { _TomWalker_Player addVest _selected; };
case "bag": { _TomWalker_Player addBackpack _selected; };
case "head": { _TomWalker_Player addHeadgear _selected; };
case "Item": { _TomWalker_Player linkItem _selected; };
case "Glass": { _TomWalker_Player addGoggles _selected; };
case "Vehicle": { _selected createVehicle position _TomWalker_Player; };
case "Weapon": { _TomWalker_Player addWeaponGlobal _selected; };
};
};
And I cannot tell you when you want to call that code. You have to know that yourself.
I didn't even do anything. I just told you to think for yourself :D
The script also works without my changes. It's just uglier
Anyone got a good SQF plugin for Visual Studios?
Not Visual Studio itself, but VS Code yes there are
Is there a way to make AI group leader give the "Take Cover" order? The one that player can give as a leader
https://community.bistudio.com/wiki/modelToWorldWorld That example... seems... 🤔
@mossy lion bad boi!
😨
There is no way to command AI to intentionally take cover. The only way of achieving this is to use setBehaviour to set "STEALTH". This is not accurately what you expect, but AI will stop running open, and will try to seek anything to hide behind, even non-absolute covers, like bushes.
@thorn saffron
also eh's Hit, FiredNear you can do so many things with them...
Hit and HandleDamage is fine, but when somebody is acutally hit. FiredNear has a limit of 56 meters AFAIK, so if somebody shoots around - nothing will happen
yeah FiredNear < limited distance
(using it for nades/smoke)
nothing will happens yeah with fired near... https://gyazo.com/20b129e1ec1bf2a6ceae9e5eb1fda607 , https://gyazo.com/9de3575532a2e87c472088cfe3aa17b7 😀
Well there is the "Take Cover" order you can give. It would be nice if you could trigger it via script
there is https://community.bistudio.com/wiki/getHideFrom
findCover is obsolette, setHideBehind not implemented anymore
What did i wrong @still forum
I dont know why and what i did there... 😅
@winter rose Well, that comands does absolutely nothing I want to do. All it does is report enemy position
That's the closest I could find, so far
Its completely unrelated to actually finding cover
It seems there is no way of actually making a unit find cover without writing the function yourself. There is no scripting command in A3 that does that. That's... sub-optimal.
oh right 👀
I don't know why but I kept in mind this command returned a possible hiding place from a menace -_- nevermind
BIS_fnc_findSafePos is mentioned in findCover
but no, useless.
BIS_fnc_findSafePos just finds a spot that is not obstructed, also unrelated
So yeah, a massive milsim game with no actual scripting command to make AI take cover. Just brilliant.
Are there any vanilla fsm scripts exposed for use with doFSM perhaps?
Why would you ask this?
For Taro's purpose.
Well, the nice thing is, that you can script everything yourself.
Arguyments are global
Does this mean that I can just add inventory closed on the server
And it will run if client closes his inventory?
A bit hard to believe, but
The eventhandler will only fire on the machine that added it, but AG means that it will fire for remote units.
oh maybe it's valid for an non-local AI opening its inventory… really not sure though
So a non local player should run ?
If machine A adds it to machine B's avatar, and B opens the inventory, the eventhandler will fire on A's machine. If the wiki is correct that is.
I think it won't. but maybe when the unit B becomes local it will trigger
Why do you think it won't? The wiki clearly says AG.
Are you saying you know that the wiki is wrong?
I say that I think it is not the behaviour the game will have
one has to try to be sure
GetIn etc. also are AG on the wiki, and they also fire for remote units.
If it didn't fire for remote units and behaved as you described, then that would be a bug.
Or at least an error on the wiki.
yeah, but I would be surprised such inventory GUI event would be broadcast
It should say AL then. Like killed or respawn.
It's not the gui opening though. That has no event unless you use CBA.
if it works, I will be happily surprised and gladly admit I am wrong 🙂
I may be wrong, actually.
You may also be right. I don't claim to know.
who has a server so we can try? 👀
Aint it more a case of on which machine the event handler gets assigned to a player/vehicle/object/ai?
I wrote everything already. No need to heat this up again.
You could still assign a event handler on a server to a ai/vehicle/player and that would get executed on the server only.
whatever ¯_(ツ)_/¯
And yeah, you're right.
It fires only on the machine that added the event, and it fires for remote units.
That's all.
You should rather heat up this ---> 🍕
I'll be eating baguette later.
Baguette is good as well.
Heating up lamb from the crock pot
eat my baguette, sacrebleu! 🇫🇷
As long as it's not garnished with 🐌 🐸 .
Seen that shit in a shop in france 🤢
oops
before im gonna start puking all over the place 😂
guts?
in China too, pork stomach
well nvm anytime we go food I'm #offtopic_arma 👀
DON'T mention frogs or snails to avoid such situation 😝
How compare is sqf to javascript?
SQF compares with == or isEqualTo
and javascript compares with == or ===
is it possible to count how many name in a RscList?
"name"?
lbSize ?
A control can only have one name. It's classname
it counts how many index's are in the listbox.
If you mean how many entries the list has then yeah https://community.bistudio.com/wiki/lbSize
Good idea to delete that. Was just getting ready to swing the hammer
XDDDD
// exemple playSound [soundName, isSpeech]
["s1_spottedcontact_1", true] remoteExec ["playSound"]; // dont play with isSpeech
["s1_spottedcontact_1"] remoteExec ["playSound"]; //plays
What is wrong?
STRING playSound BOOL doesn't exist
there is playSound STRING or playSound ARRAY I guess you want the array variant
I guess [["s1_spottedcontact_1", true]] remoteExec ["playSound"]; should work then
Yup. See this example on remoteExec page.
titleText ["Test Message", "PLAIN", 1];
[["Test Message", "PLAIN", 1]] remoteExec ["titleText"];
no one saw that....
Saw what?
nothing
I see everything.. I didn't see in this case but I can look it up!
Okey I saw it now and I'm disappointed.
ok am i wrong in saying
switch (true) do {
case (bool) :{};
}; ``` should work ?
Almost.
You have a : where a ; should be.
Thus: "almost".
Ok, so "Find Cover" order is something completely different from the Danger stance. In danger behaviour units will not look for actual cover if you just change the behaviour.
"Find Cover" makes units "Hide" something that even has its own UI description. This means that arma 3 does have all the proper code already in the engine. There is just no (known to me) script command that can trigger that "Hide" behaviour.
https://files.catbox.moe/fv42ev.webm does anyone know how to stop this and make it so people spawn in without needing to respawn the first time? After they get killed respawning sounds right
I have an idea.
// init.sqf
0 spawn {
private _respawnDelay = playerRespawnTime;
setPlayerRespawnTime 0;
sleep 1;
setPlayerRespawnTime _respawnDelay;
};
I put this in a txt in my document folder/
Do you know what init.sqf is?
also will helps
//--- description.ext
respawnOnStart = -1;
Yeah, that would be even better I think. Does this have a eden attribute?
// init.sqf
0 = 0 spawn {
private _respawnDelay = playerRespawnTime;
setPlayerRespawnTime 0;
sleep 1;
setPlayerRespawnTime _respawnDelay;
};
http://puu.sh/Ag36H.png I get this error
nothing in eden about it
private _display = findDisplay 12344321;
private _counter = _display displayCtrl 33334;
_counter ctrlSetStructuredText parseText format["<t size='1.2px'>Total Authroized Civilians</t>",(lbSize _list)];```
not working need help
plz
remove // init.sqf @civic oracle
Open your mission folder.
Create a file and name it
description.ext
And put
respawnOnStart = -1;
Inside
success! that worked thank you
sldt1ck said it first.
oh I was doing that in the init file not the documents sorry, thank you both.,
takes 🍪 x2
passes 🍪 to commy
What happened to the other one?
gulp
How would one go about moving all inventory contents from one container to another?
anyone got a link to all Rsc?
I have this: https://github.com/commy2/Arma-3-Scripted-Lobby/blob/master/missions/LOBBY.VR/ExportedGUIBaseClasses.hpp#L127
Otherwise the wiki.
ctrlCreate classnames https://community.bistudio.com/wiki/ctrlCreate/classnames
also this , outdated a bit, but it's better than nothing https://steamcommunity.com/sharedfiles/filedetails/?id=287378519
than*
thanks
👍 got your back
thenks 🤔
your whalecum
😐 💥 🔫 🤔
thx
💐 /(°_°✿)\
aww
☺
🐄 💨 🙊
so rude
💩
poor monkey 😔
👉🏼 👌🏼
no, thx
k :sad:
so many emoji
so how this is made? https://gyazo.com/865bb79354bf22c33117dbced8b7c801
probably by hands, also i think that was human... 🤔
ListNBox?
Maybe it's just a lot of controls.
Or controls groups.
Do whatever you like.
@molten folio This is made with controls groups in controls group with controls for each column, navigation bar is formed separetely according to scales.
aight
multiline structured text with huge whitespaces 🤔
@unborn ether hes a newbie, it would be easier for him to use listnbox, which is very similar in look
@wary vine Yes, but there are a lot of reasons why not listnbox
but for him, I think listnbox would be the way to go.
yeah, pretty much i think
Would anyone here be familiar with a way to script a means for AI to actively chase down players in an attempt to attack them in melee (example- bayonet charge) please tag me if you can help or know someone that can.
I modify a projectile's path slightly using setVectorDirAndUp and setVelocity. For the shooter it works and looks fine. But for remote players, the impacts are correct, but the tracers fire the original path from the barrel. So for remote client it looks like the weapon shoots at one point and hits a different place. How to avoid this problem?
There are 2 supply crates, far away each other and both have virtual arsenal in the mission. if I disabled load/save button on one supply crate like this:
[missionNamespace, "arsenalOpened", {
disableSerialization;
params ["_display"];
_display displayAddEventHandler ["keydown", "_this select 3"];
{(_display displayCtrl _x) ctrlShow false} forEach [44151, 44150, 44146, 44147, 44148, 44149, 44346];
}] call BIS_fnc_addScriptedEventHandler;
both supply crates also have the same loadout restriction. Is there an way one crate has loadout restiction and the other has not?
with that EH controls are not disabled, they just hidden, if you will press CTRL+R < random loadout or CTRL+L < load...
everything will work, to fix that you will need something like this
(_display displayCtrl _x) ctrlEnable false;
(_display displayCtrl _x) ctrlShow false;
``` at the same time ^
and for the different restrictions...
```sqf
[_objectA, _list_backpacksA, false, false] call BIS_fnc_addVirtualBackpackCargo;
_list_backpacksA < backpacks list for the _objectA...
also better option will be ace arsenal... if you are using ace mod @quasi rover
(cant tag if people are offline 🤔)
@meager heart Thx, and I mean, I want one crate has full open virtual arsenal like ["AmmoboxInit",[ammobox,true,{true}]] spawn BIS_fnc_arsenal, and the other crate has disabled-load/save button. but if I once disable load/save button and shortcut key on the other crate, the full open virtual arsenal crate also has disabled load/save button. that is not my intention. and not using ace mod, sorry.
Is there a way to create and call a custom dialog for the endMission? Like this https://i.ytimg.com/vi/eCE2cKMvdG4/maxresdefault.jpg but with custom design?
maybe you can just check distance, if player distance <box name>👌 then hide buttons else show, @quasi rover
Thx for giving me a tip. 😅
Hey,
I finished my bull dozer script
//put into init of a vehicle
this addEventHandler ["EpeContactStart", {
obj2 = (_this select 1);
if ( obj2 iskindOf "building") then
{
obj2 hideObjectGlobal true;
};
}];
Basically it'll just delete any building the vehicle drives into
I'm making a mission where IDF forces are clearing out the west bank, so I had to have bulldozers.
super simple, and fairly arcade, but might be fun for a change.
So I want to get coordinates of where player is aiming, and screenToWorld [0.5,0.5]; gets me very close, however if player is breathing heavy the crosshair obviously wont be at 0.5,0.5
Is there a way to reliably get where the actual crosshair/sight/scope is aiming?
Only intersections with the terrain or also objects like buildings and rocks and piers?
only terrain
Try this:
private _unit = player;
private _range = 1000;
private _dir = _unit weaponDirection currentWeapon _unit;
private _pos0 = AGLToASL positionCameraToWorld [0,0,0];
private _pos1 = _pos0 vectorAdd (_dir vectorMultiply _range);
lineIntersectsSurfaces [
_pos0,
_pos1,
cameraOn, objNull,
true, 1,
"NONE", "NONE"
] param [0, []] param [0, [0,0,0]] // return
requires the player to carry a weapon, reports [0,0,0] if no intersection.
Quick q here, are HC's contained in allPlayers ? I want to check if client is hc remote to the local client
Will this work with something like a grenade launcher where the muzzle doesnt point where the sight points?
Wait if the player uses a laser desg, could I just use position laserTarget
It will point whereever the primary muzzle points.
Or is that like cursorTarget where it needs to be aiming at an actual object
Drew, you're all over the place. Is he using a grenade launcher or a binocular?
The player is able to radio in for a precision strike
so I was thinking any weapon, but if laser desg is more accurate, I'd prefer that
I just didnt want a player to be aiming with a GL when they did it and have the strike hit in zimbabwe
Try what I wrote first.
Worst case I guess I just check the muzzle and if it's a GL, just default to screenToWorld
currentWeapon _unit
->
(weaponState _unit # 1)
With parenthesis. But not sure weapon direction does muzzles and not weapons only.
Problem with like GL's is if the sight is aimed at 0 degrees to the horizon, the weapon (and muzzle) may be aiming 45 degrees upwards
Did you read what I wrote?
So your first thing does work
with standard weapons
Haven't tried the 2nd thing though
What's it supposed to do?
Use the current muzzle instead of the primary muzzle of the current weapon.
currentMuzzle is just a broken command, therefore the slightly uglier weaponState.
Won't the GL muzzle be parallel with the primary muzzle?
No.
Muzzles are a type of weapon property. We're not comparing muzzle directions.
W: ET had you have to use the binculars to call in air strikes. Maybe that's what you want to do too, as it eliminates your secondary muzzles conundrum.
VANT?
^
That is UAV in spanish?
Hey commy, do you know about my question?
No, probably not possible if not advertised by the function.
Seens like it cant take Structured Text either.
Im spanish but dont knoww the name I mean Connect to a remote turret vía the VANT terminal but do it with script. I put a name on the turret (thing_1) and tried that command and nothing happened
returned false
So your UAV have a variable?
yes
player connectTerminalToUAV (sierra1 select 0)
This is how connect to my UAV, sierra1 is its variable
Stupid question but is the UAV an empty vehicle?
Its a camera
Is it yellow?
oh yeah, there is that
Ah. Um.
Did you make this?
If yes, check if the UAV has B_UAV_AI or something as crew
class StaticWeapon: LandVehicle
Could you show us the screenshot from the editor?
oh, and your UAV needs to be in the same side as yours
Okay then that should work 🤔
Nope
I dunno, it's a mod so there could be something else going wrong
Is the VANT terminal a vanilla thing?
you used my command I gived to you?
it returns false?
When I connect to the camera, i get tha action "Take control of VANT turret"
yes return false
WWhen I connect via VANT, it returns true
wait, then you are already connected?
Yes
so i think that is why, the command only connects you, not give the control
Bit i need to enter the turret
but
And how can I control
via script
I knoww its possible
but dont know how
nope
What do you mean "nope"?
Which one?
I used the 3 of them
player connectTerminalToUAV camara;
showUAVFeed false;
player action ["SwitchToUAVGunner", getConnectedUAV player];
player connectTerminalToUAV camara;
player action ["SwitchToUAVGunner", camara];
should do the same.
Are you playing vanilla Arma or with mods?
Mods
With CBA?
Yes
sec
// init.sqf
["cameraView", {
if (cameraOn == camera) then {
gunner cameraOn switchCamera "GUNNER";
};
}] call CBA_fnc_addPlayerEventHandler;
This into init.sqf
If it doesn't work, then try:
gunner cameraOn switchCamera "GUNNER";
->
cameraOn switchCamera "GUNNER";
Not sure if the gunner part is needed or breaks it.
well
but is that SP only?
now i se camera but moving player hahaha
?
Its not the gunner
cameraOn switchCamera "GUNNER";
this makes me to control the player but with the camera view (UAV view)
And
gunner cameraOn switchCamera "GUNNER";
?
So neither of them work?
🤔
I wwant to force it so the player can be only in first person while in the camera
I can do
gunner cameraOn switchCamera "GUNNER";
player connectTerminalToUAV camara;
player action ["SwitchToUAVGunner", camara];
So the player is in 1st person before entering the camera and it will be fine
just need to add a keyhandler to aviod changing to 3rd person
// init.sqf
["cameraView", {
if (cameraOn == camera) then {
gunner cameraOn switchCamera "GUNNER";
};
}] call CBA_fnc_addPlayerEventHandler;
That's what this ^ does though.
["cameraView", {
if (cameraOn == camera) then {
player switchCamera "GUNNER";
player action ["SwitchToUAVGunner", camara];
};
}] call CBA_fnc_addPlayerEventHandler;
This maybe?
That's a weird bug.
I actually had that bug back in Arma 2 were I was in my friend views and i was in my body, i even record that
Nice.
Cool.
Good luck, lol
so its all cameras not just 1
Sure, you can ajust it to your need.
The eventhandler fires whenever the cameraView changes.
Yes
Hey commy, use spawn inside of a schedule with while seens to break the schedule as we talked before
ikr?
no problem
I had a problem were my debug console stop working and when i try to use the config button more bugs happens
_unit = _this;
while {Alive _unit AND _unit getVariable "arest" == "free" AND CanKillHostage == 0} do {
if (!captive _unit AND _unit getVariable "arest" == "free" AND !(currentMuzzle _unit isEqualTo "") AND CanKillHostage == 0 AND isnil {_unit getVariable "Gased"}) then {
sleep 5;
if (!captive _unit AND _unit getVariable "arest" == "free" AND !(currentMuzzle _unit isEqualTo "") AND CanKillHostage == 0 AND isnil {_unit getVariable "Gased"}) then {CanKillHostage = 1};
};
sleep 1;
};
this was used with 10 units with spawn
that caused to brake the game
then i just move that to a script file and called with _unit execVM 'HostageSpoter.sqf';
and i did not have the same problem
before was _unit spawn {_that code}
And what happened?
Rip Arma 3
XD
though, what is the big deal with execVM and spawn? arent they the same thing?
player spawn {_unit = _this;
while {Alive _unit AND _unit getVariable ["arest", "free"] isEqualTo "free" AND CanKillHostage isEqualTo 0} do {
if (!captive _unit AND _unit getVariable ["arest", "free"] == "free" AND !(currentMuzzle _unit isEqualTo "") AND CanKillHostage == 0 AND isnil {_unit getVariable "Gased"}) then {
sleep 5;
if (!captive _unit AND _unit getVariable ["arest", "free"] == "free" AND !(currentMuzzle _unit isEqualTo "") AND CanKillHostage == 0 AND isnil {_unit getVariable "Gased"}) then {CanKillHostage = 1};
};
sleep 1;
};}
that is working for me
yup, now multiplay by 10 units using that
you execute on server or on player?
jesus christ.... the things I read here
I dont know IF AI can have loops themselfs
By the wway @little eagle Can i disconnect the player from The uav vía script too?
player connectTerminalToUAV objNull;
?
thats disconnect but im still inside the camera
getConnectedUAV player action ["BackFromUAV", player];
the showhud make something like it XD
Its weird
camera action ["BackFromUAV", player];
this make sit
it*
😉
thanks
👌🏼
@astral tendon execVM "filepath" is the same as spawn compile preprocessFileLineNumbers "filepath"
Though, why one breaked and the other not?
A fluke.
a question, we're having a discussion internally about where to use setSkill on a vehicle so that the accuracy of the gunner reduces
it seems setting it on the gunner AI doesn't have an effect unless the AI gets out of the vehicle
and setting this in the vehicle init seems to have unclear results, i remember getting it to work once, but there are claims that it doesn't work
Anyone have more concrete info?
removeAllItems;
addWeapon "SMG_01_Holo_F";
addMagazines ["30Rnd_45ACP_Mag_SMG_01_Tracer_Red", 8];
addUniform "U_O_CombatUniform_oucamo";
addBackpack "B_Carryall_oucamo";
addItemToBackpack "FirstAidKit";
addItem "NVGoggles";
addHeadGear "H_HelmetB";
};```
this addAction[localize""STR_Remove_Headgear"",life_fnc_headgear,"""",0,false,false,"""",' isNull objectParent player && player distance _target < 4 '];";
hmm... doesn't want to work
defined in functions.hpp and stringtable is correctly configured
however in-game nothing happens when middle mouse button is pressed
_units < units group vehicle
_units apply {
_x setskill ["aimingAccuracy", 0.25 + random 0.25];
};
works for me... @inner swallow
yes
yep, also after they will dismount/mount multiple times...
Hmm interesting.
Thanks. I have a suspicion that the commander's skill is what determines this stuff
vehicles are weird a bit, i'm always set it for vehicle group and seems ok... 🤷
(not for commander/gunner)
also you can check skill with skill
Could you guys help me out a little bit? I need a simple script for the console that would report my current animation name as well as "collisionShape" name for that animation.
anyone before worked with lnbAddRow
I tried placing an HMG-Offroad with only a gunner slotted, and used setSkill with aimingAccuracy of 0.0001 (and other values) on the gunner and the vehicle itself, but I didn't notice any difference in the actual aiming accuracy.
I could try with other vehicles and fully slotted vehicles as well though.
Using the diagnostics executable, I found that the AIDynamicError and AISuppression values are always 0 when mounted as gunner.
(above is part of the same discussion i was talking about, when i said we're having a discussion internally)
0 spawn {
private _veh = "B_G_Offroad_01_armed_F" createVehicle (player modelToWorld [0,20,0]);
createVehicleCrew _veh;
private _units = units group _veh;
hint str [
gunner _veh skillFinal "aimingAccuracy",
gunner _veh skillFinal "spotDistance",
gunner _veh skillFinal "spotTime"
];
sleep 5;
_units apply {
_x setskill ["aimingAccuracy", 1];
_x setskill ["spotDistance", 1];
_x setskill ["spotTime", 1];
};
hint str [
gunner _veh skillFinal "aimingAccuracy",
gunner _veh skillFinal "spotDistance",
gunner _veh skillFinal "spotTime"
];
};
```in to debug console ^ 😀
yes, skillFinal and skill show the correct skill. but the actual accuracy doesn't change, does it?
as in: the deadliness of the technical.
yeah, that's what i meant by
So their aim and stuff became worse?
Like, in practice?```
the values assigned change correctly
but we're trying to figure out if the skill of the turret is affected by the skill of the gunner
It certainly does in UAVs in our game, but we set the skill for all units not just the gunners so if it is determined by the driver/gunner/commander doesn't matter. But definitely use setSubSkill for the accuracy and any checks for the absolute skill in the end should be checked with finalSkill.
If you just want something sensible to happen just grab our CF_BAI mod and it'll set all your AI up with the skills listed in its config by subskill, it will also do the dynamic stuff we talked about in regards to foilage.
hmm thanks
I did some more testing (on the dev branch) and it seems that the skill has only very little effect on the gunner (while mounted). Offroad HMG gunners (with skill 0) will still headshot everyone with their first shot but their bursts are generally less accurate. With skill 1 usually most (if not all) bullets hit their target.
So I suppose the skill does have a slight influence on gunners, but they will always be basically snipers even with skill set to 0.
(When testing, I set the following subskills: 'aimingAccuracy', 'aimingShake', 'aimingSpeed', 'spotDistance', 'spotTime', 'commanding', 'general' )
There is skill and then there is skillFinal, which also takes into account the difficulty settings.
setSkill only influences the scripted / skill part of the whole.
I appreciate the help, but regarding skill and skillFinal:
the values assigned change correctly
but we're trying to figure out if the skill of the turret is affected by the skill of the gunner
The discussion is not about the values (you get from skill/skillFinal), it's about the actual deadliness and how accurate the bullets hit their targets.
Yeah, I'm just saying that you could also lower the skill in the difficulty settings.
skillFinal does seem to be affected by setSkill, but it has slightly different values (probably due to game difficulty settings).
skillFinal is affected by setSkill, it's just not the same number.
If you compare ai behavior, then you have to look at skillFinal. Otherwise you have this unknown influence of your difficulty settings.
The skillFinal values for the above mentioned testing were:
When setting it (all subskills) to 0:
['aimingAccuracy','aimingShake','aimingSpeed','spotDistance','spotTime','commanding','general'] apply {(gunner (vehicles#0)) skillFinal _x}
=>
[1.17549e-038,1.17549e-038,0.5,1.17549e-038,1.17549e-038,1.17549e-038,1.17549e-038]
which is basically [0,0,0,0,0,0,0]
`
when setting skill to 1:
['aimingAccuracy','aimingShake','aimingSpeed','spotDistance','spotTime','commanding','general'] apply {(gunner (vehicles#0)) skillFinal _x}
=>
[0.8,0.8,0.9,0.8,0.8,0.8,0.8]
My point is, there should be a whole lot more difference in the deadliness( / accuracy of bullets / number of bullets hitting the target object), between those two.
(So yes, there is this small unknown influence of your difficulty settings but it's not important for the point of this discussion.)
Can't go lower than 0. That's true.
So, in short, my point is:
No matter which value you set, they will always snipe down everyone with headshots.
This surely must be a bug, right?
Na.
?
This is Arma. You wait an hour and then die in a second.
lol
Wrong channel I'd say.
well, i suppose the original question was "does setSkill affect vehicles" so dunno
but there's no AI related channel is there?
My thing is, what can this channel do about this? It's for scripting related questions. It's not like there is an alternative command one could use.
Assuming one would agree that this is an issue with gunner-ai, which channel would be best suited to bring this up?
It used to affect the skill more but this is all part of the package of changes in regards to spotting distance etc that came out with Tac Ops DLC. We had to dramatically increase the distance from max and min skills and rebalanced all the firing modes as well.
One of those I have muted.
We usually talk about it in AI_modifications, although honestly everytime we talk about it the usual trolls come out and tell us it isn't a problem and we are just stupid and complaining so don't expect to discuss this and its impact unmolested
The best this channel could offer is a script to artificially add dispersion to the weapon.
We adjust the config for x/y dispersion and hence rebalance all the guns in the base game + RHS
Would be an interesting topic, because you'd have to do it on every machine, and to keep stuff synched, you could use the seed syntax of the random function.
So it is more a config fix than a scripting one at this point. That combined with cf_bai that sets the sub skills and adjusts as the game goes on based on various things.
But the range has come down on all the subskills. Spotting is the really obvious one as 0 is now 200m and maximum (as in skillFinal spotting) of 1.0 is 305m for infantry. But the same thing in regards to accuracy happened as well.
cba ai doesn't change any skills: https://github.com/CBATeam/CBA_A3/blob/master/addons/ai/config.cpp
Before tac ops for example in vanilla a base accuracy of 0.15 was low enough for the AI to miss you so much they could run through all their magazines at 20m. At 0.35 they would hit you in a shot or two. But now those numbers are utterly different but 0 is > 0.15 used to be so you can't make the game that easy anymore without a config setting.
I'm for scripted arificial dispersion tbh.
Sadly the seed syntax of random doesn't support gausian apparently.
So you may have to use the noise map, urg,
scripted arificial dispersion
you mean by changing the up/dir/velocity vectors of the bullets, or did you have something else in mind?
A configurable way to set dispersion using CBA settings based on classes of weapons and synced to all clients and such so it was consistent I think would be less maintenance than what we do with a weapons pbo that overrides the appropriate values in the various base classes.
Exactly that, Shado.
As I said, it's the best you can get from this channel about that.
That sounds like a cool idea, Bright.
This is the beginning of an example for what we do in our vanilla mod:
class CfgWeapons {
...
class LauncherCore : Default {
aiDispersionCoefX = 12;
aiDispersionCoefY = 12;
minRange = 20;
minRangeProbab = 0.7;
midRange = 250;
midRangeProbab = 0.5;
maxRange = 400;
maxRangeProbab = 0.15;
};
That script also was my initial idea to solve the gunner problem, but then I thought it must be a bug in setSkill for gunner-ai, or there must be some other way to set the gunner/turret skill. Apparently that's not the case.
So, I'd appreciate it if anyone wants to help with that dispersion script.
It's for vehicle mounted machine guns?
Anyone else run into an issue where dynamic groups only work for some players on a dedicated server?
Have entries like that for just about everything in the game and the key things are aiDispersionCoefX and Y for adjusting the actual skill.
yes, vehicle mounted machine guns (e.g. Offroad_01_armed_base_F)
The issue is we solve two problems with the mod, we solve the now broken skill values in the game but we also apply our balance for somewhat short range engagements since we don't use optics, so while the dispersion values and such are of value to others the range resetting problem isn't.
Candle, it would be way less restarting and testing if you could change the numbers while the game is running.
Well it isn't that bad actually because most of it is copy pasting values onto other weapons and in practice there are 20 or so unique combinations.
I thought 1tac also had a similar list in their mods as well.
I just want an excuse to do some more vector math for fun, lol
Vanilla? Or with mods. If that was directed at me: I'm looking for a vanilla solution.
Ok.
Apparently not with SK having the problem. But weapons mod is the reason why I haven't really complained about that aspect, because we fixed it long ago when apex released and rebalanced so that jungle combat wasn't completely insane and when it came back with tac ops we had already been running our settings anyway so we didn't notice the rebalance as much.
Spotting is my remaining issue as I haven't fully solved it yet, that one is hidden and more tricky but I will get there. But the weapons solution is relatively high maintenance and puts a lot of dependencies out on things like RHS and NiArms (although they are separate PBOs so we could release those as optionals or separately I guess).
Yeah I was talking vanilla too
@inner swallow grab @CF_BAI, @CF_weapons (will need ASR_AI, RHS all 4 pieces and NiArms but can remove PBOs) and that will at least get you as far as we got on the issue. We haven't done all the weapons but it is worth a test to see if the combo solves the issue you are having.
Spotting is my remaining issue
setUnitTraitcamouflageCoef(for the target) andsetskillspotDistance+setskillspotTime(for the shooter) > less spotting issues ? 🤔
how can I get a position by clicking on map using onMapSingleClick? I'm not sure how this method works
_pos
@tough abyss hmm that won't work for the mainland unfortunately, unless those can be run server side only
Config changes like this need to be everywhere unfortunately.
Afraid not sldt1ck the problem is more fundamental than just tweaking the values around the edges, as I said the maximum out of combat spotting the AI can have on a spotDistance of 1.0 is 305m. Even with a spotTime of 0 they respond immediately when you cross that line so spotTime has almost no practice impact at all. Even minimal caouflageCoef changes make no difference as well.
It is a bug and a pretty serious one, but we keep going over the same territory on how to fix it over and over. Only BI can fix it, but we have to work around it just as we have with the dispersion values to make aiming skill work again.
@grave bridge I'm not sure how this method works I have the perfect answer for that! https://community.bistudio.com/wiki/onMapSingleClick
yea, but I'm kinda new to scripting in arma... how can I store the result as an array ?
So at this link, https://community.bistudio.com/wiki/DIK_KeyCodes, is all the key codes. Is there any keycodes for the custom controls user action 1-20?
As an array?
What are you trying to do? I don't know what you mean by array.
@edgy dune That question doesn't make sense. key codes are key codes. And controls are controls.
I want to get coordinates by clicking on a location on map
Yeah. onMapSingleClick executes it's code when someone clicks. And the coordinates are in the _pos variable
controls usually have one or more key codes associated to them. A control doesn't have "one" key code. @edgy dune
@edgy dune Do you mean the 20 buttons you can specify in that special menu?
user actions or something whatever they are called
That are custom controls yes.
for the custom controls user action 1-20? <-- Considering he said he means the user actions from 1 to 20.. I guess he means the 20 useractions.
So how would I detect say crtl being pressed vs ctl c for example?
@tame portal and yes
Detect where?
@edgy dune you can get what key codes are assigned to an action with this command
in this list are the names of the actions
under "Custom Controls"
Here lemme show you what I mean
"User1" to "User20"
mind the first comment on actionKeys though, it contains some useful information when having to take CTRL, ALT, etc. into consideration
oh nevermind apparently that doesnt work 😄
XD, here give me a second to show what I mean
https://community.bistudio.com/wiki/User_Interface_Event_Handlers#onKeyDown if someone presses C you can use that to check if Shift,Ctrl,Alt is pressed
@still forum How would one find out (in the keyhandler) whether someone pressed User Action 1?
I think thats also the question Namenai is going for
reliably? impossible.
Oh
yea
I was thinking I would do something like this
//Assing the keyHandler script ,which is down below, to the display EH
_display = findDisplay 46;
_display displaySetEventHandler ["KeyDown",_keyHandler];
_keyHandler = {
switch (_this select 1) do {
//This is ran 'left control' is pressed
case 0x1D:
{
//do stuff
};
//This is ran if 'c' is pressed
case 0x2E:
{
//do stuff
};
//Would this be how to check if 'left control' and 'c' where pressed?
case (0x1D && 0x2E):
{
//do stuff
};
};
}
RIP white spaces
//Would this be how to check if 'left control' and 'c' where pressed?
no
because the state of _ctrl is in _this
and you shall user that
the parameters in your keyhandler contain information about the state of ctrl, alt and so on
I see
I'm not sure if keyDown fires for ctrl/shift/alt
but it will fire when c is pressed and you can then check the _ctrl state
oh so theres a diffrence between onKeyDown and keyDown
no
@edgy dune instead of using _this directly, use this instead, it makes it more clear for you
params [
"_display",
"_keyCode",
"_isShift",
"_isCtrl",
"_isAlt"
];
They are the same thing. onKeyDown is the name of the config entry. and KeyDown is the name of the eventhandler
what youre extracting from _this is the second parameter, the key code
however theres more in _this than just the key code
@tame portal ahh thx that makes it clearer
there are also booleans representing the state of shift, ctrl and alt at the time of pressing a button
so if you want to check if ctrl and c, you can do
if (_isShift && _keyCode isEqualTo 0x2E) {
however as dedmen mentioned earlier apparently there isnt a reliable way to find out if the given input in your key handler is a specific user action
#include "\a3\ui_f\hpp\defineDIKCodes.inc"
DIK_A
oh thats shame for the user actions, but atleast I can do multiple keys down
it works fine for useractions that use neither of ctrl/shift/alt
but you just cannot know that the user didn't use them
Instead use CBA hotkeys if you have CBA. They are easier to use and work
Yea I got cba, ill look into that then
thx
yep.
and also python? was there a reason to not use python for what ruby is doing?
or just someones preference
few weeks (+ -) ago, we had question here about "sniper script" with similar problem and after some testing was found only one issue with spot distances, actual range was affected by rain (close to what you just said like... ~300 ish meters or so), other than* that nothing... 🤷 @tough abyss
then*… oh no wait
onMapSingleClick "pox=_pos";
this addAction ["posasd", {hint format["position %1",pox]}];
why does it always show Z as 0 ?
no matter where I click on map, the Z is always 0
because how would you select height on a 2D surface?
doesn't it read coordinates from map? with height included? why would there be 3rd value there then
oh crap, that's too bad...
do you know any other way to get full coordinates from the map by clicking somewhere?
yes
Is it really always 0? Or is it some negative z when you click on the sea?
always 0
ATLToASL then
As Dedmen said.
It converts the above terrain level coordinate to above sea level coordinates,
Someone should add to the wiki that the position is ATL
also player onMapSingleClick {}; < does support {}
I am trying to implement groupsMenu on a dedicated server.
I think that the script will only work for the first player on the server.
if (!isNull player) then
GRPMNU_groupActions = player
Do I need to do something like this? _player = _x;
if (!isNull _player) then
@cunning storm No, please paste your entire script. player is the: Person controlled by player.
yup, it works now, thanks @little eagle and @still forum
Not sure why you'd ever do that in script
if (!isNull player) then { GRPMNU_groupActions = player addAction["<t color='#EB7FAF'>Groups Menu</t>", "scripts\groupsMenu\groupActions.sqf", nil,-200, false, false, "", "_target == vehicle _this || _target == _this"]; player addEventHandler ["Respawn", { GRPMNU_groupActions = player addAction["<t color='#EB7FAF'>Groups Menu</t>", "scripts\groupsMenu\groupActions.sqf", nil,-200, false, false, "", "_target == vehicle _this || _target == _this"]; }]; };
That is the initGroups.sqf
Utilize the discord syntax highlighting in : #info_help_tips
It works for the first player, but, not the 2nd.
what do you mean 2nd player?
if you store this inside say iniPlayerLocal or init.sqf this should be executed for each connecting client
On a dedicated server. When another person logs in. They don't see the menu.
where is initGroups.sqf executed??
Ah. I am doing it in init.sqf
So I need to move it to the local one?
if (!isServer) then { execVM "scripts\groupsMenu\initGroups.sqf"; };
\`\ sqf
\`\
if (hasInterface) then {
So I got a nice little error here ```sqf
_keyHandler={
hint format["%1",time];
};
_display = findDisplay 46;
_display displaySetEventHandler ["KeyDown",_keyHandler];
``` Now the wiki says that the params are a string and code, so thats what, I think, I have given it, but I get a error saying expected string, got code well it pretty much says that. Why is it saying this?
_keyHandler = "hint format['%1',time];";
_display = findDisplay 46;
_display displaySetEventHandler["KeyDown",_keyHandler];
oh I didnt know that format would still work inside the "
why does it have to be inside the " tho?
Because that's what it reads as {}, not sure on the specifics for sure. But it works just like {}, except to escape the string you need a single quote ' or double quotes ""
oh so "" would read as just a normal " inside the larger "
oh I c both are the same
ah thx,
🤔
@meager heart Throw me into the fire if you will, but not sure on the specifics
is it order ? like... do i have to... or ? 😄
Put me out of my misery man 🔥 🚶 💨
fire bender
screams in agony
Would anyone here be familiar with a way to script a means for AI to actively chase down players in an attempt to attack them in melee (example- bayonet charge) please tag me if you can help or know someone that can.
@green quail look at any zombie survival mod for A3 or A2 basically. Epoch, dayz, etc
i think rupert or someone else also made a sword fight mod for A2 (medieval knights charging each other) that got to have something like this too
Am I missing something or does the Gauss version of random have no seed version?
https://community.bistudio.com/wiki/random
if you mean seed random randomrange afaik there are none
Is it possible to include a .hpp file to the mission that exists only in a server mod and not in the client? Because i don´t know if my path is wrong or it is not possible.
description.ext is bugged when refering external / addon space files on a dedicated server when packed.
Otherwise it all works fine, but you need relative paths of course, not absolute paths.
description.ext?
Yes so impossible
: description.ext is bugged when refering external / addon space files on a dedicated server when packed.
feels bad
Just put the file into the mission.
That works.
It's annoying, but that is how it is.
the Deleted event handle triggers when the units is about to be deleted or when it was deleted?
are there any time or date eventhandlers in arma available to execute stuff on a specific date/time ? couldnt find any usefull EH in the wiki which i could use, im currently using CBA_fnc_waitUntilAndExecute to comapre 2 times but im not so sure about the performance. ty
@astral tendon about to be. Why else would it get the unit as variable if it doesn't exist anymore
Thanks 👌🏿
Here's the script I came up with for random dispersion: https://gist.github.com/commy2/7b53260440f81db462dea093ef543676
@little eagle Its the same approach I use to adjust shots. But only the hit location is properly synced for me in MP. For non-local machines from the shooter, the tracer fires the original path. Do you know how to fix this?
This uses seeds for randomization.
So the dispersion should be the same anywhere.
seed is based on the ammo count of the shooter.
For non-local machines from the shooter, the tracer fires the original path.
You need to run the fired eh everywhere, as these projectiles are local objects.
Interesting, didn't know that. I created a T&E system like the one in ACE 2. So should be simple to fix then since I will just synchronize the parameter used to control the shooting immediately, rather than delay it until others enter the vehicle.
So if bullets are all local, how does Arma know which one is the right one? So it does not apply damage equal to the number of clients on? This is done inside the engine?
Hmm, that must mean that the engine uses same technique you implemented. Cause otherwise, then even rounds not modified by scripting would not be synchronized anyway?
It still knows the instigator even if it's a local object.
Some engine magic.
Arma engine probably uses different math. I have this adjusted so that it uses as few sqf commands as possible -> load everything from script to code.
The real challenge here is using seeded randomization. The newish random syntax makes this relatively easy to do though.
Without seed, it would obviously be different everywhere.
Yup. Even went to implement my own hash function before the random commands. But pretty hard to with 32 bit floating numbers. Not a lot of room for arithmetic without losing digits.
You mean a lookup table?
This is what CBA_A2 did: https://github.com/CBATeam/CBA_A3/blob/master/addons/common/init_gauss.sqf
No, I was making a general hashing function. Sequence of numbers in, fixed-length number out
Basically the idea was the same, propagate the same global state without actually sending - e.g. make each client construct the same hash from the same input...
Example could be wanting to damage many buildings on the map without sending traffic. Input the classname, x,y z coords and the get deterministic hash number out. Based on that apply changes or not.
What's the benefit of that compared to a 1000 element lookup table? Without dll, this seems pretty slow.
I guess there is not that much benefit after all. Mostly way more randomness than 1000 - could get it up to 16 bits long before arithmetic operations caused losing precision. And yeah, I struggled making it decent without making it slow.
hi, I'm trying to get an azimuth with getDir:
`playerpos = position player;
onMapSingleClick "targetpos = ATLToASL _pos; _alt";
azimuth = playerpos getDir targetpos;
when I try to read it, it says that azimuth is an undefinied variable.
jesus
btw how do I paste a code on discord to make it more clear lol
```sqf
```
^
/\
🔼
onMapSingleClick "targetpos = ATLToASL _pos; _alt";
azimuth = playerpos getDir targetpos; ```
yey
sorry for beeing a total noob, but this scripting language is such a pain for me
This script does nothing.
yes, but then I add
this addAction ["posasd", {hint format["position %1",azimuth]}];
to show the azimuth as hint
but it shows that the azmiuth is undefinied variable. it shows targetpos with no problem
posasd everyone 👋
["commy_test", "onMapSingleClick", {
private _azimuth = player getDir _pos;
systemChat str _azimuth;
}] call BIS_fnc_addStackedEventHandler
that works, thanks !
Are setVariable variables synchronized to objects before the CBA runs the 'init' handler from CBA_fnc_addClassEventHandler?
Before init, there is no object reference you could use setVar on.
And setVar public even fails during init event resulting in a only local variable.
So I'd say "no".
I am setVariable'ing during gameplay. Then JIPs check whether the object needs special handling, their init runs later.
Maybe CBA_fnc_globalEventJIP is a better choice.
So you already tried and it was undefined?
You could try initPost eventhandler instead of init.
I tried in the editor using initialization line, set it to true. Then in preInit I ran the addClassEventHandler to add the init handling. When the handler ran, it read it as false (the default fallback).
But using globalEventJip the code is much prettier and shorter.
👍🏼
do respawn addeventhandlers replace older ones or they stack?
Is there anyway I can disable default Arma weather through scripting without setting weather values to 0 on a loop?
Anyone familiar with the vanilla revive system?
@obsidian kiln from my experience they don't stack but it seems like it depends on where its called from
can you use sleep on FSM ?
because the supposed solution as delay that is using a State: _timer = time + 10; Next yellow condition: time > _timer seems that is still checking every frame if time > _timer which is not performance friendly or am i wrong?
No one answered them sunday morning.
Maybe discord is bugged again.
pff, Highlightingnoobs
@fycj#4699 test 😄
whistles
¯_(ツ)_/¯
but snake man swears that people are stupid if discord breaks
He might have blocked you or have turned off notifications from this discord to avoid people randomly tagging him.
afaik that happens when people are in stealth mode
Explain this then: @obsidian kiln
😂
<@jade abyss>
Yes, thats me
<@jade abyss>
bless you
Yes, thats me
Hmm, forgot how this goes.
@little eagle
@storm crow
Or that
@radiant lantern
noob @little eagle
Backslash infront of the mention.
HAX
@meager heart
\@commy2#9913
Yep.
@winter rose test
Can I bad you with that?
you can FBI me I think
no webcamz plz, I is no dressed (@meager heart no English correction plz 😄 )
Redirict a CIA drone to your home.
okej*
lolspeek is allowed on the interwebz
there is even LOLCODE programming language, so there!
lol
code
lolcode > http://lolcode.org/
Would SQF look better or worse after this tool?
BTW If statement
BOTH SAEM a AN b
O RLY?
YA RLY
BTW If
MEBBE BOTH SAEM b AN c
BTW ElseIf
NO WAI
BTW Else
OIC
lolcode ^ 😮
so thats negative about sqf
O RLY?
YA RLY
NO WAI
OIC
😂
[] spawn {
waitUntil {
true;
hint "this should not apear"; // it did
true; //with out this it will keep looping
};
};
Did i got something wrong? I though that once the waituntil got the true it would stop executing the code, but the true must be the last one to work?
"If the very first execution of the code returns true the command will exit immediately"
waitUntil {expr} stops running when expr evaluates to true. Your expr is made of a sequence expression that is made of multiple expression/statements. The result of a sequence expression is the result of the last expressions/statements. In your case you have 3 expression: true, hint X; and true. All expressions are evaluated, and the result of the sequence expression is the last - in this case true. Then it stops.
Or simplified, in waitUntil {expr}, waitUntil does not look into expr to see the different parts. Rather the entirety of expr is evaluated, and the result then given to waitUntil.
Also above, I should have written waitUntil expr instead of waitUntil {expr}.
exitwtih is a execption?
[] spawn {
waitUntil {
if (true) exitWith {true};
hint "??"; // do not show
};
};
exitWith ends the expression
No. That's not an exception that is just exactly what it does.
Can you exit the waitUntil like that? Remember reading exitWith had some funkyness with certain scopes.
He said it works.. So please answer that question yourself...
That is some good piece of info, my thoughs on waituntil were wrong for long time.
You have to exitWith true. false or anything else won't exit it. Because exitWith just jumps to the end of the script. And waitUntil still wants a true to exit
Ah, of course, makes sense.
[] spawn {
waitUntil {
hint "?????"; // still running
if (true) exitWith {false};
hint "??"; // nope
};
};
that is right.
uh.. Yes. Like I just said.
local variables inside event handlers don't work outside of them even if they are in the same script ?
What?
eventhandler scripts are seperate scripts
they aren't the same
If you just think about when eventhandler scripts execute. vs when your script executes it should be clear
addEventHandler etc. puts a code block in memory and the script continues.
When the eventhandler is executed this code block is run. It's then a different script instance, and local variables don't carry over.
One solution is to store the arguments inside a object namespace variable via setVariable and to read them then inside the eventhandler code block via getVariable.
Alternatively one can use this function from CBA which is a wrapper for what I described basically: https://github.com/CBATeam/CBA_A3/blob/master/addons/events/fnc_addBISEventHandler.sqf#L1-L26
@grave bridge
Basically what I'm trying to do is to pull out position values to use in further calculations:
targetpos = ATLToASL _pos;
targetposX = targetpos select 0;
targetposY = targetpos select 1;
targetposZ = targetpos select 2;
hint format["X coords = %1\n Y coords = %2\n Zcoords = %3", targetposX, targetposY, targetposZ ];
}] call BIS_fnc_addStackedEventHandler;```
What do you mean, pull out?
You have to do the further calculations all inside the eventhandler.
Also, you should start to use local variables (begin with underscore), so your scripts don't start conflicting variables with each other and with those from others.
yea I know, I'm just using globals for testing purposes in the editor, where locals just can't be used
or maybe can, but only in event handlers I guess
That's not true.
what I mean is I'm testing it in character's init panel, not an sqf file
Just wrap you code into:
call {
};
Also, consider using the debug console instead. For your own sanity.
thanks for the tip 👌
@unborn ether @little eagle @winter rose discord just bugged, it was 5 am when i askedl ol
in some cases, my calculations return a value -1.#IND which I guess is indefinite.
this value is <0 but still
if (elevation < 0) then {do something}```
the if statement doesn't "do something". is there any solution to this?
it seems like that's not a value at all lol
for now I just use a workaround
if !(elevation >0), but I'm just curious
@grave bridge Any comparion with NaN will be false. Perhaps, you can use the finite command.
Ideally, you should probably not generate those numbers at all.
many thanks
with getvariable and setvariable, is using missionNamespace basicly saying instead of attaching a variable to a object, attach it to the mission it self?
like this ```sqf
missionNamespace getVariable "variableName";
yes
and if the mission restart the variables get wiped out
i don't know saving functionality though
^Profilenamespace
@edgy dune missionNamespace getVariable "variableName"; is the same as variableName in a normal script. missionNamespace is the default namespace. And it's not really "attached" to the mission. It's more like a global object that everyone has
why boundingBox(or boundingBoxReal) value of "data terminal" is too big, compared to other object such as ammo box or supply crate ? 😮
esp. z-value.
ammo box: [[-1.84154,-1.8197,-0.799121],[1.84154,1.8197,0.799121]]
supply box: [[-0.792432,-0.520492,-0.899068],[0.792432,0.520492,0.899068]]
data terminal: [[-2.40953,-2.40575,-4.78978],[2.40953,2.40575,4.78978]]
it has 4 points in res lod which extends it's bounding box
it was made like that in order to force rendering of it even when far away
right now it could be solved with featureType = 2 in cfg but removing those points would probably break plenty of missions
thx for explanation and detail pic.
then, Is there any way to obtain the size of data terminal? @dim terrace
I dont really get what HandleIdentity does, he fires when the unit with the EH is created or if any unit is created?
if setIdentity is used I guess
and EntityRespawned is a Unit that is created?
entityCreated is a entity that is created :3
And EntityRespawned is a Unit that respawns. https://community.bistudio.com/wiki/Arma_3:_Event_Handlers/addMissionEventHandler#EntityRespawned
That meas the palyer? though i dont think that AI units can respawn
https://community.bistudio.com/wiki/Arma_3:_Event_Handlers#HandleIdentity Only works if you add it before the unit is actually initialized. It can be used to stop Arma from applying the default Identity. Which is I guess the player profiles face texture and glasses/voice
Is that about the same as use lockIdentity when the unit is initialized?
Sounds like it yeah
Is there any EH when a AI unit is created?
CBA has a EH for when any entity is created
I don't know if vanilla has one. I atleast can't see one
I was thinking about doing that for new units created while the mission is on going, put scripts and stuff, my backup plan was aplying that script to a Trigger executing evrey 5 seconds, though, I think that is not friendly to perfomace.
Is there any EH when a AI unit is created?
init ? 🤔
only if defined
maybe in missionEventHandler though
nope. only when killed/respawned
i mean that one https://community.bistudio.com/wiki/Arma_3:_Event_Handlers#Init
but description says "Cannot be used in scripts, only inside class Eventhandlers in config"
sad_face.paa
You can simulate that with really nasty loop, where playableUnits and entities is used.
or maybe just entities but that one missing units in vehs afaik
for the missions maybe just
private _coolUnitDude = <class_name> createUnit [_coolPosition, _coolGroup];
_coolUnitDude call tag_fnc_myCoolInitFunction;
```huehue* 👀
Does anyone know if you can modify the VCOM Mod settings on a server?
This would be through a script but it doesn't seem the VCOM Settings file changes anything
why not just use XEH on CAManBase and post_init event?
I have several missions which need to edit AI after they are spawned, especially with zeus.
and it works just fine with an extended eventhandler defined in the description.ext
pretty much
init is technically not config only, but there is no way to obtain an object reference before the eventhandler is executed, and it never fires again afterwards.
even on a respawn? I didn't test that one
init never triggers on respawn, except for vehicle respawn, and vehicle respawn deletes all eventhandlers.
thanks
I think XEH init has a reapply_on_respawn flag, at least the config version. I personally hate that, makes things even more confusing.
tbh xeh only for AI, respawning Ai should not be a thing. Players can be handler easily with iniplayerlocal.sqf and respawn EH
Is there any reason to pack missions to PBO? like performace wise?
I don't think servers read unpacked missions
I did not think it was wort worie about it, i just send it straight to workshop.
It'll be packed
you can have the server to read it with allow file patching I think
Hey, trying to knock down all the trees in an area in Leskovets.
any reason why this isn't cutting it?
[] spawn {
{
_x setdamage [1, false];
sleep 0.02;
} foreach ((getMarkerPos "NukePos") nearObjects ["TREE", 700])+((getMarkerPos "NukePos") nearObjects ["SMALL TREE", 700])+((getMarkerPos "NukePos") nearObjects ["BUSH", 700])};
linux servers might crash when reading a mission from a folder.
@warm bronze that's not how nearObjects works
you are mixing https://community.bistudio.com/wiki/nearObjects with parameters for https://community.bistudio.com/wiki/nearestTerrainObjects
cheers dedmen, worked perfectly. On a side not if i destroyed everything in say 500m like that, would that destroy frames so to speak?
cheers
Ok, I still can't quite grasp how to set up functions in separate files and then call them.
I've got the functions.hpp called by the description.ext
class taro
{
tag = "taro";
class functions
{
file = "taro_shop\functions";
class showGunShopDialog {};
class weaponPrices {};
};
};```
``taro_fnc_showGunShopDialog`` is called by an action and it works. Now in that function I want to call ``taro_fn_weaponPrices`` with this
```sqf
_weaponPrice = [_weaponClass] call taro_fn_weaponPrices;```
However I get the undefined variable in expression error, like the ``taro_fn_weaponPrices`` is not existing.
taro_fn_weaponPrices > taro_fnc_weaponPrices 👌
i knew it was something small 😄
Hey, at least the error message was correct for once.