#arma3_scripting
1 messages ยท Page 422 of 1
np
anyone know how to setBehavior on UAV AI? I'm trying to make another vehicle a UAV via config but since I can't change the behavior of the AI crew (B_UAV_AI) from careless the driver remains turned out.
that or force turn in the driver.
Dont know in what channle to ask but does anyone know where the pictures you see spinning of faces when you are aboutto change are stored? http://prntscr.com/i9iao6 (The actual animated picture on the right)
Is there anyone about that could help me with a trigger?
Im not too savvy with scripts ๐ฆ
this is what im struggling with
0 = [] spawn {
_center = createCenter sideLogic;
_group = createGroup _center;
_pos = getpos arrow3;
_CAS = _group createUnit ["ModuleCAS_F",_pos , [], 0, ""];
};
for bubble1 do {
_bubble = missionNamespace getVariable ("delay1" + bubble1);
_bubble hideobjectglobal 1;
};
null=[] spawn {sleep (60+(random 60)); trigger1 setvariable ["delay1",true]; trigger1 setvariable ["delay1",false]; playSound3D ["pop", bubble1] [format["<t size='1' color='#ff7700'>%1</t><t size='1' color='#ffffff'> called in an airstrike</t>",profileName],""] remoteExec ["ST_fnc_hintSound",0];
@lone glade [] is a string yes.... {} is config array.
@strong canopy Don't see problem
@still forum Seen slack?
I'm not fully online yet
First checking all the few hundred discord messages, then emails and whatsapp, then open a youtube video that i can listen to while I check the rest, then github, then slack, then armaworld, then BIF, then check BIKI edits for crap, Then go back to Discord to read the stuff I missed while checking other stuff
Rip
Also I gotta make myself some curryrice with fishsticks or I'll starve
Questione,
Anyone think it's a bad idea to use some locations for some stuff I wanna do and I need to use nearestLocation etc.
Explain more @peak plover
Dunno if locations are in a seperate list or quadtree compared to other objects
if they are then that's probably the best solution
nearestlocation
Even by vanilla there are tons of locations on the map
Just wondering if anyone else uses them at all or ?
And the CBA namespaces are also there
you mean if someone looks for a location he might accidentally find yours instead of what they wanted?
Okay exactly
I can see some noob mission maker doing that yeah
@dedmen when I try to run it it says "type array, expected nothing"
expected nothing???? What ex....
for bubble1 do { That's invalid
unless that's an array I guess
Gonna be honest, Im a propper noob at this, I just cobbled together bits of code I found
I don't even know what that for code is supposed to do
If your free could you come on TS so I could explain?
no
Lol
I don't talk
Paste the script and we can help
No that expression means my eyes died because of spawn
It's possible to make the night vision like night at day time ?
You can set the time to night when NV is turned on and set it back to day when it's turned off
Yeah but i want to be MP compatible, and it's not possible to set the time locally in mp, with the sync of arma
really?
That was my idea
you can have local weather so I thought why not time
In multiplayer, the effect of this command is local, not global. [...] However, if you run this command in the middle of the mission, effect is local.
Ah... So it's global yeah?
Yeah but changed now
if I remember right, if you execute skiptime, to set date, he will directly come back to server date
but never tested with setdate
skipTime executed on a client will change time on client for about 5 seconds after which it will sync back to server time.
Yes.
I guess I can use nearLocations and filter them with getVariable
Lose some speed, but locations still seem to be the fastest, compared to other alternatives
ahhh
so, locations are local
Can I somehow send them to clients?
like setVariable as public ?
๐ค
afaik locations are entities and thus broadcasted
scripting noob here... what is the best way to get a vehicle classname if you have the displayname?
well that's a bummer... ๐ฆ
why do you have only the display name
how do you get that
and what do you need the class name for
@zinc geyser
basically I've crawled through the configs and grabbed a list of vehicles , got the display names, populated a listbox, and sorted the listbox by displayname (OCD). When someone selects the an item on the list, I need a way to return the classname.
@peak plover can't nearlocations filter bz classname?
why the hell did you get the display names instead of their config name
@peak plover no you can't send local things via publicVariable. Had that topic yeserday
you could keep a parallel array of configs
i got the config name but the display names are sorted the config names arent
sort the configs beforehand?
you can't do the opposite without going through each fucking class ever
sorting the classname will not end up with the same result as sorting the display name
sort by displayname
that is what I did
so the list view sorts differently?
In description.ext, can you somehow concatenate an eval'ed value. Something like:
MAKE_NAME NAME_##__EVAL(nextID)
Hey guys how can I retreive data from a database using extDB3?
yep
can you disable sorting in the list view?
.....
@lone glade... not sure I'm articulating it to you right
you can make an array of config names, retrieve their display names and fucking sort it then
but its not as straight forward as you think... I'm doing that
he's saying the list view sorts them differently
@still forum Thanks for confirmation that it is not possible.
not quite sure how that would be though...
I wonder how he sorted them because list sorting works perfectly fine
ok will send message
forgot sqf alganthe
_midnightIsACoolKid = true;
:)
`
_midnightIsnotACoolKid = true;
`
OH
Anyone know how to retrive data from a database using extDB3? THe documentation is crap
@brave jungle @tough abyss
Please stop spam.. Not needed.
exactly
Torndeco...?
why torndeco too?
don't use a runtime variable for that, just do #define IS_MIDNIGHT_COOL (false) since the value is not about to change
Because Torndeco knows the answer
well chat was active, wasn't sure if anyone saw it dedmen. Excuse me for trying a second time.
@pliant stream Well it was obviously a joke and served no purpose other than for you to see pretty colors
Just wait Curious, some people will scroll up sometimes and they might find your question
okay cheers
extDB is a very special topic. That's why most people here don't know the answer
Which is why noone replied.
Thus Torndeco = ExtDB3 God
Try looking at using the following
https://forums.bohemia.net/forums/topic/211872-oo_extdb3-a-driver-for-extdb3-addon-mysql/
https://bitbucket.org/torndeco/extdb3/issues/69/set-of-functions-used-to-handle-extdb3-api
OO_EXTDB3 - A driver for extDB3 addon MysqlLastest version : 0.2 by Code34
GitHub : https://github.com/code34/oo_extdb3.altis
OO_extDB3 is a driver...
I have compiled some functions that could help begining mission developpers in the task of using extdb3. Most of theses functions are error safe and well optimized. I would be glad to see them improved and included in a pbo next to the .dlls.
Feel free to contact me on steam for any questions.
http://steamcommunity.com/id/youpala
why expose some mysql api to sqf? surely it would be smarter to expose an application specific api to sqf to abstract the database access
Ohh okay thanks @still forum
Wouldn't it be great to be able to send a local vehicle to other clients?
Your making assumptions that mysql API is exposed there based on an add-on name
hey ded
Cheers Torndeco, ugh all this to have persistant gear across mission files :\
ace_arsenal_fnc_addStat is turning out to be params galore
already done
problem solved.
it's all config based right now
i'm just adding the ability to add / remove them via funcs after the fact now, I already have planned for it anyways ๐
plus I added a priority entry to the stats array / config, so I can decide which ones go on top, very useful to keep weight at the bottom
Are https://community.bistudio.com/wiki/Event_Scripts beeing called or spawned?
neither
ok to make it more precise, is suspension allowed or not
They are ran from engine. Not from SQF
you mean scheduled/unscheduled.
Most are scheduled
most?
I didn't try all of them
init.sqf is scheduled but game will wait for it iirc
they are all special
that is what makes them horrible
๐
so: back to topic
what about writing webpages in sqf? (never said when that topic was a thing)
what about writing sqf in sqf? That is the real question
sqfception?
can do it
i wrote sqf-vm
writing sqf-vm in sqf is the next logical step
emulating sqf in sqf to emulate sqf in sqf
to emulate sqs
to again emulate sqf
in the end we will be so slow that even outputting diag_log 1 will take years
question in the end will be: can it run doom
comment "Exported from Arsenal by Jacob";
comment "Remove existing items";
removeAllWeapons this;
removeAllItems this;
removeAllAssignedItems this;
removeUniform this;
removeVest this;
removeBackpack this;
removeHeadgear this;
removeGoggles this;
comment "Add containers";
this forceAddUniform "U_BG_Guerilla2_3";
for "_i" from 1 to 3 do {this addItemToUniform "11Rnd_45ACP_Mag";};
this addBackpack "B_AssaultPack_blk";
this addItemToBackpack "FirstAidKit";
for "_i" from 1 to 3 do {this addItemToBackpack "11Rnd_45ACP_Mag";};
comment "Add weapons";
this addWeapon "hgun_Pistol_heavy_01_F";
comment "Add items";
this linkItem "ItemMap";
this linkItem "ItemCompass";
this linkItem "ItemWatch";
this linkItem "ItemRadio";
comment "Set identity";
this setFace "GreekHead_A3_02";
this setSpeaker "male01gre";
class CfgRespawnInventory
{
class SurvivorBasic
{
vehicle = "b_Soldier_F";
displayName = "Survivor";
};
};
how do I add my custom export class to be the respawn class?
Do I change "set idenity" to something like... Player Person or something?
@still drift What?
I want that to be what the players spawn with
So I put it into an sqf file. The thing that says "comment "set identity" i
is that what the name will be
so I would se the idenity to "Survivor0" or something and then the vehicle would be vehicle = "Suvivor0" right? Because thats the ID and the ID is set to that exported loadout
also where do I put these files?
no....comment is ignored by the compiler. it's similar to:
//this line is ignored
it's worse than //
aaaand I can't send screenshots for further reference
because it does nothing and takes time to run
I M G U R
Don't I need an account for IMGUR?
N O
Like I said the first two times
literally click "upload" drag and drop
copy the link
bam
https://imgur.com/a/jkB8E (Hawkeye Pierece)
Took me less than two clicks
๐ Here we go again
or not writing anything besides it
theoretically, this should be valid sqf:
_myvar = comment "reason why nil";```
fuck
just found a valid usecase for comment
"description"
hnnnnnnng, notepad++ without highlighting
yeah sorry about that
anyways what do I do to make that custom class into a respawn class?
And where do these files go once they're done?
You probably want to change the spelling of "Initalize"
those are CfgRespawnInventory classes ^ (survivor)
what?
BIS_fnc_addRespawnInventory takes CfgRespawnInventory or CfgVehicles classes as second argument
it's not an issue
huh
I really know nothing about scripting so I'm kinda doing this blind
Should I remove all the instances of comment? You said earlier it just ignores the script there so what do I do to make it so it will not ignore the scrip there?
like getArray or getText - is there something to "getBoolean" to get a true or false? or should I use a string "true" and translate it to true/false via script
Use 0 or 1
There are no boolean constants.
And as configs can only be constants. There are no booleans in configs
Intercept_CBA has a getBool config function that auto converts number or string
In SQF true and false are also no booleans
doesn't getNumber return 0 if something doesn't exist? I guess I could base the defaults off of that
yes
๐ thanks
getNumber hasn't always returned 0 though. It might screw up if the behaviour changes again
For awhile there it return 0.xxxxxxxx if it didn't exist. Messed up Exile i believe for abit
Hwo can i create a display above a layer?
I created the layer like this:
"startScreen" cutRsc ["SplashNoise","BLACK"];
And create the display with:
disableSerialization;
private _display = findDisplay 46 createDisplay "RscDisplayEmpty";
after the creation i add controls with ctrlcreate.
I cant see the controls nay ideas?
You can't.
Ay commy. How do I edit config values via script?
Create trigger, 10m around 0,0,0, repeats every 3 seconds, setdamage 1 for each units in the area - resolve the "spawn in corner" bug for Zeus?
Well yeah, not a fix - but it seems that killing them resets them, so Im proposing it as a patch until the glitch is fitched. Fixed.
theres no script to make a specific ai surrender is there? other then the module
modules are scripts too.
@Namenai#3053 id share if I wasnt away from comp :/ ill pass along what I have later if you still need it.
@little eagle
_myvar = comment "reason why nil";```
im trying to get the remote designator to turn on its laser but cant get it to work at all??
player addaction ["<t color='#ff9326'>RDF LASER:</t> TOGGLE",
{
_myPlayer = (_this select 0);
_remoteDesignator = _myPlayer getVariable "MY_RDF_CAM_OBJECT";
// DOES NOTHING
[_remoteDesignator, "Laserdesignator"] call BIS_fnc_fire;
// ALSO NOT WORKING
_remoteDesignator forceWeaponFire ["Laserdesignator","Laserdesignator"];
},
i have the remote slaved to the players crosshairs so having it just turn on/off the laser is better than constantly creating/moving a laser object trick
@lusty canyon doFire?
@manic sigil i crie :(
Oppppsss i just ran a createUnit script and it spawned 50 dogs ........
But thx shining , it be cool when u could
@Namenai#3053 The script as I have it: { if ((side _x) == West) then {_x setcaptive true; _x playmove "AmovPercMstpSsurWnonDnon" ; _x disableAI "ANIM";}; } forEach allUnits;
Obviously kinda specialized, but it can be broken down.
_x setCaptive true; _x playmove "AmovPercMstpSsurWnonDnon" ; _x disableAI "ANIM";
is the core part.
Check syntax for forceWeaponFire should be: unit forceWeaponFire [muzzle, firemode]
Params passed to the script upon activation in _this variable for addAction is: [target, caller, ID, arguments]
player addaction ["Laser",
{
_player = _this param [1]; // unit that activated the action
_player forceWeaponFire ["Laserdesignator","Laserdesignator"];
}];
@lusty canyon
So I have :
class lights_infoMain
{
idd = -1;
movingEnable = 0;
enableSimulation = false;
controls[]=
{
lights_info
};
class lights_info: RscText
{
idc = 1000;
text = "Testing 1234";
x = 0.752656 * safezoneW + safezoneX;
y = 0.00500001 * safezoneH + safezoneY;
w = 0.252656 * safezoneW;
h = 0.198 * safezoneH;
colorText[] = {1,1,1,1};
sizeEx = 4 * GUI_GRID_H;
};
};
For my config, and I am curious as to how I would make this a control that didn't free the player of it's controls until pressing escape
are you using cutRsc ?
should I be? I thought this was achievable with createDisplay?
well if you need just to show dialog on screen you can use createDialog
Right, but I just want this to be completely visual
the player doesn't need to interact with it, and still be able to move around and use items like you would withought it
i think then you can try cutRsc
_your_layer = "Midnight_layer" call BIS_fnc_rscLayer;
_your_layer cutRsc ["lights_infoMain", "PLAIN"];
Yep, seems to be working well. I'll have to use ctrlCommit to set duration to -1 then to make it infinite yes?
i do it like that duration=1e+011; in cfg ๐
Lol
yes was fails with -1
nice man
Thanks for your help ๐
np
At second note here, it still dissapears lol
class RscTitles
{
class lights_infoMain
{
idd = 1000;
movingEnable = 0;
enableSimulation = false;
duration=1e+01;
type = CT_STATIC;
controls[]=
{
lights_info
};
class lights_info: RscText
{
idc = 1000;
text = "Testing 1234";
x = 0.752656 * safezoneW + safezoneX;
y = 0.00500001 * safezoneH + safezoneY;
w = 0.252656 * safezoneW;
h = 0.198 * safezoneH;
colorText[] = {1,1,1,1};
sizeEx = 4 * GUI_GRID_H;
};
};
};
ยฏ_(ใ)_/ยฏ
1e+011
npx2
๐
is it working ?
Yep, it doesn't dissapear now ๐
weee
๐
๐
Okay, now next question. With these RscTitles and cutRsc can I set the text dyanmically?
because it seems like you can do so with dialogs and displays
ctrlText 1000 is also returning "" for some reason or another, even though the idc number is 1,000
yes you can do it
_ctrls = uiNamespace getVariable "lights_infoMain";
(_ctrls displayCtrl 1000) ctrlSetText _text;
hmm... add onload then in cfg
wait
onLoad = "uiNamespace setVariable ['lights_infoMain', _this select 0];";
onUnLoad = "uiNamespace setVariable ['lights_infoMain', nil]";
AHA! ๐
Welp, that would explain that. Let's try it
Works like a charm, thanks for helping me out ๐
nice
Does anyone have a kill tracker that works with ace3?
Make your own ?
@kindred lichen ACEX has a kill tracker
So I'm creating a dialog with a bunch of ctrlShortcutButtons, bu tfor some reason whenever I create it on the player, 1 of the buttons is focused on and has the hover colour set
Any scripting command I can use to deselect it on load?
yeah, maybe add a invisble meta butrton that does nothin
yeah just w and h to 0 and position it somewhere off the screen with something like x=safezoneX - 10
thats usually how I do that
I have a question myself: I have a function in my mod thats called by the postInit = 1; attribute in the CfgFunctions. So far, so good. The problem is that my function is now also called for the main menu intro mission. Any Ideas how I can differentiate (in the called function) between a "real" mission and an intro mission?
Cheers guys, just made a temporary button, set focus on it and delete it.
@tender root Its just how its called. postInit functions are executed just after mission objects are initialized
Yeah I know but maybe theres a way to check in my postInit function if the misison loaded is just an intro mission.
hey
setVariable with a public flag
It's persistant
So every client who connects gets it
However
Do they get it before or after preinit?
is it part of the persistent functions?
So I'm trying to find the ACE3 last damage dealt variable, but google as I may, I can't seem to actually find the exact variable name
_killer = _unit getVariable ["ace_medical_lastDamageSource",_instigator];
THANK YOU
Where did you find this? like is there some place that has a more detailed list of ACE variables or did you just look through the source on github?
I've found all the class lists, but i can't seem to find the variables.
I've had similar problems with things like ramps, and gates and stuff, trying to find the right variable to get them to open or animate or whatever.
source on github
Use it once and you kinda know what to look foor
I just searched last damage and found it
Hey whoever had the issue with zeus having to click double
I found a fix
I created the zeus on the server during postinit and then assign from player postinit
just made 10 of them
having to click double ?
For all zeus dialogs
Like changing the waypoint settings
had to clikc it double
for confirm
oh yes i think i saw something like that
I'm doing some ballistic testing on the guns in arma 3 and I'm trying to hit a soldier wearing armor to test the effectiveness of different calibers. I've turned off sway, but weapons still have innate innacuracy which makes consistent testing difficult. Is it possible to use a command similar to player setCustomAimCoef 0; to completely remove gun innacuracy?
gun innacuracy? wat?
You do realize dispersion in MIL / MOA is part of how ballistics work right?
I think the proper term is dispersion. It's described on the weapons setting page under cfg weapons https://community.bistudio.com/wiki/Weapons_settings.
I understand that's how the weapons work and should work, but for the sake of testing I'm trying to hit the chest of the target consistently to determine how protective armor is. With default disperson values for most infantry weapons it makes testing much, much more difficult to get consistent values. The other alternative would be to see the actual numbers for the vests, but I don't believe that information is accessable.
You'd need to make a mod to disable dispersion
plus that kind of testing is pointless
or I guess you can script the Fired eventhandler to set projectile velocity to always go the same way
Damn, well I'm unsure how to do both of those. Well the testing is mostly for the sake of my own curosity, but also for a roleplay event in Arma I'm planning for my friends. I'm trying to put some hard numbers for stats because most of my players aren't too familiar with the real world performance of most military equipment, and since the roleplay is going for realism I'd like to give them some concrete information to help them. A lot of them are more familiar with role playing games so they like stats too.
I know the approximate values from my own experience playing Arma, but I like hard data. I really wish the virtual arsenal just gave the damage numbers for weapons and the protection values for body armor. It's not too much of a loss, but it would be nice data to have.
those numbers are bullshit
the "impact" stat for arsenal is simply:
sqrt(hit^2 * initSpeed) with hit being the weapon damage (which is completely ignored, bullet is used instead) and initspeed which also doesn't matter much unless you're sticking the rifle up someone's ass
Yeah, that's why I've resulted to manual testing because I'm more interested in the real world effect rather than the vague bars of the arsenal. I get that what I'm doing isn't really necessary. At the point at which accuracy becomes an issue for my testing, the weapons are generally aren't terribly effective anyways, but this information is interesting/useful to me and I think it could be for the Arma community too. I mainly just wanted to know if a simple command existed for weapon accuracy that does what I want like the player setCustomAimCoef 0; does for sway because that command has been super helpful for my testing.
Without a mod no.
damage to infantry depends on very many things and its not as simple as "at range X you need Y shots"
most importantly it is dodgy due to penetrating projectiles doing weird damage https://feedback.bistudio.com/T120542
the inconsistency means that sometimes a bullet can do more damage at longer range suddenly, when it fails to penetrate completely
weeeelll, it's not really inconsistent
I mean, it's logical that it would do more damage if it doesn't penetrate the hitselection fully
it's when it doesn't fully penetrate vests / other "protective" geometry that it gets dicey
Is there a way to add an infantry kill to the scoreboard or is that an engine limitation?
nah you can add kills / points willy nilly
@austere hawk Yes of course, but I'm just trying to isolate one variable: range. I'm trying to keep everything else the same. Theoretically, when using a Katiba if I could hit the exact same place at long range on a target with body armor would it always kill in the same amount of shots does the engine have some variance built in? From my own testing short range is extremely consistent but at long range it seems like there could be some variance outside of the variable I'm testing for, but it's difficult to tell because of how hard it is to hit the chest consistently. I end up hitting the arms, or legs or head, or miss constantly, which throws off results.
if you hit the exact same spot at same range it's consistent
^ that depends, if he uses ACE the wind might change ๐
but vanilla it should be extremely consistent
as soon as a projectile does not "die" inside the penetrated body, damage suddenly reduces significantly (1/5th of the damage and less)
in real life, over penetration is a thing, 7.62 nato does less damage point blank than out at 300m.
tbh at that point you're in shock mittens
Yeah, but at 300-400m you die instantly
Does Arma handle overpenetration without killing the target? I think I've seen that can happen when you hit an arm. I think i've seen that before.
penetration is completely unrelated to damage
you die as soon as a damage selection reaches 1 damage, 0.9 for the head
but damage is highly influenced by penetration (or rather - amount of speed lost inside the target)
I mean, by the time rounds are going through a body armored target in and out the back it's usually in 1-hit kill range no mater where or at what range you hit the target.
not in arma
I've rarely seen even 7.62 go through a target, .50s and 9.3 do, and they usually 1 hit people.
"nah you can add kills / points willy nilly"
Am I able to add infantry kills? I've only ever found "AddScore" which just adds to the total score, not infantry kills.
@kindred lichen "rarely seen" ... what? at pointblank in arma 7.62 goes through infantry like butter (it has about 50% velocity after passing through the chest)
So a related question to this discussion. What exactly are the different hitbox "areas" of a soldier when it comes to how much damage is taken. I know from my own experience that when unarmored, legs and arms take many shots to kill, torso takes 1, and head also takes one. Is there any difference between the resistance of different parts of the torso, for example?
look at the config of the base human class - the hitpoints in particular
pelvis / neck / face mostly
resistance also comes from the fact that - as i said - the more bullet speed is lost inside a target, the more damage it does. So damage to arms and legs will be lower than to torso due to volume
its worth reading the fundamentals - https://community.bistudio.com/wiki/Arma_3_Damage_Description (applies to every damageable object in arma practically). Infantry have extra modifiers for body armor (=health modifier basically) but otherwise its the same.
btw there also different "ammo types" ...
bullets
yep
That article is very much the kind of information I'm looking for I'm surprised I didn't find it earlier.
Okay, time to learn the hard rules of internet coding.
I want to make a code that checks, every three seconds or so, if a player has a primary weapon; if null, change their side to civilian. A very crude infiltration system, easily worked around but should ideally be a short script.
I'm looking at a spawned while-do loop with a sleep 3 in it to keep it from overwhelming the server. primaryWeapon is easy enough, and I can figure out the change side function (join silent to a custom civilian faction, then undo with a custom side faction.
My issue is this: How do I point primaryWeapon at each player in a jip game?
I could just make it an addaction system, if weapon=null then allow, else 'drop the gun before you infiltrate', but if I walk without rhythym, I'll never learn.
BIS_fnc_animatedBriefing ... is this working? or work in progress?
@manic sigil If you want to it be running all the time for all players you could just spawn it in the "initPlayerLocal.sqf".
Problem is, this is for admin console coding ๐ extra limitations
then remoteExec probably is your friend.
You could use this as a script:
while {true} do {
if ((primaryWeapon _unit) == "") then {
_unit setCaptive true;
} else {
_unit setCaptive false;
};
sleep 3;
};```
And then do
```{
[[_x], "yourScriptNameHere.sqf"] remoteExec ["execVM", _x, true];
}forEach allPlayers;```
Aaaand full disclosure. I am not sure if that will work with JIP as i never used remoteExec with JIP. But that is the way i understand that command and it should be really easy to test.
Furthermore there might be a lot better solutions performance wise. But this should work.
Damn. wait. How do i do those code blocks in Discord? ๐ค
@knotty mantle
` sqf
`
```sqf
```
shiet
like dat
how tf did you do that nigel?
Nice. Thanks guys
// comment
I typed
```sqf
// comment
```
0.o
????
You can put \ in front of something to disable it's magic properties
Huh, interesting
```sqf Used 3x \
\`\sqf
\`\
` ?
backslash`backslash`backslash`sqf
```sqf
```
๐
@manic sigil scroll up a bit for a possible solution for you problem. Formatting is horrible but you can do that in notepad. Should be working for your purpose. And if you only use that script for players i would prefer the setCaptive over making them join another group.
@knotty mantle Of course I forget setCaptive t_t still need to figure it out for a looping script and JIP, but that should fit the bill better than forcing side changes.
So I have this, and it works for ai, if it's in the init.sqf of the server.
But it doesn't work for players, and it doesn't work on zeus units even if I run the script after spawning the zeus units.
if(isServer) then
{
{_x addMPEventHandler ["MPKilled", {_killer = (_this select 0) getVariable ["ace_medical_lastDamageSource",_instigator]; _killer addPlayerScores [1, 0, 0, 0, 0]; ;}]; } foreach allUnits
};
Is the reason it doesn't work for players, because MPKilled is run locally on the player that was killed machine, and only the server can use the addPlayerScores function?
This stuff is super annoying to test my way through, because I need another person on a dedicated server.
@manic sigil setCaptive doesn't need to be looped, once set true or false it stays that way
@kindred lichen QT: the loopback setting will allow multiple clients on the same machine connect to the server and to act like their own clients. Easy for testing things you'd need other players for
So I can run like 2 instances of arma and test it.
also -showScriptErrors will be nice thing to have
Can someone help me with this script... i'm pulling out my hair why it sometimes just don't work
concept:
4 player squads (variables: alpha/bravo/charlie/delta) that i want to simply teleport to the cargo of 2 planes (plane1/plane2) after firing a trigger on a dedicated server. Alpha/Bravo moved to plane1, Charlie/Delta move to plane2
Script (in it's entirety, doing some other stuff as well):
/* client commands */
if (group player == alpha || group player == bravo) then [{player moveInCargo plane1;},{player moveInCargo plane2;}];
/* server commands */
if(isServer) then {
/* skip time */
skipTime (23 - daytime + 24) % 24;
/* short delay */
sleep 2;
/* remove from groups */
{[_x] joinSilent grpNull;} forEach (playableUnits + switchableUnits);
}
Results:"
Local: Always works
Listen server: always works
Dedicated with 2 players: always works
Dedicated with 8 or more players: Only randomly puts people in the plane
if (group player == alpha || group player == bravo) -> if (group player in [alpha,bravo])
Lol that hidden else ๐
Randomly means some players are not teleported at all?
randomly means that if i run the mission the firs time... player 3/4/7 in the squad stay behind
and the 2nd time player 3/6/8 for example
Did you try diag_log or hint to check if the teleport code does run?
Maybe moveInCargo fails if executed from lots of machines at the same time, because the requested slot gets occupied by a different unit.
that's my guess
you ever try to get into a car at the same time with someone else and it just fails?
at least that happens in a2
Would have to take care of giving each player his slot that isn't occupied by someone else
Maybe use cargo index as (units group player) find player or something like that?
Don't know if the order of units is the same on every client
i COULD just individually move each soldier into the plane?
i.e. naming every soldier in the squad A1/A2/A3/etc and then assign a slot?
You could do what I just told you.. Or just ignore my idea and come up with something different.. sure....
Btw
skipTime (23 - daytime + 24) % 24;
This is wrong.
skipTime will be executed before %
Also, why add 24 right before getting the modulo by 24?
That's pointless.
or 23+24 seperately.. why not just +47 then? Or better.. Why not just +23 then..
if (isServer) then {
skipTime ((23 - daytime) % 24);
private _plane1Cargo = units alpha + units bravo;
private _plane2Cargo = units charlie + units delta;
{
[_x, [plane1, _forEachIndex]] remoteExec ["moveInCargo"];
} forEach _plane1Cargo;
{
[_x, [plane2, _forEachIndex]] remoteExec ["moveInCargo"];
} forEach _plane2Cargo;
};
This makes more sense to me. No idea what the joinSilent grpNull is supposed to do.
That would move the units if they are not inside the trigger though.
OK.
But easy to fix
skipTime:
Mission begins at 14:00 and i don't know how long the players will take to activate the trigger.
I want the next part to start at 23:00 precisely, regardless what the current mission time is.
Well, your math is wrong, and the order of operations is too. So it'll not work atm.
it does work though ๐
skipTime (23 - daytime + 24) % 24;
This will not work correctly.
skipTime (23 - daytime + 24)
Just setDate if you just want a specific date/time? ๐
will be executed first and report nil
nil % 24
will be ignored.
So even if it works, the code is broken.
Ofcause it works.
setDate is local
It will just be off by one or more days
Yeah and?
remoteExec?
And the trigger fires for everyone that you teleport anyway
so everyone executes it anyway
I'd just use a server only trigger tbqh
well, someone recommended the skipTime because it also works with JIP or something
server synchronizes the date for jip
skipTime is fine, but you need more parenthesis for the % to not be ignored.
or should in theory
k, ill test it
anyway
No idea what the joinSilent grpNull is supposed to do
Every player will get disbanded from their group after teleporting to the planes.
also maybe a culprit why the TP doesn't always work... maybe they get disbanded from their names variable group
No group management (disabled with ACE), No ShackTac HUD markers, no magic appearing markers when placed in Group Channel.
no 3d teammember markers
That would move the units if they are not inside the trigger though.
What part does that?
Well, do you want to move each unit on it's own once they reach the trigger or all at once?
all at once
I suspected all at once, because of the skipTime occuring everywhere at once too.
i have a "Blufor NOT present" trigger activation
So that's why I made the script move them all at once. And that's also why it should be a server only trigger.
What part does that? all of it. ๐
yea get it
was looking for something specific that said player !intriggerarea
super psuedo
anyway, thanks commy.. i'll try that
The command is named inArea actually.
unit inArea marker/trigger/array-with-coordinates
or just in thisList as you already have the units in the trigger in thisList inside the trigger action
Yeah. That should work too. I really don't like triggers. Now that there is inArea, might as well create a scripted loop on the server.
With a marker on the map.
does that work with "Blufor not present" though?
in thiList?
inArea works always, as long as the size of the trigger is not 0-0
player inArea trigger_1
returns bool
@quasi thicket Not that easily I think. You can manually check it ofcause bit.. ugh
Well, not relevant for my question though... just wondering ๐
// init.sqf
if (isServer) then {
0 spawn {
waitUntil {
sleep 5;
count (allPlayers inAreaArray "plane_teleport") > 0
};
skipTime ((23 - daytime) % 24);
private _plane1Cargo = units alpha + units bravo;
private _plane2Cargo = units charlie + units delta;
{
[_x, [plane1, _forEachIndex]] remoteExec ["moveInCargo"];
} forEach _plane1Cargo;
{
[_x, [plane2, _forEachIndex]] remoteExec ["moveInCargo"];
} forEach _plane2Cargo;
};
};
So much more freedom with this.
argh, @little eagle , showed your script to a missionmaker from my group and instantly went: "no that won't work!"
urgh ๐ฆ
May he tell me why?
[10:17 AM] Captainblaffer: Just do a forreach that runs on all clients
[10:17 AM] Captainblaffer: But in the doreach do
[10:17 AM] Captainblaffer: If (_x == player ) then {}
@open tendon
oh he's in this server as well :p
That makes no sense to me.
Why on all clients? Why make it more complicated than it has to be?
If you run moveInCargo on all clients at the same time. It will bug out, because they all would think the spot they are about to take is empty. Had the same thing a few weeks ago
Commy's code is perfect to avoid issues like that
Is there a reason to NOT put a function in the condition of presence of a unit?
Because i have this function:
_limit = floor (("amountOfEnemies" call BIS_fnc_getParamValue) * 0.1 * 100); //100 ist die Zahl der gesamt Einheiten leider aktuell hardcoded
if (isNil "iterator") then {
iterator = 0;
};
_count = {(side _x) != civilian} count (AllUnits - playableUnits);
if (_count >= _limit) exitWith {false};
_toinit = 100 - iterator;
_toput = _limit - _count;
if (_toinit <= _toput) exitWith {true};
_return = ((random 1) < 0.5);
iterator = iterator + 1;
_return
Well you can set a probabilty for a unit. If it is placed or not
The reason is if you use the variable somewhere and your script would break if it's not there
the variable of the unit
and you can give a condition for existence aswell (for example a parameter set at the lobby or smth)
I dont. My script is just a logic to give me an exact amount of enemies but if not set to 100% they should always be on different positions.
I did this in a "speedrun" on a Metro 2033 subway "map" and it worked like i wanted for 36 units. But here i have 100 units and for some reason i get nearly always around 70 - 80 people even if i only want 50.
I dn't see a problem with doing that
My trigger chain btw: https://imgur.com/5jHcCia
_count = {(side _x) != civilian} count (AllUnits - playableUnits);
if (_count >= _limit) exitWith {false};
_toinit = 100 - iterator;
_toput = _limit - _count;
if (_toinit <= _toput) exitWith {true};
Why not just.. like... Actually count them.
At the end just
if _return then iterator = iterator +1
and just check if iterator>_limit
Because i need the total amount of units to be placed or i might end up with less units(i think).
In your way i have no idea how many units didnt get placed. Therefore i cant say if there is a point where every unit HAS to be placed to fill up to the wanted number. Or am i missing smth?
What?
My way counts how many units are placed that have the condition code
True. Units that don't have a condition code and have 100% spawn chance are not counted
Every unit has the code. but what happens with your way if _return is false. The iterator doesnt go up. How do i know how many units i have to put there? Because if i have a limit of 80 units from those 100 placed in editor and have a ((random 1) < 0.8); Your way is great to make sure that i dont have too much units. But i am missing the part where it makes sure that there aren ยดt too few.
Uh...
And if i set the random higher the units arenยดt distributed evenly.
Ah you want exactly that number instead of too many and too few?
Yeah. Otherwise i would just set the probabilty to the wanted factor
Which is the way i am doing it currently as my script isnt working for some reason i dont understand
randomness is random. You might end up with 100% or 0% of your units.. Because random.
Yeah but if _toInit which is the amount of units that are still in for that function is the same or lower as the amount of units that need to be placed to fill up the gap it doesnt come to the random
Then it is just true.
And if you always return true if you have too few units. And always return false if you have too many...
Every unit then is set.
There is no randomness
I would just spawn all of them.. And delete some of them with a custom script later
That way you can just take all your units. And select random units to delete till the count matches
random distribution and exactly the number you need. The easy way
Are you sure that in my script there is no randomness?? Your way is obviously the easier one and i will do it that way. But if my logic is so flawed that the random in my script isnt used i would like to know...
if (_count >= _limit) exitWith {false}; //If we already have the number of units we want. Don't place any more.
_toinit = 100 - iterator; //How many units are still left.
_toput = _limit - _count; //How many units do we need to place.
if (_toinit <= _toput) exitWith {true}; //If we don't have enough units over just place this unit.
On the next iteration your iterator didn't increment. So even if you only have 20 units left it thinks you have 21.
I see how your random comes into play now
This reads mildly interesting. What's the task here?
I want to have an exact amount of units but on different positions everytime.
So i should increment the iterator just before that second exitWith to avoid any problems.
private _units = [];
for "_i" from 1 to 20 do {
private _unit = ... createUnit [...];
_units pushBack _unit;
};
private _positions = [...];
{
_x setPos (_positions deleteAt floor random count _positions);
} forEach _units;
Something like this?
is there a difference when using include for \ and /
There isn't. But I'd say go for consistency
not anymore
Just somehow thought you'd do the same now. So I wanted to give you the ability to do so
commy i placed my units in editor. With a disableAi "move" for some, some ar kneeling. Some have a patrol which is triggered. That is why i used the function in the condition of presence.
Never used condition of presence.
But in my tests i mostly end up with way too many units ๐ฆ 70-80 for a cap of 50 units. And therefore i asked here where my logic is flawed.
give each unit a number
build array of numbers you want at preInit
and then just check myNumber in ListOfNumbersOfUnitsThatIWant
I told you why your logic is flawed
and where
Knowing Arma, COP is probably just a broken leftover from an older game.
And you So i should increment the iterator just before that second exitWith to avoid any problems. Found the fix for that problem too
Yeah i know Dedmen. But that point is after the line that is probably causing issues.
If i have a limit of 50 units. From a 100 placed. it should end at if (_count >= _limit) exitWith {false};
It wouldnt run into my error.
But i get 70-80 units placed...
But i might consider commys approach that COP is broken and will do the reasonable thing you suggested and just delete them afterwards. ๐
The less you rely on stiff hard coded stuff from the editor like triggers and init boxes, the better imho.
Yeah i try to avoid them as much as i can.
I guess the condition might execute before the unit is spawned
Aka units might only spawn later
which is why you don't find them in your count check
So again. Just don't use condition of presence
yep. Wonยดt do anymore as you gave me a good way to do it aswell ๐ Thanks for that ๐
how do you make an object not interactable by players and ai but still visually rendered?
_darterObj hideObjectGlobal true; _darterObj hideObject true;
hiding the object just removes it visually right? AI can still "see" it?
i still need the darter to be fully functional, like a player can still access through UAV terminal but when they cursortarget they dont see any disassemble action menu stuff
disableSimulation
no AI can't see invisible objects
how do you make an object not interactable by players
i still need the darter to be fully functional, like a player can still access through UAV terminal
So what do you want now? Not interactable but interactable?
yea only interactable remotely by players
yea i can use that, how about AI cannot see the object? (but still visually rendered)
if i change the side to CIV can players with nato terminals still access the darter?
Dunno
ok thanks
is there a fnc or command to open the jukebox from anywhere? (without admin or debug console)
https://community.bistudio.com/wiki/Arma_3_Utilities#Jukebox
Hi im trying to have a addaction added to a ammo box with a restriction by unit type, the addaction will load a loadout onto a player with certain loadouts restricted to certain unit types.
so far i have . . .
if (player == B_sniper_F) then {player addAction ["<t color='#FF7722'>Sniper</t>", "loadouts\Sniper1.sqf"]};```
im not too familiar with addaction restrictions, can anyone stop my mistake?
classname
If you want a string then you have to use a string
"B_sniper_F"
And to get the type of a object you use typeOf
i wanted it to be variable but unit type/classname will server me better
how can I add vehicle door animations using scripts for when I get in and out of vehicles?
playing as a sniper class B_sniper_F showed no addaction css if (player == "B_sniper_F") then {player addAction ["<t color='#FF7722'>Rifleman</t>", "loadouts\Rifleman.sqf"]};
@tough abyss that will require messing with getin/getout eventhandler and prodcing good getin/getout animations to animate the character and syncing that to the cars animations
@tame stream Make a file/function, exec/call it with your action, in that file/function you can check typeOf player and do what you want
so it will check the type of class and if satisfied will execute the script
@young current So it's not by any means a good starter project for modding in Arma 3?
It's a feature I've always wanted.....
there are reasons why its not very common in arma
@meager heart wouldent that still show up on the ammo box as an option that cant be selected, trying to make it as neat as possible... idea is to have player walk up to ammo box and then have 2-3 choices according to their class. Instead of see'ing all other class option aswell even if wont work for them
ehm.. wrong topic.
@tame stream you can check type of player and then with setUserActionText change it like you wish, so the sniper will see action with text for sniper...etc
As I said... typeOf...
player isEqualType "string"
Does that count as comparing object with a string?
yup thats it thx guys
And if you want the action on a box you have to add it to a box instead of the player.
added to box all good now
if (player isKindOf "B_sniper_F") then {player addAction ["<t color='#FF7722'>Sniper Light</t>", "loadouts\Sniper1.sqf"]};```
works like a charm...thx
No, the action is added to the player, not the box
above code add to ammo box, sniper walk up and can choose loadout...none sniper walks up , no options
ยฏ_(ใ)_/ยฏ
gg
aa dammit ... ๐ค needs a tweak
the sniper has the addaction on him instead of near by ammo box
named object will do i suppose...testing
You can use this in the ammo box init box
if (player isKindOf "B_sniper_F") then {ammo1 addAction ["<t color='#FF7722'>Sniper Light</t>", "loadouts\Sniper1.sqf"]};```
Works in single player when playing as *player*, but not in MP playing as *playable*... not sure how to fis that
gonna switch to ``this`` instead of ``ammo1``
player is always the unit the client is playing as, MP or not doesnt make a difference.
Btw you can use SQF highlighting.. Instead of whatever else you are using for your scripts there.
where are you running this script from?
Consider running it from initPlayerLocal.sqf
Ammobox init is fine for this
Also true.
Oh you mean player might not be defined yet?
yeah
Yea good point
@indigo snow thats what i though as well (switched to sqf), i assumed it must work player or playable
Where do you get playable from
Either way, when init boxes run theres a good chance player is still Null
So you need to execute from somewhere else
@inner swallow just addaction on ammo box for specific classes can have addaction to load class specific loadouts
uh what
I second SKs comment on running the code from initPlayerLocal.sqf instead of the ammo box init box.
Its not a command, thats why
ok will try
yeah, playableUnits returns an array of playable units
(In MP)
player is the player when a human player controls it and is local to the player machine https://community.bistudio.com/wiki/player
that playable setting in editor is unrelated to this
initPlayerLocal.sqf with sqf if (player isKindOf "B_sniper_F") then {ammo1 addAction ["<t color='#FF7722'>Sharp Shooter</t>", "loadouts\Sharpshooter.sqf"]};
did the job
sniper walk up and has option
pilot walk up and has nothing
PERFECT !! thank all, appreciate it
is initPlayer called by you or one of the eventscripts?
I guess he means initPlayerLocal
Yeah was just thinking what it would do differently then initplayerlocal.
yes local, fixed
๐ฟ
if I have a HC and execute a RE on all clients except for the server, what can I do to avoid executing useless stuff on the HC?
I mean, with a -2 target for the RE
will it include also the HC, since it's a client?
Just check for hasInferface at the start of whatever youre executing?
does hasInterface return false for server though?
Gotcha
is there a way to change the position of the first person camera?
Not with #arma3_scripting
is there a way to know when the playmusic command has stopped playing?
[_cfgMusicDisplayName, _cfgMusicClassName, _cfgMusicDuration] spawn
{
_displayNames = _this select 0;
_classNames = _this select 1;
_durations = _this select 2;
while { true } do
{
_randomTrack = floor(random (count _classNames) );
playMusic (_classNames select _randomTrack);
uiSleep (_durations select _randomTrack) ;
};
};
testing with uiSleep the track has stopped playing for a while and its still not looping for another bgm.
so i have to use the EH instead of playmusic command?
[_cfgMusicDisplayName, _cfgMusicClassName, _cfgMusicDuration] spawn
{
_displayNames = _this select 0;
_classNames = _this select 1;
_durations = _this select 2;
while { true } do
{
_randomTrack = floor(random (count _classNames) );
_ehID = addMusicEventHandler ["MusicStart", (_classNames select _randomTrack)];
};
};
aside from the infinite loop, will this work? then to stop it setEH musicStop?
["All", "MPKilled", {(_this select 0) call myFunction}, true, ['Man','StaticWeapon'], true] call CBA_fnc_addClassEventHandler;```
returns false
But if I use Killed, returns true
No clue why
i don't think it supports MP events
๐ค
these are supported xeh events https://github.com/CBATeam/CBA_A3/blob/master/addons/xeh/script_component.hpp#L46
It does not support MPKilled.
:sadnessface:
Just use killed and a global event / RE.
I use description.ext xeh class works ๐
MPKilled has no config equivalent.
You still need RE / global event even if you use the mission config event handler.
class Extended_Init_EventHandlers {
class AllVehicles {
class booBoo {
serverInit = "_this select 0 addMPEventHandler ['MPKilled', { (_this select 0) call myFnc; }]";
exclude[] = {"Man", "StaticWeapon"};
};
};
};
It's the same as CBA_fnc_addClassEventHandler. Config versions are a wrapper for CBA_fnc_addClassEventHandler.
Ah, I see.
Well that works lol.
๐
Just a quick one ๐ how can i make lbAdd add things to the top of the listbox and not below the last?
Can't. They're added in order.
No way to change it around ? make it add in order but the other way around ?
You could give them a value and then use https://community.bistudio.com/wiki/lbSortByValue maybe.
Otherwise no. They're listed in the order they're added.
Sure can do will try the value thing How do i give them a value tho? ๐
lbSetValue
thanks
lbSort sorts them alphabetically if that is what you want.
I'd pre sort them before adding them though.
Sort the array, then add the array in order.
creating one manually always will work
though ... that might be a little bit over the top
Is BIS wiki still the best place to learn UI editing in Arma 3?
arma4 surely will have a new UI system that is not weirdly build on internal static IDs and crappy configs
Yup, but I still need to battle with Arma 3 for another couple of years ๐
Damn, I'm gonna be so no-life when A4 comes out ๐คค
<ui ns:core="bis.arma4.ui.core" enf:my="io.x39.scripts">
<core:background backgroundColor="#AAAAAAFF">
<core:stackpanel>
<core:button click="{x:static my:button_click}">
<core:label text="OK"/>
</core:button>
</core:stackpanel>
</core:background>
</ui>``` would love to see something like this
Verbose.
even better if they just would take WPF and slam it into arma4 as UI system
๐ต ๐ ฐ ๐ท ๐ ฐ ๐ฒ ๐ธ
Anybody ever had any success getting tooltips to work with ListNBox? I can only get it working on the first row with lbSetTooltip as there is no lnbSetTooltip command I've tried ctrlSetTooltip aswell ๐
Not all ui commands are documented. Make sure lnbSetTooltip really doesn't exist and is just not documented. Otherwise refer to https://feedback.bistudio.com/T83315.
Is there a way to set velocity to 0 completly
for what
I was flying, teleported player and took damage
players velocity is dicey
because they aren't physX objects ๐
but setVelocity 0 should help
how to replace a "OPFOR not present" trigger with a scirpt based approach?
is there a way to make non heli class vehicles able to slingload? i tried adding
liftForceCoef = 60.5;
maximumLoad = 10000000;
slingLoadMaxCargoMass = 50000000;
slingLoadMemoryPoint = "slingLoad0";
slingLoadMinCargoMass = 1;
to the f35b but ofc it did nothing
Nope, you can't
@worldly locust https://community.bistudio.com/wiki/inAreaArray + https://community.bistudio.com/wiki/countSide in a while loop
sleep 30;
count (
allUnits inAreaArray [_position, 500, 500, 0, false] select {_x side=="EAST" && !(_x getVariable "ACE_isUnconscious")}) ==0;
};``` so to do a check every 30 seconds or so if the area is clear and not including unconscious AI?
that is... an interesting way of doing it
well its a non functional way of doing it for sure.
Personally I'd be just as happy to use a trigger, but apparently they're "bad"
so I'm trying to learn new skills.
Just use a trigger honestly
so yes. "bad"
It's "bad" if you're using a bunch of triggers
One trigger is fairly inconsequential
Anyone done much with RscControlsGroup im playing about with it seeing what I could do but it looks like its possible to use them inside of each other but cant seem to get it to work... anyone had any experience with them?
even within a trigger condition you can optimise it
depends what you're trying to do. (controlGroups)
like you could just have
_units = allUnits - playableUnits;
while {
sleep 30;
east countSide (_units inAreaArray [...]) > 0
};```
maybe you need to add an empty do{} at the end
...... theshit
?
Not including playbale units
heck i'd say _units = allUnits select {side _x == east}
then just normal count
You have a small issue tho.... what if zeus / the mission spawns more units?
Ok. Will try that.
isn't entityCreated EVH a thing?
Not sure what you mean @lone glade
Midnight, sadly no.
Personally I'd be just as happy to use a trigger, but apparently they're "bad"
so I'm trying to learn new skills.```
small rant on this - i get irritated when people push these claims of triggers being bad or whatever because it seems like a great way to frustrate relatively new mission makers
Triggers are bad, because they're unnecessarily hard to maintain compared to some loop in init.sqf due to the gui and less flexibility like local variables or even customized wait times.
And often end up pushing them towards scripted solutions that can be way more tedious/perf unfriendly
yeah but it depends on what you're doing
Triggers are way more tedious.
Really?
Yes.
@little eagle that may be true. But either a trigger in eden or via script is straight forward enougb
and also because they tend to break easily when the scheduler hits the shitter
Well, I've really not run into that
I get not wanting to use them while making complex stuff
but a couple of triggers in a fairly simple mission? problems are exaggerated
I don't see the point as waitUntil and inArea(Array) are easier to use.
The synch to waypoint feature maybe.
very subjective IMO
Otherwise they're just inferior in every way.
OPFOR NOT PRESENT, on activation do a thing. Set the dimensions visually via GUI. job done.
And yeah, it has pitfalls but hey.
Easier to you @little eagle with your vast experience. To the noob like me. Not so much.
Harder to learn as well.
For example. Trigger version. Done. Dusted. Works. Script version. Not so much. Hoping for help here
I mean people also complain about using sleep and scheduled code etc
it's a rabbit hole
which in my experience is irrelevant to a lot of use cases
It is shit, but for missions it's fine.
anyway rant over ๐
Reddog, what are you doing?
The only thing i really dislike about triggers is that they continue to check the condition after it's been activated (and build thisList)
I'm creating tasks in towns to clear them. I've got the tasking all working, now I just need to have the conditions for success
To which my solution is usually to just deleteVehicle thisTrigger in the activation field.
so I know where -> _position and I'm working on a set radius
Well, what are the conditions?
No OPFOR troops in 500m circle and if there are then they need to be unconscious via ACE
0 spawn {
waitUntil {
sleep 5;
{
alive _x && {!(_x getVariable ["ACE_isUnconscious", false])}
} count (allUnits inAreaArray "town_marker") == 0
};
// task complete
};
Just place a marker on the town.
And name it town_marker or whatever you like.
do I need to add a check for side in there? I don't see anything restricting to opfor?
=="EAST" no?
No.
The command is named east. It is it's own data type in SQF (SIDE) and not a STRING.
ah.
thanks.
wonder where I've got that into my head from.
*shakes head to dislodge
I cannot see my error for looking in the last few lines -- could someone put me out of my misery.
//evacuation.sqf
//looking for SmokeShellGreen
_shooter = _this Select 0;
_ammotype = _this Select 4;
hint format["%1",_shooter];
sleep 0.5;
hint format["%1",_ammotype];
sleep 0.5;
hint "";
sleep 2;
switch (_ammotype) do
{
case "SmokeShellGreen":
{
Hint "Green Smoke Detected";
sleep 0.5;
Hint "";
_signalArray = [];
_smoke = position player nearObjects ["SmokeShellGreen", 50];
private ["_signal","_signalPos"];
if (count _signalArray > 0)
then {
_signal = _signalArray select 0;
_signalPos = position _signal;
} else {
_signalPos = position player;
};
Hint format["%1",_signalPos];
sleep 1;
Hint "";
_safePos = [];
_range = 35;
_maxGrad = 0.1;
while {((count _safePos) == 0)} do
{
_safePos = [
["position", _signalPos],
["number", 1],
["objDistance", 9],
["range", [0, _range]],
["maxGradient", _maxGrad]
] call RUBE_fnc_randomCirclePositions;
_range = _range * 1.25;
_maxGrad = _maxGrad + 0.01;
};
createVehicle ["Land_HelipadSquare_F", (_safePos select 0), [], 0, "NONE"];
};
};```
Many Thanks.
Well, what does the RPT say?
...
Machiya, check the RPT file. Or at least tell us what the last shown hint is and what you even expect from this code. Because all it does is spawn a helipad.
Exactly - throw a grenade, check its a green one, spawn a helipad. It work right up to the final line...
Check the RPT file.
%appdata%/Local/Arma3 -- no relevent .RPT
Script Error is 'Error undefined variable in expression : _safePos' in the createVehicle command
is there a way to lose the time stamp on diag_log entry to .rpt ?
How would I go about using an entitykilled event handler but only if the entity belongs to a certain side
so
addMissionEventHandler ["EntityKilled",
wait
addMissionEventHandler ["EntityKilled",
{
_this spawn
{
params ["_target"];
if ((isPlayer _target)) exitWith {};
sleep 3; // reset time...
deleteVehicle _target;
_newTarget = independentDummyGroup createUnit [(typeOf _target), [0, 0, 0], [], 0, "CAN_COLLIDE"];
_newTarget setPosATL (getPosATL _target);
_newTarget setDir (getDir _target);
_newTarget switchMove "";
[_newTarget] call BIS_fnc_VRHitpart;
// _newTarget disableAI "ALL";
// _newTarget enableSimulation false;
};
}];
woops
``sqf
''sqf
this
addMissionEventHandler ["EntityKilled",
{
if ((side _x == independent) && (!isPlayer _x)) then
{
_this spawn
{
STUFF TO DO
};
};
}];
im trying to make a grid system that displays a picture with a text value with controlsGroups but when I use the controlGroup inside a controlsGroup then in a display it just comes up blank with the scrollbar. I tried using ListNBox but didnt really meet what I was trying to do...
[SOLVED] Helps if you don't use deprecated functions! Now using BIS fnc findSafePos.
Spawns a helipad on a specific grenade; having looked for a nearby flat'ish spot.
Thoughts on best appraoch to cleaning up would be welcome.
//evacuation.sqf
//looking for SmokeShellGreen
//Check what has been fired
_shooter = _this Select 0;
_ammotype = _this Select 4;
sleep 3;
switch (_ammotype) do
{
case "SmokeShellGreen":
{
Hint "Green Smoke Detected";
sleep 1;
Hint "";
_signalArray = [];
_smoke = position player nearObjects ["SmokeShellGreen", 50];
_signalArray = _signalArray + _smoke;
private ["_signal","_signalPos"];
if (count _signalArray > 0)
then {
_signal = _signalArray select 0;
_signalPos = position _signal;
} else {
_signalPos = position player;
};
_safePos = [];
_range = 10;
_maxGrad = 0.1;
while {((count _safePos) == 0)} do
{
_safePos = [(_signalPos), 0, _range, 9, 0, (_maxGrad), 0, [], [getPos player, getPos player]] call BIS_fnc_findSafePos;
_range = (_range * 1.25);
_maxGrad = (_maxGrad + 0.01);
};
Hint format["%1",_safePos];
_evacPOS = createVehicle ["Land_HelipadSquare_F", (_safePos), [], 0, "NONE"];
};
};```
nvm, HAZ is a godsend and he fixed it
my next task i've deemed to be ridiculously difficult to do and have given up before I even start
do nested ifs work in SQF?
Yes
if(cool) then
{
if(cool && cooler) then
{
if(cool && cooler && coolest) then
{
};
};
};
10/10 question
[Code]
if(cool) then
{
if(cool && cooler) then
{
if(cool && cooler && coolest) then
{
};
};
};
[Returns]
Mike Posner - Cooler Than Me
LOL
I really just know this song because of GTA 5
But it's catchy when you're driving over pedestrians
is there away to just spawn a grenade?
_frag_grenade = createvehicle ["GrenadeHand",position player,[],10,"none"];
done
that "GrenadeHand" is ammo for "HandGrenade" classname
or it will not boom and even spawn without weapon holder
I can't believe you can't add accessories to weapons in containers (specifically player's uniform / vest / backpack)....
there's commands to retrieve them but not add them ๐
yah
Guys. Anyone know a shorter name for addWeaponWithAttachmentsCargoGlobal?
addWeaponCargoGlobalLinked ez
AddLinkedWeaponCargoGlobal?
There is also addLinkedWeaponCargo then.
Just like addWeaponCargo and addWeaponCargoGlobal
Addcratemakeplayergethisownoutofthecrate
That's a serious question...
addLinkedWeaponCargo, addLinkedWeaponCargoGlobal ?
I don't know if Linked is clear enough
from linkItem
it isn't and that word isn't used for any of the getter commands
also linkedItems...
which isn't a getter for weapon items / attachments
I'm making a new script command.
So far
container addWeaponWithAttachmentsCargo(Global) [weaponClassname, muzzle, side, top, bipod]
Maybe
container addWeaponWithAttachmentsCargo(Global) [weaponClassname, muzzle, side, top, bipod, magazine, ammocount(optional), count(optional)]
With count you can add like N weapons of same type with same attachments
Oh man... How do I handle defaults..
If someone passes "" as magazine. Does he want no magazine or the default magazine associated with the classname?
How do I handle that
I guess I can just take nil as default?
Yeah
Is not a problem passing nil in scheduled right? as long as it doesn't come from a variable?
is there a cba/bis func that simulates the auto hover action of choppers?
Nah.. I can't give you the ability to remove attachments that are preset in the weapon class... But that's fine right? @lone glade
@meager heart thanks thats exactly what im looking for
yes
Actions#AutoHover didnt work im guess cuz im in a class plane not class heli?
not anything, atleast directional thrust vectoring planes like harrier /35b
would make it easier to use the pilot camera
I mean vtols have hover mode?
vtols dont have hover thats why i want to add it, nvm tho
how do you stop the renegade mechanic? (auto enemy when you FF or crash)
i tried player addscore and increase rank but nothing changed, tried remove group and add to new group but still considered enemy of the state
"all i did was crash a blackhawk full of tier 1 operators"
i dont know the technical term of what it is but it makes the player side == ENEMY?
player addRating 2000;
player addEventHandler ["HandleRating",{0}];
i dont know the technical term of what it is but it makes the player side == ENEMY?
https://community.bistudio.com/wiki/ArmA:_Rating_Values @lusty canyon
YES thats it, i knew it was something like that. my head was stuck with "score" something...
if i do the EH 0 rating, will there be any issues to not having the rating go up either?
rating will not change
to rephrase does having a positive rating actually effect anything?
last time i checked, a positive rating makes your mates not shoot you :>
other than that it's just the pointless endmission score, no? i dont think i've seen a point in it ever since operation flashpoint back in the days
i thought addRating and addScore wer different? do both have to be positive so they dont shoot you?
oh, maybe i confused em
dont know really, tbh. the only time i use it is when i want the player to be enemy of all
i want the player to never be enemy of all AI just cuz of silly mistakes in driving so i guess ill do the EH with a neg value filter
do the other ai see each other?
because might as well just give them a huge negative rating?
oh wait, taht wouldnt do. it'll end up as deathmatch :>
@lusty canyon I mean, it obviously depends on the mission, as this wouldn't work for all, but a way that's been done before is to have the player on civilian side, and when he makes a "screwup" (as determined by a number of eventhandlers), you swap him to blufor/opfor/whatever.
Not sure if that's exactly what you're looking for, but sounds like it ๐
i probably would scrap that idea all together, because it's really not smooth to pull off and also i cant really imagine a scenario right now where that would be worth the work :p
I mean it depends on the "openendedness" of the mission
if it's just a mission where you have to drive on a road and not leave it
another solution would be to have all on blufor side and then switch the enemy groups to opfor, similar to how you suggested above.. just with the ai group and not the player
just have it with some invisible zones along the road, if exit zone, switch
or, if player sprints within 10m of AI, switch
that probably would be the smoothest way, i guess
hell, there's even a vehicle speed handler i believe
if speed goes above speed limit, switch
40km/h you're cruising, 41km/h, you dead!
๐
player addEventHandler ["HandleRating",{0}]; //--- No change in rating
player addEventHandler ["HandleScore",{false}]; //--- No negative score added
"40km/h you're cruising, 41km/h, you dead!" << sounds like american police when you're black :p
sounds like a cophater when he's uninformed tbh
Not attackin ya, but don't make fun of people who risk their lives to protect innocent people.
from my little understanding of EH would this work
player addEventHandler ["HandleRating",
{
_returnRating = _this select 1;
if (_returnRating < 0) then
{
_returnRating = 0;
};
_returnRating;
}];
all positive values get passed along as normal while anything negative should pass 0, is this correct?
"Not attackin ya, but don't make fun of people who risk their lives to protect innocent people." << too late, already made fun of em
the problem with the so called protect and serve people is when they are in a peaceful gun free country, they have a QUOTA to fill so they have to prey on the innocents they protect just to justify their existence.
its the innocent people that need protection from them!
@indigo snow what does max keyword do?
returns whichever number is higher
inverse of min
so if (_this select 1) < 0 it returns 0
oh cool great way to shorten my shiet code
i dont need to add my EHs inside the players respawn EH since they are persistent already?
and how do you protect your EHs / inits from mission makers that wipe players slate clean?
What are the best sources to learn UI editing in Arma 3? Still VBS wiki?
