#arma3_scripting
1 messages Β· Page 204 of 1
I probably found the last piece for my solution.
I was able to change the AA_Count value from my client machine.
So I managed this. But I noticed that my AA_Count allways resets to 0.
I started thinking and took a look about all moments when the script defines "0" as value
And I remembered that my script fires the randomGen again if there is no possabilty to
spawn in the selected objective. So it always gets new defined with 0 value so that the script
runs infity
You can see in my screenshot that Ive tried to only define it once and then skip
the part in the second launch because the If-Cause turns "false"
I checked out the BIS function in the function viewer and the variable name keys in the docs are wrong
https://community.bistudio.com/wiki/setDamage to the car when you want it to explode
https://community.bistudio.com/wiki/attachTo do you use to make the men boomable and also set damage to it
@buoyant merlin
Got it to work now, thanks and sorry for posting π
There is isNil command
if (isNil "EBER_AA_count") then {
EBER_AA_count = 0;
publicVariable "EBER_AA_count";
};
Not sure if it's best practice, but couldn't you do missionNamespace getVariable ["EBER_AA_count", 0];?
I dont have experience with getVariable
hello all: So on a hosted server: is the player the Server and also hasInterface with the Server: em i correct in saying this ?
All servers are hosted. I assume you mean player-hosted, as in someone created a local server from the multiplayer menu.
In that case, the server machine is also a player machine, and hasInterface will return true if executed on that machine.
I think I've explained this before, but hasInterface does not mean "an interface with the server". It means the current instance of the game application is displaying a graphical interface (or not).
yes thats what i mean: and thxs you again Nikko
i didn't have anything go wrong, i was just woundering:
thx again
oh cool @thin fox
thx you m8
You might also be able to just use isDedicated in placement of checking both isServer and hasInterface. We don't really use isDedicated but I think that's also because at one point we considered setting up a headless client
addAction doesn't show up π€
private _action1 =
[
"<t color='#80FF80'>Add Veles Crewman</t>",
{
_unit = veles createUnit ["O_R_JTAC_F", flg, [], 5, "NONE"];
[_unit] joinSilent veles;
addSwitchableUnit _unit;
_unit setCustomAimCoef 6;
comment "Remove existing items";
removeAllWeapons _unit;
removeAllItems _unit;
removeAllAssignedItems _unit;
removeUniform _unit;
removeVest _unit;
removeBackpack _unit;
removeHeadgear _unit;
removeGoggles _unit;
comment "Add containers";
_unit forceAddUniform "U_O_R_Gorka_01_camo_F";
comment "Add items to containers";
for "_i" from 1 to 4 do {_unit addItemToUniform "FirstAidKit";};
_unit addItemToUniform "MiniGrenade";
_unit addHeadgear "H_HelmetCrew_O_ghex_F";
_unit addGoggles "G_Bandanna_Vampire_01";
comment "Add items";
_unit linkItem "ItemMap";
_unit linkItem "ItemCompass";
_unit linkItem "ItemWatch";
_unit linkItem "ItemRadio";
_unit linkItem "ItemGPS";
_unit linkItem "NVGogglesB_blk_F";
comment "Set identity";
[_unit,"WhiteHead_02","male02rus"] call BIS_fnc_setIdentity;
_unit setVariable ["BIS_enableRandomization",false];
_unit setSkill 0.6;
systemChat "A Crewman joined Veles!";
},nil,1.5,false,true,"","true",2,false,"",""
];
[flg, _action1] remoteExec ["addAction",[0,-2] select isDedicated, flg];
Flag, maybe your distance is calculated in the middle of the flag model center, so try increasing your distance 2 ---> 10
can i use the path calculated event handler to force a group to move to a waypoint using the calculated path?
i want to make a unit take a more concealed path to an objective using a path calculated with "stealth" as the behaviour parameter & i want the group to follow this path but with behavour "Aware" (and best without messing up already established waypoints). Is that achievable?
test it out and tell us
yeah doesnt work. I disabled medical menu and revive. The basic ace wounding stuff still stays. So you cant even treat your injured body parts.
Hi guys, would anyone know where the P3D's used for players faces in the profile screen would be located? Have tried scrounging around configs but haven't had any luck
Ah wait might have just found one on the CT_OBJECT page
Okay yeah sorry appears I am good
Hey
There is a problem about escape missions , where player must shoot about 20 or 30 shoot to kill ai!
Also a problem is bots moving like robots and like bad ping statement
Anyone can guide?
mods?
Can i send you pm?@thin fox
no, just send everything here
Ok
A few mods we have on dedicated server
any AI mods?
No ai mods i think
send the modlist here
No access now , i will send it tomarrow
Got a question in regards to decals - should one use createVehicle to create/place a lot of them via script or is it better to create them via createSimpleObject or maybe createAgent? Am not at all certain how placement of a lot of decal impacts performance and which would be the best/proper way to go. I should add that I did place everything via Eden so far, so this time I am trying to dabble in creating things via script.
Hi - see https://community.bistudio.com/wiki/Arma_3:_Simple_Objects; simple objects are static objects that are not simulated, very light on the performance β however, don't think you can move such soda can with a tank π
other objects are simulated
decals could be simple objects as they don't change over time
Thanks for the swift reply Lou! So I can/should use createSimpleObjectwhen creating/spawning/placing a decal (I do need the decals as they fit to the terrain automatically without any additional hassle).
Would be so great if we would finally get a usertexture decal of various sizes.
if they adapt to the terrain doing so, yes π
same with grasscutters, they perform way better as simple objects
Ace medical is baked into ACE. You have to disable it fully to disable medical.
right so in case the decals do not adapt to the terrain ascreateSimpleObjectthen I should use createVehicle to spawn them? (will have to test tomorrow)
Oh did not know that grasscutters could be simple objects too! That is good to know!
decals should adapt to the terrain even as simple objects, but I cannot certify it
otherwise yes, createVehicle
createAgent is for "simple AIs"
Ah got you! Thanks for clearing that up, the different "create" versions got me confused. Will test this tomorrow and let you guys know if the simple object thingy works with the decals ;)
If you have more questions, you can ask on the ACE slack.
There are no plans to make medical modular from the rest of ace, too many interdependencies.
Alrighto. Thanks!
not sure if this is the right playc but anyone know how to call a different skybox? im trying to do a halo campaign and theres only 4 halo maps and i want to just be able to change the skybox to say that we are on halo
You cannot through a script
would it be in the config then?
Yes
thanks
operation trebuchet first contact
has 4 halo maps
ive found the .paa's used for the skybox but idk how they are called
Hazard a guess it's the skyTexture property in CfgWorlds, but #arma3_terrain may be able to help you better
The GameDay is over and Im back into improving things.
Currently Im updating the script so it communicate correctly with the vars in their determining varspace.
But somehow the simplest thing isnt working. Im not able to define the publicVar. Even if Ive did it
like Ive always do it.
I attached you the error and the text location of it
Also you really should to install at least a working syntax highlighter
You won
Finally
I agree
I will hit up a friend. He also got a highlighting for N++
```sqf
// your code here
hint "good!";
```
β
// your code here
hint "good!";
@broken pivot
@winter rose - Hey mate! Update from a few hours ago, tried to make the spawned decals (dirt patches) into simple objects but the weird thing is they "vanish" when I look straight at them and only show up when I looks straight down, at a medium distance from me or when I set the camera a bit back in 3rd person view), also the textures are blured (even if the scale is set to 1). So I guess I have to stick with createVehicle.
Btw. do I have that right that createUnit is just for spawning single AIs?
createUnit only spawns an AI, not multiple of
@thin fox you remember the thing, with us being player 10: insted of player 1: i found if you put player2 on the right of player 1: and player3 on the left of player 1: in Formation: and so on: back and forth: it seems to work better
@thin fox i was always putting player 2 on the left of player 1: i think this is why it was messing up
as soon as i put player 2: on the right of player 1: in Formation: it all worked great
# Hey there :D
Ive got a localization question :D
This is my script:
_marker1 = false;
_marker2 = false;
if ((getMarkerColor "capture_29") == "ColorOPFOR" //hier "Capture_29" durch eigene Zonen austauschen
) then {
_marker1 = true
} else {
_marker1 = false
};
If the _marker1 is changed to the value "true" is the value tranmitted to the outer scope? So is the value also changed outside of the if-condition?
Or would I have to publish the value to the rest of the scope?
Yes, it does change the _marker1 value in the outer scope too
Maybe you need to give more content,
Where you will use it and when
Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.
Thats step 2/3
And I have the problem that the script dont pass in server enviroment but in Editor
private _marker = getMarkerColor "capture_29" == "ColorOPFOR";
//will result true/false
private !!!!!!!!!!!!!!
I totally forgot about that
But wouldnt it effect anything because that would lead into caging the var inside my if cause because that is the innermost scope in this case?
Youve comprimised 20 lines in one haha
Because now I dont need a default value because the default value is already asked in the if cause, where it gets defined. Nice!
how to make markers don't update for non existing players?
while {true} do
{
"kiba3x_mrk" setMarkerPos kiba3x;
"bobcat2_mrk" setMarkerPos bobcat2;
sleep 1;
};
And you can check boolean in condition
_marker == true ,
!_marker == false,
So ->
//will continue if _marker1 or _marker2 isequalto false
if ((!_marker1 || !_marker2)
//if ((_marker1 || _marker2 || _marker3 || _marker4) == false
) then {
"EBER\Erweiterungen\Luftabwehr\randomGen.sqf" remoteExec ["execVM", 2];
systemChat "AA Nr1 <-> Not spawned";
};
//will continue if both _marker1 and _marker is true
if (_marker1 && _marker2) then {
....
}
Not sure if you are a VSCode fan but this extension is pretty good and what I have used for a long time π
https://marketplace.visualstudio.com/items?itemName=blackfisch.sqf-language
Extension for Visual Studio Code - Full SQF Language support for VS Code. Forked and updated from https://github.com/Armitxes/VSCode_SQF
Hey guys. I'm learning sqf and I have problem. Look, I wrote this script to create a marker that should appear only on my client. But when I tested it in multiplayer, the other client saw a black dot at the same position
private _markerName = format ["playerMarker_%1", getPlayerUID player];
private _marker = createMarkerLocal [_markerName, getPosATL player];
_marker setMarkerShape "ICON";
_marker setMarkerType "mil_dot";
_marker setMarkerColorLocal "ColorRed";
_marker setMarkerTextLocal name player;
Is there a way to make it completely local?
Every command call that modifies the marker must be the local version
Make sure you are doing setMarkerText at the end instead of setMarkerTextLocal
Ideally also making every prior command local will be more performant for network as well :)
I think he wanted to have completely local marker (?)
Oh apologies I misread
So ```sqf
private markerName = format ["playerMarker%1", getPlayerUID player];
private _marker = createMarkerLocal [_markerName, getPosATL player];
_marker setMarkerShapeLocal "ICON";
_marker setMarkerTypeLocal "mil_dot";
_marker setMarkerColorLocal "ColorRed";
_marker setMarkerTextLocal name player;
If you miss the "local" appendix in any of the marker commands, it becomes instantly global
Oh, thank you very much
@stable dune thats a question for you
It depends on what you do with the private variable
I'm not fully sure I entirely understand your question but if you're just wondering if private would make a variable out of scope if defined within an if statement, it will.
if true then {
private _variable = true;
};
_variable // nil
private "_variable";
if true then {
_variable = true;
};
_variable // true
Does someone got capacity to take a look at a screenshare?
So I gues not.
My current problem is that something wont work with my markers.
I gues that because the red marked areas arent getting passed.
Its all with the marker condition.
Works in the editor but not on the server. Like always...
Check the values of _marker1 and _marker2 with debug logging. And you can remove the == true part from the if clause
Oh I'm blind, you have the logging there already
true. Because the if cond is awaiting an true value
why so much scripting for markers seems like it should be way smaller
skill issue
oh ok copy that
Could you send your entire script as a file?
Or alternatively if it lets you fit it all in markdown
```sqf
```
Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.
it's weird, I've already said to him multiple times to get vsc and a sqf ext
And its weird you dont understand that I use this for learning
yeah but its way easyer with collored text m8
thats not the hard way thats i omg this sucks way lol
Hahaha true
But in that way I learned it
i used to use ArmaEdit program but now VSCode is awsome m8
Are you able to describe your issue a little more? What do you mean by the red markers aren't getting passed?
ill telling you man collerd Text helps big time if you really want to learn
Sooooo: ill update the msg
My script first picks (in randomGen.sqf) 3 random AA fortifications
Then it launches the activation.sqf (the sent script)
There it checks if the areas are red or blue (enemy/ player conquered)
After the are is red, it belongs to the enemy, its clear to spawn the AA with
the deformer, the patrouls, the Object ASL and so on
But: (now my issue)
The script isnt launched in server enviroment with also headless clients
Have you checked your RPTs to verify the paths you have for your remoteExec are correct?
Or that there aren't any script errors on server? Are you able to send the file of where the markers are handled?
I havent. But it works in editor.
why are you using headless client
Performance
Oh wait you might have already sent earlier
Let me take a look at some of your previous pastebins 1 sec
The .rpt of the server isnt in the time Ive used the script
If you want it to be launched for headless clients, you will need to specify that in remoteExec as well as 2 is just server
But wouldnt it be launched xMachines time?
You don't need to be an expert haha I know zero about programming but I use it to highlight my code so I don't get headaches for simple things like missing commas etc
So in our case 5 times
- Server
- Client
- HC1
- HC2
- HC3
Its hard to understand that also in times of AI still people want to do and learn things the old way. I can relate
???
AI can be a crutch but syntax highlighting is just saving your sanity
If you're wanting to learn you're not disadvantaging yourself by using syntax highlighting. If anything you're giving yourself larger opportunity to see where potential problems are. This is currently how it looks with my Visual Studio Code extension.
Did you get it work
negativ
Are you able to send the file where you create your markers?
Plus the name of what it is called
Scripts:
1/3: https://pastebin.com/euxMJUeY randomGen
2/3: https://pastebin.com/VfvCiNVR spawnCheck
3/3: https://pastebin.com/FiskmQHM playerInteraction
Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.
Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.
Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.
Can you recommend a sqf highlighter for N++?
I don't see any reference of playerInteraction in any of those files- do you remoteExec it anywhere?
Are you sure that's it's file name?
Its ErstelleAufgabe.sqf
"CreateTask.sqf"
In line 19. Sorry for that language gap. You couldnt know that
It's okay, that's your native language π
Just to confirm, is it that you are wanting these markers to be visible to all players?
All people recommend to write in english but I argue with "My vars wont collapse with common english words" π
The first one shall be visible the second one, in line 53, is only for the briefing table area
briefing table attached, the marker is for the hight map
I don't have Notepad++, but I use VSCode with extension.
https://marketplace.visualstudio.com/items?itemName=blackfisch.sqf-language
Extension for Visual Studio Code - Full SQF Language support for VS Code. Forked and updated from https://github.com/Armitxes/VSCode_SQF
cool. I dont. I use N++ and not be able to use your plugin
"I need N++ Plugin"
-> "Here you have an VS Plugin"
dafuq
im still not sure what your what to happend with them markers
yes ok
The markers are there to check if the player conquered the area because the markerColor changes
In fact there is, let me find for you
getmarkercolor "marker1" == "colorBlue"
Spoiler
Already my script
copy that
I'm trying to suggest to use VSCode instead, but do whatever
Got it earlier but you cant force people by ignoring what they say. I would like to stay with N++
im sorry again: but what r you saying that's not happening for you in your script
I dont understand what you mean
yeah what's not working in your script
Now Ive got you π
My script works in editor but not on the server. I gues it hangs up in the 2/3 script -> spawnCheck (aktivierung.sqf) because the EBER_AA_COUNT remain the same after launching and because also the buildings arent spawning Im guesing that something wont work with the marker system. Because the EBER_AA_Count and the Building spawn depends on the _marker condition
We can die in piece now
hey, im trying to learn about multiplayer scripting and i have a few questions:
private _h = _unit getVariable ["MRPH_forceSprint_Handle", nil];
// Ensure _h looks like a script handle before scriptDone
if (!isNull _h && { typeName _h isEqualTo "SCRIPT" } && { !scriptDone _h }) then {
terminate _h;
};
_h is a scripthandle, but when i check if it is defined it gives an error saying _h is undefined and i dont understand why
second question is how do I safely exit a loop?
exitWith {}; on its own gives an error.
Thanks
@old owl do we have some news? Im really in a mess this time haha
The way your Boolean (true/false) checks are written is a bit clunky. For example, you have this:
if ((_marker1 || _marker2) == false) then```
and similar structures. But think about it: `||` and `==` both return booleans. So you're making a boolean that reports on the status of another boolean. It's pointless - just use the first result.
```sqf
if !(_marker1 || _marker2) // succeed if neither is true
if (_marker1 || _marker2) // succeed if either is true```
private = private for the innermost scope. Your locking your varspace
Are you sure that MRPH_forceSprint_Handle is what you expect? You're using nil for your default along with your getVariable, that will produce a script error of an undefined variable if MRPH_forceSprint_Handle doesn't exist.
π
Yep,
I tried to say the same thing earlier.
#arma3_scripting message
Can you now anwser my question on KP_Lib DC hahaha
With success. I already changed it
I've already did, no?
Good π
Ill text there
@valid abyss ```sqf
if (whatever you want) exitWith {whatever you want};
//or
if (!alive player) exitWith {};
Notepad++ syntax highlighting and autocompletion for SQF (the scripting language for the ArmA games) - nixchecker/npp-sqf
It will work in if, or any other scope which in not outside
Honestly I am still just having a really hard time understanding the logic enough to find where the problem is. It appears you're executing those marker commands as global, so really not sure why you'd be having an issue unless there is some sort of logic issue. Kind of just difficult to look into when I don't exactly understand the order of operations, what files are beign ran, etc. I would just continue to debug and make sure that all of your conditional stuff is hitting the way you're expecting it to
MRPH_forceSprint_Handle should only store a script handle or store nothing
Where do you define MRPH_forceSprint_Handle and how do you define it? A spawn will be a script handle but a call will not
Good call π Also really relatable. The more I learn the more I see the mess...
Ill dm you
ah sorry for clarifying, its being spawned, not called
Are you certain the script is being spawned before it's checked?
the error isnt with terminate its with the if statement, more specifically it shows !isNull _h is where the problem is, which is confusing for me since isNull is supposed to check if the variable is defined (at least i think).
Maybe give this a whirl
private _h = _unit getVariable ["MRPH_forceSprint_Handle", scriptNull];
// Ensure _h looks like a script handle before scriptDone
if (!isNull _h && { typeName _h isEqualTo "SCRIPT" } && { !scriptDone _h }) then {
terminate _h;
};
Although if it is being spawned in an order prior than expected then the above could still produce issues if not addressed
This would really just prevent it from ever being undefined
@old owl ive DMed you
If we're talking about variables, shouldn't isNil be used instead?
the script is only spawned if a param is set to true when I call the main init function, but it is still checked to see if it exists before it checks to spawn it to cleanup if the main init has previously been called and not terminated
The use of a default value with getVariable means it cannot be nil
That's definitely a valid way of doing it. He was using the array syntax of getVariable anyways so I was proposing scriptNull for the default which cuts out needing to check if it isNil
Well yeah, good point π How about in general?
this works, thank you!
You're welcome! Again though just be cautious of what I had there though. If it is an issue with the script not being spawned before it actually runs, you might still run into issues with unintended behavior. To resolve this you would likely just put some sort of uiSleep before your if statement if you run into issues with that later down the road π
thanks for the advice, i appreciate it
@old owl did you have seen that I tried to send you a DirectMessage?
//what condition is your condition in
private _condition = (!alive Helo2 || !canMove Helo2 || !alive Pilot2);
//systemChat str _condition;
if (_condition) exitWith {
deleteMarker "mkr_LZ2";
SAA_mapPosition = nil;
};
| | = and or
cost
cost?
oh
nvm
i was using the wrong thing
I was trying to figure something out, the cost vs threat targeting system
Cause i noticed AI doesnt use the Vorona launcher at all anymore, no matter the target
And in general i experimented a bit with vehicle AI and the way AI chooses what to target needs some improvement
Couldnt find much in the search bar
even without mods?
how to check if unit is driver, gunner or commander in vehicle ?
_unit == driver _veh
Yes.
You could give more content, where do you want to check it and when
can someone else test this command for me? The alt syntax to be precise: https://community.bistudio.com/wiki/nearSupplies#Alternative_Syntax
If I put a typeName it only gives me the origin and not supplies nearby.
Hey peeps is there a singular command that can return all items inside a crate/vehicle or do I have to use the different commands and combine the result?
Different
@stable dune
_veh addEventHandler
[
"GetIn",
{
params ["_vehicle", "_role", "_unit", "_turret"];
if (_unit == driver _vehicle || _unit == gunner _vehicle) then
{
if ( headgear _unit != "H_HelmetPilotHeli_O" ) exitwith
{
_unit action ["Eject", vehicle _unit];
systemChat "You are not Pilot!";
};
} else {};
}];
I had success, only "pilots" (units with heli pilot helmet can get in as pilot or gunner)
And in the mission I am making you can get "pilot training" along with pilot gear that allows you to fly helis and jets - for a price (score points). The idea is to make pilots expensive asset and make player want to save their pilot - ejecting, crash landing, etc. And to make pilot rescue actually vital tactic.
hello all: if i have this marker selectRandom
How do i make sure it selects a different one each time the script is run
or can i Delete the one it picked from the list so it can pick a New one the next time
_mrk = selectRandom ["C1","C2","C3","C4","C5","C6","C7","C8","C9","C10","C11","C12","C13","C14","C15","C16","C17","C18","C19","C20"];
Not sure if anyone answered your second question, but the break keyword works if you need it. exitWith needs a preceding if statement.
markers = [...];
// ----
_index = floor (random (count markers));
_mrk = markers select _index;
markers deleteAt _index;
_mrk = markers deleteAt floor random count markers :P
really cool man thx
deleteAt returns the value that was deleted. Which is handy.
Ohhh Hell Yeah: WooHoo: Works like a Charm: guys thx soooooo Much: WooHoo Arma 3 @faint burrow @granite sky
OMG It Works So Good: thx again Guys i Love you Guys @faint burrow @granite sky
Hey there, do you guys know of any EH that I can use for all my terrain objects so when they get damaged I can repair them every once in a while? (Doesnβt matter if I have to override the objectβs config)
Objective: a little cleanup script to save me some performance, and to also clean JIP Queue a bit
I think I cant help you there but got an problem on my own.
Somehow my condition turns false when it should be true.
Im checking 2 markers if there color is "colorOPFOR" (both have) but my condition
turns false...
If I check them one by one, my output is true.
Maybe you see or know something I dont
Is it possible to make an **ammo_Missile_Cruise_01 ** (cruise missile from VLC) rocket fly to its target using the **setMissileTarget **command so that it uses its flight profile (cruise one)? Or maybe someone know how would be better to do that ?
Yes, you can use a laser target to make it guide to somewhere
do i need to set this laser target to missile first ?
_marker1 || _marker2 == false means _marker1 || not _marker2
But thats okay. In that case it means that the AA wont spawn until one of both marker isnt colorOPFOR anymore
To simplify true || false == false is true || true because false == false has priority AFAIK
Okay so thats good to know lol I dont know where Ive catched that... But in that case its still what I need because one not red marker is enough to not spawn the AA
Is laser target have specific type ? Classname ?
laserTargetW / E / G IIRC
The problem is that he selects the first case if both markers return "true" so if they are colorOPFOR
Here Ive checked both markers and they return "true".
Aww....Yeah, u r right. But **setMissileTarget ** have some condition to using, right ? Like the missile has to be in the cone of target or smt like that
"BuildingChanged" mission event handler - only works for objects that have ruin variants iirc
Again true || true is true, true || true == false is true || false so still true
Do you mean (not _marker1 && not _marker2)
AFAIK no. The only condition is it is a valid target (eg heated vehicle against IR seeker, laser target against laser seeker)
Sounds like a solution for me. Thank u for you help. Do u know the difference between laserTargetW / E / G ? Side ?
I tryed to ask him if _marker1 or _marker2 is false
W means West, aka BLUFOR. Same concept with others
Will take a look, tysm for the constant help man hahahaha. I guess you also run some sort of life server?
But interesting, why laser object couldn't be a valid target by itself ?
?
Ouuuuu
A laser target cannot lock a laser target?
Yeah. run into a few of your issues before lol
Its because Im covering both cases. So I would need to create another scope to pack the anwser
π you learn a lot from issues
Wait. You suggesting to spawn the laser object (one of laserTargetW / E / G) and writing this object into the rocket via setMissileTarget. Is that right?
Thats why Im learning a lot
Yes
So missile should hit this laserTarget. Guided ammo should be able to hit any surface or object if its see the laser here. Even just a surface if there is a laser on it
I gues Im looking for
(_marker1 || _marker2) == false
That should be the concept
See also, fireAtTarget
its good but for case if ammo wasn't created yet. In my case i'm firing a one projectile object and changing it "on the fly" to cruise missile. And it should hit pos that i want (which one i'm also configuring on the fly)
but your knowledge about laserTargetW helps, rly. Didn't find that in wiki
Maybe even EntityKilled could do something
If (!_marker1 || !_marker2) then {
...
};
If you're wanting it for all objects, and not just buildings, then yes, thats probably better.
Yes, all terrain objects. Iβve seen in this chat that a terrain object cannot be revived and itβs gotten me kinda worriedπ
Up until now I was thinking that I could get away with a setDamage 0;
Ahhh now Ive got. Hes skipping the "... == false" part. Im up for 20 mins...
It maybe can by using the alt syntax, AFAIK you can revive a terrain house by that
unfortunately missile flies directly to target and ignoring any obsticle (like a hills). Its not using its own cruise fly profile
that's all what i'm doing with it:
private _target = "LaserTargetE" createVehicleLocal _targetPos;
private _successful = _projectile setMissileTarget _target;
btw _successful returns true if it matters
They can. setDamage will fix most terrain objects like trees, walls, buildings, etc
_count = {
if (getDammage _x > 0.9) then {
_x setDamage 0;
uiSleep 1;
true
} else {
false
};
}count ((nearestTerrainObjects[player,["House"],200,true,true]) + (nearestObjects[player,["House"],200,true,true]));
systemChat format["Restored %1 buildings!", _count];
Is something I actually use
is there a way to get the config path by the classname only?
Having a hard time understanding exactly what you mean by this? You have to know where to search for the classname to find the config
Wow, yeah that was my initial idea at first too but I thought maybe the command might be too heavy to run for the whole map?
I also plan on adding some 3D countdown on the objects just so people donβt casually stay in the middle of an object while it is restored.
Maybe use W
Officially this doesn't work. In practice I didn't find any issues except that the killed event handlers don't work for subsequent deaths.
Well true point anyways
BuildingChanged still works.
It's hard for me to explain haha I want the path
Unable to test right now, will it trigger if I βaccidentallyβ smash my lambo truck into a tree?
no difference
I don't think BuildingChanged applies to trees, only models like houses that have ruins and/or partially destroyed models.
Shoot
So maybe it's no good for your case. You'd have to test whether any of the killed EHs fire the second time around.
(fire with correct parameters)
Yeah my issue is with those models that just give up and fall onto the ground. Itβs bad for performance and even worse for my eyes
Is it bad for performance?
How do you actually run the code then? Entire code?
Like once they're done falling
I think so? I donβt really know but I guess itβs an entry on JIP Queue and over the time with multiple objects breaking and falling it might cause a little lag though
No, because it's ambiguous. It's entirely possible for the same classname to exist under multiple config branches.
Tryna find out the key parts to making my server less redundant on restarts, and achieve a similar outcome than the one you get from restarts but via SQF
Now if you know whether it's a weapon/item, magazine or backpack through other means then you can certainly look the thing up.
hmmm
yes I know, I just wanted to put in a more dynamic way
Just tested, it seems "EntityKilled" doesn't trigger on terrain trees, walls, etc. Only buildings and actual entities, hence the name.
Might have to look into something different if you're wanting to fix those as well
this addEventHandler ["Fired", {
params ["_unit", "_weapon", "_muzzle", "_mode", "_ammo", "_magazine", "_projectile", "_gunner"];
[{
params ["_unit", "_projectile"];
private _pos = getPosASL _projectile;
private _velocity = velocity _projectile;
private _vectorDirAndUp = [vectorDir _projectile, vectorUp _projectile];
if (!isServer) exitWith {};
private _projectile = createVehicle ["ammo_Missile_Cruise_01", [0,0,1000], [], 0, "FLY"];
_projectile setPosASL _pos;
_projectile setVectorDirAndUp [_vectorDirAndUp#0, _vectorDirAndUp#1];
_projectile setVelocity _velocity;
_targetPos = _unit getVariable ["aslPosOfTarget", []];
private _target = "LaserTargetW" createVehicleLocal _targetPos;
private _successful = _projectile setMissileTarget _target;
}, [_unit, _projectile], 3] call CBA_fnc_waitAndExecute;
}];
Technically i'm replacing one missile with new one bc i need its cruise profile
Gotcha, appreciate it.
I have this script, and some times _name is returning empty for some items, like some of the CUP ones, and I find out that they are in a different config path
{
private _name = "";
private _picture = "";
if ((_x isKindOf ["Default", configFile >> "cfgWeapons"])) then {
_name = getText (configfile >> "CfgWeapons" >> _x >> "displayName");
_picture = getText (configFile >> "CfgWeapons" >> _x >> "picture");
} else {
_name = getText (configfile >> "CfgMagazines" >> _x >> "displayName");
_picture = getText (configFile >> "CfgMagazines" >> _x >> "picture");
};
private _amount = (_allCount # _forEachIndex);
if (_name isEqualTo "") then {_name = _x};
private _rowIndex = _control lnbAddRow ["", _name, str(_amount)];
_control lnbSetPicture [[_rowIndex, _itemsPics], _picture];
_control lnbSetData [[_rowIndex, _itemsColumn], _x];
_control lnbSetValue [[_rowIndex, _itemsAmountColumn], _amount];
}forEach _crateAllItems;
An easier and better way to check would be isClass(configFile >> "CfgWeapons" >> _x)
In this context you need to check type etc to find it is a CfgMagazines or CfgWeapons or CfgGlasses or CfgVehicles
I think I miss something obvious. Can't tell rn as I'm not at PC
At least I recall it is possible
yup
could u please look at it when u will be at PC ?
Sure. If u don't mind i'll ping u here in case u will forget
Sure
setMissileTarget does engine checks for target validity
Doesn't quote the important part, which is where _crateAllItems comes from.
But since recently you can bypass that with alt syntax
munition setMissileTarget [target, force]
Also don't scripted laser targets delete after a few seconds?
Oh 2.18. Does that mean I can, let's say use Macer to take down a soldier target?
Yeah but missile flies directly to target and ignoring obstacles. The question is how to tell missile to fly its cruise profile and then hit target ?
Haven't tried that but I had my AA missile follow flare object instead of the jet that dropped it
Not sure what you mean by profile, engine defined flight path for guided missiles?
Does it exist for cruise missile? If not, you'll have to do your own
Probably move that laser target in front of the missile for desired profile
https://community.bistudio.com/wiki/Arma_3:_Missile_flight_profiles#Cruise this tells that there is cruise missile profile
which works fine if u r using MK41 VLS
but in this case i want to spawn it on the fly and tell it to hit a target (flying over obstacles)
Hmm, perhaps its triggered by the engine on actual fire
Haven't touched any of this myself
What entity does the firing?
You can add VLS missile weapon and magazine with 1 ammo, do the fire then delete it
Plane, papa TU-95 from RHS
Didn't it also have some cruise missile already?
Yeah but its using performance-intensive script. RHS team wrote it in years when there was no cruise missile profiles
My guess is that you need missile fired from an entity for these profiles to work
For a test try just adding VLS weapon and magazine to it?
i'll try this one, sounds like a solution
yeah, moment
https://community.bistudio.com/wiki/Arma_3:_Simple_Objects -> Simple objects are ideal for decorative objects in situations where fully simulated and destructible objects are not required or we can sacrifice full simulation and destruction of some objects to get some performance improvements.
Can that be done from within TB or some config directly?
no success
Attach your laser target to dummy object.
If you look up from Zeus view , it will create your laser target, but it will delete it before your missile reached target .
Don't know why but x reason lasertarget get deleted if it's not attached
O_O. Yeaaah. This explains why I see the missile turning toward the target when launched but flying over the target. Let me try that
Im still confused. Ive now comprimised my script but still wasnt able to run it on the server.
And also your example is resulting into _marker1 = notColorOPFOR, so that means colorBLUFOR wich would mean that the area is captured...
Also || = and/ or
@warm hedge
It is not and or. It is or
And = &&
Both of my markers are "colorOPFOR" so _marker1 and _marker2 got the value "true"
Then Im checking if one or both _marker is "true" and receive the value "false"
dafuq
Please explain for a monkey
You shouldn't get false if either or both are true there, how do you even check it?
I check with the else cause and the system Chat
I get true if Im on in the editor. I only receive true on our server. But if I check the markerColor one by one. I receive = true
in both cases. So both markers are true
as you can see at the screenshot
Then probably both markers don't exist in the client that runs the script
hmmmm
thats a new perspective
Arent marker names always global?
I havent even thought about because
You are completely right! As Polpox said to me laser target should be on some object. I still don't understand why scripted laser objects are being deleted anyway.
Ty Sa-Matra for hint with adding weapon from MK41
How do you change marker colors?
Liberation does
Markers and their colors/texts/etc. can be local
How could I find and publish the marker to the rest of my machines?
You call any non-local set function on that marker.
The better idea would be to find out what these markers represent and use that as condition instead of markers
but yeah, don't pass information to SQF via markers. That's icky :P
They have got an variable in editor. Thats what Im already using
but any global set function on a marker broadcasts all information about that marker. Hence common creation code looks like this:
_mrkFinal1 = createMarkerLocal [format ["Arty%1", random 100], _pos];
_mrkFinal1 setMarkerShapeLocal "ICON";
_mrkFinal1 setMarkerTypeLocal "hd_destroy";
_mrkFinal1 setMarkerColor "ColorBlack";
If all the commands were non-local then it would broadcast all the information four times.
Find the code that changes marker colors in Liberation to see what it does
I think thats not efficient. I would rather change the course to an Liberation funciton wich checks the sectorOwnership
You could find it there too, or check all places that call that marker color change function
Hi
I see somewhere player shoot ai and in some pos of screen damage recived and name of bot who is player target
That was good with some display effect
Any guide?
But yeah you'll need a function that properly checks sector ownership rather than relying on UI info like marker color
But it only returns "TEST". That is prepared for the cause of an independant sector lol
Look at line 30 in the script
Ive used the example Ive writen down in there
If you mean you want to display body part hit and how much damage you did thats a rather complex task. You can get exact hit information using HitPart event handler which you add to targets (have to add it to all targets beforehand).
Doesn't it save previous ownership anywhere?
Previous? Why?
Ive also tried the "getNearestSector" function but it also returns only the kind of name of the marker that Ive already using in my script
So you can retrieve it and base other logic on it rather than looking up players and doing that logic
Thats also a cool idea. So I would build in another step that checks for a minimum distance to the player.
If this boolean fails the random genarator goes in again. So I could build up more dynamcly formed focus points
Im into testing with multiple preset functions of Liberation. But they are all not exact what I need.
I would combine some of them and would start with the F_getSectorOwnership to receive the current owner of predefined
capture zones in the near of the AA fortification I would like to spawn in.
Ive used the red_underlined code from my screenshot
The problem about is that I only receive "TEST" as return value...
But "TEST" value is defined for the resistance fraction, as you can see in line 30
How i can build a text hint style
For fade in and out with typer effect
I need use it for show damage recived by shoot
You can start with basic hint and parseText https://community.bistudio.com/wiki/Structured_Text
Otherwise create a display on UI with https://community.bistudio.com/wiki/cutRsc
hello, Is it possible to add a player respawn cooldown on a specific respawn position? For example, if a player respawns at base, prevent him from using that base again for 30 seconds. (I'm using BIS_fnc_addRespawnPosition)
im trying to do some basic elint sandbox stuff with the editor in the contact dlc, is there any documentation anywhere on how the radio stuff works? ive got the ability set up to place down a basic transmitter and have the player be able to detect it, but i cant for the life of me work out how to set up any more complex antennas (like the ldf base, or antennas on squads for deception). Theres clearly scripts there to set this stuff up like initAISquad, and preInitEM but its totally undocumented
surely in the 5 years since this dlc came out someones gone though this ane made like a really basic scenario, right?
https://forums.bohemia.net/forums/topic/224820-tutorial-contact-scripts/ ok this is working as a descent starting point, setting the squad id isnt working quite right yet ill fix that later
This may be a bit out there, but I might as well ask:
I am trying to use the tracer module from Zeus Enhanced in a script instead of manually plopping it down from zeus in order to choreograph a large firefight.
I've tried calling it directly ([test1, "LMG_Mk200_F", "200Rnd_65x39_cased_Box_Tracer_Red", [0, 1, 2], 2, test2] call zen_modules_fnc_moduleTracers;), and I've tried de-pbo:ing the module and putting the code in an SQF (manually assigning the QGVAR). In both cases, the invisible gunner spawns, but he only ever fires a single round towards the target. There are no players nearby to trigger {allPlayers findIf {_gunner distance _x < 100} == -1}, so that's not the issue.
Any ideas?
VoN is getting eventhandlers
oh yeah, sorry, it's from getMagazineCargo getItemsCargo getWeaponCargo commands
Noiceee
Is setVariable going to accept an array of player objects on βpublicβ param?
Like remoteExec
wdym?
I was tryna setVariable on an array or nearby players and it couldnβt be done
.
We already answer you that, why bother with it?
just do the easy way
don't create problems
it's not going to affect the performance
Yes no worries I donβt bother but itβd be cool to have added
so, where is the thing called from? is it client side (because of the player variable)?
client sided, yeah
what is SP_69 is going to do in your framework?
matter of fact I did delete it because I found another solution
it was supposed to be set to true whenever the player was speaking
why? what your goal on that?
This helped me
Just a little indicator over the surrounding players head when they talk
any case:
private _broadcastTo = nearestObjects[cameraOn, ["CAManBase"], 10];
{
player setVariable ["SP_69", true, owner _x];
}forEach _broadCastTo;
maybe
yeah but apparently owner command is only giving a valid return value when server sided
I'm sure there're multiple ways of doing that
it depends on how you set up your scripts
Just thought Id show something off for a change rather than asking for help
Developed a cool new feature im not entirely sure i've seen before. With these swing gates you can shoot out the two locks when they are locked via 3den/zeus (When the variable: bis_disabled_Door_x where x = door index number is set to 1) and once both are shot out the door pops open slightly to let you know its unlocked
Wow that's really cool
I wanna do smth similar with houses. I wanna make the doors slowly open whenever they get shot at
player addEventHandler ["FiredMan", {
params ["_unit", "_weapon", "_muzzle", "_mode", "_ammo", "_magazine", "_projectile", "_vehicle"];
if(_unit == _vehicle) then {
if(_unit ammo _muzzle == 0) then {
_unit addMagazine _magazine;
};
};
}];
Does this code works for vehicles as well?
Triggered when the unit fires a weapon. This EH must be attached to a soldier and unlike with "Fired" EH, it will fire regardless of whether the soldier is on foot or firing vehicle weapon.
https://community.bistudio.com/wiki/Arma_3:_Event_Handlers#FiredMan
Other than that I don't know what do you expect from that code
well, it isn't working for vehicles, but it's fine
if(_unit == _vehicle) then {
This will never return true and so your code will do nothing.
_unitis the unit the EH was added to. If they are not in a vehicle and they fire their own weapon,_vehiclecontainsobjNulland so your==returnsfalse. If they are in a vehicle and they fire the vehicle weapon,_vehicleis the vehicle they are in, but_unitis still the unit the EH was added to and so your==returnsfalse.
So i'd have to add a EH to the vehicle separately
That is one way to do it but it's not the only way. You could also modify this EH so that it works with vehicles as well. The problem is the code inside the EH, not how the EH inherently works.
It depends how you want it to behave. An EH on the vehicle is attached to that vehicle. It's specific to that vehicle; if you want to work on all vehicles, you'll have to add an EH to each of them. An EH on the unit is attached to that unit. You could use such an EH to affect any vehicle that unit gets into, and also affect the unit itself when outside any vehicle.
sounds perfect to me: nice Nikko: very good and clear info
the effect would remain after my player get out of the vehicle, for example?
If it's from getMagazineCargo then it's CfgMagazines. If it's from getItemsCargo or getWeaponCargo then it's CfgWeapons.
(getBackpackCargo is CfgVehicles, for completeness)
If you merge the results into one array then you're losing valuable info.
totally forgot about that, thanks
how is that?
I'm doing something like this:
(getMagazineCargo _crate) params ["_magsArray", "_magCount"]; // [["5MagsType1","10MagsType2"],[5,10]]
(getWeaponCargo _crate) params ["_weaponsArray", "_weapCount"]; // [["a", "b"], [3, 2]]
(getItemCargo _crate) params ["_itemsArray", "_itemCount"]; // [["5ItemsType1","10ItemsType2"],[5,10]]
private _crateAllItems = _magsArray + _weaponsArray + _itemsArray;
private _allCount = _magCount + _weapCount + _itemCount;
but now is working fine, I just added one more config check for Glasses
Hey folks!
Trying to get a screen to display a score, held in variable '_Score'. Using this code:
screen setObjectTexture ["Screen_1", "#(rgb,512,512,3)text(0,0,""Caveat"",0.3,""#0000ff7f"",""#ff0000"","_Score")"];
But I cannot figure out for the life of me how to get my '_Score' string variable to be displayed, due to the funky """" formating Any ideas?
You can use format
format ["%1",_score];
Already attempted that, but I believe I may have formatted the script wrong, as I get a 'missing ]' error. How do I fit that into
screen setObjectTexture ["Screen_1", "#(rgb,512,512,3)text(0,0,""Caveat"",0.3,""#0000ff7f"",""#ff0000"","_Score")"];
```?
You need use
"'Caveat"'
So " , ' , text, ',"
See quotes in quoted
private _string = "my string ""with"" quotes";
private _string = 'my string "with" quotes';
private _string = 'my string with quotes';
So double "" or ' in " "
Well it seems I missed that, sorry, througt there was a normal "issue" with quoting,
But did you get your _score shown?
With this variant it displays the given text 'Hello'
galleryScreen setObjectTextureGlobal [0, "#(rgb,512,512,3)text(1,1,""PuristaMedium"",0.3, ""#000000ff"",""#ffffff"", ""Hello"")"];
With this variant there is an error (Missing [) just before 'format'
galleryScreen setObjectTextureGlobal [0, "#(rgb,512,512,3)text(1,1,""PuristaMedium"",0.3, ""#000000ff"",""#ffffff"", "'format ["%1",_score];'")"];
With this variant there is an error (Missing [) just before '#(rgb,')
galleryScreen setObjectTextureGlobal [0, "#(rgb,512,512,3)text(1,1,"'PuristaMedium'",0.3,"'#000000ff'","'#ffffff'", "'format ["%1",_Score]'")"];
Apologies for the slightly different script; The main bits are the same, I just edited variable names and stuck a 'Global' on setObjectTexture. I don't believe this changes anything, as the top line still works.
private _score = 1;
galleryScreen setObjectTextureGlobal [0, format ["#(rgb,512,512,3)text(1,1,""PuristaMedium"",0.3, ""#000000ff"",""#ffffff"", %1)", _score]];
Ahhhhhhhh, I understand. I hadn't thought to treat the whole thing as one big string. I'll test it out, cheers!
Sweet, works as intended. Cheers!
In case others wish to do something similar in future, here's my full code. Put it inside the 'Hit' event handler.
private _score = (galleryScreen getVariable ["_score", 0]) + 1;
galleryScreen setVariable ["_score", _score];
galleryScreen setObjectTextureGlobal [0, format["#(rgb,512,512,3)text(1,1,""PuristaMedium"",0.3,
""#000000ff"",""#ffffff"", ""%1"")", _score]];
galleryScreen is the screen you wish to display the score on. Critiques of my method welcome.
Gooood morning!
Im into remoteExec (my worst nightmare)
I still need to practise this more and need to find more out.
So Im here to ask you how I remoteExec an "createMarker" command global for everybody.
I dont know if Ive did the order syntax right, I basicly just packed the whole command in an string
you don't. Createmarker has a global effect already.
In the future you can check the commands locality on the biki
Thats a really lovely information
But Ive now got the problem that I cant see the marker after creating it like Ive did on the
screenshot Ive attached to my message.
Also the camera drive wont happen. I think "remoteExec" will help me a lot in this case
Dont just remoteExec without an exact reason why you need it
Good call
I think it can go out of controle fast
But why cant I see the createMarker wich executes itself global automaticly
- You didn't execute it
- You already have a marker with same exact name
If you create marker with same name again I think it just gets ignored
If I copy the part of my script and launch it in server debug:
Server -> Nothing
Global -> Marker
Thats what confusing me
Remove the 1 at the end of the line
The creator?
Actually let me ask this, do you want everyone to see the marker or only specific players/sides?
If you want everyone to see it, then yeah just remove it
I want to bring it up to the BLUFOR players
Ah, and this script is being executed by who?
By a further script wich launches this one in server space
I believe it being executed as server with the creator of 1 is your issue.
Iirc 1 indicated the creator is side, meaning it is visible to all players on the side of the person executing the script
Were wrong
Were talking about the channel. Its placed in side channel.
There is no creator defined. Im using default creator lol
Lol, my 3AM brain is failing haha
btw check your dms
But why is my global command not visible if I execute it in server space?
This one? Probably because when executed on the server, the side channel is for...I dunno, sideLogic or something, so you don't see it. When executed globally (on every machine), there are many copies, and at least one of them was created on your machine, where the side channel belongs to your side and you have access to it.
does anyone know why this wouldn't be able to close the inventory with tab. awhile ago I found a post on the forums I think that had a console debug script to close the inventory with tab but i cant find that post any where prob cause the forums are down so im left to make my own. this code was generated with chatgpt but it does work for all other keybinds but TAB any help would be nice.
waitUntil { !isNull findDisplay 46 }; // Wait for main display
(findDisplay 46) displayAddEventHandler ["KeyDown", {
params ["_display", "_key", "_shift", "_ctrl", "_alt"];
// Tab key (key code 15)
if (_key isEqualTo 15) then {
if (!isNull findDisplay 602) then { // 602 = Inventory display
(findDisplay 602) closeDisplay 2;
hint "Inventory closed";
};
};
false
}];
Add EH to display 602, not 46.
There is a scripted eventhandler which you could use.
https://community.bistudio.com/wiki/Arma_3:_Scripted_Event_Handlers#BIS_fnc_arsenal
https://community.bistudio.com/wiki/BIS_fnc_addScriptedEventHandler
And if you search "arsenalOpened" from this community, you will find some examples that other ppl has done
Hi, is there a script to paradrop any vehicle on the map ? Even with the crew if possible
I have a module for this in Modules Enhanced
Hey guys, not sure if this is the right channel, but I've been struggling with a weird issue - whenever I make edits to the mission scripts they're not recompiled at runtime for whatever reason.
I tried saving multiple times, but the only thing that could help - resaving missions with a different name, copying all the scripts and running it in 3den. I'm not sure if it's a bug with Arma or some mod. Did anyone happen to have this kind of issue?
Basically what happens is Arma runs the last iteration of the script and whatever changes I make to the script are ignored
Is the mission folder in a cloud drive?
Nope, local
Also if I wait long enough in the editor - it eventually runs the up-to date scripts
Yes
How do you run the script?
Trigger
execVM?
Yep
Can you check with loadFile if the content is up to date?
Seems to be up to date in 3den
Then it should work.
I have problems with object (repair station) jumping around at the beginning of the mission, sometimes it moves around 10 m until it stops, wtf π΅βπ« map is Sefrou Ramal
Just had the same issue, checking with loadFile shows a different content
Running loadFile later (about 2 minutes later) shows correct content
Making an edit and immediately checking with loadFile shows correctly
It seems there are times when Arma can't keep up with edits, very weird
Known issue.
like this?
waitUntil { !isNull findDisplay 46 }; // Wait for main display
(findDisplay 602) displayAddEventHandler ["KeyDown", {
params ["_display", "_key", "_shift", "_ctrl", "_alt"];
if (_key isEqualTo 15) then {
if (!isNull findDisplay 602) then {
(findDisplay 602) closeDisplay 2;
hint "Inventory closed";
};
};
false
}];
waitUntil display 602, too
also the nullcheck is useless π
this better? it returns -1 in debug console
waitUntil {findDisplay 602 }; // Wait for main display
(findDisplay 602) displayAddEventHandler ["KeyDown", {
params ["_display", "_key", "_shift", "_ctrl", "_alt"];
if (_key isEqualTo 15) then {
if (findDisplay 602) then {
(findDisplay 602) closeDisplay 2;
hint "Inventory closed";
};
};
false
}];
waitUntil {!isNull (findDisplay 602)};
I meant the 2nd nullcheck is useless, don't, use _display
something like that```sqf
waitUntil { !isNull findDisplay 602 }; // wait for main display
(findDisplay 602) displayAddEventHandler ["KeyDown", {
params ["_display", "_key", "_shift", "_ctrl", "_alt"];
if (_key isEqualTo 15) then
{
_display closeDisplay 2;
hint "Inventory closed";
};
false;
}];
still getting -1 on return
inventory or arsenal?
inventory
player addEventHandler ["InventoryOpened",
{
[] spawn {
waitUntil { !isNull findDisplay 602 };
(findDisplay 602) displayAddEventHandler ["KeyDown", {
params ["_display", "_key", "_shift", "_ctrl", "_alt"];
private _handled = false;
if (_key isEqualTo 15) then
{
_display closeDisplay 2;
_handled = true;
};
_handled;
}];
};
}
];
this worked thank you vary much for the help and to everyone else that helped.
this code worked for me
but Weiss' code is better structured
exitWith doesn't work in EH, it will still return false - use else
I need to put a pause in between these two functions. Would sleep be the best choice like so?
if (alive _leader && _leader != _scout && _leader in units playergroup) exitWith {
["playersspotted", [_leader, _scout]] remoteExec [
"FoxClub_fnc_Conversation",
allPlayers select { _x distance _leader <= 100 }
];
sleep 5;
if (_leader distance _scout <= 100) then {
["bombplantedScout", [_scout]] remoteExec [
"FoxClub_fnc_Conversation",
allPlayers select { _x distance _scout <= 100 }
];
};
};
yes, unless you are in an unscheduled* environment
Still wrapping my head around that. The code is in an EH initServer.sqf if that matters.
Happy days!
is any1 able to assist me with this issue
if needed i can stream and show you the other scripts i have
Does anyone here have any experience creating respawn templates with adding to the normal menu system that menuInventory and menuPosition use?
well, it's pretty clear
it says the function is not defined
could it be something named improperly
the files seem good, it could be a lack of config
could you elaborate
http://i.imgur.com/wXmOnWi.png adding extra tabs to this with custom systems is what I mean. Or just a gamemode that already does something like that. I'm trying to do it myself now and I can't figure out why the hell it doens't work.
did you define them in CfgFunctions?
:D
I⦠think so?
see https://community.bistudio.com/wiki/Arma_3:_Functions_Library to be sure ^^
after long enough you begin to become a wiki dependent
I need this condition to work on a dedicated server. What could I use instead of player?
if (player != (_this#0)) then { playsound "talkradio"; };
depends
what would be the trigger, any non-player?
Basically it will playsound for any human player that isn't _this#0 (which is a unit called in my function that could be human or AI).
in doubt use allPlayers and use some commands to filter the players like select
Which of these two options is preferable if so?
allPlayers can return headless clients, BIS_fnc_listPlayers returns all player units
if you aim your function to be called right you don't need to check that
(alive or dead though)
private _allPlayers = call BIS_fnc_listPlayers;
_allPlayers - [_this select 0];
["talkRadio"] remoteExec ["playSound", _allPlayers];

Oh I see now. So if I want to do it without the bis_function, can I do it?
allPlayers - [_this select 0];
Btw the function is already remoteExec so this might double up things?
["generalfled", [HQRadio, leader playergroup]] remoteExec ["FoxClub_fnc_Conversation"];
So I think this will be remoteexec
if (allPlayers - [_this select 0];) then { playsound "talkradio"; };
wat
Lol I'm doing a poor job of explaining the full picture.
the function is already
remoteExec
then you haveparams ["_unit"];available right?
maybe not? Here is the function
params ["_convo", "_speakers"];
{
_x setVariable ["foxclub_var_isTalking",true];
} forEach _speakers;
private _conversationData = foxclub_var_conversations get _convo;
{
_x params ["_speakerIndex","_text","_sound", ["_delayAfter", 0], ["_customCode", {}]];
private _speaker = _speakers select _speakerIndex;
if (isNull _speaker) then { _speakers spawn _customCode; sleep _delayAfter; continue };
if !(alive _speaker) then { break };
_speakers spawn _customCode;
private _sound = _speaker say3D _sound;
_speaker customChat [FOX_DialogueChannel, _text];
_speaker setRandomLip true;
waitUntil {isNull _sound};
_speaker setRandomLip false;
sleep _delayAfter;
} forEach _conversationData;
{
_x setVariable ["foxclub_var_isTalking",false];
} forEach _speakers;
I'm having a hard time explaining because I don't fully understand it myself. It something NikkoJT wrote for me. I'll just mess around with it. I think one of the options yall gave will get me there.
I'm testing this in SP right now (will do MP later) and it's not filtering out the player it should. So then I changed it to
private _allPlayers = call BIS_fnc_listPlayers;
_allPlayers - [leader playergroup];
["talkRadio"] remoteExec ["playSound", _allPlayers];
But it's still playing the sound talkRadio for me. And I'm the leader of playergroup, so shouldn't I be removed from _allPlayers?
- / - return new arrays, not modify them in place
long time I did SQF apparently π
private _allPlayers = call BIS_fnc_listPlayers;
["talkRadio"] remoteExec ["playSound", _allPlayers - [_this select 0]];
Ah okay yeah it's doing what I said before where it's going to play the file twice because the function gets remoteExec too. So that code you provided also is getting remoteExec.
So my solution is I need to find a way to do what you just wrote without remoteExec.
if it is already remoteExec on clients, use player
I was told I can't use player on a dedicated server.
But maybe that's just for conditions? And not code elsewhere?
You cannot use player on the dedicated server machine because the DS machine has no player unit. It just returns objNull.
You can use player on player clients that are connected to a dedicated server. They have player units and player will return their player units when executed on the clients.
listen to NikkoJT
he has a wiki account
Ahhh this is going to help so much. Thank you all!,
Hey all - I was wondering if there is a smart way to return if a player is being shot at
Like I said, if you're using that then you're doing it wrong.
The config of the item is already known from where you get it from.
not using it, I just found out
Never try to do this with backpack/weapon, because they actually do collide in some modsets.
magazine/weapon probably never does.
why :/
oh sorry, not native speaker here haha I'm not going to use it*
item/weapon => CfgWeapons, magazine => CfgMagazines.
I'm going to script a thing for all sorts of items I mean
yes I'm already doing this, I was thinking if there was a way to get the path into a variable to get "displayName" and all of that
It says only damage - I am looking for shots going around the player
FiredNear maybe, check the EH list
how can i use nearEntities to find nearby corpses in a radius? syntax 3 doesn't seem to have radius.
you'd pass in [pos, radius, radius] as the left-hand parameter.
not necessarily faster than starting from allDeadMen, although I don't know if that's a fast command.
haven't heard of this command yet. but looking at it I dont need to check the whole map for dead, only a small area.
yeah but you can do allDeadMen inAreaArray [pos, radius, radius]
And inAreaArray is fast.
are you able to make an area in code rather than editor?
like that, yes.
Ohh I see
Anyone has any sample code / reference for an audio (playMusic / playSound3D) being jip compliant? (i.e. the jip player must hear the audio based on the audio's runtime and not from the beginning)
Don't have any sample, just thinking about it. Remote executing playMusic on player join, sending played time as parameter should do the job.
so I have a small question to. Does this work the intended way? -> init.sqf : isHC = false; if (!hasInterface && !isServer) then {isHC = true}; -> some script that gets called global : if (isHC or {isServer}) then {hint "yay"};
so when a hc is present only hc will execute it. if a hc is not present only the server executes it. client never executes it?
I'm looking for a solution to the problem that the settings for group indicators and friendly name tags are active on the dedicated server, but I don't want them to be displayed on my client. i tried something with a config mod but that is not a good solution. when i switch the settings the change is instant active so i thought a3 would save this maybe into a variable inside the uiNamespace and check this every frame to choose to display group indicators and nametags but i did not found anything in uiNamespace, localNamespace, profileNamespace. Anybody has an idea how this could be solved? thank you
Difficulty settings are engine driven sadly.
Problem was adding new template and showing it in the same, not using one of the existing templates. Was testing MP though and description.ext didn't reload properly apparently so that ended up being the problem
ok sorry. didn't get your question right ^^
i'm not ready yet to accept that i can not solve this with sqf but maybe i have to stick with my config solution. Thank you R3vo for your reply
@placid root In the bit you posted the server would also execute it whenever there is a HC present.
ok. i thouht the conditions are met as soon as ishc is true.
and {isServer} will never be called
Actually that's a good point ye
Function for executing stuff on HC id present or server if not: ```/*
Author: Kingsley
Description: Execute given code on either the headless client or on server depending on which is present
Parameter(s): CODE - { ... } or string code
Returns: Spawned code handle
Example _handle = { hint "Ran on HC" } call ARC_fnc_execHC;
*/
if (typeName _this != "STRING" && typeName _this != "CODE") exitWith { diag_log "The argument(s) specified in ARC_fnc_execHC are not of type STRING or CODE." };
private "_handle";
_handle = _this spawn {
private "_code";
_code = if (typeName _this == "STRING") then {compile _this} else {_this};
if (!isNil "HC" && isMultiplayer) then {
if (!isServer && !hasInterface) then {
call _code;
};
} else {
if (isServer) then {
call _code;
};
};
};
_handle
requires HC unit to be called HC
kingsley quicktip
_this isEqualType ""
is faster then typeName _this == "STRING"
ah okay cheers
New command.
So rather than putting something like STRING or ARRAY you just put the actual thing like "", [], 0?
Yes
Alrighty
player isEqualType objNull
and my stuff does not work?
@placid root on the server isHC would be false, meaning that it would still check isServer which is true, so it would still execute no matter what.
damn you're right ...
You need a check on the server if the HC exist, kingsleys isNil "HC" does that, but you can also use something like
if (!hasInterface && !isServer) then { hcPresent = true; publicVariable "hcPresent"; };
In case you don't have named HC
if ((!hasInterface && !isServer) || {hcPresent}) then { };
Obviously you gotta make sure you only execute that after the HC had a moment to set the variable, so just naming it and using kingsley function should do whatever you want
puhh ok. give me a minute to get through the code π
okay edit doesn't work. need !hcPresent && isServer in the bit i send :p
I was checking my mission for dependencies and found this CBA - Joint Ammo Magazines. What did I do to have this dependency?
You had CBA loaded and your mission.sqm contains weapons it modifies
I have CBA loaded because it's needed for ADT I think or ZE. Since I don't recall using it to modify weapons, what is the way to go about removing the dependency? Systematically delete unit inventories until it's gone?
You don't use it to modify weapons, it's part of what the mod does. It changes weapon config to add its common magazine wells; this means the weapon has CBA as a dependency while it's loaded.
If your mission uses ZEN, then your mission will require CBA anyway and you shouldn't worry about removing this dependency.
Normally Zen is a thing you use for testing/admin, not a mission requirement. In that case just manually delete the dependency from the SQM file.
Oh, mission needs to not be binarized.
I vaguely recall CBA adding some other shit too though.
Like script snippets.
ZEN isn't listed as a dependency for me in this list. I just use it for testing.
If I don't use CBA for anything in the mission I figured why have it?
Save mission without binarization, open as text file, search for CBA.
At least they tag everything properly :P
One mention of "cba_jam_vn", like my picture. 44 mentions of
if (isNil 'CBA_fnc_setCallsign') then { _this setGroupID [_value];} else { [_this, _value] call CBA_fnc_setCallsign;
yeah I remember that one.
upload script message is constantly showing, cannot use Discord normally
So my solution is before I publish the mission just load into the editor without CBA and save as, then Im good?
shrugs
The setCallsign code doesn't actually introduce a dependency.
If the function doesn't exist then it just runs setGroupID instead.
So it sounds like manually stripping the dependencies out of the SQM should be easy enough.
Am I to understand you mean to delete all these mentions in the .sqm? Then open the file in the editor and see if there's a dependecy like in my screenshot?
You can leave the setCallsign ones.
The actual dependency is stored in addons[] near the top. But if you remove that then you'll need to remove the related items too or something will break.
Okay thanks. As Nikko said it seems CBA is just modifying while it's loaded. I didn't actually do anything with the weapons. So in this case it sounds like I should be OK.
are dead players existing objects ? π€
corpses are objects. And entities.
yeah but if corpse disappear before respawn?
Then the player probably doesn't have an object. Test it.
I've been updating my holdAction conditions now to use toString, but some of my old ones are working just fine with code in the string part
"_this in (crew _target) && !scubaEquipped && ActionSCUBA",
Why did the below not work, but the above does?
(missionNamespace getVariable ['ActionSTABTimeBombs', false]) && (vehicle _caller != ptboat)
I think it's easier to launch game without any unwanted mods and save the mission, it will remove any unwanted depedencies automatically.
Like JSRS always adds itself as dependency while it's not required at all
Now that I remember more I think CBA is needed for EdenEnhanced. That's probably why I load it.
I don't even know if Im using the features it has but a tutorial I watched a year ago said it was a good idea.
@granite sky tested, seems like players are always !isNull
with strings or using toString will work fine, it's just better to read with the command
The second example gave me an error "code, expected string" or something like that IIRC. It's like if I use some code it'll work but not too much lol. Im sure that's not how it works but I can't explain it otherwise.
Sometimes I get this error too, but it's not related by using the command or not, it's something in the code that is wrong
check the last rpt file for silent/masked errors
objectParent _this != ptboat
Because you are using _caller in condition , which is not present in condition params.
conditionShow: String - (Optional, default "true") condition for the action to be shown. Special arguments passed to the code: _target (action-attached object), _this (caller/executing unit)
So I can write whatever code I want in there except _caller?
No, there are other limitations. You can't use any other variables that aren't defined in that context. You can't use suspension. Your code must eventually return true or false.
Not being able to use _caller isn't some special "you can't use a variable named _caller" rule, it's literally just that no variable named _caller is automatically created, and your code assumes one exists.
Is this the best way to write this? I noticed that code B is repeated, so I thought maybe there is a way to restructure it?
if (conditionA) then {
// code A
} else {
// code B
};
if (conditionB) then {
// code C
} else {
// code B
};
That's what functions are for
So make a function are place code B in it?
Its only like 10 lines of code if that matters
If it's going to be used elsewhere as well, you can make a full function for it.
If it's only used here, you could use a private variable. The function won't be available to other scripts, but you won't need to do CfgFunctions.
But why is code B repeated in this system? What if conditionA is false AND conditionB is false? Is it meant to be run twice?
The best would be if conditionA is met to exitwith all of it. But I need that else for conditionA.
The condition filters out a leader for a group. There should always be a leader I think?
So one of them should fire.
But thats why I wish I could use exitwith because if conditionA fires then no need to run condition B.
Or just use a switch, assuming you don't want codeB to run twice
switch (true) do {
case conditionA: { codeA };
case conditionB: { codeC };
default { codeB };
};
If you've only got these two conditions and B can be discarded if A fires, you can also try putting B inside the else for A
Guys, the hashmapObject is a bit ridiculous.
_class_a = createHashMapFromArray [
["#type",["a"]]
];
_class_b = createHashMapFromArray [
["#base",_class_a],
["#type",["b"]]
];
_class_c = createHashMapFromArray [
["#base",_class_b],
["#type",["c"]]
];
(createHashMapObject [_class_C,[]]) get "#type";
//["c","b","a"]
(createHashMapObject [_class_C,[]]) get "#type";
//return ["c","b","a","b","a"]
If #type is an array, every time I create a hashmapObject, it will stack on top of the previous ones like described above.
But if #type is a string, rpt will write some garbage information.
Bad conversion: array
β₯ Context: [] L81 (DBUG\functions\console\exec\fn_exec.sqf)
[] L81 (DBUG\functions\console\exec\fn_exec.sqf)
[] L16 (new_1.sqf)
<- [] L23 (/DEV_TOOLS/functions/general/fn_addSchd.sqf)
[] L76 (DBUG\functions\general\EHs\fn_eachFrame.sqf)
[] L65 (DBUG\functions\general\EHs\fn_eachFrame.sqf)
[] L68 (DBUG\functions\general\EHs\fn_eachFrame.sqf)
[] L77 (DBUG\functions\console\exec\fn_exec.sqf)
[] L80 (DBUG\functions\console\exec\fn_exec.sqf)
This might be what I'm looking for. So does codeB run if condition a or b are true?
In my case they both shouldnt be true. But what would happen if they are? Code B runs twice?
No, in that example codeB runs if neither are true
Dang.
Look at the structure. There is a case for when each condition is true, and then a default case. Under what circumstances do you think a default case might be used?
Always?
Oh it's like a backup if none fire.
Tried this way you mentioned. I can't do it like this because if my scout is the leader he will never get to speak. It seems like the best way is to use a private variable like you mentioned before. I'll try that out.
if (leader !scout) then {
// leader speaks (not scout)
} else {
// pick random unit to speak
if (leader scout) then {
// scout speaks
} else {
// pick random unit to speak
};
};
Base needs to be deep copied or your member variables will be combined with parent classes
Wait, why is this even a thing that needs multiple conditions and shit?
It should be simple. If the leader is the scout, the scout speaks. Else pick a random unit to speak. That's one if else.
What are you actually trying to do here that's not covered by a single if else?
Very effective! Iβve got another question.
How do I override a base class method?
_class_a = createHashMapFromArray [
["#type",["a"]],
["@method",{}]
];
_class_b = createHashMapFromArray [
["#base",_class_a],
["@method",{
// Can't get #base here
private _base = _self get "#base";
private _baseMethod = _base get "@method";
call _baseMethod;
}]
];
Like in the example above, I can't access #base, so I had to write it like this:
_class_a = createHashMapFromArray [
["#type",["a"]],
["@method",{
systemChat "parent";
}]
];
_class_b = createHashMapFromArray [
["#base",_class_a],
["_base",_class_a],
["@method",{
private _base = _self get "_base";
private _baseMethod = _base get "@method";
call _baseMethod;
systemChat "children";
}]
];
Is there really no way to directly access #base? This feels a bit messy.
Maybe it's because the data type of #base is an array or hashmap. Since arrays are mutable collections, could #base be hidden for that reason?
Can't be made final like a hashmap with compileFinal.
You're supposed to use createHashMapObject to create hashmap object. You just have bunch of regular hashmaps
(createHashmapObject [_class_b,[]]) call ["@method"];
There is no super, but you can call the next base class method first externally
Hmm, maybe #base just causes child object to have all pairs from parent rather than storing parent object in #base
Also, I would not have any local hash objects if making systems with them. I would treat them globally for easier reference elsewhere later
If all pairs from parent were in #base then you would have to use get twice to do anything with them
So overriding means removing original value
Alright, looks like there's no other way then.
I'm using it to write UI controls.
["_newindex",0],
["_isShowing",true],
["@toggle",{
FLOG("toggle");
private _isShowing = GPROP("_isShowing");
SPROP("_isShowing",!_isShowing);
METHOD("@resize");
}],
["@addChildCtrl",{
params ["_childCtrl"];
private _result = _this call BASEMETHOD("@addChildCtrl");
if !(_result) exitwith {false};
METHOD("@resize");
true;
}]
```
Just to be clear I'm guessing how it may work. So it may not be true
Because mainly I want the leader group to say the voice line. He is American and speaks English. But there could be a situation where leader group ends up being scout. Like, if someone dies, then now the scout is leader group. The scout is Vietnamese and speaks broken English, and has different voice lines.
When I do the voice recording, it wouldn't make sense to have the scout saying American voice lines. So I have an if statement for all the convos to filter out if the scout is speaking or the American.
But since players can be separated on the map. I need a backup in case the scout or the american aren't in the area. In that case who says the line is chosen randomly from units in the trigger area.
There are 8 total characters but its would be too hard to give them each their own personality and such. So I scoped it down to two characters. American leader and scout. Sure, it would break continuity to have the leader's voice be switching between 7 americans (based on who is the leader of the group) but it's the best compromise I can think of.
You can do this with if structures and you don't need to have any duplicate code. You just need to think about it logically.
There are a few ways you could implement it; here's one:
private _units = units _group inAreaArray ...; // some inAreaArray to find who's in the area
private _speaker = selectRandom _units;
private _convo = "americanLines";
if (_scout in _units) then {
_speaker = _scout;
_convo = "vietnameseLines";
} else {
if (_american in _units) then {
_speaker = _american;
};
};
[_convo, _speaker] call fox_fnc_convo ... // I don't remember the exact syntax for this but you know what it is```
I think I have a use for something like this, even if it's not exactly what Im trying to do in this specific case.
It is exactly what you just told me you're trying to do in this specific case :U
I'm probably explain myself poorly. I will modify your code then I think it will be more clear.
Here's what I got so far. This should prioritize the american leader for the voice line. Then give it to the scout if he's not there. And finally give it to a random american if either the american leader or scout arent present.
private _units = units _group inAreaArray ...; // some inAreaArray to find who's in the area
private _speaker = selectRandom _units;
private _convo = "americanLines";
private _americanLeader = leader playergroup;
if (_americanLeader in _units) then {
_speaker = _americanLeader;
} else {
if (_scout in _units) then {
_speaker = _scout;
_convo = "vietnameseLines";
} else {
// code to somehow choose an unit that isnt the leader or scout
_convo = "americanLines";
};
};
[_convo, [_speaker]] remoteExec [
"FoxClub_fnc_Conversation",
allPlayers select { _x distance _speaker <= 100 }
];
I already see some issues here. I'll try it again.
Nevermind Im stuck.
You can use speaker to return the unit's voice class name, like "male01ENG", and then you'll know what voice they originally used.
You've just modified the code to try to make it do something that it was already doing
Go back and read the original code again
private _speaker = ...
private _speakerClassName = tolower speaker _speaker;
private _convo =
switch (true) do {
case "eng" in _speakerClassName :{
//speak english
};
case "fre" in _speakerClassName :{
//speak freach
};
default {...};
};
[_convo,_speaker] call ...
They want to prioritise specific character units, whose languages are already known. This is a handy trick in general but it's not necessary in this context.
Ok I'll read it again. I modified it because I thought it's not going to do what I wanted. Let me look again. It seemed to me preference was given to the scout instead of he american leader.
OK sure, so those two were backwards, but that's an easy switch, you just change the variables being referenced in each case. It's not a structural problem. That's not what I'm talking about.
Okay I see now that it finds the unit I want it to in the else portion. So if the _americanLeader is in area, he would get the line. What I dont see is a case where his line is given to anyone else in the area should he (or scout) not be present.
Oh wait. I might get it.
If the leader is not in the array, then its given to a random unit in the group?
No nevermind that wouldnt happen because the condition can only be true if the american leader is in the area array
Yeah, I'm stumped.
Follow each reference to _speaker and see under what circumstances it can change, and what it changes to
Ok. Doing now.
π€― If neither condition is true, then the original private _convo = "americanLines"; runs along with private _speaker = selectRandom _units;
So then the function calls a random unit to say the american line!
And it wont be the scout or leader else one of the conditions would have fired!
Wow, I'm impressed with how you and others here seem to think in different dimensions.
Okay so now I will clean it up to give preference to the leader. And try to complete the array check.
Here is the code now.
_scout = missionNamespace getVariable ["scout", objNull];
_leader = leader playergroup;
private _units = units playergroup inAreaArray pilot_trigger; // why not inArea? I've used that one before.
private _speaker = selectRandom _units;
private _convo = "americanLines";
if (_leader in _units) then {
_speaker = _leader;
} else {
if (_scout in _units) then {
_speaker = _scout;
_convo = "vietnameseLines";
};
};
[_convo, [_speaker]] remoteExec [
"FoxClub_fnc_Conversation",
allPlayers select { _x distance _speaker <= 100 }
];
_leader = leader playergroup;
You said sometimes the scout could be the group leader. If the scout is the group leader, this will result in them being picked even if the American is available but not the leader.
why not inArea? I've used that one before
Look upinAreaandinAreaArrayand see what the difference is between how they work. It should be easy to see whyinAreais not appropriate for this use.
Oh right, so I need to filter out the scout:
_scout = missionNamespace getVariable ["scout", objNull];
private _allPlayers = call BIS_fnc_listPlayers;
_playergroup = _allPlayers - _scout;
_leader = leader _playergroup
private _units = units playergroup inAreaArray pilot_trigger;
private _speaker = selectRandom _units;
private _convo = "americanLines";
if (_leader in _units) then {
_speaker = _leader;
} else {
if (_scout in _units) then {
_speaker = _scout;
_convo = "vietnameseLines";
};
};
[_convo, [_speaker]] remoteExec [
"FoxClub_fnc_Conversation",
allPlayers select { _x distance _speaker <= 100 }
];
_playergroup = _allPlayers - _scout;
_leader = leader _playergroup;```
You can't do this. `leader` returns the leader of a _group_. It's not for using on arbitrary arrays of units. Who do you think is the `leader` of an array?
If it matters which American you pick, you need to identify the priority American specifically and reference them specifically. Stop hanging onto `leader` if the group leader could be someone else.
If it doesn't matter which American you pick, then this could be substantially simpler.
Thematically, it makes sense for the group leader to be saying these lines. That person controls the AI so they are a leader of sorts anyway. Also, by choosing the leader of the group it adds some continuity.
Since I have 100's of lines, it wouldn't make much sense for a random American in the squad to be barking orders throughout the mission. But if it's always the leader of the group then it kind of makes sense, even if the leader gets tossed around a time or two during the mission.
So I could specifically say the leader is _leader = missionNamespace getVariable ["commander", objNull];
But then I open a can of worms if the leader has changed by the time the code runs.
If I'm hitting the limits of what the system can do then I accept that and randomization is what's left.
If it's more important that it be the group leader than that it not be the scout, then _leader = leader playergroup is fine
If the scout is the group leader, it will prefer the scout (because they are the group leader).
Your original phrasing made it seem like there was a specific "leader" character, separate to the mechanical group leader, who should be prioritised. If that doesn't really matter then that's not an issue.
Yeah its fine for the scout to be the group leader. All do is give them unique voice lines. I just dont want the voices line to get crossed up if that makes sense. If he is the leader he has to say his line.
Yeah but like you said here could result in the scout saying an american line, no?
Yeah that's a point actually
OK then we just...
_scout = missionNamespace getVariable ["scout", objNull];
_leader = leader playergroup;
private _units = units playergroup inAreaArray pilot_trigger;
private _speaker = selectRandom _units;
if (_leader in _units) then {
_speaker = _leader;
} else {
if (_scout in _units) then {
_speaker = _scout;
};
};
private _convo = ["americanLines", "vietnameseLines"] select (_speaker == _scout);
[_convo, [_speaker]] remoteExec [
"FoxClub_fnc_Conversation",
allPlayers select { _x distance _speaker <= 100 }
];```
maybe I'm bit off, but you could try to use this EH https://community.bistudio.com/wiki/Arma_3:_Event_Handlers#LeaderChanged case the leader changes, then you could check the unit, etc.
I'm not sure what that would do for us in this situation

Im trying to break this line down private _convo = ["americanLines", "vietnameseLines"] select (_speaker == _scout);
It is one variable assignment (I assume you know how that works), one command, and one logical comparison operator (I'm pretty sure you know how == works too).
ima go read select brb
I think this is syntax #2, boolean
https://community.bistudio.com/wiki/select
Okay I get that. But if the first if condition isnt true speaker isnt defined and would throw an error
_scout = missionNamespace getVariable ["scout", objNull];
_leader = leader playergroup;
private _units = units playergroup inAreaArray pilot_trigger;
private _speaker = selectRandom _units;
if (_leader in _units) then {
_speaker = _leader;
} else {
if (_scout in _units) then {
_speaker = _scout;
};
};
private _convo = ["americanLines", "vietnameseLines"] select (_speaker == _scout);
[_convo, [_speaker]] remoteExec [
"FoxClub_fnc_Conversation",
allPlayers select { _x distance _speaker <= 100 }
];
Accidentally removed the selectRandom line when moving something else
Ima test this now. I think it's gonna work!
Wait I can make this more complicated! Now there can be a response to the _speaker.
_scout = missionNamespace getVariable ["scout", objNull];
_leader = leader playergroup;
private _units = units playergroup inAreaArray pilot_trigger;
private _speaker = selectRandom _units;
private _responder = _scout;
if (_leader in _units) then {
_speaker = _leader;
} else {
if (_scout in _units) then {
_speaker = _scout;
_responder = _leader;
};
};
private _convo = ["americanLines", "vietnameseLines"] select (_speaker == _scout);
[_convo, [_speaker, _responder]] remoteExec [
"FoxClub_fnc_Conversation",
allPlayers select { _x distance _speaker <= 100 }
];
OK, now what happens if the scout is the leader? (and the scout is present in the area)
Or what happens if the responder (be it the scout or the leader) is outside the area, or worse, outside the range used for the remoteExec targeting?
Oh yeah I would have to do a _leader distance _scout <= 100 check so it makes sense they are talking to each other.
Still working on your first question
Okay so for the first question the scout would end up speaking to the scout. Not good.
As for the second question then if the responder is outside the range of the remoteexec then it looks like hes talking to no one.
And if I put that distance check somewhere then _responder could be nil or objnull in the remoteexec which would throw an error
Ok heres an idea. Would it be possible to find the opposite of _speaker? Then that could be responder?
I think you shouldn't get an error if you target objNull in remoteExec. I think it will silently fail. Or you should have checks to make it silently fail.
Okay like defining it as objNull before in case of never being definded through the conditions?
Whew, my brain is fried. Ima sleep on this and hit it again tomorrow!
you still putting this on github?
`//init.sqf
hcPresent = false;
if (!hasInterface && !isServer) then
{
hcPresent = true;
publicVariable "hcPresent"
};
//in a script executed global
if ((!hasInterface && !isServer) || {!hcPresent && isServer}) then { };
/*
hc present
hc -> true
server -> false
client -> false
hc not present
server -> true
client -> false
*/`
this should work, i think
Regarding the implementation of calling super methods in hashmapObject:
_class_A = createHashMapFromArray [
["#type","A"],
["@method",{
params ["_whatever"];
systemchat str _whatever;
}]
];
_class_B = createHashMapFromArray [
["#type",["B"]],
["#base",_class_A],
["__base",_class_A]
];
_class_C = createHashMapFromArray [
["#type",["C"]],
["#base",_class_B],
["__base",_class_B],
["@method",{
params ["_whatever"];
private _currPrototype = _self;
private _types = _currPrototype get "#type";
for "_i" from 0 to (count _types) - 1 do {
if !("__base" in keys _currPrototype) exitWith { diag_log ("method not exist")};
private _cache = (_currPrototype get "__base");
_currPrototype = _cache;
if !("@method" in keys _currPrototype) then {continue};
breakWith (_this call (_currPrototype get "@method"));
};
}]
];
Could also be defined as a macro:
#define SUPER_METHOD(_method)\
private _currPrototype = _self;\
private _types = _currPrototype get "#type";\
for "_i" from 0 to (count _types) - 1 do {\
if !("__base" in keys _currPrototype) exitWith { diag_log ("method not exist")};\
private _cache = (_currPrototype get "__base");\
_currPrototype = _cache;\
if !(_method in keys _currPrototype) then {continue};\
breakWith (_this call (_currPrototype get _method));\
};\
_class_C = createHashMapFromArray [
["#type",["C"]],
["#base",_class_B],
["__base",_class_B],
["@method",{
params ["_whatever"];
SUPER_METHOD("@method");
}]
];
There might be potential performance issues, but it's a working solution at least.
would anyone have any idea how to change a skybox for mission specific? i have a mod that does what im looking for on any maps that use altis or stratis but i dont want to have to change the code for every map i want to use, i would like to have the skybox be able to to just be added to the mission files and called/changed easier than that
No
Isn't it better to do _self get "__base" get "@method" instead of the macro?
Or save method from parent in child constructor into something like @super_method before overriding it?
This is just an exampleβin practice, the actual number of inherited classes isn't fixed.
It could also be written as a function, but that would defeat the purposeβit's mainly meant for smaller functions that might need modifications.
When you call the @method of __base, the _self still points to the current class instead of __base.
If write it like this, computer might literally explode:
_class_B = createHashMapFromArray [
["#type",["B"]],
["#base",_class_A],
["__base",_class_A]
["@method",{
_this call ((_self get "__base") get "@method")
}]
];
_class_C = createHashMapFromArray [
["#type",["C"]],
["#base",_class_B],
["__base",_class_B],
["@method",{
_this call ((_self get "__base") get "@method")
}]
];
whoops bug then
Was there a way to make attachTo use render time scope? I could've sworn there was so you didn't have to use to set the position in a loop but I can't find anything about it on the biki. Trying to fix arma (seemingly) over-compensating with some attached objects on a fast moving vehicle, which ends up with lights in front of the vehicle at high speeds
I don't think so
It's something about light objects in particular that makes them not update fast enough IIRC
Ah
Could make a dummy object with a reflector in it then, tempting
Hello. This addAction is giving me Bad conversion: scalar in rpt file when the condition is true. Seems like the problem is related to the alt syntax of nearSupplies, the original syntax works fine (no error in rpt file). The alt syntax is giving the origin (inside an array) instead of supply objects nearby.
_crate addAction [["<img size='1.5' image='Supplies_Menu\icons\exchange.paa'/>","<t color='#00FF55' size='1.2'>", " " , "EXCHANGE CARGO", "</t>"] joinString "", {
params ["_target", "_caller", "_actionId", "_arguments"];
private _supplyNearby = (((_target nearSupplies 5) select {_x isKindOf "ReammoBox_F"}) - [_target]) # 0;
[_target, _supplyNearby, _caller] execVM "Supplies_Menu\functions\suppliesMenuManager.sqf"
}, nil, -400, true, true, "",
toString{
count(_target nearSupplies ["ReammoBox_F", 5]) > 0
}, 5];
thank you, Nikko
Yessir. I think that link I gave you a while back should still work!
Unfortunately automated HC detection is a giant pain in the ass
I messed around trying to do that a while back, came to the conclusion it was easier and more reliable to just use a mission parameter
Here is the new version, which should address the issues of the proximity and _scout talking to himself. I put _responder as objNull in hopes that I would avoid an error. Going to test now.
_scout = missionNamespace getVariable ["scout", objNull];
_leader = leader playergroup;
_responder = objNull;
private _units = units playergroup inAreaArray pilot_trigger;
private _speaker = selectRandom _units;
if (_leader in _units) then {
_speaker = _leader;
} else {
if (_scout in _units) then {
_speaker = _scout;
};
};
private _convo = ["americanLines", "vietnameseLines"] select (_speaker == _scout);
if (_leader distance _scout <= 100) then {
if (_speaker == _scout) then {
_responder = _leader;
} else {
_responder = _scout;
};
};
[_convo, [_speaker, _responder]] remoteExec [
"FoxClub_fnc_Conversation",
allPlayers select { _x distance _speaker <= 100 }
];
(The main problem is that timing isn't guarenteed unless you wait specifically for a variable. You can't do that though for cases where the HC isn't present. Though now that groups can be transfered a PV EH to transfer groups on the server is a viable alternative.)
What's "PV EH to transfer groups" @tranquil nymph ?
is it now possible to apply post effects in thermal mode?
anyone ever seen this immensely helpful error?Error Type Number, expected Number
What are you getting it from? I think I've had cases where getHitpointDamage or something like that didn't actually return anythign and I believe it showed that error, but i might b wrong
At least the resolution effect is supposed to work π
@foggy pike I'm guessing Public Variable EventHandler?
good day y'all. does anyone know how to disable that slight camera shake during firing small arms?
If not how should i move on with this?
hmm you could set sqf player setUnitRecoilCoefficient 0;but this also eliminates the recoil at all, no exactly what you want
why did you want to disable the slight camera shake during firing small arms ?
player setCustomAimCoef 0.0;
but like Moerderhoschi said this make all weapons this way
does anyone know how to stop dynamic groups overriding patches
just for the feels, and I've already tried many ways to counter this but still there is some sort of camera shake or movement (In first person) that is bothering me. I changed so many values in "cfgRecoils" and "cfgCamerashake" and still nothing. I wonder if it's something that is forced by the engine.
I don't want to defuse the weapon recoil but the camera movement only.
@brittle minnow maybe see if this would work for you
if (!hasInterface) exitWith {};
private _weapon = "hgun_P07_F";
// Check if player has the weapon
if (_weapon in weapons player) then
{
player enableFatigue false;
player enableStamina false;
player setCustomAimCoef 0.0;
};
I take it you've tried enableCamShake
Also make sure you don't have any mods running that might be adding their own manual camera shake, some mods like to do that for "immersion"
yeah I'm running the vanilla right now. still no clue what else should i try.
tnx bud but this doesn't seem to help with the case.
oh hmmm ok
i'm not sure what Camerashake your talking about: i have no Camerashake with pistols:
unless its like what Nikko said mods or what
really i have no Camerashake at all: when i run this script
this is with setCustomAimCoef set to 0
both dead zone and head bob is set to zero, unfortunately it couldn't fixed that.
hmmm that really looks ok to me the way you have it set
go to opticts mode and show me again
there is definitely nothing wrong with the recoil. arma 3 had this camshake since i remember. but recently I've come around some other shooter games that don't have any camera shake. I wanted to capture that feeling here. that's all. it nothing like bug or anything.
yeah but look at the edges of the screen, there is still some movement.
even with recoil set to 0 in config
all values in cfgCameraShake set to zero
i wonder if it's tied to character animation
hmmm yeah i see that intersting
oh maybe you need to set player enableFatigue false;
player enableStamina false;
did you check the Animated Recoil coefficient changer mod? maybe there are some options about this, not sure
yep the actual goal for me to use that as the main effect for shooting. just for that i want to completely remove this camshake .
there is no option there either.
maybe try this
if (!hasInterface) exitWith {};
private _weapon = "hgun_P07_F";
// Check if player has the weapon
if (_weapon in weapons player) then
{
player setDamage 0;
player setFatigue 0;
player enableFatigue false;
player enableStamina false;
player setUnitRecoilCoefficient 0;
};
Fatigue will affect camshake
Fatigue affects weapon sway, I wasn't aware it affected shake in any way
it's still there.
I've noticed that as you take more stable stance for shooting it lowers the shakiness.
but the effect is still persistence.
yeah it seem like we can't stop that effect
but it look really good the way you have it set
that weapon you have is really bad for cam shake
any MG is really going to shake the cam
like i already wrote afaik with sqf you can only kill the effect with sqf player setUnitRecoilCoefficient 0;but this also eliminates the recoil at all
me myself i don't like to disable Recoil: but thats just me
it may seem to Arcade if you disable Recoil
but that may be the only way to do it
as Moerderhoschi said
i changed my script up there
to what Moerderhoschi said
Do you have Ace recoil loaded? It adds a little more cam shake as well.
no he said hes using no mods
only vanilla
good thing i don't use Ace lol
well i mean i use no Mods at all
why is a good thing? ace is awesome
both in script level and config level there are no command or parameter that could remove weapon firing camshake.
I think I should fill a feature request. I've tried everything and nothing seems to work in this case. by everything I mean every relatable sqf command or any config related settings. I tested all of it in vanilla environment.
by the way, I recently tried to reconfigure a weapon to have to recoil in the config. even with that, the camera still shakes.
You can do one better, do a pull request
It's like six lines
unless you mean for non ace
in which case feature from dedmen I guess
It's not tied to ACE or other mods, the game add that punch to the camera for some reason. as you said "ace recoil" messes with some addCamShake but I'm not using that at all.
Yeah it does a little extra
its set in the ammo
but from what Ive seen all the infantry weapons has the values set to 0
for the fire/playefire camshake
is there any reason why _player and _hostage would come back as undefined?
_player = _this select 0;
_hostage = _this select 1;
detach _hostage;
Removeallactions _player;```
[player, hostage1] execVM "scripts\gamemode_release.sqf";
its genuinely confusing
Where are you running the code?
basically in a holdaction, one checks if a hostage is attached to you or not, when it attaches a hostage, it adds a holdaction to the player, but its that translation right there thats the issue
i'll put the full code, its probably worth nothing anyway
_player = _this select 0;
_hostage = _this select 1;
if (!isNull attachedTo _hostage) exitwith {
hint "Gamemode: Hostage is already being handled!";
};
if ((isNull attachedTo _hostage) && (!isNull attachedTo hostage2) ||
(isNull attachedTo _hostage) && (!isNull attachedTo hostage1)) exitwith {
hint "Gamemode: You can't take two hostages!";
};
if (isNull attachedTo _player) exitwith {
hint "Gamemode: You're now handling a hostage!";
_hostage attachTo [_player, [0, 1, 0]];
call{
[_player,
"Handle Hostage",
"\a3\ui_f\data\IGUI\Cfg\simpleTasks\types\interact_ca.paa",
"\a3\ui_f\data\IGUI\Cfg\simpleTasks\types\use_ca.paa",
"_this distance _target < 1",
"_caller distance _target < 1",
{hint "Shop Status: Loading..."},
{},
{
hint "Shop Status: Complete";
[player, _hostage] execVM "scripts\gamemode_release.sqf";
},
{hint "Shop Status: Interrupted"},
[],
0.5,
nil,
false,
false] call BIS_fnc_holdActionAdd;
};
};```
release sqf is the code i posted above, i seperated it to see if the _hostage / _player scenario would fix
_hostage doesn't exist in that scope.
player does, so I assume you're misreading the error.
i'll take a screen just incase
never really proof read that screen π
Sorry John, hopefully that helps
is there something i need to do to get the _hostage into the scope with a holdaction involved?
You can probably use attachedObjects and filter it to get the hostage and use that, but the easier way is probably to just set a variable on the player when they pick him up e.g. player setVariable ["hostage", _hostage] and then grab him again in the action completed section, so adding private _hostage = player getVariable ["hostage", objNull]
Not sure if this action is supposed to go on the player or the hostage though cause you're adding it onto thr player but then checking the distance from the caller (the player) to the target (the player) if I'm reading it rigth
nvm it was a vector passed to createVehicle, it turns out one of the components was NaN
(coincidentally similar subject, but separate question)
I've got a few functions for escorting prisoners and carrying incapped units, both of which use attachTo and detach. However, sometimes when releasing the unit, they'll teleport back to the position where they were first attached. Anyone have an idea on what causes this?
I've encountered this every so often since 2.18, when I first wrote the code, but never figured out why it happens. Only some target units are affected, both local and remote. Seemingly after some time, the issue goes away and the unit will drop where they were released as normal.
Hmm. I wouldn't ever use a detach without setting the position afterwards.
but maybe it works if the locality is right.
I'm trying to use this event handler by putting it in the object's init. However, it won't fire when the pilot ejects for some reason.
this addEventHandler ["GetOutMan", {
params ["_unit", "_role", "_vehicle", "_turret", "_isEject"];
if (_isEject) then {
missionNamespace setVariable ["pilotEjected", true, true];
};
}];
The wiki says _isEject is boolean.
What's the locality of the event handler?
Im testing it on SP at the moment, so my computer?
No idea then. Is the unit human or AI?
AI. Would locality matter since my variable is broadcast to all?
It doesn't matter in SP.
I'm assuming that the event handler is bugged for the eject case, but you would need to research exactly which cases work and which don't.
I guess I'll try out "GetOut" next. You can put that EH on the vehicle.
"GetOut" works fine. Maybe because the plane is a SOG: CDLC unit they aren't using the vanilla Eject Action?
I don't remember if AIs even have a vanilla eject.
so yeah, maybe
I mostly remember RHS planes dropping 30 copies of the same canopy due to locality bugs.
GetOutMan is supposed to be triggered by all methods of leaving a vehicle. Even if the Eject action isn't used, they would have to use moveOut to transfer the unit to the ejection seat vehicle, so it should still trigger
It just wouldn't be detected as being an eject by that parameter in the EH
Ah okay so my condition shouldnt be to look for _isEject. I could find a way to look if the unit is not in the vehicle anymore.
Well if getOutMan fired you can be fairly sure they are no longer in the vehicle
You should test though, and make sure that getOutMan fires at all in the circumstances you need. I've described how it should work, but it would be good to verify.
Good point, I already spent the last hour trying to break getOut, so I'll just stay with this one instead.
Works great so far.
Assuming getOutMan fires, your challenge is going to be determining whether it was an ejection.
You could look for whether the pilot is now in an ejection seat; you could look for whether the plane is at altitude (might fail if they pull the lever while parked, but ejecting is the only way to leave the plane while it's flying).
Also worth checking the ejector seat functions to see if there's a scripted EH for it.
My setup is pretty simple. The plane is hidden in the sky until players get to a trigger area. Then a SAM fires and the pilot ejects. I had to play around with the damage a bit to get it consistent, but if I set the plane to 60% health, he ejects every time.
OK well then you don't even really need to check if it was an ejection. There's no other reason for the pilot to leave the plane, so you can just assume that if GetOutMan fired at all, the job is done.
hmm, for carried units it does set their position immediately after detaching, but it can fail the same way as escorted units which doesn't set position... is there a preferred locality for detach + setPos? or should there be something like waitUntil {isNull attachedTo _target} before setPos?
They're both global effect so you can probably just run them in order from anywhere.
I don't recall running into any trouble with that. Velocity is another matter.
Oh, you're attaching units? Not tried that.
Basically every type of object has different rules and none of them are documented :P
Has anyone got any good group matrix systems setup? Like with F3's framework I'm trying to get a dynamic and reliable tree view of a side's units starting with command, then squads, fireteams etc. But I don't want to have to hardcode group names since it seems very un-future proof
So like a group could be called GrpNATO_0_PltHQ which would basically be side west, index of 0 so it#s at the top and then called PltHQ.
a different system is coding an orbat into the .ext
Oh you can do that? I'll have to look into it
well if you go by a pure arma style scheme
grp_side_number_number_number would handle most use cases
gpr_east_1_1_6 : 1 coy, 1 plt plthq
its more about the consistency
Yeah that would work and then I just have a class for each