#arma3_scripting
1 messages ยท Page 197 of 1
dumb question, does your game server have the all same mods loaded as you?
like RHSSAF, 3CB and all
its not as dumb as you think
but all the content that is being used by this script is in fact on the server yeah
- requirements
i guess what i could do is reupload the mod to server just to be sure, its been updated a bunch over the past weeks but shouldnt be in any way that impacts this
i installed arma 3 server on same machine as my game earlier, and in those tests the units always spawn with their loadout fully sorted
so i think you are on to something with the delay
since i was connecting to that with internal ip
the missing items make me think their classes might not exist on server, so i just wanted to rule that out - it'd be unlikely to happen on a normal configuration anyway, e.g. verifySignatures = 2 + no items from optional mods
im beginning to doubt FASTER now
it's weird though, the out-of-order setUnitLoadout and addMagazines commands shouldn't happen if they were executed where the unit was local
its been behaving erraticly
i think the RPT lists the loaded mods
sec
got confused for a sec which mod we were talking about lol. Man its been so long staring at this stuff im just seeing stars at this point lol
i check RHS mods are all loaded on server, so is 3CB, so are the other content mods that are used for the loadouts
wouldnt that give the 'no entry' or some other error or warning in rpt?
How can I get the laser object from an UAV directly? I can't get it with laserTarget ๐ค laserTarget (remoteControlled player) // returns null
you can test to see if they are on there by just manually adding it while on the server. don't even use your script.
or, do you even have mod verification with keys enabled?
Is it possible for me to overload a built-in function for my mission? For instance, I'd like to overload fn_masterarm.sqf to remove the capability to change loadouts.
it looks like Faster shit the bed thoroughly
im gonna bite the bullet and set it up from scratch
its so bad i dont think my problem its script related anymore
i think all sorts of stuff is messing up under the hood of faster to the point where the UI and what actually happens with mod files and on server launch dont correspond in the slightest
so beginning to think those classnames were in fact missing @errant iron
That's just normal-for-Faster stuff. It is not very reliable at installing mods.
is there anything better that you know of?
nah
buhhh
It's Arma, everything is awful
It's likely a lower level issue because many hosting providers have the same issue. steamcmd tends to timeout in the middle of downloading mods or something.
faster is pretty solid once you know the quirks, but shes also busy and can't put out more patches atm
and yeah the steam timeout is a big thing
I'm not sure what the standard workaround for that is.
I just see a lot of people with the problem and send them to the Faster discord :P
there is always CLI too ๐ฆ
And they can at least tell them which button to click on.
For a personal server you can re-use the client data and not bother with steamcmd at all. Saves a lot of hassle, but then making command lines for high mod counts is a pain.
im hosting for a community, we play with a variety of mod sets so faster is really the only option
i know there is a good linux software for arma server management but my box is windows
Ah well, keep clicking that update button or whatever it is
oh i ahvent had that issue in a while
i started suspecting things when a while ago it told me i had unsigned content when in fact everything was properly signed on client and server
since then i guess its just been degrading
just now i found that RHS mods were on the server, though not being used by faster, while still visible in the UI, and it was loading what now seems like empty mod folders lol
dont even know whats going on anymore, just select all, delete, and start over
I need a hand, I'm trying to make a thing that does one line if BOL_1 is taken, and another thing if the slot is untaken (variable undefined)
At the moment the code breaks due to undef var
//OP LEAD
if (isNil BOL_1) then {
"There is not an OP Lead yet, there may be an Element Lead to run the show.";
}
else {
if (vehicleVarName player == BOL_1) then {
"You are the OP Lead.";
}
else {
format[ "The OP Lead is %1." , name BOL_1 ];
}
},
this is a block from the total hintC script
isNil takes a string, not a identifier
I see, when I ran that before using string I got a dif error.
[] spawn {
"Mission Information:" hintC [
if (isNil "BOL_1") then {
"Ther>
14:21:51 Error position: <hintC [
if (isNil "BOL_1") then {
"Ther>
14:21:51 Error Type Any, expected String,Text```
That was when it had quotes
Post your code not just error
//OP LEAD
if (isNil "BOL_1") then {
"There is not an OP Lead yet, there may be an Element Lead to run the show.";
}
else {
if (vehicleVarName player == "BOL_1") then {
"You are the OP Lead.";
}
else {
format[ "The OP Lead is %1." , name BOL_1 ];
}
},
this led to error above
Where is hintC
It seems one of your texts within if and switch is not returning a string properly
Yeah error's on the first block I sent
You really sure the first if is doing it
if (isNil BOL_1) then {
"There is not an OP Lead y>
14:57:42 Error position: <BOL_1) then {
"There is not an OP Lead y>
14:57:42 Error Undefined variable in expression: bol_1
14:57:42 File C:\Users\alex-\Documents\Arma 3 - Other Profiles\TechnoTrog\mpmissions\OPS - Regular\Cherno.chernarusredux\scripts\welcome.sqf..., line 9
from RPT
wait no wrong error
that was no quotes
Your conditions return nil and it seems hintC doesn't like it
15:19:39 Error in expression <0;
[] spawn {
"Mission Information:" hintC [
if (isNil "BOL_1") then {
"Ther>
15:19:39 Error position: <hintC [
if (isNil "BOL_1") then {
"Ther>
15:19:39 Error Type Any, expected String,Text
15:19:39 File C:\Users\alex-\Documents\Arma 3 - Other Profiles\TechnoTrog\mpmissions\OPS - Regular\Cherno.chernarusredux\scripts\welcome.sqf..., line 7
Thats the error using the above sqf
Simplified:
"asd" hintC [
if(true) then {"100"},
if(false) then {"200"}
];
```will do array of "100" and nil which errors it out
"asd" hintC ([
if(true) then {"100"},
if(false) then {"200"}
] select {!isNil"_x"});
```do this to filter out nil lines
What does that return then?
it will remove nil items from array before sending it to hintC
First code bit will produce ["100", nil] and error out, second will make ["100"] array
does that not just only then return the first value?
no, it selects items that aren't nil
try it, wrap your right hintC array like that
ok
[1,nil,2,if(false)then{100},3] select {!isNil"_x"} => [1,2,3]
More specifically your if ((groupId group player) == "Bruiser 1") then { lines end up in nil as they don't have else condition
We might be in biz here
first slot worked.
checkin gthe others
Yew
rock on that worked, love the community
hey is there a way to destroy the glasses / window of a building? ai inside buildings dont wanna shoot at a target they see if there's a window infront of them that isnt broken...
ok i foud it
private _building = nearestBuilding player; {if ((_x select [0,1] == "g") || (_x find "glass" != -1)) then {_building setHitPointDamage [_x, 1];}} forEach ((getAllHitPointsDamage _building) select 0);
Hey so idk where to address this, but I seem to have a problem where the DLC watermark appears on a modded item. I do not own any of the dlc's
but when I play on a different modpack, there's no watermark anymore
we're still talking about the same item in two different modpacks
_nearestPlayer setPosATL (getPosATL pad1);
Trying to make a teleport trigger that if one player steps on it, they (the nearest to the trigger) get teleported to pad1. Tried to use just player setPosATL but it teleports the whole lobby
.
^ Current result of using _nearestPlayer is that it doesn't teleport anyone or anything. Tried to run this via singleplayer and MP (locally hosted) with no luck.
some mods uses a DLC item as the basis of the item. Others use a vanilla item (no watermark) and work through that, thats my best guess
yeah, but the thing is on one modpack, with 17 mods and this one, the item (helmet) has no watermark
but the other modpack with about 60 mods, the same helmet proceeds to have the watermark
my best guess is a collision somewhere
Nearest player from where.
If you have trigger that active tp,
And you want to teleport the nearest player of object x?
You get your nearest player with nearest entities and sort list by distance and select 1st object.
Or list of player and apply distance to object and sort it and select 1st (nearest)
how to process event handler once per hit ? want to also register fire from handgun if possible
with these conditions event is still triggering multiple times
_tank addEventHandler [ "handleDamage", {
params [ "_unit", "_selection", "_damage", "_source", "_projectile", "_hitPartIndex", "_instigator", "_hitPoint", "_directHit", "_context" ];
if ( not local _unit ) exitWith {};
if ( damage _unit >= 1 ) exitWith {};
if ( not isDamageAllowed _unit ) exitWith {};
if ( _projectile isEqualTo "" ) exitWith {};
if ( _context isNotEqualTo 0 ) exitWith {};
// process damage
_damage
}];
Where do you call this script from? A trigger?
You can't exitWith out of topmost scope in event handlers
As far as I know there is no 100% consistent way to do it with handleDamage. hit EH might do it, I forget, but then you don't have damage handling.
The reason it's firing multiple times is because the bullet is hitting multiple sections of the body, either directly or by damage spreading to adjacent selections. If you want to properly handle incoming damage, you'll need to process these secondary hits too.
But yeah, you must process your HandleDamage function for each hit part. You can come up with some elaborate scheme like saving the damage into variable and then do calculations at the end of frame but I wont recommend it as its very complex topic
What's your end goal anyway?
register hit by any weapon
calculate overall damage based on projectile ( e.g. missile = kill in 1 hit, tank shell = kill in 2 hit, bullet = kill in 500 hit )
apply damage to vehicle
do a more "arcade" damage model
problem is, that event is trigger multiple times = adding more damage than suppose to
What you need is to get previous damage and return it instead (not exitWith) if you want to skip that damage part
Changed the trigger condition to
this && (player in thislist)
Think it works
so exitWith { 0 };
You can't exitWith out of topmost scope in event handlers
exitWith {0} will heal the unit to 0 damage on that part
ah, so exitWith { damage _unit }
_tank addEventHandler [ "handleDamage", {
params [ "_unit", "_selection", "_damage", "_source", "_projectile", "_hitPartIndex", "_instigator", "_hitPoint", "_directHit", "_context" ];
private _old_damage = if(_hitPartIndex < 0) then {damage _unit} else {_unit getHitIndex _hitPartIndex};
call {
if ( not local _unit ) exitWith {_old_damage};
if ( damage _unit >= 1 ) exitWith {_old_damage};
if ( not isDamageAllowed _unit ) exitWith {_old_damage};
if ( _projectile isEqualTo "" ) exitWith {_old_damage};
if ( _context isNotEqualTo 0 ) exitWith {_old_damage};
// process damage
_damage
};
}];
guys im going absolutely crazy
how is it possible for a server to demand for mod signatures with the verification turned off?
are you using faster, right?
Go to the faster discord
๐
alright so sorry for wasting everyone's time with the randomized loadouts issue, it turns out it was cursed FASTER
fresh install + all mods deleted and redownloaded fixed the loadouts script
i have no idea why there were no related errors generated for anything else missing
weve been playing missions on this busted configurations with all sorts of assets for weeks without trouble with anything but my home made random loadout script
my last question is what would be the optimal way to implement this stuff, the current state of things is based on the latest attempt of fixing the problem
should i do this?
or this?
possibly over half a year actually
both options work, but IMO i would keep the local check inside the function
that'll simplify your init= fields and make it less likely to encounter the same bug again, like if you call the function in a different script, it'll simply do nothing on remote units rather than sometimes half-loading them incorrectly
thanks again for all your help @errant iron
.
is there a guide for obfuscating ur code files
why would you
so it doesnt get stolen
make your addon/script server-side then
obfuscation is slowing things down and does not even prevent finding the original code
Most likely no-one wants your code except OpenAI :P
One way to get obfuscated code is to just write it absolutely poorly lol.
๐
Who knows how to use RadioProtocol from script? What I want to achieve is scripted messages to group radio mimicing player commands to AI. I know the RadioProtocl config and figured out that you can do eg.
player groupRadio "SentCmdDetonate", which works (player says "Detonate charge" in correct voice/language and radio chat message is shown. What doesn't work is that the selected AI team member is not said as part of the message, eg. "Two, Detonate charge".
The RadioProtocl config shows that there are arguments in the messages, eg. configfile >> "RadioProtocolENG" >> "SentCmdDetonate" >> "__1_1___Detonate_charge" >> "text" is "%1.1 - Detonate charge"; How can you fill the %1.1 argument from script?
not the correct forum to ask. Try #arma3_questions instead.
To answer your question in a broad way anyway, its likely a mod in the larger modpack (dont do modpacks this is the main reason why this kind of stuff happen, get a properly curated modlist) is redefining the class or a variant of the object is inheriting from that and using dlc references, like models, animations, ammo or pictures.
hello, so i want to make a simple mod, but after i load the mod and get in to the main menu of the game it says that the mod's fn_initPlayerLocal.sqf is missing, even though its in the mod folder where i work it on before i pack it into a pbo, can someone help me with this?
im new to modding arma3 so sorry if i made any confusion
I assume your issue is that your path is just wrongly defined.
You could share your config (cfgFunctions at least)
#arma3_config
sure
I hadn't thought about this before, but if I create a unit and then remote execute a function on another client with the unit as an argument, is it guaranteed that the unit will be broadcasted to that client before the function is executed?
Yes
whew, was a thought that came up while debugging my curator modules not initializing reliably
ended up fixing that by wrapping the unit creation + variable assignment in isNil
https://github.com/Warriors-Haven-Gaming/WHFramework/commit/1491fd3c4a8bbe92ed9b51f8beade0c8a1324e9c
well, half fixed at least, module comes out uninitialized in postInit, but it now works if i delete it and let the mission regenerate the module later
meh, good enough ๐
Has there been any luck? I was planning to do something like this for a survival mission but just couldn't wrap my brain around it.
Is it possible for a Task to have multiple targets attached to it?
yeah basically you create child tasks with https://community.bistudio.com/wiki/BIS_fnc_taskCreate
Example 2
Ah ok cool, seemed a bit overkill as i just want to highlight like 5 enemies at the end of a wave. So best case would to be create a task per enemy?
Thank you
dont know if this is the right place but. I am trying to start Arma 3 and I keep getting a crash on startup followed by
z/ace/addons/main/script_macros "not found"
I dont want to use ace anymore but the game wont work unless I have ace loaded is there any way to fix this?
maybe some other mod requires it?
ive checked all my mods for dependencies of ace, but havent found any, these are also mods ive used in the past without ace.
hmm maybe you should still try without any mods
.......okay so no mods works fine, ANY single mod though, and the error appears
its weird
Yesh, I simply set it so that the money only spawns on each non-Indfor (because players are Indfor) human unit
What code do youn need me to show you?
How would I go about compiling a bunch of scenarios together and publishing it in a mod? I'm currently maintaining five different workshop scenarios involving different sets of dependencies, and that requires me to re-open Eden Editor repeatedly and manually update each scenario which is getting cumbersome, hence the idea to compile them together.
Ideally this mod would work server-side and the scenarios could be downloaded onto clients like a normal scenario file, though if I can't do that, I'll likely continue offering the bare scenario files outside of workshop. The scenarios share a ton of scripts, and as part of keeping it server-side, I (probably?) can't afford to extract them into a common addon. However, I maintain each scenario as a separate branch in a Git repository, so merging changes across them is relatively easy. I'd imagine having a branch that contains just the addon files, and then using a Python script to copy the scenario directories into the addons before packing and publishing it.
FYI I've never published a proper mod before and couldn't fully grasp the addon mechanism from the "Creating an Addon" wiki page, so I might need some pointers on that too.
yeah, i have a rough idea that i'll probably need CfgMissions.MPMissions, multiple addons, and CfgPatches.requiredAddons to specify each scenario's dependencies, i'm just not sure about other details that i might not know about
HEMTT seems like a pretty useful tool too, but i previously didn't know how to proceed after generating the project template, and couldn't find much more info from the docs either
does anybody know how to create an eden editor script for the following please: land_3as_Sullust_Factory_Light_Red
I am trying to make it flash on and off repeatedly on activation.
If u can help that would be great thanks.
What do you mean eden editor script? You mean a script in this object's init field?
So like when making a mission file in eden editor I have it so that there is the red factor lights on the roof and when activated by pressing custom noises for an alarm the red lights turn on when activated but also flash on and off repeatedly.
I don't know what this object is but start simple, make it appear on your "activation" event, whatever you wanted it to be
Learn triggers and addAction, depending on what you need
Is there a way for me to learn how to Arma 3 code?
i suppose this fits here
im very new to scripting in pretty much anything lol
but ive managed to load some textures onto a shikra using SetObjectTexture (in the eden editor)
all im trying to figure out is
the fuselage is
SetObjectTexture [0, 'texture.jpeg'];
and then wings are
SetObjectTexture [1, 'texture.jpeg'];
is there one of these numbers for the cockpit texture?
or do you have to modify the vehicle config to change that
Depends on the vehicle. Custom textures are applied to "selections", which are defined in the model. If the model doesn't have an accessible selection defined for a particular part of it, then you can't change the texture of that area without modifying the model.
You can inspect the vehicle in the Config Viewer to see what hiddenSelections are available. (They might not have useful names; if not you can test them in numerical order to see what they cover, or use Advanced Developer Tools to see what their texture looks like.)
ahh yea i see it now
theres only camo 01 and camo 02
cant change the cockpit one
ahh well thanks for the help lol
BTW, I'd recommend using PAA files for object textures rather than JPEGs. JPEGs have some rendering problems at longer ranges. Arma 3 Tools contains a converter.
yah ik, im only using the jpegs as a test
loading them from the mission file just to learn texturing
hello all: why is it sometimes when p1 as in, ( i'm the player named p1) and i add 9 more soldiers, p2 p3 p4 and so on, why do i end up being p10 or the last playable unit in the group at the start of the mission, this is just nuty to me,
I assume just the initserver.sqf, I should have the gradmoneymenu module for the mission folder
Are you copy + paste.
Not with new unit, add attributes manually.
I assume you [โ๏ธ] player check from attributes get copied so last unit that you have is player (it can be only one in sp)
yes i checked the box player only on me
i seem to have to group each playable unit to me one at a time, and then hit save mission, each time
to get it the way i want , its just nutty
but if thats what i must do then so be it lol
yes i make each playable soldier one at a time and i make sure every thing is ok then i group them to the leader me witch is named p1 and when i start the mission sometimes im p10 it just nutty
hey... I noticed that too
good so im not going nuts
even tho I'm the leader, I'm like the last in the group
so what i did to fix this is: i seem to have to group each playable unit to me one at a time, and then hit save mission, each time
to get it the way i want
what do we have to make p10 first and then p9 and so on to end up being p1 lol
like backwards lol
Unit ordering in the slotting screen is based on order of creation, not group hierarchy
yeah thats the way i was doing it
Can we have a more exact description of what you're doing? Like in detail.
yes ok so i would make a playable unit and i would make it the player
then i would make each playable unit after that
and the i would group each playable unit to the leader and each playable unit would be ranked in order
What do you mean by "ranked in order"? Like Sgt, Cpl, Pvt?
like the leader would be the highest rank
Okay, and then what do you do next?
then i would make each playable unit after that
and the i would group each playable unit to the leader and each playable unit would be ranked in order
from highest to lowest rank
...yes, and after that?
then i would save the mission and start it and i would end up being p10 insted of p1
- How are you defining who is "p1" and "p10"?
- How are you starting the mission?
The variable name, or the identity name?
variable name
SP or MP?
SP and MP both
When you select a unit to play in MP, you can see the role description of the unit you're selecting. Is this different from the unit you end up being put into?
yes sir
i can see p1 at the top then i chose that 1 and some how i end up being p10
but it only happends sometimes
so what i did to fix this is: i seem to have to group each playable unit to me one at a time, and then hit save mission, each time
Science: I created an empty VR mission containing a Squad Leader (playable, player) and 9 Riflemen (playable), named from unit_p1 (Squad Leader) to unit_p10.I created them all at once, auto-grouped to the Squad Leader by proximity, and then saved the mission. I started the mission several times, in SP and MP, including saving and reloading the mission between attempts. Every time, I selected the Squad Leader, and was deployed as the Squad Leader on mission start.
Anecdote: I have never seen this happen in 7500 hours.
corrupted mission .sqm?
Same here.
everything seem to work perfectly sep for that
So I'm scripting some ai movement, or atleast trying to. Where do i put my .sqf files in my mission file? (I'm new)
This is my file (Don't worry the real file is the right format
Things to try:
- start a new mission from a blank file. You can copy over things from the old mission with Ctrl+C, Ctrl+Shift+V if needed.
- verify your game files.
maybe I'm talking about something different, in my case I'm the last in group ui (sp), even tho I placed the unit first in editor but gonna to double check that
yes same here
For mission scripts, the root folder is the folder with the .sqm file. You can do any folder directories after that however you want to organize it
If you want to make a mod, the root is the folder with config.cpp for each addon, but it's going to be a lot more involved in packing it.
allright, seems like a problem of yesterday, not happening now lmao
its a easy fix but was just woundering
maybe I reloaded the mission and got working, dunno
hmmmmm
interesting, I'm trying to activate them through triggers, I know the trigger activates as it triggers the weather change, but it ignores the script that I created and imported into "On Activation"
no = eather
thank you, i'll test that
just do [] execVM " triggerZone1.sqf";
how come is ignoring it? check with a hint
You might need #arma3_config for this
I finally got it to work after removing the null, and adding the directory for the folder. I was very excited when it said there was an error in my code as I finally can see it's accessing it
cool
adding the directory for the folder. is what did it, the null part was no big deal
that null = stuff i learned from NikkoJT that was from way back in the game left over from old stuff
Chat gpt was telling me that adding that null, while not necessary, is the better choice when dealing with "On Activation" Fields
ah
omg don't use ChatGPT omg
lol, why not
making simple scripts has never been easier, and you still need to understand the code, to see if your variable names line up
it's getting better
yeah but yu'll have more headakes , then if you just ask the guys in discord
like i said cuz my ChatGPT is the guys in discord
Discord is still very useful, chatgpt is kinda just like looking at a wiki page of whatever your prompt is, and I find it easier to understand at times
ok well i hope you enjoy headakes lol
That's my life, don't worry
going into a test of my scenario, hopefully I fixed my code correctly (no chat gpt this time)
Chatgpt is poor for a very small language like sqf with a small sample size. And that small sample size is 90% garbage.
well shit, didn't work
what was the erra
trigger was activated by group type apparently, not sure what happened
not by the conditions
okay maybe lets look at things more in depth.
does this snipbit of code make sense?
_eG1 move (getPos _heli1);
i'm trying to move a squad to a heli in the sqf script
well it does make sense but what about this
_eG1 move (getPos heli1);
or this
eG1 move (getPos heli1);
when should I distinguish between the two of them? All of this is in a external .sqf file that is imported into a trigger
whats the difference between global and local
well like i said your getting some what out of my range help @hallow mortar lol
i mostly use globale variables it easyer to me
Private and global are different
Global means the variable is in the global scope.
Such as mission variables, variables on an object, etc.
Private is only for local variables,
i.e. variables that start with an underscore
Variables that being with an underscore are local variables,
meaning they are only defined in that scope
someVar = 1; global variable
_someVar = 1; local variable
All local variables have to start with an underscore
interesting, so you use global if you want something to be shared between functions, and local for a safer way of running within the function. Both at the end of the day in my application of the scripts would function pretty similarly
like i said help @hallow mortar lol
im not that good m8 we need good guys to help you
see im still a noobe when it comes to scripting
esAlpha is already a group
Don't make me come over there and take your @ key
This page has useful information: https://community.bistudio.com/wiki/Variables
lol thx man shooo
So that variable should refer to the squad leader and not the squad it self
The error tells you that esAlpha is a group. The group command is for getting a group reference such as a group of a unit. You already have that reference in esAlpha (which you can use directly if you want)
see why my ChatGPT is the guys in Discord woohoo
Ooooh
that would be cool
thx for saving me guys the water was getting to deep for me lol
no they would be the same that unit1 is referring to the group not the leader
Is crew1 a group? An array of units? An accidental single unit?
Then yes, you would remove the group command since you already reference the group in crew1
@little raptor Thank you for posting this so many years ago. It has greatly helped me trying to solve a mission issue currently. However, I'm trying use the addEventHandler ["Take"..."Supply" option instead the addAction command, basically forcing the player to either reload or move the mag around in the inventory (simulating clearing the malfunction). I've tried removing the actionID variable and some other things and it's clear I'm not a coder. Any chance you can assist? I'm getting lost in the tree of command lines assisgned to the function, I think.
Look into how ace does their jam system. Or just use ace.
The intent is not to use ace, just to use the script for a one-off need.
If you want to keep it simple, just straight up remove the loaded mag and add it back to the inventory. Then they have to reload.
That's an idea. Although simple for you and simple for me may be relative. ๐ Leopard's script works great as is, so at the end of the day, I can still roll with it, but figured I'd ask for help in adjusting it. If that doesn't happen, that's okay and I'm thankful for what he's offered.
thats what i did
sep i did not add it back to inventory
its gone i removed it ๐
plus i added this to my player reload script ```sqf
if (needReload _player == 1) then { reload _player };
but you may need to change this so all players don't reload
How can i check if an object exists in a mission?
i have var name for an object, and if that object doesn't exist in the mission, i want my script to throw an error message
https://community.bistudio.com/wiki/isNil
If that variable is not defined
so that checks if the variable has been defined, but not if the actual obj with that varname is present in the mission
maybe vehicle varname could work?
Where and when you want check is x object doesn't exist in mission?
If you create in editor with var name object, that is broadcasted globally, and you want check in where is that object exist on mission?
You want use it in some condition if var x exist then, or some other situation?
During a user triggered script
yes, if the object with that var name is present. if its not present, then script exits with an error message (a condition)
seems like isNil worked somehow as the way i intended
thanks for the help 
hey guys, I'm pretty new to scripting in A3 and would like to have a helicopter teleport elsewhere on spawn, so that when it is destroyed, it will spawn at its "original" spawnpoint, e.g. the base. I've got this in my init.sqf,
waitUntil { !isNull heavy_gunship };
sleep 1;
_position = getPosATL helipad;
heavy_gunship setPosATL [_position select 0, _position select 1, _position select 2];
diag_log "Attemped to move heli";
where heavy_gunship is the actual helicopter and helipad is the actual helipad I would like it to move to. My script seems to run fine, get no errors in the mission, but the helicopter remains. (am testing by hosting in multiplayer) - would anyone be able to assist here? Am I somehow not understanding how setPosATL is meant to be used? Or maybe this should go in a separate file or in the helicopters own init section?
as an update - maybe this is an issue with global/remote/local issues? I've got it down as to literally hard-coding in a timer trigger, which does nothing with the activation line: heavy_gunship setPos [19962.613, 9723.102, 6];
however, when I hit Esc and run the same exact command as above, it works perfectly fine. I don't understand this at all
so you place the helicopter in the editor, then you want it to move somewhere else?
yessir - can confirm that this does seem to work perfectly fine in singleplayer when I test in editor, only when I try Play in Multiplayer it simply does nothing
do I need to use a RemoteExec somewhere?
so, once the aircraft is destroyed, you set up to respawn right?
using module?
aircraft retrieved by the players or destroyed, essentially yes
so once they "find it" they have it for the remainder of the mission even after destruction
so with the module for vehicle respawns I'm using, I technically need the helicopter to at least exist in the actual spawnpoint for a bit prior to then moving it over
ah okay, so the players find the helicopter, then if it's destroyed, it spawns back in the base
yessir
however, the trigger that I've setup just does nothing in multiplayer for some reason, but works perfectly in SP
how is your trigger set up? can u send us a ss?
another thing, what's up with the waitUntil there? are you waiting the helicopter to be deleted?
literally as barebones as possible:
idk what my thought process was, I thought originally maybe the init.sqf was running too fast or something and therefore the helicopter didn't "exist" until a few seconds afterwards
hmm make a separate script and don't use waitUntil like that, add a small delay (sleep) to it, but better yet, use Event Handler instead, like the "Killed" EH, so when your helicopter gets killed/destroyed, it executes your code directly
I mean would my trigger setup work though?
that's with the hardcoded code that works for sure
now it doesn't seem to work in SP either, this is very inconsistent
well this trigger, like this, will never activate
I'm not sure why - is it not set for a countdown and when the countdown is over, it activates?
I thought the this code in condition is always true?
no, it's because you don't have anything to activate it
what is the condition that you want to activate it?
nothing - I just want it to be a timer
no, this is used to check the activation type above, and true sure, will activate instantly
so that I can teleport the helicopter after 5 seconds
but to activate you need something
to start the timer? So should I switch to timeout?
but I don't want to destroy it - I don't understand
no, you're not getting the idea, trigger must activate with something, some code or some type of activation
to test it out
huh interesting you're right
then I don't understand, why doesn't just putting true; into the condition also satisfy the activation requirement?
If the condition code contains true and nothing else, the trigger will activate as soon as it starts evaluating.
this is not true.
In a trigger condition, this contains the result of the trigger's basic activation conditions (as configured in its Editor attributes or with setTriggerActivation), which can be true or false depending on whether those conditions are satisfied.
For example, if the trigger is set to BLUFOR PRESENT, this contains true when a BLUFOR unit is in the trigger area, and false when no BLUFOR units are in the trigger area.
It's provided in the Condition code so you can combine it with other scripted conditions.
Your "barebones" trigger has no activation conditions set, so this will never contain true.
I understand perfectly now, thank you very much ๐
is your trigger and script working okay now?
yep, thanks for the assistance ๐
though I still don't know why my init.sqf wasn't working properly
but that can wait for another day
great, still I highly recommend to check this for a good practice #arma3_scripting message
Tried attaching this static weaponn to a glass decal with [this, glass1] call BIS_fnc_attachToRelative; , but it keeps janking out like this being unable to fire. Anyone know a solution?
attachTo makes the attached use the simulation/updaterate of its parent
so attaching a proper vehicle (or static in this case) to a decal causes issues like this
ah makes sense, drove me nuts every time I would use attachTo to an object in a trench composition and it would cause this. I'll find a workaround.
I've been working on a custom module but I'm really struggling to get it working, does anyone know where I can find some documentation for it? (other than the wiki)
You can also tell what's unclear
Fair enough, serves me right for not elaborating lol.
I've been trying to basically make a trigger in the form of a module that checks if a player is in a given area. (I figured it'd be better to use the module as the trigger rather than a middleman that spawns one)
This is what I cobbled together (I know it's rough lol)
The problem is the _isActivated seems to only apply once when initialized, then the module just deletes itself? (I have set it to isDisposable = 0; in the config)
I've tried using the registeredToWorld3DEN case and I've tried both is3DEN = 1 and 0. There's something I'm not getting
https://community.bistudio.com/wiki/while
In non-scheduled environment, while do loop is limited to 10,000 iterations, after which it exits even if condition is still true.
No it is not deleted, it is just reached the limitation
while {_isActivated} do in that context will not end
Workaround for bad simulation when using attachTo on static objects. For example: a turret attached directly to a static building inherits its simulation and appears to lag.
So instead make an invisible logic under the turret and attach the turret to the invisible logic.
Turret init:
private _logicCenter = createCenter sideLogic;
private _logicGroup = createGroup _logicCenter;
private _logic = _logicGroup createUnit ["Logic", (getPosATL this), [], 0, "NONE"];
[this, _logic] call BIS_fnc_attachToRelative;
this enableWeaponDisassembly false;
this addEventHandler ['Deleted', {
params ['_logic'];
deleteVehicle _logic;
}];
If you don't need your module to run in 3den you can do:
private _logic = param [0,objNull,[objNull]];
private _activated = param [2,true,[true]];
if !(_activated) exitWith {false};
...
Then you don't need to deal with the modes and all that.
Its how i start most of my module functions. Only works if is3den = 0; is in the module config.
And i am pretty sure **activated **is just a value passed into the function. It never changes. So you can't loop over it expecting it to change.
The module function is just called again if a trigger activates it (that time with activated true).
If you need repeating logic, which you can stop: While loop (or CBA PFH preferably) -> write condition in a code field in the module and use that. And stop the loop when module is deleted. Either with delete eventhandler if you use a PFH or just checking alive _logic in the while loop.
A synced trigger can then control when the module starts its loop. You have a condition checked on each iteration which is defined in the module. And you can stop the whole thing by deleting the module ๐
Be careful with using logic units for this; they do require a group and so contribute to the hard limit for number of groups that can exist at one time. If you have a lot of other groups and also want to use a lot of logics for this purpose, it may be better to find another object to use as an attachment dummy.
* the hard limit is 288 per side, so this is not likely to be an immediate issue, just something to keep in mind
I never had a need to try it. But you could probably just group your logics into one group?
Also logics have their own side "sideLogic". So this is only really a concern if you create a ton of them.
You also shouldn't need createCenter. Arma 3 automatically creates a centre for all sides. Doing this would also create a new centre for each turret you applied this init code to, and while I don't know for sure that that would cause issues, it's probably best not to.
That would be why I just said it's not likely to be an immediate problem
Logic entities are also used by other systems, like Editor and Zeus modules, as well as some BI functions, so you do need to leave space beyond what's being used for this specific purpose
I would rather it behave like you would expect from SQF :harold:
Its easy to workaround by assigning it in constructor
Ah, that might do it, ty lol
Ah ok... I'll look into this. What does PFH stand for?
Per Frame Handle, CBA feature
https://cbateam.github.io/CBA_A3/docs/files/common/fnc_createPerFrameHandlerObject-sqf.html
Is there a way to stop static weapons from tipping over without disabling simulation?
I wonder if it would be possible if to run a HTML5 version of mumble be compatible with the steam browser and be compatible with ACRE at the same time? So you could kinda run mumble in the stream browser as background and have that as a PTT client instead of teamspeak?
https://github.com/Johni0702/mumble-web like this one
Agreed, it would be only for Arrays and HashMaps anyway, since all other (passed by)reference types have null.
It might worth pointing out on wiki through. It's not easy to see, that creating objects from same array(with nested arrays) results in objects having same empty array references.
Depends why they're tipping over. But in a general case you can attach them to an object.
How do I reduce the AI's ability to detect threats for a stealth mission? I don't want to be in captive mode. The AI โโalways detects me, no matter what precautions I take... it's impossible to remain undetected. Please help me.
It doesn't matter if I use silenced weapons in the rain or in the dark. Their threat detection capabilities are still beyond normal.
I did everything
Like the detection is pretty sensible at ~0.5 skill IME
out of curiosity, is it possible to detect a magazine that is supposed to be reloaded into a weapon right now, and then swap it out with a different magazine? like a replacer?
i'm kinda annoyed that some special magazines like round mags have a custom animation in config, which ofc only works with certain weapons
so my first thought was.. to write a script that swaps the magazine with a different one with a different defined animation ๐
but i think it would be stupid to track magazines at all times when picking up, dropping, starting a mission, etc..
Ask the SPE people, they do that shit and it fucks us up.
in what way?
Oh, garbage fake magazines to deal with in the arsenal.
hm. ok, but what i am thinking about is effectively the same magazine - in itself it would still be usable
I just need the AI โโto be less adept at detecting threats. I've tried every option in the game.
I It is impossible not to use weapons in that mission since it is a rescue
So give an example of what AI response you want from what action.
disableAI "FSM" ?
You can always do disableAI "CHECKVISIBLE" and manage all the checks yourself. Might be appropriate in some cases.
To enter a building where the hostage is, I must shoot the one at the door, but the enemies on the 2nd floor always notice and start killing the hostages.
To enter a building where the hostage is, I must shoot the one at the door, but the enemies on the 2nd floor always notice and start killing the hostages.
Yeah they'll hear that. I think CHECKVISIBLE still works but haven't tested.
real life
Also I think if you kill a unit in a group (even in one shot, miles away) they automatically gain some knowledge.
You can use the knowsAboutChanged group event handler to see how that works.
I think he should try disable FSM also, makes AI dumber and slower
the guy in the door is not par of the unit
ok ill check it
thanks sir ill try it
yea test both of them and check the results
yes..! thank you guys
There is also forgetTarget. And disableAI "AUTOCOMBAT".
I think this is what I needed. Thanks.
Once again I come crawling here for help after my lackluster understanding of SQF Syntax and the Real Virtuality Engine fail me.
I am trying to implement BIS_fnc_holdActionAdd in a multiplayer scenario.
I have the attached code in my init.sqf. It (including its comments so I can actually know what I am looking at) is copied from the Wiki and only slightly modified to fit my needs.
When the mission is started, no interaction prompt with the object is visible. Can someone tell me why this is?
If you're running it in init.sqf, you don't need to remoteExec it.
remoteExec is used to instruct other machines to execute the function, so you'd use it in code that's only running on one machine. init.sqf is executed by every machine when they start the mission, so by adding remoteExec in, you're making every machine instruct every other machine to add the action.
That's not why the action isn't appearing - it would cause the opposite effect, multiple actions on each machine - but it is an issue.
thank you, i will try a different implementation and see if it magically fixes anything
What is pizza1? Specifically, is it a Simple Object or does it have simulation disabled, and how is it created?
it is a user texture displaying a pizza, i should probably have tried to see if that is an issue already.
Probably worth testing with a different object, user texture might not have the right kind of geometry to be "looked at"
If that is the issue, a neat trick you can do is use an Invisible Wall object as a proxy
i may have done that before actually
I always forget how I did anything between making two missions and try to piece it together from my old scripts with variable success
You can deleteVehicle objects to remove them entirely btw, which you may find more convenient than using hideObjectGlobal, since hideObjectGlobal must be executed on the server
I got it to work but the pizza exploded when damaged for some godforsaken reason
This is a lot smarter.
Thanks
explosive flavor
Hello, I'm trying to edit a mission with some dialogues and voiceovers. Everything works allright when playing on singleplayer but when I test it on my server dialogues repeat tons of times, they get delayed, actions that are supposed to happen at a certain time don't happen at all or are way way way delayed etc... I guess it has to do with the functions used on the scripts because they're not compatible with multiplayer but I don't really know what I have to change. If someone can help me I could share the .sqf files
tell us how did you set up your dialogues so that we can help you
this the intro.sqf for example
Cuttext ["", "BLACK FADED", 999];
[0,0,false] spawn BIS_fnc_cinemaBorder;
0 fadesound 0;
//HideAll - units
{_x enableSimulation False;_x hideObjectGlobal true;} forEach (getMissionLayerEntities "Layer_AA_Units" select 0);
{_x enableSimulation False;_x hideObjectGlobal true;} forEach (getMissionLayerEntities "Layer_CargoBase_Units" select 0);
{_x enableSimulation False;_x hideObjectGlobal true;} forEach (getMissionLayerEntities "Layer_Fieldbase_Units" select 0);
{_x enableSimulation False;_x hideObjectGlobal true;} forEach (getMissionLayerEntities "Layer_HQ_Units" select 0);
Sleep 1;
Playmusic "SG_Intro_Music";
["<t font='PuristaBold' color='#f7f9fa' size='1'>El equipo ruso SSO estรก en el terreno para recuperar los mรณdulos de vigilancia perdidos<</t>",-1,-1,4,1,0,789] spawn BIS_fnc_dynamicText;
sleep 6;
5 fadesound 1;
Cuttext ["", "BLACK IN", 8];
[["01 - Marzo - 20XX", 4, 3], ["Cerca de Oteren, Fiordos - Noruega", 4, 3], ["223.ยบ Destacamento de Propรณsito Especial, Indicativo 'Sputnik'", 4, 3] ] spawn BIS_fnc_EXP_camp_SITREP;
Sleep 8;
["Kasatka", "Sputnik, tienes luz verde para ir. Cambio."] spawn BIS_fnc_showSubtitle;
["KasatkaTopicChat", "MissionConversation", ["Kasatka_Start_1", "Kasatka_Start_1"], "SIDE", nil, nil, 1, true] spawn BIS_fnc_kbTell;
Sleep 0.25;
["Sputnik", "Recibido, comandante. Por favor, repita sus รณrdenes. Cambio."] spawn BIS_fnc_showSubtitle;
["SputnikTopicChat", "MissionConversation", ["Sputnik_Start_1", "Sputnik_Start_1"], "SIDE", nil, nil, 1, true] spawn BIS_fnc_kbTell;
Sleep 0.25;
["Kasatka", "Dirรญgete a su torre de comunicaciones y apรกgala para retrasar la respuesta de cualquier unidad fuera de esta regiรณn. Seguimos investigando dรณnde estรก exactamente nuestra carga prioritaria. Corto."] spawn BIS_fnc_showSubtitle;
["KasatkaTopicChat", "MissionConversation", ["Kasatka_Start_2", "Kasatka_Start_2"], "SIDE", nil, nil, 1, true] spawn BIS_fnc_kbTell;
Sleep 2;
[1,1,false] spawn BIS_fnc_cinemaBorder;
{_x setunitpos "Auto"; _x EnableAI "Move"} foreach units CB_G_Player;
MissionStart_Con = true; //Flag for scenario start
If I managed to fix just the intro dialogues then I could fix every other dialogue that happens throughout the mission because the logic is the same
And well, this is the init.sqf but I believe this one has to be alright
//Start
execVM "scripts\CB_Intro.sqf";
//Environment set up
"colorCorrections" ppEffectEnable true;
"colorCorrections" ppEffectAdjust [0.9, 0.9, 0, [0.05, 0.05, 0.1, -0.05], [0.6, 0.7, 0.9, 0.6], [0.5, 0.6, 0.9, 0]];
"colorCorrections" ppEffectCommit 0;
@digital hollow Thanks for pointing me in this direction. I ended up going in a different direction and using Phronk's CRS scripts, but added the removal and adding of the mag with the same ammo count. This also let me turn the jamming on and off in-mission based on weapon class. I still suck at coding, but at least this was a small victory.
Anyone have any insight as to why uisleep 0.1; is throwing the following error?
5:58:09 Suspending not allowed in this context
5:58:09 Error in expression <xtDB2: uisleep [4]: %1", diag_tickTime];uisleep 0.1;} else {_v77yl = false;};};}>
5:58:09 Error position: <uisleep 0.1;} else {_v77yl = false;};};}>
5:58:09 Error Generic error in expression
5:58:09 File mpmissions\dominateStratis_50v50.Stratis\uk97z89ylo\z4urzj7cwc\fn_jurqmhmkr5.sqf, line 22```
@thin fox you got any idea of what's happening?
_nyi1g = "extDB2" callExtension format["4:%1", _bpc19];
if (_nyi1g isEqualTo "[5]") then {
_nyi1g = "";
while {true} do {
_oqpen = "extDB2" callExtension format["5:%1", _bpc19];
if (_oqpen isEqualTo "") exitWith {_v77yl = false};
_nyi1g = _nyi1g + _oqpen;
};
} else {
if (_nyi1g isEqualTo "[3]") then {
diag_log format ["extDB2: uisleep [4]: %1", diag_tickTime];
uisleep 0.1;
} else {
_v77yl = false;
};
};
};```
something is wrong in the script on line 22
Well it is saying "Suspending not allowed in this context" with the position right before a sleep. So it must be the uisleep command
the bottom most uisleep
idk
i just got into scripting a little while ago, not vary good at it
not good at all to be honest
variables are setup else where
and it's missing a get in function, but other than that it works great
```sqf
// your code here
hint "good!";
```
โ
// your code here
hint "good!";
Easier read when you use code block
// === Helicopter Movement ===
// =============================================================
// === STEP 1: Order enemy squad to board heli1 ===
_eG1 move (getPos _heli1);
// === STEP 3: Wait until all units are inside the heli1 ===
waitUntil {
({_x in _heli1} count units _eG1) == ({alive _x} count units _eG1)
};
// === STEP 4: Prepare FRIES and fly to drop zone ===
[_heli1] call ace_fastroping_fnc_prepareFRIES;
_heli1 move _dropZone;
systemChat "HQ: Be advised, bad sever rain storm and Enemy MI8 are inbound to your position.";
// === STEP 5: Wait until heli1 reaches drop zone (within 50m) ===
waitUntil {
(_heli1 distance _dropZone) < 20
};
// === STEP 6: Deploy ropes and rappel troops ===
[_heli1] call ace_fastroping_fnc_deployFRIES;
sleep 2;
[_heli1, _eG1] call ace_fastroping_fnc_fastRope;
// === STEP 7: Wait until all troops are out of the heli1 ===
waitUntil {
({_x in _heli1} count units _eG1) == 0
};
// === STEP 8: Return to base ===
sleep 5;
_heli1 move _returnLZ; ```
is that better?
Yes.
btw are you a mission maker?
Yes.
This is crazy! Can I use some of this code?
Yeah, you can
are you intereseted in being in a unit, cause we need a mission maker right now, im the head currently of S-3 Operations but i cant put all of my time into it right now due to exams and school
I figured it out. It is because it is being used in a call. Cant sleep.
My time is quite filled at this point, sorry.
ok
Do you have a server?
yes, and we are getting a dedicated box soon
I can help you with that aspect. Check out our services.
we have 2 other people working on the server.
You have many locality issues in that
Yes, but as a provider. Not running the server for you.
do you have a website that i can look at?
I suspect it's been called multiple times because it executes per client. It depends where you execute the script and how you manage it... like Hypoxic said, locality issues.
Could you tell me how could I fix it?
start reading this, with attention
https://community.bistudio.com/wiki/Multiplayer_Scripting
Okay
Sent it in a message, some people wouldn't like me posting that.
@tough abyss you cant sleep in unsheduled environment that the problem if you want to sleep you have to spawn or execVM your script
one
just to get the idea
Figured that out a few minutes ago @still forum but thanks!
It was being used in calls
So I just took it out
first decide, is this going to be a local script, a global script, or a server script
This was a mission-saver, thank you!
Swapped in the CBA PFH and now it works perfect, thanks man
Is there a way to make it so anybody (not just engineers) can use toolkits?
access to microphone is not allowed
If you wanted to test if it can work, just run the live demo in steam overlay.
yes definitely but I won't find the time to do that
Yeah. Will do that later.
Sure there is ^^ But its hard to find out i guess
Haven't been able to find anything anywhere online on it. I will have to look through the functions viewer to see if I can find something
That was what i just tried... I searched for keyword toolkit but didnt find anything... There has to be a script that decides if player can repair or cant
Unit has variable engineer = 1; in config
engineer = 1;
```};
So if I put in the init field of all the players: engineer = 1; they probably could use a toolkit?
no
You cant do that per script that has to be done in config... Which could be done in the description.ext like
class cfgVehicles{
class Man{engineer = 1;};
};
i guess atleast
ahh, gotcha
So I should build a script for it instead or make everyone an engineer? lol
hello all: is there a way to change the size of the text on a marker
i want it to be smaller
even if i have to script the marker it would be ok too
ahhhh dam
while there's no explicit setting to adjust marker text size independently, try adjusting the overall interface size in the game's video options
yeah im not doing that lol
I guess yes
did you try formatting the text? Idk if this will work btw
https://community.bistudio.com/wiki/parseText
https://community.bistudio.com/wiki/formatText
https://community.bistudio.com/wiki/Structured_Text
i did not try that but i will now lol
thx for helping m8
its really no big deal i can live with the way it is
Well, mission doesn't require any specific classname for my players, all 100 are rifleman, so won't make a difference.
but im going to try anyway
I'm not sure if parseText will work tho because it returns a structured text not a string ๐ค
yeah i guess i must script the marker to have that work maybe right ?
ahh nice cool man
try it first, not sure if it will work
looks like it will i hope it does
This is exactly the same as just doing _marker setMarkerText "<t size='2.0'>Marker Text</t>" btw. joinString is useful for making a string out of modular components - for example, you could use it to make a function that applies your text formatting tags to any string you feed it, so you don't have to type them as part of the string content every time. But it's not strictly required for making a string. If you already know exactly what you want to put into your string, then you don't need to use it.
copy that NikkoJT
yeah you're right, got things in the top of my head that's why, it's more useful for stringtable I guess
so is there any option to change the marker text size? that not involve draw
I prefer joinString over format honestly
i want the text to be 0.5 and to have the text EX Chop
Maybe it supports structured text returned by parseText just like hint for example, but wiki doesn't mention it for markers, so I doubt it
rgr that
It's worth trying the structured text and string-containing-structured-tags methods, just in case they do work.
If not, then I don't think there are any options. I don't remember if marker size also controls the text size; if it does then you could combine a standard size marker with a smaller one that's just the text.
@pallid palm could test it out for us 
i'll try but im not that good
From what I remember messing with marker size, it doesn't change the text size
you could make your own action and just use something like this
player playMove "ActsPercSnonWnonDnon_carFixing2";
sleep someSeconds;
_vehicle setDamage 0;
theres got to be away
Nah don't want to be launching a launcher for 5 minutes just to test this out. And I'm not joking, it does takes that long on Linux ๐ง
Well, you could try any of the ways that have just been suggested. That would be a good start.
im going to try my best but like i said im not to good
Good thing PiG13BR provided an exact example then
yes sir
yeah he always helps me
thx btw
most times all i need is a example then i can run with it
i hope a don't fall he he
PiG13BR's example doesn't parse string using parseText
We were discussing trying both structured text from parseText and string-containing-structured-tags. PiG13BR's example is the latter.
Luckily, using parseText is incredibly simple.
Nah, setMarkerText just supports string according to wiki. So, it most likely won't take Structured Text from parseText
if nothing works, ugly solution
: https://community.bistudio.com/wiki/drawIcon
I know what it says, but we don't really have a lot of other options. Hence try it, just in case. You don't lose anything by trying.
thats a roger
as a matter of fact my teacher said im the most trying guy in her class lol he he
I'm really impressed by your ability to type in here at the same time as typing the code in the game
yes thx, thats the 1st time anyone was impressed by me (sep when i'm on the Golf Corse) ๐
i go back and forth
ahh dam forgot a end of block damit lol
fingers crossed
oh so close let me try again
ahhh man
It does not work. It won't take Structured Text, nor it parses the string in any way. Using "<t size='2.0'>Marker Text</t>" just displays the string like it is, without any parsing.
yup yes sir: there must be away i can feel there is
hint parseText "<t size='2.0'>Marker Text</t>";
Displays hint with nice and big font. Just to test it out.
i want the small font lol
That's besides the point
i think it will work with a scripted marker
It doesn't support formating, it doesn't matter if large or small
It took longer to launch a launcher than test this out.
Ya, just one more script to write
i wish you could use getText in configs but this doesnt work ```sqf
class AAAA
{
atest1 = __EVAL(call compile "getText(configfile >> 'cfgVehicles' >> 'B_soldier_AR_F' >> 'displayname')"); // Sets empty string (not working)
atest2 = __EVAL(call compile "isClass(configfile >> 'cfgVehicles' >> 'B_soldier_AR_F' >> 'displayname')"); // Sets "false"
};
simple outside configs
Next question I have. I have a script looping on the server to every minute remove all "Killed" event handlers from Independent AI and add one, because I want the killer (player) to be given a reward after they kill an AI.
I am using a Headless Client and sometimes it works once at the very beginning, then never again, sometimes it doesnt even work at all
Reason why I am looping is because there is a spawn AI module and I want to make sure all AI are accounted for.
No errors in the logs, nothing.
I am using a regular event handler for "Killed" not the MP ones because I don't want it broadcasted to every client when an AI is killed (over 150 AI)
guys, I need help from someone who works with unpacked pbo data. anyone out there? ๐
shoot
@tough abyss thanks.
i cant get arma to read unpacked data. i added -filePatching to startup parameters, ran the filePatching script command in a formatted hint, result is always "any", disregarding the startup parameter. if i remove it, result is still "any". so im confused.
filePatching is not in the list of scripting commands.
Check your logs on the first line or two and it will tell you if filepatching is launching in the parameters
"Add scripting command filePatching to detect the actual state."
yep, filePatching is in the RPT.
wtf. y put it in sitrep goddamit. ๐ฆ
Even when testing the value in the debug console, doesn't work
exactly
so im really curious why arma does not accept my config changes from the unpacked data.
hmm...
Is there a way to make units follow a specific move path and still stop to fire, but not take cover or deviate from that path?
I want units to follow a specific path down through a tunnel, I don't want to use unit capture since unit capture is recording player action and I want the units to stop and shoot. What I don't want is for them to pathfind out of the tunnel because their AI is telling them to take cover from getting shot at. I want them to advance into position and stay there.
Better still if the AI can fire on the move like players can while walking.
You might need to split them into individual groups
You can use disableAI "COVER" to turn off at least some of that behaviour
I expected to need to have them in separate groups, so that's not a huge problem. Still, good to mention for anyone reading this who might not think of that.
hi guys, wondering if there is a command to find which target the gunner in a AA vehicle e.g tigris is locking currently?
for players there this command playerTargetLock but I cant see anything for AI that works the same. best ive found is getAttackTarget _unit;
I used to make single player story driven missions all the time back in day - I liked to try and follow a similar structure as BIS and the official missions in terms of how theyโre created and scripted etc.
I began to learn how to use FSMs for the mission structure- one thing I donโt fully understand is why isnโt the FSMs used for more of the scripting. Often, the FSMs are used for a small amount of scripts and then just call another script stored in its own SQF.
What is the benefit of doing that as opposed to just having the scripts in the FSMs?
Iโm trying to get back into mission making as Iโve gone down a rabbit hole of war lore and was researching the newer campaigns structures and community campaigns.
try getSensorTargets
and filter the returned array using other commands
mmmh I saw that command, but im not sure what further filtering could be applied.
Ofcourse checking if its enemy etc. But if there is 2 targets close to each other I couldnt find which one was currently being locked by the AA past that. getAttackTarget _unit; this seems to work ok tbh. Just when the AI change targets it takes a few seconds for it to update
Quick question, if I use getVariable to retrieve a variable assigned to a player, is the server contacting that client to retrieve the variable? Or is the variable also stored on the server somehow?
I want to avoid repeatedly contacting the client
getVariable is purely local. So it depends how/where setVariable was used.
If you're doing getVariable on the server, and succeeding, then you're accessing the server's copy of that variable. The variable was broadcast at the time it was set, not the time of retrieval.
Each machine can potentially have a different value for the same variable on the same object.
Ah ok thats good, that's the behavior I was intending.
And the client value should only ever be changed by a broadcast command so that's good too
Thanks guys
the wiki says that lineInterstectsSurfaces includes ground intersections but it doesn't seem to work, anyone have experience with it to share?
@tough abyss fyi - command is called "isFilePatchingEnabled", returns true on my system. still no loading of unpacked data. oh well.
anyone have a good preset for a spark effect? I cant seem to find anything that says "sparks" on the wiki to help point in that direction. If the forums worked, there seems to be alot of things there but of course they cant seem to fix that.
oh, ok
While I'm away, look for "drop" and "ParticleArray"
haha I crack myself up
Wrote it like 10 months ago, just opened it up, funny stuff
anyone? should i make ticket about this?
no, it's not something that can be added
that's just how configs work. you can use strings instead (and call compile it)
but i dont understand why isClass works but getText doesnt?
it doesn't "work" tho
no?
if you can make it return true I'll believe you ๐
false is just the default value
e.g:
class AAAA
{
atest1 = __EVAL(call compile "getText(configfile >> 'cfgVehicles' >> 'B_soldier_AR_F' >> 'displayname')"); // Sets empty string (not working)
atest2 = __EVAL(call compile "isClass(configfile >> 'cfgVehicles' >> 'B_soldier_AR_F')");
};
leo can you explain on the strings and call compile?
and ideas how to use getText with those? cause i have tried....
ill try
This documentation doesn't describe when EVAL is actually evaluated :/
without eval the code just becomes string
Ah yeah, I guess it'll only execute if you do getNumber.
config is silly
I don't know the logic here though. If the class is definitely loading after the stuff it's reading then I guess config commands aren't usable until config init is done.
that could be
Why would you do that?
can someone help me out with a script? http://pastebin.com/raw/VCdCuGQQ the setDammage 0 for the foreach objects isnt triggering, but I can stick the nested forEach bit in the debug and replace _kart with vehicle player and the objects get repaired like I want
hey guys, hope everyone is doing fine! I have run into an issue that I can not seem to solve:
I am trying to keep objects, that have been "attachto", always on ground level, even if a unit moves from flat ground to a slope. On flat ground all is great, but when moving to a slope all that is downslope is "floating" and all that is upslope is "stuck in the ground". I have experimented with sqf _x setVectorUp surfaceNormal getPosASL _x; in a repeating trigger, but it is not really working (am pretty sure I am doing something wrong).
i guess it wont work because the object is attached
setVectorUp and dir do work on attached objects
but the vectors should be relative to their parents. this simply means that your code will work incorrectly.
since it doesn't work at all, the issue here is your repeating trigger
idk what you're using and where _x is coming from here
pls use setDamage with one m
You use _x (if (str _x find ": tyrebarrier" > -1) then {_x setDammage 0};) inside the event handler
The _x is probably from the forEach
That doesn't work. It's a completely different scope
setVectorUp will rotate the object around its own origin, not around the object it's attached to (although the rotation vector will be relative to the object it's attached to). It will rotate the object in place, not change its position.
Your code (if corrected for being relative) won't move the object to the ground surface, it'll just rotate it to be at the same angle as the ground surface. The object will still float, just at a funny angle.
Local variables don't carry over to the event inside the addEventHandler
If you want to change the position of an attached object, the typical method is to attach it again with new relative coordinates.
It is probably possible to calculate new coordinates that match the terrain surface height, but it's going to be a bit of a bastard to figure out how...so I'm not going to.
And you can't pass arguments to events either, because this game <blank>
Point of interest, if these attached objects are units, it's worth keeping in mind that standing and crouching units do not actually rotate to match the angle of the surface they're standing on. Regular vehicles do (affected by their suspension as well) but Man units don't. They adjust their leg IK to account for it, but their actual object orientation remains perfectly upright. Prone units might be a bit different but I'm not totally sure.
I'd like to define a local function in the gamelogic and use that. http://pastebin.com/raw/pAPzxKm4 the hint works, but thats about it
you cant use local functions in a handler
Make it a global variable/function?
they only exist in the original scope
Ohh. I mis read the code.
if (str _x find ": net_fence" > -1) then {_x setDammage 0};
} forEach (nearestObjects [_kart, [], 10]);
I don't think this is the correct way of doing this
try: if (_x isKindOf "House")
or: if (toLower typeOf _x in [<list of class names>])
nearestObjects will also not work on map objects iirc
They have to be editor placed
okay well I got it to work, changed from call to spawn and put a sleep in before the forEach. The code DOES work with map objects
ahh
Anybody got a script to detect if an explosion goes off within a trigger, and do something when it does?
basically I made the code wait for the object to be destroyed
Are you testing this on a server?
editor
the return of the damage EH sets the damage
The reason for this is that the objects are probably damaged after the handleDamage from the vehicle runs
you dont setDamage inside the handler
He setDamages other objects
Ahh, yes. If your kart got damaged, then don't use setDamage on the kart, but return 0 for the handle damage script
You could also simply use allowDamage false instead.
if I did that, the handledammage could wouldnt fire, would it?
I am trying to run a piece of code whenever a player changes his weapon. I am using the "WeaponChanged" event handler, but it doesn't fire. the "EH loaded" systemChat below is shown, but when I change weapon, nothing happens.
player addEventHandler [
"WeaponChanged", {
params ["_object", "_oldWeapon", "_newWeapon", "_oldMode", "_newMode", "_oldMuzzle", "_newMuzzle", "_turretIndex"];
systemChat "EH fired!";
if ("_newWeapon" == "sfp_ksp58B2") then {systemChat "till ksp!"};
if ("_oldWeapon" == "sfp_ksp58B2") then {systemChat "frรฅn ksp!"};
}];```
* Am I using the eventHandler wrong?
* Is there some other method that could accomplish the same effect?
hmmm, apparantly it still does
where is the code run?
I am just testing it with execvm on a character's init field. None of the effects I'm after need to be global so I'm thinking I'll initialise it from initPlayerLocal.
was just thinking that maybe player is null there
You need use your variables without quotes.
In params those are defined with quotes, but those are used without.
If (_newWeapon ==...
If (_oldWeapon ==...
that may be the case, but systemChat "EH fired!"; should still fire even if the conditionals are shit.
Try add in initPlayerLocal.sqf
I tested this EH a couple of days ago and it's working fine
@little raptor & @hallow mortar - Thank you for your input guys, you are once again very helpful with your experience and insight. I am still testing so I am using a normal trigger that is attached to a leader that the player can control.
In the tigger condition I have ```Sqf
this && round (time %5) ==5
And on activation & deactivation I have:
```sqf
{
_x spawn {
sleep 1;
_x setVectorUp surfaceNormal getPosASL _x;
};
} forEach units group this;```
My probably very naive reasoning was that this would recalculate the **Z value** for each of the attached units and set them accordingly, but sadly things are not as simple as I hoped.
Is there a way to address/access each individual unit in a group (i.e. like the unit at group position 1, 2, 3, etc.) without giving it a unique name in the Editor? This way one could probably reset the attachement with the corrected z value? (like: ```sqf
*unit at position 1* attachTo [LEADER, [1, 0, 0]]; ```
Or maybe I am still seeing this a bit oversimplyfied again (am not really a big math genious).
This turned out to be correct. @stable dune running it from initPlayerLocal worked. Thx guys!
forEach units _leader (possibly (units _leader) - [_leader], if the leader is included in the returned array)
Because attachTo uses relative coordinates, not AGL or ATL, 0 Z means the same Z as the parent object - and if you only want to change the Z, you also need to know the child object's current relative position. You'd need to do some vector maths.
See: getRelPos, worldToModelVisual, vectorAdd
thanks, that puts me on the right path again, will see what I can cobble together :)
I would have used EpeContactStart, but it wasnt triggering for some items I wanted to undo dammage to
Tbh, I would just allowDamage false on everything you don't want to get destroyed.
Also, "damage" with one m
vectorWorldToModel to convert a direction to model space.
at this point you're better off not using attachTo in the first place
just use setVelocityTransformation every frame
setVelocityTransformation every frame does not appear to do anything different to setting pos/vel/dir every frame.
Unless you want the interpolation then I wouldn't bother with it.
well in MP those interpolations are important
also I think if you do setPos dir up separately they generate separate messages?
anyway the point is, since he wants to set the position too, attachTo is not helpful anymore (also calling attachTo is relatively slow)
I think the main reason to use attachTo here is that this is a relatively new scripter, and dynamically calculating the correct positions from scratch is a fairly tough problem. Saying "just" use setVelocityTransformation is kind of skimming over a pretty big chunk of understanding that you need in order to do it.
how to write a script so an engineer can build fortifications similarly ace fortify?
Is there a possibility to trigger freelook per command?
no
Meh... kk, thanks
Question for those who may know, what causes units to die underwater without a SCUBA/Rebreather?
And is there any way i can disable that?
I just made a custom buillding feature where you can freely build all kind of objects in game (with persistence and functionalities โค๏ธ ๐ )
where I do kinda have a function which checks for stuff like auto level ground or then is the obj in the ground or too far above it (can be set up per part in a cfg).
Since I do also work with attach to when placing stuff, I could maybe help you out there, if you haven't already done it ๐
IF you are using mods like ACE just enable BTF or blue force tracker in addon settings. If not then you will need to make a script that will get all of the units from side of bluefor and create marker on their position. But to update each marker you will need to have logic that would either update after x amount of seconds those markers or each frame. I wouldnt recommend updateing markers each frame tho.
reveal
Dosent that depend also on difficulty setting. If you are playing in Veteran dificulty isnt that just rendundend ?
I want to use the vanilla map extended content to blue force units, same as ACE blue force tracking, but the problem is the player doesn't know about all friendly units and they do not show all on the map ...
units blufor
private _BlueForUnits = units blufor;
{
player reveal [_x,4];
} forEach _BlueForUnits;
Iโm using the UPS and JEBUS i am trying to get them to work together but it seems impossible i want the units to repspwn with the same load out and have a delay and chance distant but canโt figure it out can someone please help me
I remember a while ago that he had all the files combined but i canโt find it any where now
Hey guys, I'm having trouble trying to rework this function in 3DEN:
https://community.bistudio.com/wiki/BIS_fnc_ambientAnimCombat
I wanna place this in a BLUFOR's INIT so I'm trying to change the anim-termination condition to be detecting OPFOR but ChatGPT ain't providing anything that does this. Would love ya'lls input if anyone has any ideas
what is exactly that you are trying to do?
Hey @proven charm, I wanna setup a few BLUFOR NPC's in a command tent to do ambient anim SIT_AT_Table perpetually until OPFOR gets within say 5 meters distance in which they will cancel animation and enter combat
Normally I used 3DEN enhanced and it's exit-combat ambient anim but when used next to friendly artillery, NPC's tend to exit ambient-anim
TLDR is I want an INIT script that forces ambient anim for a BLUFOR NPC that terminates when OPFOR is within 5 meters proximity
@proven charm can you help out next
well you can create condition like this for cancelling the anim```sqf
({ _x distance sittingGuy < 5 } count (units opfor)) > 0
help with what?
Got any codes to make jebus and and ups script work together into the init field of the squad leader
nope sorry
Ahh okay thank you
they either work with each other or they wont...... scripts here probably wont help
unless you can like toggle their features on/off
I have nice info panel when select HC group icon on map, the problem is it stays when I close the map, I searched for even handler to fire when map is closed or group unselected but didn't find anything. This is the script (it is from biki)
addMissionEventHandler ["GroupIconClick", {
params [
"_is3D", "_group", "_waypointId",
"_mouseButton", "_posX", "_posY",
"_shift", "_control", "_alt"
];
hintSilent parseText format
[
"<t align='left' font='EtelkaMonospacePro'><br/><t size='1.2'>General Information:</t><br/>Callsign: %1<br/>Leader: %2<br/>No. of Units: %3<br/>Delete when Empty: %4<br/><br/><t size='1.2'>Group Status:</t><br/>Health: %5<br/>Fleeing: %6<br/>Attack Enabled: %7<br/>Combat Behaviour: %8<br/>Combat Mode: %9<br/>Formation: %10<br/>Speed: %11<br/><br/><t size='1.2'>Waypoints:</t><br/>No. of Waypoints: %12<br/>Current Waypoint: %13<br/>Speed: %14</t>",
format ["%1 (%2)",groupID _group, if (vehicle leader _group isNotEqualTo leader _group) then {[configFile >> "CfgVehicles" >> typeOf vehicle leader _group] call BIS_fnc_displayName} else {"-"}],
name leader _group,
count units _group,
isGroupDeletedWhenEmpty _group,
units _group apply {str round ((1 - damage _x)* 100) + " %"},
fleeing leader _x,
attackEnabled _group,
combatBehaviour _group,
combatMode _group,
formation _group,
speedMode _group,
count waypoints _group,
waypointType [_group, currentWaypoint _group],
units _group apply {str round speed _x + " km/h"}
];
}];
Hey @proven charm , how would you combine this with [player, "SIT_AT_TABLE", "ASIS"] call BIS_fnc_ambientAnim;? I'm a bit of a noob and didn't have any success trying to combine the that script with your terminate-anim script
sounds like you need something like ```sqf
addMissionEventHandler ["Map",
{
params ["_mapIsOpened", "_mapIsForced"];
if(!_mapIsOpened) then { hintSilent ""; };
}];
@proven charm thanks !
[] spawn
{
[sittingGuy , "SIT_AT_TABLE", "ASIS"] call BIS_fnc_ambientAnim; // Start the anim
sittingGuy attachTo [thechair, [0, 0, -0.5]]; // Attach to chair
sittingGuy setdir 180;
waituntil { sleep 0.1; ({ _x distance sittingGuy < 5 } count (units opfor)) > 0 }; // Wait enemies near
detach sittingGuy; // Get off the chair
sittingGuy call BIS_fnc_ambientAnim__terminate; // end the anim
};
``` something like that
gotta run ๐
Couldn't get it to work unfortunately @proven charm, thanks for trying though ๐
how to get if the group is infantry, motorized, mechanized?
There is no such definition
I would use units opfor findif distance _x > 0 or nearest entities with radius 5 and if entitie group side is opfor.
Count will check every opfor unit distance to player , every 0.1s.
there's equal commands for "dammage"
yeah it can be optimized a lot with findif , i was thinking the same. But not that count is any problem to todays CPUs
scripts errors? or just doesnt work
Honestly? I legit don't know what I'm doing so chances are I'm implementing it wrong
Any chance you can dumb it down completely for me if you're not busy?
i added comments. not sure what else i can say ๐
So I've made the NPC's variable name as sittingGuy
Tried to look into some BIS forums on how to attach an NPC to a chair and can't find anything
ok then remove the sittingGuy = player; line
Tried this
to make sit: ```sqf
sittingGuy attachTo [thechair, [0, 0, -0.5]];
sittingGuy setdir 180;
oops my bad, updated the code
but you cant probably wait in init anyhow
updated code again (and again)
Hey @proven charm , it sorta works now
might not be the correct channel, however im curious on how id make a faction Redux as ive researched into it but not found anything, i know about the ALIVE faction system, but im interested in if there is a way to have them replace Vanilla unit say in the Campaign
Any idea on how I can get the BLUFOR to sit properly haha?
[] spawn
{
[sittingGuy , "SIT_AT_TABLE", "ASIS"] call BIS_fnc_ambientAnim;
sittingGuy attachTo [thechair, [0, 0, 0]];
sittingGuy setdir 180;
waituntil { sleep 0.1; ({ _x distance sittingGuy < 5 } count (units opfor)) > 0 };
detach sittingGuy;
sittingGuy call BIS_fnc_ambientAnim__terminate;
};
``` this works for me, had to get rid of the comments (Because init field doesnt like them)
Holy Sh*t, it works pretty good thanks!
I had to change the setdir to 0 though
[] spawn
{
[sittingGuy , "SIT_AT_TABLE", "ASIS"] call BIS_fnc_ambientAnim;
sittingGuy attachTo [thechair, [0, 0, 0]];
sittingGuy setdir 0;
waituntil { sleep 0.1; ({ _x distance sittingGuy < 5 } count (units opfor)) > 0 };
detach sittingGuy;
sittingGuy call BIS_fnc_ambientAnim__terminate;
};
One weird thing is the SIT_AT_TABLE anim keeps deleting the NPC's primary weapon. I hate to ask for more help but do you know how I can get BLUFOR to keep his rifle?
it shouldnt remove his weapon.. maybe it just doesnt show up? ๐ค
Yeah I made sure it keep the anim on ASIS but it keeps removing the rifle
you know you dont have to place him at the chair in editor, the script does that
Yeah force of habit using the 3DEN Enhanced editor haha
Also, I plan to use this script excessively cause for my composition builds
So thanks again haha, you're amazing
np
Are creating to MP,
Your code will be executed for every client and every JIP etc if on MP.
You should add is server check to make it sure it is only called once
totally forgot that stuff
Just to confirm though, if I wanna use this for a non-furniture based anim, I'd write it like this right @proven charm ?
[] spawn
{
[standingGuy , "LEAN_ON_TABLE", "ASIS"] call BIS_fnc_ambientAnim;
waituntil { sleep 0.1; ({ _x distance standingGuy < 5 } count (units opfor)) > 0 };
detach standingGuy;
sittingGuy call BIS_fnc_ambientAnim__terminate;
};
Do I keep the detach standingGuy; line?
if theres no attachTo then it isnt needed
Ah gotcha, thanks man
I am running the following script via a vehicle's init field:
["_vic", objNull],
["_weaponTemplate", ["sfp_ksp58B2","","","ASE_optic_AimpointCS",["sfp_249Rnd_762x51_ksp58", 249],[],[]]]
];
_actionId = [
_vic, // Object the action is attached to
"Plocka lรถs KSP58 frรฅn lavetten", // Title of the action
"\a3\data_f_destroyer\data\UI\IGUI\Cfg\holdactions\holdAction_loadVehicle_ca.paa", // Idle icon shown on screen
"\a3\data_f_destroyer\data\UI\IGUI\Cfg\holdactions\holdAction_loadVehicle_ca.paa", // Progress icon shown on screen
"_this distance _target < 3", // Condition for the action to be shown
"_caller distance _target < 3", // Condition for the action to progress
{}, // Code executed when action starts
{}, // Code executed on every progress tick
{
params ["_target", "_caller", "_actionId", "_arguments", "_frame", "_maxFrame", "_weaponTemplate"];
_playerWeapon = getUnitLoadout _caller select 0;
[_target, _caller, _actionId, _playerWeapon, _weaponTemplate] execVM "scripts\ASE_tgb16\unloadVehicle.sqf";
}, // Code executed on completion
{}, // Code executed on interrupted
[], // Arguments passed to the scripts as _this select 3
3, // Action duration in seconds
0, // Priority
true, // Remove on completion
false // Show in unconscious state
] call BIS_fnc_holdActionAdd;```
``_weaponTemplate`` is, in my mind, pretty obviously defined. However, when I trigger the hold action, I get the error below (line 20 is ``[_target, _caller, _actionId, _playerWeapon, _weaponTemplate] execVM "scripts\ASE_tgb16\unloadVehicle.sqf";``). What am I missing?
[], // Arguments passed to the scripts as _this select 3
params [
["_vic", objNull],
["_weaponTemplate", ["sfp_ksp58B2","","","ASE_optic_AimpointCS",["sfp_249Rnd_762x51_ksp58", 249],[],[]]]
];
_actionId = [
_vic,
"Plocka lรถs KSP58 frรฅn lavetten",
"\a3\data_f_destroyer\data\UI\IGUI\Cfg\holdactions\holdAction_loadVehicle_ca.paa",
"\a3\data_f_destroyer\data\UI\IGUI\Cfg\holdactions\holdAction_loadVehicle_ca.paa",
"_this distance _target < 3",
"_caller distance _target < 3",
{},
{},
{
params ["_target", "_caller", "_actionId", "_arguments", "_frame", "_maxFrame"];
_arguments params ["_weaponTemplate"];
_playerWeapon = getUnitLoadout _caller select 0;
[_target, _caller, _actionId, _playerWeapon, _weaponTemplate] execVM "scripts\ASE_tgb16\unloadVehicle.sqf";
},
{},
[_weaponTemplate], // Arguments passed to the scripts as _this select 3
3,
0,
true,
false
] call BIS_fnc_holdActionAdd;
@dire island โ๏ธ , you need pass your _weaponTemplate to holdaction.
I am unsuccessfully trying to make the unit I switch to HC leader ๐ค
addMissionEventHandler ["TeamSwitch", {
params ["_previousUnit", "_newUnit"];
setGroupIconsVisible [true, false];
_oldleadergrp = group _previousUnit;
hcLeader _oldleadergrp hcRemoveGroup _oldleadergrp;
_leadergrp = group _newUnit;
hcLeader _leadergrp hcRemoveGroup _leadergrp;
_newUnit hcSetGroup [_leadergrp];
}];
result is the new switched unit is HC leader and can give commands to his group but not the previous group (the group of the previous HC leader)
Yeah, but they are for backwards comp, because whoever made them in OFP couldn't write proper English.
removing
_oldleadergrp = group _previousUnit;
hcLeader _oldleadergrp hcRemoveGroup _oldleadergrp;
have the same result, the old HC leader group cannot be commanded ...
Worked like a charm, thanks! ๐
private _oldGroup = group _previousUnit;
if (_newUnit != hcLeader _oldGroup) then
{
hcLeader _oldGroup hcRemoveGroup _oldGroup;
_newUnit hcSetGroup [_oldGroup];
};
You need set old group to new HC ?
@stable dune yes
"proper"
depends where in the world you are
some would argue commonwealth english is the "proper" english ๐
None of them would argue dammage is the way damage should be spelled.
Its a bit silly to use dammage
Doesnt really matter in the end
I found old (A2) wind ballistics script, can it be changed to work in A3 or is complete trash?
player setVehicleInit "
BWS =
""
_info = _this;
_bullet = (_info select 0) select 6;
if((_info select 0) select 1 == 'Throw') exitWith {};
_wind = wind;
sleep 0.05;
while {alive _bullet} do
{
_windX = wind select 0;
_windY = wind select 1;
_windZ = (wind select 2) + random (2) - random (2);
_velX = velocity _bullet select 0;
_velY = velocity _bullet select 1;
_velZ = velocity _bullet select 2;
_bullet setVelocity [_velX+(random _windX)/10, _velY + (random _windY)/10, _velZ + (random _windZ)/10];
sleep 0.01 + random 1;
};
"";
bulletWindSimulation = compile BWS;
player addEventHandler [""Fired"", ""[_this] spawn bulletWindSimulation;""];
hint ""Bullet-Wind Interaction System Initialized..."";
";
processInitCommands;
setVehicleInit and processInitCommands are disabled in Arma 3. This would probably go in init.sqf instead.
Otherwise it should work much the same as it did in A2. But I'm pretty sure it could be substantially optimised.
because the script is running in scheduled it's affected by lag
sleep 0.01 + random 1; is a precedence bug. The script would not work as intended.
"dammage" is neither AE nor BE
with this its kinda working but bullets fly alongside wind like feathers
BWS =
"
_info = _this;
_bullet = (_info select 0) select 6;
if((_info select 0) select 1 == 'Throw') exitWith {};
_wind = wind;
sleep 0.05;
while {alive _bullet} do
{
_windX = wind select 0;
_windY = wind select 1;
_windZ = (wind select 2) + random (2) - random (2);
_velX = velocity _bullet select 0;
_velY = velocity _bullet select 1;
_velZ = velocity _bullet select 2;
_bullet setVelocity [_velX+(random _windX)/10, _velY + (random _windY)/10, _velZ + (random _windZ)/10];
sleep 0.01 + random 1;
};
";
bulletWindSimulation = compile BWS;
player addEventHandler ["Fired", "[_this] spawn bulletWindSimulation;"];
hint "Bullet-Wind Interaction System Initialized...";
(I set wind at maximum in eden and I am shooting at 90 degree crosswind)
The velocity adjustment is triggering up to 50x as often as it's supposed to, so that would follow.
@granite sky making
sleep 0.01;
makes it better but I think wind is influencing bullets too strong ...
Nah, you want sleep (0.01 + random 1);. But it's a pretty daft method anyway.
best rewritten from scratch.
its working well with windStr = 0.5 but with windStr = 1 is impossible to shoot at 400 m with 5.56 mm ...
This will fall apart anyway once the scheduler gets filled up and shots will become unpredictable.
ah well, it's unpredictable already since it's randomly applied
sup guys
I need help creating my first mod
like how do i even start with my mod?
how do i setup the files?
YES TYSM
thats what i have been searching for
like
years
*2hours
yeah it's a good article but it's hard to find.
yeah
oh and btw
uhm
Can I say Car.gearbox = {-18, 0, 10} in the following script: ```cpp
// ModFolder/Config.cpp
class CfgVehicles
{
class Car;
};```
i have no idea what i am doing lol
No. Would be:
class CfgVehicles
{
class LandVehicle;
class Car : LandVehicle {
gearbox[] = {-18, 0, 10};
};
};
#arma3_config for config stuff
isnt that with [] ?
yeah this is why you should ask in the config channel :P
oh ty
I'm a bit confused.
I have a script:
// Config.cpp
class CfgPatches {
class MyTestMod {
units[] = {}; // Units added by this mod
weapons[] = {}; // Weapons added by this mod
requiredAddons[] = {}; // Dependencies on other addons
};
};
class CfgUserActions {
class MarlosEnhancedTransmissions_ChangeTransmissionMode {
displayName = "Change transmission mode";
tooltip = "Changes the current transmission mode of the vehicle";
onActivate = "_this call IdkTheFunctionNameSinceImConfused"
}
}
And want to have another SQF function/script(This is the part that I'm confused about) that gets called using onActivate.
Do I put all the functions I need for my mod into one SQF file, or spread them out? If I spread them out, then how am I gonna call them? Since the website says onActivate = "_this call TAG_fnc_MyHandler";(https://community.bistudio.com/wiki/Arma_3:_Modded_Keybinding#Adding_a_new_key).
Is the file called TAG_function and MyHandler is the function name?
this message might be a bit terrible
nvm got the great father of vibe coding to help me
oh thanks this is actually more usefull than chatgpt
I would advise against using ChatGPT in general, but it's especially unhelpful for Arma SQF and config. In order to work somewhat acceptably, LLMs require a large body of (valid) source material to train on. SQF does not have this out in the wild - there's the wiki, and there's whatever code gets posted by random people on the internet, which is completely unreliable and often contextless. Understanding Arma code also requires understanding how the game works, which LLMs can't do.
LLMs are also not suitable for anything based in fact. They do not understand the concept of "fact"; the core principle of an LLM is to generate text that appears plausible, and generating text that is true is at best a secondary concern. They will happily make things up in order to provide a response that looks helpful. They do not actually understand the material they're generating.
Moreover; if anyone else has noticed the BI forums being broken as heck due to 'overwhelming spam'
A part of me thinks AI trying to be helpful is causing problems with looking at forum posts by clogging BI forums network bandwidth with 'spam'.
So the same functionally useless generative programs are compoundingly eliminating availability of good or partially useful examples. It's a real pain.
i don't think the forums are broken do to spam, i think its purposefully pulled down until they get something reliable after the attacks on reforger a few months ago
You might be right - but at least Google's 'AI' cites BI forums as source material still.
Perhaps it's pulling archived webpages, but it looks like the bots have more access than I do to some of these old posts.
Also -
when obtaining a 'objectParent' on a player in SP - the return value is the name of the unit (identity i.e. "Private John Doe" the player is attached to.
I am trying to return the actual vehicle the player is piloting, but retutning the parent again on the unit ID is returning ObjNull as if they weren't in a vehicle.
Is this normal?
The actual context is a little more complex but for example if I wanted to refill the vehicle's ammo, I would want to use
(objectParent player) setVehicleAmmo 1;
// this would do nothing because it refers to a unit identity rather than an actual vehicle
(objectParent(objectParent player)) setVehicleAmmo 1;
// also does nothing because this returns a null value
well what I want is:
if the player is piloting the A-164 Wipeout, a command pulls the ID of the specific vehicle the player is piloting
_plane = (command to return based on the thing the player is in the pilot seat of)
where
hint str (_plane);
should hint something like "e76048219482" because that's the specific object containing the player as a pilot
for example - if I wanted to add an instant takeoff for a player vehicle, the addAction would contain:
_pos = position player;
_pos set [2, (_pos select 2) + 1500];
_plane = cursorTarget;
_plane setPos _pos;
player moveInAny _plane;
But if I wanted to automatically teleport the plane into the air when a player gets in, I need to refer to the specific vehicle the player has gotten into.
_plane = objectParent player; is perfectly fine for that
or if you're using the getIn eventHandler that provides the vehicle directly.
Huh
Agree when it comes to SQF (so far), but I wouldn't call LLMs completely useless anymore. While they're not perfect, they've progressed a lot recently. I used to be a full luddite when it comes to LLMs, but not anymore.
How do we define "understanding" something? We don't even know how consciousness emerges in human body. And is the human way of consciousness the only way to be conscious? What if there are other "dimensions" of consciousness and because they don't remind the human way of being conscious, we don't recognize it? (Couldn't tag you in #offtopic_arma so idk where to possibly continue, or then just drop the topic)
I'm not going to get into this in too much depth, because it's a) offtopic and b) tedious, but the clue's in the name: it is a Large Language Model - not Large Sapience Model. It works by analysing its training data and determining the probabilities of words appearing together, and then producing something that seems probable. We know how they work, they were written by humans. And even without seeing the code, you can prove it doesn't understand by asking questions that require understanding and watching as it tries to bullshit its way to an answer.
Even CS staff up to professors at my uni are testing the LLMs and apparently based on their experience the models have progressed a lot recently, as they're solving complex programming challenges compared to what they were able to do just something like half a year ago. (They verify the results afterwards naturally.) The LLMs can do many other things too as we know. I agree that their success rate is far from 100 %, but it's improving quickly. But yeah, it's getting probably too offtopic so I'll let it be
I assume the initServer.sqf was changed? If that's not the case (and up to your purview), I'd be happy to look at the whole mission file/folder in case I missed anything.
I've been trying to get a script working that figures out the angle between the sun and the player, but I can't get it to work for some reason. I've lost count of all the ways I've tried lol
_playerDirFor = vectorNormalized(vectorDir player);
_playerDirUp = vectorNormalized(vectorUp player);
_sunDir = eyePos player vectorDiff ((getLighting#2));
_angle = _playerDirFor vectorCos _sunDir;
//_angle = _lookDirection vectorCrossProduct _sunDir;
systemChat str _angle;
};
instead of using onEachFrame which is kind of in the depreciated realm, use the EachFrame event handler
https://community.bistudio.com/wiki/Arma_3:_Mission_Event_Handlers#EachFrame
Oh, ok I'll keep that in mind, though I was only really using it for testing anyways
The problem is the return is always wrong - that code returns 0.63 when looking directly at the sun
getLighting doesn't return the "real" vector of sun IIRC, you might be able to see what I mean with draw a line
Mm, but that shouldn't matter in this context no? The angle should still be the same?
wiki says getLighting#2 is a direction but you're subtracting eyePos from it for some reason?
Yeah I don't know what anyone is trying to do here.
It's definitely a direction.
Between the sun and the player's what?
Oh my god you're right
Now it's starting to work lmao. Thanks for that
I'm trying to figure out the players orientation relative to the sun so I can approximate the exposed surface area of the player (relative to the sun)
I'm making a thermal system
you would want to be comparing getDir player with getLighting#2 then.
well, and player stance versus the Z value, I guess
I've got the horizontal working, now I just need to get the Z working
Yeah I know that, but it still kinda helped me, even though the code wouldn't work. It gives me an idea of what it should look like. Even if it doesn't know that much about SQF or that stuff, it can help sometimes, due to overlapping knowledge with other games.
Oh also why not use ChatGPT? It can be very helpfull when you're just stuck or don't know where to start. It saves hours sometimes.
And waiting for a response in StackOverflow or Discord takes hours, depending on the topic.
ChatGPT code takes hours to debug either. SQF is not something that ChatGPT can handle
Don't take the code then. Take the idea and structure
i got a quick question
I would advise the best thing you can do, especially with dynamically typed language like this, is to learn how to debug/log well. A lot of the problems that are posted here are issues that could be fixed with proper debugging. Seeing what your problem is is most of the battle when asking for help
uhm
I have a vehicle
and every vehicle has a gearbox array
how do i get the gearbox
this sounds like a #arma3_config issue, but if you are asking how to get the numbers within script of whatever values you put in that config, you would use getArray in that instance.
idk but i cant find it on the wiki, but i think im too stupid
so i just want to get the gearbox for a general vehicle
like a humvee or something
Then pull it from a specific class, but that's kinda odd to do
to specify this: I have a variable with a vehicle instance
So just grab the value from that vehicle's config
private _gearboxArray = getArray (configFile >> "CfgVehicles" >> typeOf _myVehicleInstance >> "gearbox or whatever");
yes tysm
getArray (configOf _someVehicle >> "gearbox") (or whatever the property is called)
ty guys
configOf is faster if you have an object + missing property (I assume you know, just writing out for other readers)
Just note that you'll get an empty array if the value isn't defined, so you should add a default
[arraysmth, 0] for example?
around the getarray?
E.g.
private _gearbox = getArray (configOf _someVehicle >> "gearbox");
if (_gearbox isEqualTo []) then {
_gearbox = [1, 2, 3]; // or whatever works, haven't touched gearbox stuff in like two years
};
oh alright
and is it possible to overwrite the movement system of vehicles in general?
like instead of the automatic transmission from the game make my own?
Doubtful, all of that is engine level which we can't access
I guess you could use setCruiseControl to require the driver to press a button before they can go faster. The existing gears would still be there as well though, and it wouldn't account for downshifting.
No, not really
Well thats just sad
that kinda makes my whole mod obselete
Is there a way to disable just all of the vehicle's movement?
sure, destroy it ๐
I could build mine above it?
you want to disable the movement and preserve inertia? or just make it straight stop in a single frame
No like the AI part of the vehicle movement.
Also, doesn't this engine have just normal physics? If yes, then inertia should be preserved.
By default
If a vehicle's driver is AI you can use _unit disableAI "PATH" (or _unit disableAI "MOVE" but that may be excessive) to stop it deciding to move on its own. Obviously doesn't do anything for player-driven vehicles though.
Then I don't know what you mean by "the AI part of vehicle movement"
The autmatic transmission.
The automatic transmission is not really AI.
You could modify every vehicle in the game to only have one long gear, I suppose. This would require a massive config patch with a specific entry for almost every vehicle you want it to affect.
I know that it's not AI. I don't know what I was thinking saying AI
well i guess my mod is scrapped then
and have to live with that shit transmission that cant even get up a hill ๐ญ
Some things are just not really possible in this game, and we don't have direct access to the engine to modify it.
that sucks