#arma3_scripting
1 messages · Page 576 of 1
compileFinal can not be compiled again, so no matter when you try to override it, it will return an error and only the first will work (if at all).
Loadorder of Arma is based on "requiredAddons" and mod name (eg. @aaa is loaded before @bbb)
Hmm so defining a particular ui namespace var/function def as compilefinal in a __name addon would prevent the subsequent compilefinal from the original addon
Or however the load ordering works with symbols and special chars
say, @aCBA compileFinal'ing a function that @CBA compileFinals, it would just spit out a log but the function would be @aCBA's
let me correct myself:
class CfgPatches {
class ZZZ {
// loads last
};
class AAA {
// loads first (after A3)
};
};
but again... using compileFinal twice on the same variable will return errors, if loading at all
I just need help with scripting with teleporters anyone care to help?
hey guys im currently having an issue i want to only add this code to a certain side (Example) player setVariable ['copLevel',1]
wouldnt the correct code be
if (side _Player == west) then player setVariable ['copLevel',1]
is it possible to disable penetration on objects
@slim oyster their script file that does the compiles, is probably called from config. Config you can modify, you can just replace the whole file that contains all the compiles. Thats the way to do it with ace for example
why not on the wiki :)
https://community.bistudio.com/wiki/Introduction_to_Arma_Scripting
Hi, I'm seriously brainless. I'm a basic editor that makes simple but fun scenarios but I still don't know to to make customChats appear? I know how to use sideChat and groupChat, I can't figure out how to make the Unit's name White to make it look like he's talking directly because if I use globalChat, would come up like 'BLUFOR (unit name): "Text here."' In short, is there I way I can make it like, 'Jackson: "Job's done Sir, what's next?"' and also make Jackson a custom colour? Thanks 🙂
hi seriously brainless, I'm dad!
you could use directSay, but this would require CfgRadio definitions
or create a custom chat…
or better!
https://community.bistudio.com/wiki/BIS_fnc_showSubtitle
@still frost
much better 🙂
I'd love to create a custom chat but it seems too hard for me.
Or maybe I'm just that unexperienced.
Cause like my mission works perfectly, this stuff is the only issue that's bothering me.
is BIS_fnc_showSubtitle ok to you?
I don't even know how to use it 😦
it's easy, it's explained on the page
e.g```sqf
["Jackson", "keep your hands up!"] spawn BIS_fnc_showSubtitle;
Do I insert it into a trigger or?
the same place you used globalChat
Well I put it in my trigger and comes up with, "On Activation: Type Script expected Nothing"
oh
then use the old trick of 0 = -yourscript-
0 = ["Jackson", "keep your hands up!"] spawn BIS_fnc_showSubtitle;
BEAUTIFUL!
It won't be consistent with the groupchat and side chat as they will appear on the side and this appears in the middle but I guess it's better than nothing. Thanks @winter rose !!!
you're welcome! well this is for direct chat only; if you wanted a special colour for each person a customChat is needed and can be tricky in MP
Thing is my Scenarios are only made for myself haha, Singleplayer so I guess customChat won't work?
customChat works in single player yes
Oh, is it hard? I don't want you to spend too much time on me haha
hopefully the wiki is here 😉
https://community.bistudio.com/wiki/radioChannelCreate
Already checked it out, it's all foreign language for me 😦
in initServer.sqf:
redChannel = radioChannelCreate [[1,0,0], "", "", allUnits];
whiteChannel = radioChannelCreate [[1,1,1], "", "", allUnits];
then you can use in your triggers
jackson customChat [redChannel, "hello there!"];
@still frost
Where's this initServer.sqf? Sorry.
you simply create a file at the root of your mission, named initServer.sqf (make sure it is not initServer.sqf.txt)
I'll give it a go right now.
(maybe use "%UNIT_NAME" as the second "" parameter though - so the unit's name would display)
redChannel = radioChannelCreate [[1,0,0], "", "%UNIT_NAME", allUnits];
whiteChannel = radioChannelCreate [[1,1,1], "", "%UNIT_NAME", allUnits];
Some issues happening but the text did come up on the side.
which issues?
May I dm you the screenshot?
yup, sure!
oh! my bad, indeed it's RGBA
redChannel = radioChannelCreate [[1,0,0,1], "", "%UNIT_NAME", allUnits];
whiteChannel = radioChannelCreate [[1,1,1,1], "", "%UNIT_NAME", allUnits];
try this and it should be fine
I actually don't know how to thank you man!
1 bitcoin should be enough 😁
Hehe, seriously, this is legit what I've been after! Thank you for spending your time on a newbie! 😁 ❤️
I shall save all of this on a document before I forget!
You're welcome! that's why we're here 👍
Last thing I promise, vehicleChat isn't working properly so how would I make the channel orange as I don't know the numbers.
for info, the [1,0,0,1] is [red, green, blue, alpha]
so
[1,0,0,1] is red
[0,1,0,1] is green
[0,0,1,1] is blue
[1,0.6,1,1] should be orange
Beautiful, thanks!
if you want to make any other colour combinations, you can also use an online RBG table
and the alpha should be the opacity of the colour
@surreal peak thanks!
np
Does anyone know off hand a way to set a trigger to activate if a player slot isn't filled, or if a unit just plain doesn't exist?
I'm using !alive unitName; at the moment, but that of course only works if the unit spawns, and then I kill the unit. I need the condition to activate if the unit never spawns.
Alternatively, if there is a way to detect if the unit DID spawn and cancel an action based on that.
Any advice is appreciated. Thanks!
@shadow sapphire try maybe```sqf
isNil "unitVariableBetweenQuotes";
Oh! Thanks a ton! Will try right now!
YES! That worked perfectly! Thanks so much!
I have the following condition and was surprised when it returned true considering the profileNameSpace variable I'm using is nil
!((profileNamespace getVariable ["ZKB_PVP_ProfileOwner",["",getPlayerUID player]] # 1) isEqualTo getPlayerUID player)
So I started to break it down on what might be wrong with it and I narrowed it down to the way I was using # was messing it up but I still can't figure out why exactly. No matter what profileNameSpace variable I used it returned the same results.
//Default returns
profileNameSpace getVariable ["ProfileVar",["0","1"]] // ["0","1"]
The following returns something other than what's expected
//If index 0 of default is an empty string
profileNameSpace getVariable ["ProfileVar",["","1"]] # 1 // [884099,96500,0,0,11,0,0,3660,[]]
profileNameSpace getVariable ["ProfileVar",["",""]] # 1 // [884099,96500,0,0,11,0,0,3660,[]]
//If index 0 is NOT a string
profileNamespace getVariable ["ProfileVar",[0,""]] # 1 // Error Type Number, expected String
profileNamespace getVariable ["ProfileVar",[0,1]] # 1 // Error Type Number, expected String
isNil {profileNamespace getVariable ["ProfileVar",[0,"1"]] # 1} // True with RPT Error Type Number, expected String
//Selecting index 0
isNil {profileNamespace getVariable ["ProfileVar",[0,"1"]] # 0} // True with no RPT error
//But works with select
profileNamespace getVariable ["ProfileVar",[0,"1"]] select 1 // "1"
//and index 1 works as long as index 0 is NOT an empty string
profileNamespace getVariable ["ProfileVar",["0",1]] # 1 // 1
The following returns as expected
//Works as expected when # is outside parentheses
(profileNamespace getVariable ["ProfileVar",["","1"]]) # 1 // "1"
//If index 0 of default is NOT an emtpy string
profileNamespace getVariable ["ProfileVar",["0","1"]] # 1 // "1"
//Works as expected with select
profileNameSpace getVariable ["ProfileVar",["","1"]] select 1 // "1"
If someone could shed some light on why the way I was using # caused issues it would be much appreciated.
has higher precedence
profileNamespace getVariable ["ProfileVar",[0,""]] # 1
->
profileNamespace getVariable (["ProfileVar",[0,""]] # 1)
->
profileNamespace getVariable [0,""]
error varname is a number, should be a string
ah so it's returning [0,""] from ["ProfileVar",[0,""]] then getting variable
You are just repeating what I said.. uhm. yes.
I think I need an ELI5 at this point for an issue with locality.
If I run this code:
test = {
params ["_text"];
systemChat _text;
};
["test"] remoteExec ["test", 0, false];
Locally, for example through an addAction, why does it not execute on all clients despite the remoteExec targets being 0? I'm sure it's something simple that I'm just not grasping atm...
because test is only defined locally
when you use e.g remoteExec ["BIS_fnc_ambientAnim"], the target has BIS_fnc_ambientAnim in CfgFunctions
here, you define locally a function in the global variable "test" that the other computers don't have.
what you could do is publicVariable "test", but… it's not great
also (maybe you know), your simple example can be simplified as ```sqf
["test"] remoteExec ["systemChat"];
Thank you. Yes I knew about the simplified version, I was trying to represent the fact I was trying to use a custom function. If that's the case, I could define the function in cfgFunctions and be good. I may just try getting away with publicVariable since this is for a single mission. Thanks for the clarification!
@winter rose
you're welcome
I would say GG Dad but apparently you are no longer our dad 😭 I miss you dad!!!
Did the RHS documentation get moved? I can't seem to get to the class documentation.
anyone know the 'type' list for https://community.bistudio.com/wiki/nearEntities ? is there one for players only?
No... Unless you are doing it very mission specific in which case you could filter for certain classes... You can get the list and check whether each one is a player though
well thre man air car... bla bla but no core list which should exist.. right?
I mean is there a player type? I only need to search for players within 300m and kinda not wise to do that given there gonna be ai everywhere
re-read what you said so like i could use B_Survior_F? as in ?
No... because the type is, at least I assume, the same as the result from isKindOf... so you can list a class in the hierarchy above the classes you use for players... going up to "Man", "Air", etc... If all your players are, for example BLUFOR then yes, you'd search for the lowest inherited class shared by each class of player
My last comment was written before I saw you last one
yeah they all gonna be same side but are enemies doing something with Alive
Yes... if the players are all subclasses of that and AI are not then that should work...
sweet yeah Im trying to make random teleporters for spawning into the combat area, but I dont want players jumping on top of others in a immediate area. so wanna put a check in if the random spawn object name pick is safe to go to.
Let me know whether that works @bright flume
heh just seen that when I jumped out lemme go back in and finish up
yep totally does. so just like you suspected likely using isKindOf @restive leaf
👌
IsKindOf inheritance rules we should point out for viewers 🙃
@steady galleon
I may just try getting away with publicVariable since this is for a single mission.
Or you could remoteExec "call" and pass the function along. thats less efficient when you call it multiple times though, but more efficient than calling publicVariable everytime
@lean furnace evo server best server
how to detect destroyed buildings best?
and if there is units inside that were not killed be the collapsing structure?
attach first to the "normal" building, then not alive _building
and on this, setDamage mweheheee
@velvet merlin
Thanks @still forum I'll give that a shot too
@winter rose attach?
this is about generic monitoring - not just one building
afaik there is a EH telling you about buildings being destroyed?
ty
can only find very limited info on https://community.bistudio.com/wiki/showSubtitles - what does it disable exactly?
and https://community.bistudio.com/wiki/disableConversation is A2 only, isnt it?
not that I know of? it may only impact Conversations though, not radio
these arent available in A3, are they?
its the tech from A2 talking to units asking for weather, enemies nearby, etc
the conversations themselves are not present, but I wonder if it doesn't still disable the chatting option in A3 (conversation EH)
@cunning oriole you are better asking in the L*fe Discord itself, see #channel_invites_list
@velvet merlin I can test it rn if you need
enableSentences false = disable all but KBTell? (friendly and hostile) or only AI voice chat but not text? player chat also ignored? (for MP only for local AI)
showSubtitles false = disable all but player chat?
enableRadio false = disable "radio" completely (only text?) - (in MP player chat and status messages remain?)
_unit setSpeaker "NoVoice" = mute AI radioprotocol - text still shown? (for MP needs to be applied on each client)
showChat false = hide all text display of the "radio"
0 fadeRadio 0 = mute AI radio protocol - text still shown?
(all: friendly and hostile AI radio reports, system messages, scripted chat messages, player chat, kbTell)
player auto spotting - cant be disabled?
this is my research without testing so far
so yep, disableConversion disables the Conversation EH
and it goes both ways: disabling the "talker" or the "talkee" will remove the speech action option
maybe we can put all that you collected in one Wiki page @velvet merlin
only tested disableConversion
I should try enableSentences too
is it just me or is createMine working weird? i'll use it to spawn a mine on the character that walks into a trigger, but the mine won't trigger. it triggers if you walk away a bit and return
now i'm trying to just spawn the mine explosion, but finding the right ammo is... ugh
@west grove it take that the mine has a timer before activating, so have the mines you place
so how do i get around that
updated the overview about a bit. will try to do SP and MP testing in coming days
i would just spawn an explosion, but i want to have the bounding mine bleep ... pew ... boom
@west grove can't you setDamage the mine?
then it'll explode without the bleep ... pew ... boom
did a workaround. i spawn it at 0,0,0 and run a sleep for a few seconds, then move it to the target
the explosion timing isnt crucial, so that works for me
again what is "Conversation"? 👼
well this was ditched from A3 (relevant fsm and data), no?
ok i see. well the terminology can be misleading
in A2 this was used for the small talk stuff (greeting, weather, soldier nearby, etc)
whereas "Conversations" is actually the term for the underlying mechanic of KBTell
but yes enableSentences doesnt block KBTell - thats known. the open question what it does really
https://community.bistudio.com/wiki/disableConversation - does this then block/mute KBTell?
it blocks the conversation system, but doesn't prevent kbTell no (just tested)
sorry still dont quite get the difference - blocks means what exactly? the EH no longer reacts, anything else?
it means that I can use kbTell as I wish, but initiating the conversation is not possible
the Conversation Event Handler menu doesn't show. I will see if AI still reacts to sentences though
the player answers menu still pops up in reaction to a sentence
Hey guys, do you know how in the official zues missions, the players’ characters are not present until they join in and after they actually spawn in, the player’s character automatically gets added to the zues editable objects list?
Can someone show me how to do that on a custom zues mission so that we dont have to add editable objects everytime someone joins? Thanks !
too many macros, can't help
Sorry, I can’t insert the code correctly
also stylise it
I Deleted "/*", because I need so that the markers could not be put without a walkie-talkie, but the script starts to throw an error.
see pinned message
MFive look at pinned to see how to style it
I insert a ", but it does not work
Im Sorry
Can I give a link to the Bohemia forum?
I created a topic there with this question.
plz delete, post in sqfbin.com and post link (or forum link, yes)
you deleted /*, but not */ ? there is your error
Can you make it work? I don’t understand how. I deleted everything, even there is the same script of version 9, this version 11 with a changed interface. I even copied and installed at version 11 from version 9, but still the script refuses to work and gives an error.
it would help if we had the actual error
After changing the script, it throws an error stating that the script was not found.
Well, than a path in wrong or you renamed something.
That has nothing to do with the code of the script.
As soon as I redo it, it gives an error. If you don’t touch it, everything works fine. But there is one thing but, I need that this part, which is located in the "/ *", should work, but not be disabled.
hello my preties
on the wikipedia it says its more performance friendly if you don't pass anything to a function
but does that mean that
[] spawn function
is more optimized than
spawn function
or will it make no difference
uh
one works, and the other is a script error and won't execute your code
so yes, there is a difference
also where on wiki does it say that?
spawn is also more performance friendly if you don't execute something within it 😄
I meant call
but under the call section
but would [] call {}
be quicker than call {}
So i'm wondering if i could optimize my scenario by removing all the empty arrays
if you don't need to pass parameters with call, then ofc it doesn't make sense to pass parameters
no [] call { is slower than call {
I don't see why you would pass parameters if you don't need any
yes, an empty array as parameter is also a parameter
...is there something like "current player index" that returns index position the current player has in allplayers?
allPlayers[this]
xD
allPlayers find player
but allPlayers ordering is not guaranteed afaik
every player could have a different ordered array
I just ended up passing an empty array all the time because thats how they do it on the AsYetUntitled framework, just empty arrays being passed everywhere, and that got me into the habit of doing
Also I believe allPlayers is listed in the order that they joined, but that is not reliable enough to base off of in practice
remoteexec requires CfgRemoteExec and i prefer to avoid that
on the other hand, find player implies a O(n) algorithm
remoteexec requires CfgRemoteExec
no, by default everything is allowed
and O(1) would be wornderful
unless you have a CfgRemoteExec already, that forbids it
I'm quite confident you are overcomplicating your thing alot.
lol
so, as I said before why not playerUID?
why is that not an option
or ownerID
you can also setVariable onto the player object from the server, with public flag and give ID that way
instead of my remoteExec setVariable
hence, each time a user disconnect i would need to loop again
or i will end with gaps xD
Maybe tell us what you actually want to do?
have a marker for each player
print a line for each player(including serverm and hc)
to display fps and other info
Why would you need the position of the player in allPlayers then
to my surprise, liberation script is quite buggy
You'll need remoteExec for fps anyway
the server doesn't know the fps of other clients, you have to grab it
unless i run global and each player invoke setMarkerText
with a position/line
ç
(this is similar on how liberation does it)
Why not run the script locally?
Ugh, Whatever. I have you multiple solutions that work just fine. Have fun
ding.
you gave a few, but they doesnt look efficient
looping all players each second to remoteexec -> O(n)
listen Dedmen wouldnt be telling ya bs. nor would any other non white named player in here... suggest you take their suggestions seriously.
If you look for efficiency then don't even print fps and stuff on screen.
If you know better solutions, why not just take them instead of asking here
exactly revo that action alone is the anti-thesis of perf.
looping all players each second to remoteexec -> O(n)
That actually is none of my ideas.
mmm...another aproach:
global array of players[uid], each client writes his result to that array, server loops on array and prints.
but O(n) for printing
I've spawned a group of squad replacement units as cargo into a spawned crewed truck using moveincargo. I then create a waypoint move and the truck moves with the assigned units to a marker. On arrival at the WP I then do an unassignvehicle for each unit in the group and the units get out. However they keep getting back in the truck , then out again then back in. How best do I ensure that the units get out and stay out on reaching the WP? Note that the vehicle crew are a separate group. Its the squad replacements that are assigned as cargo that keep getting in and out at their destination.
...what about clientOwner?
I told you that a couple hours ago
but you just ignored me
help my P drive contents appears to have vanished. not sure if this was to do with development A3 tools instead of release version?
this seems like the right track, if I edit the Tools settings.ini? whatever happened with that, seems to have either replaced the old one? or was not properly setup somehow.
wrong channel.
but also what on earth are you doing
use PMC wiki tools and P drive setup guides
@still forum i didnt see you mentioned clientOwner...perhaps to another folk 😉 nevermind, im testing that atm
🙄
exposed
Didnt notice. my bad
Does anyone have any experience with grad-persistence?
having trouble with something related to saving
Hello
If anyone is still around i need some help. So i want to make the script of the USS Freedom Deck Crew that launches you. I tried searching everywhere and i found nothing at the end. So if anyone knows how to do this and is willing to help, thank you. I just really want this to work. (Trying to make the crew launch you off the Freedom like in the showcase) I'm terrible at scripting, that's why i asked for help.
Is there a scripting command that makes visible zone . ie like a trigger but will show in game where I can adjust the size/shape
@spring vigil do u mean makers??
Im looking for a 100mx100m visible box . maybe a marker my google skills are lacking today
think PubG
its in already in the editor just click on marker (f6) then areas
oh i see ...so u want it to keep updating?
we have a marker on the map, I wanted to have the players be able to see it in 3d space so they know if they are in the zone or not
i dont think drawIcon3D is what im looking for
Hey @serene timber ! @dense tendon might have some tips about carrier launchers.
Hey everyone,
Before asking the next question, I give feedback on my last one (how wide can a briefing picture be?). Turns out that, regardless of resolution or .paa filetype, the maximum width is 360 pixels. Appreciate the inputs.
Now another question: I'm dropping off my players with a helicopter. For effect, I'd like the sound to start completely mute, except for the music.
Problem is that although fadeSound ( 0 fadeSound 0; 30 fadeSound 1; ) is affecting the weather and engine sounds, it doesn't change the volume of the helicopter rotors. Is there a different command I should be using? Or another way to remove the rotor sounds?
well maybe its possible but i have never seen that 🤞
why isn't this working? ```sqf
DIK_RWIN 0xDC /* Right Windows key */ = (findDisplay 46) displayAddEventHandler ["KeyDown","_mjk_scripts\mjk\mjk_jeep.sqf"];
the script path is in the arma 3 root folder and reachable for me
leading \ ? and where/how you running that? debug console? mission coded?
@sacred slate
Check this example, (instead of \_mjk\_scripts\mjk\mjk_jeep.sqf - wich is missing commands, btw. )
https://community.bistudio.com/wiki/DIK_KeyCodes
syncholic, i have some stuff in my root folder, i add it via: player addaction ["Jeep","_mjk_scripts\mjk\mjk_jeep.sqf"];
at least that works, dunno if its correctly formated.
there are some slashes missing wtf
player addaction ["Jeep","_mjk_scripts\mjk\mjk_jeep.sqf"];
yeah thought maybe the leading / was the issue but wasnt it
ok they get removed by discord
```sqf
code
```
code
i thouht i need the leading trail to be able to reach my script at arma.exe level
use triple ` for blocks. and a single for one liners.
nope, it needs a function to execute the code
well yeah, this example works `player addaction ["Jeep","_mjk_scripts\mjk\mjk_jeep.sqf"];
damn 😄
ok
player addaction ["Jeep","\_mjk\_scripts\mjk\mjk_jeep.sqf"];
is this wrong?
Regarding Keyhandler:
Best way, is stuff like that:
My_fnc_JeepSomething = compile preprocessFileLineNumbers "\_mjk\_scripts\mjk\mjk_jeep.sqf"; //To make the function final -> just exchange "compile" with "compileFinal", so it can't be edited/changed during the mission.
my_fnc_KeyHandler =
{
//insert the codestuff from the example here.
//Instead of systemchat bla -> call/spawn My_fnc_JeepSomething;
};
MyKeyHandlerIDisStoredInThisVar = (findDisplay 46) displayAddEventHandler ["KeyDown","_this call my_fnc_KeyHandler;"];
+addAction supports calling files, wich is okay.
thx
Trying to get a list of markers cords without having to go to each one and copy each cord down.Is their a simpler way to do that?Would really appreciate it if someone could help me with this.
Fav this site (if not done already):
https://community.bistudio.com/wiki/Category:Scripting_Commands_Arma_3
ctrl+F -> type in, for example, "marker" -> F3 to cycle through the results
What's the best way to convert sqf "[""test"",0,WEST]" back to an array without touching the side?
call compile does execute the side command and parseSimpleArray does not support sides.
what do you mean? executing the side command is fine because west returns west?
or do you want it as string or what?
I would need it as string, as call compile would return ["test",0,WEST]where WEST is a variable, not a string.
I'd say use stringReplace to replace WEST with "WEST" and then parseSimpleArray. but stringReplace is not a thing yet.
you could use the cba function for it
Thanks, gonna check that out
is possible to get all items from uniforms, backpacks and vests from container?
yes
Does anyone have any experience with inidb2?
Having issues with it where it used to save vehicles to the database in the mission i'm using but 6 months later it dosn't save any vehicle data
but is still saving character data just fine
in the description```
onLoadName = "TOB ZGM Template Mission";
briefingName = "TOB ZGM Template Mission";
respawnTemplatesVirtual[] = {};
cba_settings_hasSettingsFile = 0;
/*
class CfgMusic
{
tracks[] = {};
class stalker
{
name = "stalker";
sound[] = {"stalker.ogg", db+0, 1.0};
};
};
*/
in activation of a trigger
!alive trg
in the trigger
playMusic "stalker"
What am i doing wrong?
no error message , it just doesn't play
it's commented out
better seen with syntaxic color:
onLoadName = "TOB ZGM Template Mission";
briefingName = "TOB ZGM Template Mission";
respawnTemplatesVirtual[] = {};
cba_settings_hasSettingsFile = 0;
/*
class CfgMusic
{
tracks[] = {};
class stalker
{
name = "stalker";
sound[] = {"stalker.ogg", db+0, 1.0};
};
};
*/
``` @modest temple
Hi.
Why running this on server:
myVar = 1;
publicVariable "myVar";
while { myVar = 1 } do {
diag_log format ["in: %1", myVar];
sleep 1;
};
diag_log format ["out: %1", myVar];
results in:
17:34:05 Error in expression <ublicVariable "myVar";
while { myVar = 1 } do {
diag_log format ["in: %1">
17:34:05 Error position: <= 1 } do {
diag_log format ["in: %1">
17:34:05 Error Generic error in expression
17:34:05 "out: 1"
Setting invalid pitch 0.0000 for L Alpha 1-2:1 REMOTE
?
oks
Can I add a disconnect handler for new players at runtime?
ie: from debug console, run on server the following:
addMissionEventHandler ["PlayerDisconnected",
{
diag_log...
}];
?
yes
For better preformance, If I have 3 functions and all of them have 3 of the same lines of code in the end, would it be better to create another function and call it instead? Or does it not matter since the functions only run when called?
the functions only run when called
duplicate code is just duplicate code. the usual rules apply. duplicate code is generally bad but not for performance
ty
@winter rose
I had placed an ALiVE Player Multispawn module down to look at it and never deleted it. That's why my respawn wasnt working.
The tl;dr of that whole thing was me being an idiot.
@devout brook oh ok! Glad you sorted it out 🙂
Is there any more documentation for onPlayerRespawn.sqf than https://community.bistudio.com/wiki/Event_Scripts ?
It's all the information needed... name of file, when it's called, and which parameters are send to it... Not sure what else is to tell about it 🤔
Personally I prefer the Respawn Event Handler, although that doesn't have respawn settings in the params (although usually also not needed).
Is there documentation for that?
I was expecting to have to write out what was to happen when the player respawned
again, very limited but enough to know when and how it triggers
in short; when a player respawns, the script/EH gets triggered and the code you place there gets executed
I'm not super familiar with the syntax here -- where is "there"? And where would this go?
"there" is in the onPlayerRespawn.sqf file (part of mission), or within the event handler (either in mission or mod scripts).
Hmm okay
some basic understanding of programming is needed before diving into Arma, and the wiki is probably the best source of information you can get.
I've got a bit 😛
hi folks
Having some trouble with create marker, what's the syntax for using it to place a new marker at location of old one?
Current code (in trigger):
_markerstr = createMarker ["BLU_Airfield", 2160, 5610];
_markerstr setMarkerShape "b_hq";
deleteMarker "IND_Base";
hint "The airfield is now available for BLUFOR use and man/vehicle spawner has been setup at the flag's location!";
I want to create the marker w/ variable name "BLU_Airfield" at either the position of marker "IND_Base" or failing that, at 2160, 5610
Neither way works, not the # of expected arguements
createMarker ["BLU_Airfield", 2160, 5610];
https://community.bistudio.com/wiki/createMarker doesn't take 3 arguments in the array
I want to create the marker w/ variable name "BLU_Airfield" at either the position of marker "IND_Base"
https://community.bistudio.com/wiki/getMarkerPos
@copper raven Can I use "createMarker ["BLU_Airfield", position IND_Base]"? If so, should I have quotation marks around IND_Base? And if not, how can I use getMarkerPos within the createMarker line?
While we're at it, should I add "Server Only" to my triggers that are triggered by radio codes? they're used for playing music and grouping units if players want to be in the same group
Nvm the groups, gonna try to add dynamic groups
the second parameter is an array or object... so
// use position to get location
createMarker ["marker_name", position player];
// use position array
createMarker ["marker_name", [123, 456]];
it's written out on the wiki...
Is fovTop param constantly equal to 0.75 on all (hardware) displays?
no, user can change them if he wants to
I mean without user's changing
@exotic flax Actually, none of the examples mention using a set location in the world as an array. They're all "position player" which was not what I was looking for
https://community.bistudio.com/wiki/getResolution see notes there
position: Array or Object - format position: Position2D, PositionAGL or Object (object's PositionWorld is used)
@foggy hedge position takes location or object, it doesn't take any strings
use getMarkerPos if you want to get position of a marker, getMarkerPos "my_marker"
Ok and thanks for the help, new to scripting and some terms fly over my head
@rustic plover
The engine default value for fovTop is 0.75 in case it is needed to calculate difference with custom FOV.
So it's not a constant, just a default
It's default on all displays? Cause some people send me fov's params and fovTop is not 0.75. They are say that it's without any changes
It should be default on all displays, and only fovLeft should change based on the screen resolution (afaik)
is possible to prevent put item to container?
but it working when item is already in container
i try'ed make a rule - when on uniform, vest or backpack items or magazines - player can't put them on the ground\container
So im brand new to this whole thing and dont know how it really works
//initPlayerLocal.sqf
TAG_fnc_captiveCheck = {
params ["_unit"];
_unit setCaptive true;
waitUntil {currentWeapon _unit != ""};
_unit setCaptive false;
{_x reveal [_unit,4]} forEach (_unit nearEntities 25);
};
player spawn TAG_fnc_captiveCheck;
im trying to get this to work in game
//--- Took a weapon - turn into enemy
player addeventhandler [
"Take",
{
if (primaryweapon player != "" || secondaryweapon player != "" || handgunweapon player != "") then {
unit1 setCaptive false;
bis_hasWeapon = true;
bis_isTarget = true;
terminate bis_isTargetTimeout;
};
}
];
//--- Dropped the weapon - turn back to civilian, unless he killed someone
player addeventhandler [
"Put",
{
if (alive player && bis_hasWeapon && {!(primaryweapon player != "" || secondaryweapon player != "" || handgunweapon player != "")}) then {
bis_hasWeapon = false;
unit1 setCaptive true;
};
}
];````
@sand nest try
[player] call TAG_fnc_captiveCheck;
@exotic flax what exactly do i do with that like im very new at this, I got COS to work with dumb luck but cant get this one
How to define the player without giving him an name, when the player is blufor and enemy opfor! I use it now so that i give the player an name and put "this setCaptive true " in the init. field?
the script that i have seems to be fine but (if not then idk) but how do i make an init for it to work in game
okay so i see what you changed its the lats text right
@tough abyss all players can be accessed through player and checked by isPlayer _unit (along with a lot of other functions to find and check players).
@sand nest the code you posted even has a filename in the comments... so make that file, put it in your mission and it should work
I had change "unit1" to "_unit" , without giving an name and did`nt put the code in the init., but this did´nt works!
both the Take and Put EH's have parameters which you can access (including the unit)
@exotic flax So odd question bc i have no idea, So the code makes it so when not shot or having a weapon out they don't shoot what about once they are shot does it make only the people around hostile or all oppfor hostile on sight now? (sorry for all of these bothersome questions I'm just trying to learn
it will make the enemy doesn't see you as an enemy the moment you don't hold a weapon in your hands
so i changed what you said then do i make a game logic and just put the samw thing in it?
first line of what you posted: // initPlayerLocal.sqf
meaning it should be in that file, which is part of a mission
🙃
meaning it should be in that file, which is part of a mission
Thanks get it now to work
player setCaptive true;
//--- Took a weapon - turn into enemy
player addeventhandler [
"Take",
{ params ["_unit"];
_unit = player;
if (primaryweapon player != "" || secondaryweapon player != "" || handgunweapon player != "") then {
player setCaptive false;
bis_hasWeapon = true;
bis_isTarget = true;
terminate bis_isTargetTimeout;
};
}
];
//--- Dropped the weapon - turn back to civilian, unless he killed someone
player addeventhandler [
"Put",
{ params ["_unit"];
_unit = player;
if (alive player && bis_hasWeapon && {!(primaryweapon player != "" || secondaryweapon player != "" || handgunweapon player != "")}) then {
bis_hasWeapon = false;
player setCaptive true;
};
}
];
I got a Bootstrap mod in my server because I want to run/setup something in the preinit. My mod Config.cpp it's ```class CfgPatches {
class DEF.Bootstrap {
units[] = {};
weapons[] = {};
requiredVersion = 1.0;
requiredAddons[] = {};
};
};
class CfgFunctions {
class PreInit {
preInit = 1;
};
};
And Inside the mod I got a fn_PreInit.sqf with some code that could be replaced by a
diag_log "## INITIALIZING DEFROCKED'S FRAMEWORK ##";
diag_log "########################################";```
For example
This script is not running when the mod get's loaded and neither in the preInit, does anyone know why is this happening?
Are you checking this when main menu is loaded or when you start a game?
Hmn no, because it'a server-sided mod
That mod it's only in the server and it's objective it's to run a script server-side
Ok, my bad I missed that part.
I didn't say that, you don't missed anything xd
I just wondered if u mixed preInit with preStart, but I dont know how they work in the case of dedicated server.
Is there a way of running a script on the mod init?
The point of this is that I don't want any trace on the mission files because If the Kernel files are leaked I am fucked
So I just need to run a script in the mod on the load
anyone possibly have a script or proper settings to script into a smoke module/generator to create ground effect smoke? Ive tried for few days now I just cant get it to look right so figured I'd ask if someone maybe knew some trick or had code/settings laying around that might help out. thanks ahead of time if anyone does.
is there any way to get the number of player slots from the server config from a script?
Is there any limit (or other considerations) to the total number of missionNameSpace variables you can create?
Thinking in terms of tens of thousands
https://community.bistudio.com/wiki/playableSlotsNumber prob best ya gonna get @viscid crescent
@bright flume unrelated
@mortal wigeon… why?
@bright flume no I think he means "how many public variables" 🙂
It's me who didn't make the connection 😅 my bad!
ye that's the wrong slot number, i want the server.cfg one, not the mission one, oh well
funny how you can get that outside of arma but not in the scripts :P
@winter rose I'm drawing 100m^2 rectangles all over a 16000m^2 map for a frontline visualization script. That creates 25,600 markers.
I did some performance testing. It takes ~1s to create variables for all those points. So I don't think total variable numbers is a problem. However it takes 130s to create all the markers as well.
What's interesting is that the first 10-15k markers are created very fast, but it continuously slows down so that by the end it's creating markers at a fraction of the original speed.
The majority of that 130s is in the last third of the map.
I believe it has to do with the full list of markers, the more you add the more the game has to check if such a name already exists in the already existing ones, hence increasing the process
Buuut 25600 markers is a bit too much, innit? 😅
@mortal wigeon no limit Maybe int32 max
re: stringvars sounds like an 'acid test' situation....
@viscid crescent why I said think thats close as you can get. sadly actual slots can be higher then actual server cfg'd max players... Im still digging
you could try and use https://community.bistudio.com/wiki/loadFile then process it only other thing I can think of. tbh doubting on that unless ya do some allowed file extension editing
Testing in seconds:
Create variables only: 0.8
Create variables & markers: 40.2
create variables, markers, and give markers standard attributes: 135.4
I don't particularly want 25600 markers, but I don't know how else to color over the map with a decent resolution
in realtime
for "_horiz" from JST_size to JST_mapSize step JST_gridSize do
{
for "_vert" from JST_size to JST_mapSize step JST_gridSize do
{
// this code block is "inside" each square, _pos being dead center of square
private _pos = [_horiz, _vert, 0];
private _posStr = _pos joinString "_";
missionNameSpace setVariable [("JST_FL_" + _posStr), createMarker [format ["JST_FL_%1", _posStr], _pos]];
private _mkr = missionNameSpace getVariable [("JST_FL_" + _posStr), objNull];
_mkr setMarkerColor "COLORWEST";
_mkr setMarkerAlpha JST_FL_alpha;
_mkr setMarkerShape "RECTANGLE";
_mkr setMarkerSize [JST_size, JST_size];
// debut time testing:
if (((_pos select 0) > 15300) and !(JST_limitReached)) then
{
JST_limitReached = true;
JST_currentDiagTime = diag_tickTime;
JST_timeElapsed = JST_currentDiagTime - JST_diagTime;
systemChat format ["%1 elapsed to limit", JST_timeElapsed];
};
};
};
how 'small' is a one of these squares? o.O
100m^2
I suppose the upside is I only have to do it once, then updating a specific existing marker is much faster
I don't need to manipulate the entire map at once
prob dont even need that just virtualize the positions and spawn the marker on demand when you need to update it? use a exclusion ideal, only use what you have to change. dont think ya gonna be happy coloring every 100m grid block.
I'm coloring the whole map based on who controls the territory, so it all needs to be drawn at least once. Then I update sections as territory changes hands.
could just look at how alive, KP and many other insurgency type mods do it... what you describing has been done already. just not a fan on of a global blanket method not in a MP setting.
not saying ya wrong either just not view of looking at programing something like that. unless you got live entities in every grid, they all arent controlled... if you needed some thing more broad use a larger grid. like 300m or 1/2km?
I don't think they do what I'm trying to do. I'm talking about a dynamic frontline/territory like this: https://i0.wp.com/www.pbs.org/wgbh/frontline/wp-content/uploads/2015/11/2014210193630_7275.jpg?resize=900%2C512
well okay thats easier. is this gonna be a 'fixed shape' that I would do something with a overlay on the map itself ignore the radar.
sounds like you looking more more of a live front line take over as you progress... maybe use lines and draw out a polygon map markers on map? ie use some kind of outline vs 'fill' ? then you can just update the position of the lines end points
yeah I want to update the map as the mission progresses. not using fill is an interesting idea. I would have to figure out how to do geometric drawing which sounds mathematically hard
no use the line drawing tool I think you can call that from code it just has two points you can use. also you dont gotta update everything only the individual lines that make up that small part of the poly you need to change.
lemme dig
the challenge I think would be I'd need a way to dynamically create new lines if e.g. there's a pocket of enemy behind friendly front lines
i'd need to calculate if a position is inside the existing lines
https://community.bistudio.com/wiki/drawLine you can put it anywhere pretty much you gonna need it...
small pocket you could make it really stand out and use the poly ones which I think have fill effects would work nicely for pockets.
actually hell I didnt even know there is draw triangle? where that come from?
even that isnt likely a best solution apparently can kill frame rate.. dunno ya got a good idea/question just implemention dunno...
wow I have 3000hrs in Arma and I didn't even know you could draw a polygon
I had no f'n clue Im at 8k
why I was no joke... 🤯 cuz I already know the math to make simple n-sided polys not even needing the drawPolygon part I could do it with the core square and now knowing of triangles would let me easy make like any poly <= 8 sides
Hey, so I'm trying to make a CBA_fnc_registerChatCommand call that gives the command to specific players that aren't necessarily the admin. How would I do this? I'm willing to use another function that's not CBA to accomplish this if needed
if (hasInterface) then {
_spawn_pos = ["respawn_west", "respawn_west_1", "respawn_west_2", "respawn_west_3", "respawn_west_4", "respawn_west_5", "respawn_west_6", "respawn_west_7", "respawn_west_8", "respawn_west_9", "respawn_west_10", "respawn_west_11", "respawn_west_12", "respawn_west_13", "respawn_west_14", "respawn_west_15", "respawn_west_15", "respawn_west_16", "respawn_west_17", "respawn_west_18", "respawn_west_19", "respawn_west_20", "respawn_west_21", "respawn_west_22", "respawn_west_23", "respawn_west_24", "respawn_west_25", "respawn_west_26", "respawn_west_27", "respawn_west_28", "respawn_west_29",, "respawn_west_30"] call BIS_fnc_selectRandom;
waitUntil {!isnull player};
player setPos (getMarkerPos _spawn_pos);
};
is this correct for random spawn points?
also for the point names do i use the variable name?
so what do i put for that section
see wiki page i linked
i am
not really understanding it
im trying to set up random respawn points on death
_spawnPos = selectRandom [...]
ok, so how do i then have it select the spawn markers i have?
is it the variable name then or do i need to find another field to base the agrument off of
ok
so basically just change the start of the command line?
ok that worked
now how to set up initial spawn to be random?
got it
thank you so much for the help =^w^=
Is there a copy/paste script to make a BLUFOR / IND Zeus only be able to edit that side/faction?
I’m good with either a BLUFOR/IND or NATO/AAF, if there is
If not a script, is there a feature somewhere?
New to scenario editing, please excuse my timidity
whats the most efficient way to clean up dead bodies and weaponHolders - when the player is no longer close?
Probably the BI garbage collection @velvet merlin
is it any good?
It's handled by the engine. So I'd say it's fast.
believe you can tweak the settings on the built in GC question is what you consider close. misjuding distance with cleanup can be tricky keep that in mind.
Have some issues with AI behaviour.
I spawn soldier at static weapons. The first one is the leader, and it is ok.
But all the others exit their guns and try to reach the leader.
I tried doStop + disableAI "MOVE" commands with no effect.
The gunner doesn't move if he becomes a group leader, but I don't want to change the group leader all the time the gunners are spawned, cause it can cause some inperdictable behavior for on-foot garrison soldiers.
Also I can't create a new group, as one garrison should keep only one group.
Is there any other way to make them not to exit guns/move to leader?
could try making a order for that specific unit in the team to have a move cmd where the static weapon is? think some mods do add a method for statics like that I believe. try searching thru some of the eden/zeus mods.
thx for the loadFile tip sycholic, I'm gonna try that 👍
worth a shot atleast its not massive should be manageable to get the string out for what you need.
@cosmic lichen did some reading and people reported issues (like weaponHolders and MP). however cant tell if the system is solid by now or not
I'd just give it a try.
@unreal scroll if you want them too stay on the weapon until they die try this
this disableAI 'PATH';
Question. To make something fly in at a specific height i would say
this flyInHeight "20";
correct?
how to Use "if" to judge whether the variable is a string or a number?
@silver mauve Thanks, it works 🙂
@runic quest https://community.bistudio.com/wiki/typeName
@unreal scroll Your Welcome
@unreal scroll tks bro
hello, i am trying to get the list of submarine actions out of Hellenic Armed Forces mod but i'm finding unable to, i basically want the script to upper the periscope, the action is the 3rd from top (array index 2 so) but i am unable to run it in any way, any hint?
@unreal scroll isEqualType is the new and more efficient way to do that
Hello.
I have a mission where I assign loadouts through the player units init-field: if (isServer) then {this setUnitLoadout [loadout-array];};, this works perfectly for players joining from mission start but JIP-ing players don't receive any loadout and instead are left only with the helmet and rifle of the original unit loadout. Does anyone know what might be the cause of this? Thanks in advance.
put it in initplayerlocal.sqf
I feared that the solution would be actually require me having to put in work and implement a switch-case or something of that nature 😅 . Thanks, I'll do that.
Question. To make something fly in at a specific height i would say
this flyInHeight "20";
@silver mauve 20, not "20"
ohh ok thank you
anyone have any idea for my issue?
@wispy cave That worked brillianty. 👍
@unreal scroll isEqualType is the new and more efficient way to do that
@still forum pretty old TBH
Hi , I need help with an script . The script has an executor . It's this : ["generarmisionesINIT"] spawn ica_fnc_misionesLaEmpresa;
Where have I to put it ?
in your b—… in your initServer.sqf file @candid cape
Life server or Mpmission @winter rose
better ask in L*fe Discord server, see #channel_invites_list.
hi, i have some questions with editing the BIS_fnc_respawnBackpack script and adding it to a mission. I'm super new to scripting 😦
I wanted to add to the backpack script to spawn an object composition around it
around the tent*
and how I would implement that in the mission.
would I run a line in the init.sqf to call the function?
Can someone help me i want to make a trigger loop because im using the alarm SFX can someone help me
Tick the repeat box
When using class CfgRespawnInventory is it possible to specify where (uniform, vest, pack) the items you define show up?
@obsidian violet done that but it doesn't repeat
another question, im editing a GF script and want to have the script equip magazines belonging to the weapon from the array. how would i go about that?
GF_ARL_secondaryWeapon_array = ["launch_NLAW_F"];
GF_ARL_handgunWeapon_array = ["hgun_ACPC2_F"];
GF_ARL_Magazines_array = ["100Rnd_65x39_caseless_mag","16Rnd_9x21_Mag"];```
Wondering if someone could help me, looking for a script or something to limit the range which thermal goggles can be used. E.G. I want people to be able to use them to see targets 200m away but anything past that it doesnt appear on thermals?
Is there a command to turn on the AN/MPQ-105 Radar and leave it on? For some reason it's off and it doesn't actually lock on to targets. Very weird.
Wondering if someone could help me, looking for a script or something to limit the range which thermal goggles can be used. E.G. I want people to be able to use them to see targets 200m away but anything past that it doesnt appear on thermals?
@nimble raven Limit your questions to 1 channel pls, thx ( #rules - means: delete the other one)
Regarding your question: No, not rly possible, without some trickery like reducing the viewdistance to 200m, if they turn on/use their Thermal stuff.
which would be the "only" way to do it properly, unless you want to play with hideObject for enemies (but terrain and objects would still be visible)
There are many ATMs on Altis. Is there a way to add some actions/ACE actions to it (like "Take money")? Does it support adding actioins?
there always via eden 'edit terrain object' module that lets you inject code onto them. addaction def possible.
Thanks. I thought simple objects doesn't suport it.
hey all, trying to make a counter to count the number of completed tasks, which will be used to feed a trigger
terrain objects are not (all) simple objects @unreal scroll
tried just using the onActivation block of the flag which sets tasks to completed to read taskscore = (taskscore +1) with taskscore = 0 in the missions init.sqf. But this hasn't worked
using a trigger with taskscore == 2; as the condition to give a hint "trigger is working"
but no worky... 😦
anybody?
do you use -showScriptErrors, and did you have any?
wtb copy to clipboard option on that text popup kind alike how you got the option to dismiss missing cfg messages one/all
wtb…? gib $$?
someone did that I'd drop a Grant on them.
a grand* and Dedmen does it :p
thanks Lou
wtb == want to buy. GRANT as in president. 😛
I'll let you know
@bright flume I got "grant" as subvention, but I think a grand is a good thing for the dev too 😄
I got $ not like that though to just throw at something. rather build a new 3800 AMD rig with that.. I'll stop here kinda off topic. 🙂 but yeah a copytoclipboard on that message would be sweet. (that or just flat out not cut off full error messages would be nice)
Lou, doesn't return any script errors. Just doesn't work.
place your variable ZAP_TaskScore in the initServer.sqf (create the file if needed)
where the task is activated, use ZAP_TaskScore = ZAP_TaskScore+1;
if it is a trigger, make it Server only, no need to do that on clients too
@spark rose
and of course, condition to ZAP_TaskScore == 2
Better ask on the Ravage Discord I think
Is it possible to get the exact 3DEN Editor Position of an object?
Currently i've got an object with following 3DEN Position values:
[3593.180,13384.058,0.062]
But getPosWorld returns:
[3593.18,13384.1,5.20777]
For me the Y value is the most important one, but its imprecise ...
https://community.bistudio.com/wiki/get3DENAttribute with the Position value perhaps?
Though you can't pull that outside of the Editor workspace
yeah i also tried that but it returns [3593.18,13384.1,0.0615325] 😄 so the Z value is very precise but the other values are still rounded
@viral basin getPosWorld and getPosATL are different
yes i know, the Z value is not the problem. its the Y value. i tried every getpos command even the ModelToWorld and Visual ones, there is none which gives the position with the exact same values of the 3den editor position. :/
is 4.2cm difference really that important?
I don't even know if you can move by such small steps in arma
yes it is 😄 we placed some objects in a house and after exporting they moved into the wall
they move 5cm into the wall?
paintings on the wall, yes
yes inside 3den
have you tried the copy position thing from 3den enhanced?
not yet, is that a mod? the main thing is that i wrote a little script which exports the placed objects in sqf - with a little less information than the official sqf export does.
use E2TB
the official export does not do rotations correctly
in short 3DEN is not proper terrain making tool. But with enough hacks it works.
Also some objects, if they are not done correctly have different center points in game and TB
@viral basin try E2TB out though
Or use PLOPPER
thats the latest tool for in game placement
okay i will look into these 2, thanks in advance
is there a reliable way to detect if a player is in a cutscene (camCreate) via sqf?
maybe cameraOn
I managed to find a way to get more precise Position Values. i just added toFixed 4 at the top of the script. 🙂
Need some advice.
There is a event which is called on some conditions (i.e., one code for loosing battle, and another for winning it).
The process look like:
- Starting the battle via calling the fnc_NATOCounterTown function. It holds the code that must be executed on the battle end, and call another function for battle, passing this code as arguments.
- On battle end, an appropriate code is called.
The example of called code:
params ["_tskid","_town"];
somecodehere
};```
And calling the battle script with:
```[_atwin,_atloose] remoteExec ["OT_fnc_NATOQRF",2];```
Then, after the battle ends, on appropriate conditions:
```_someparams call _success (passed code in _atwin);```
But there is a persistent error in log, saying about local variables in a global namespace, pointing at that line: ```params ["_tskid","_town"];```
How to correctly pass _atwin code to OT_fnc_NATOQRF function?
Hello all, I was hoping you can solve a query off mine. Simply I want to use a variable e.g. _i in an array like this _myArray[_i] to use that position in a variable. How do I go about doing this?
Hey all. I'm trying to spawn groups (1 of 6) on a trigger with switch do, but can't get it to work. The script gives no errors, but nothing happens except the trigger hint.
I liberated the code from a kindly soul online.
not sure how to post it in a nice format
_RandCorp = floor (random 6);
switch (_RandCorp) do {
case 0: {
_grup1 = [SafePos2, EAST, (configfile >> "CfgGroups" >> "East" >> "OPF_T_F" >> "Mechanized" >> "O_T_MechInf_AT"")] call BIS_fnc_spawnGroup;
_wp1 = _grup1 addWaypoint [position player, 0];
_wp1 setWaypointType "SAD";
};
case 1: {
_grup1 = [SafePos2, EAST, (configfile >> "CfgGroups" >> "East" >> "OPF_T_F" >> "Motorized_MTP" >> "O_T_MotInf_Team"")] call BIS_fnc_spawnGroup;
_wp1 = _grup1 addWaypoint [position player, 0];
_wp1 setWaypointType "SAD";};
case 2: {
_grup1 = [SafePos2, EAST, (configfile >> "CfgGroups" >> "East" >> "OPF_T_F" >> "Motorized_MTP" >> "O_T_MotInf_GMGTeam"")] call BIS_fnc_spawnGroup;
_wp1 = _grup1 addWaypoint [position player, 0];
_wp1 setWaypointType "SAD";
};
case 3: {
_grup1 = [SafePos2, EAST, (configfile >> "CfgGroups" >> "East" >> "OPF_T_F" >> "Mechanized" >> "O_T_MechInf_Support")] call BIS_fnc_spawnGroup;
_wp1 = _grup1 addWaypoint [position player, 0];
_wp1 setWaypointType "SAD";
};
case 4: {
_grup1 = [SafePos2, EAST, (configfile >> "CfgGroups" >> "East" >> "OPF_T_F" >> "Armored" >> "O_T_TankSection")] call BIS_fnc_spawnGroup;
_wp1 = _grup1 addWaypoint [position player, 0];
_wp1 setWaypointType "SAD";
};
case 5: {
_grup1 = [SafePos2, EAST, (configfile >> "CfgGroups" >> "East" >> "OPF_T_F" >> "Motorized_MTP" >> "O_T_MotInf_Reinforcements")] call BIS_fnc_spawnGroup;
_wp1 = _grup1 addWaypoint [position player, 0];
_wp1 setWaypointType "SAD";
};
default { hint "default" };
};```
Have you tried putting this into anything that shows syntax highlighting at all?
Because that gives a huge hint ("" != ")
if(getPosATL player isEqualTo [438.765,8220.86,0.00140715]) then{hint"123123";}else{hint"1231231231"}; getPosATL =[438.765,8220.86,0.00140715] why not work?
What code and where do you call initPlayerLocal.sqf, initPlayerServer.sqf, and initServer.sqf? I'm trying to setup whitelisting for certain roles, it works in editor but not on dedicated. Any ideas? I have already checked out the available resources for knowledge, I'm just not understanding how those files are supposed to be called
Those sqf run automatically. Their names describe when.
dont they need to be called in the init.sqf? as like [] execVM "initServer.sqf"? does it need to be under isDedicated or isServer or something along those lines?
I guess im just confused between [] call compileFinal preprocessFileLineNUmbers and [] execVM
@spark rose
If you get your syntax highlighting correct
```sqf
code
```
->
SafePos2 = [getPos player, 50, 100, 20, 0, 0.3, 0] call BIS_fnc_findSafePos;
_RandCorp = floor (random 6);
switch (_RandCorp) do {
case 0: {
_grup1 = [SafePos2, EAST, (configfile >> "CfgGroups" >> "East" >> "OPF_T_F" >> "Mechanized" >> "O_T_MechInf_AT"")] call BIS_fnc_spawnGroup;
_wp1 = _grup1 addWaypoint [position player, 0];
_wp1 setWaypointType "SAD";
};
case 1: {
_grup1 = [SafePos2, EAST, (configfile >> "CfgGroups" >> "East" >> "OPF_T_F" >> "Motorized_MTP" >> "O_T_MotInf_Team"")] call BIS_fnc_spawnGroup;
_wp1 = _grup1 addWaypoint [position player, 0];
_wp1 setWaypointType "SAD";};
case 2: {
_grup1 = [SafePos2, EAST, (configfile >> "CfgGroups" >> "East" >> "OPF_T_F" >> "Motorized_MTP" >> "O_T_MotInf_GMGTeam"")] call BIS_fnc_spawnGroup;
_wp1 = _grup1 addWaypoint [position player, 0];
_wp1 setWaypointType "SAD";
};
case 3: {
_grup1 = [SafePos2, EAST, (configfile >> "CfgGroups" >> "East" >> "OPF_T_F" >> "Mechanized" >> "O_T_MechInf_Support")] call BIS_fnc_spawnGroup;
_wp1 = _grup1 addWaypoint [position player, 0];
_wp1 setWaypointType "SAD";
};
case 4: {
_grup1 = [SafePos2, EAST, (configfile >> "CfgGroups" >> "East" >> "OPF_T_F" >> "Armored" >> "O_T_TankSection")] call BIS_fnc_spawnGroup;
_wp1 = _grup1 addWaypoint [position player, 0];
_wp1 setWaypointType "SAD";
};
case 5: {
_grup1 = [SafePos2, EAST, (configfile >> "CfgGroups" >> "East" >> "OPF_T_F" >> "Motorized_MTP" >> "O_T_MotInf_Reinforcements")] call BIS_fnc_spawnGroup;
_wp1 = _grup1 addWaypoint [position player, 0];
_wp1 setWaypointType "SAD";
};
default { hint "default" };
};
There, can clearly see your mistake. I recommend you use a real code editor with syntax highlighting when writing your scripts
@runic quest floating point
@wicked merlin call compileFinal is bullsh* it makes no sense, I don't know which idiot came up with that. Someone clearly thought he can be extra intelligent, and then showed how not intelligent he actually is.
call compile preprocessFileLineNumbers if you need it to be synchronous, but the init scripts are already async so I don't get why.
For a simple call once a execVM is just fine.
Really you should be using CfgFunctions for everything you execute more than once, for the rest execVM is probably sufficient
What code and where do you call initPlayerLocal.sqf, initPlayerServer.sqf, and initServer.sqf? I'm trying to setup whitelisting for certain roles, it works in editor but not on dedicated. Any ideas? I have already checked out the available resources for knowledge, I'm just not understanding how those files are supposed to be called
dont they need to be called in the init.sqf? as like [] execVM "initServer.sqf"? does it need to be under isDedicated or isServer or something along those lines?
Answering with no insults here...
@wicked merlin Just simply place them in the same folder as themission.sqmis in. They will be executed (as Goat already said) automatically. By just add something likediag_log "initServer.sqf loaded"to it, you can check it for yourself in the .rpt files.
This said, that call compileFinal preprocessFileLineNUmbers-stuff isn't needed for init-files. For normal (your created) functions you should stick to cfgFunctions.
Although, while testing normal functions ingame, this is fine to use:
my_fnc_finalyFunctionName = compile preprocessFileLineNumbers "Path\To\file.sqf";
When done, finishing your script -> Add it to the CfgFunctions and remove or disable the code.
call compileFinal is absolutely useless nonsense
I know the guy above just copy pasted it from somewhere and doesn't actually understand what it does.
The problem is with whoever came up with that idea
Haven't said it would be useful ¯_(ツ)_/¯
Maybe it's time for a page like do's and don'ts in Arma
wasn't there a page on performance and speed of certain commands, though it's probably aged by now
We have a optimization guide yes
is there a difference between 'call' and 'spawn' on how they handle parameter?
Because the second call 'ignores' the offset '32' and spawns on '_roadCenter' one meter in the air.
But when i use 'spawn' the objects spawn correctly
https://imgur.com/a/hvm8RkA
[_roadCenter, -32] call fnc_wealthy_plot;
[_roadCenter, 32] call fnc_wealthy_plot;
fnc_wealthy_plot
_road = _this select 0;
_offset = _this select 1;
_pos = getposATL _road;
_centerPos = _road modelToWorld [0,_offset,0];
_center = createVehicle ["Sign_Arrow_Large_Pink_F", _centerPos, [], 0, "NONE"];
Only this part realy matters since everything that spawns is based on '_center' and _center itself spawns above ground
i know i could fix this by checking the offset and changing to position accordingly.
But why does this happen?
is there a difference between 'call' and 'spawn' on how they handle parameter?
no
could there be another reason why it there are two different outcomes?
You are not using private on your variable, it may come from this
you should use params.
It can't come from that, if the code he posted is exactly the same code he's running
i changed the variable from _center to _roadCenter in discord to make it more clear which one i was talking about. Turns out they conflicted in my code since both scripts had the same variable name.
i always assumed that underscore variables would be automatically private 😫
you should use params.
😉
_road = _this select 0;
_offset = _this select 1;
```no
```sqf
params ["_road", "_offset"];
```yes
```sqf
params [
["_road", objNull, [objNull]],
["_offset", 0, [0]]
];
```best
thanks, i have some scripts to overhaul 👍
and ofc private keyword everywhere where you intend "create" a new variable
anyone ever use an aws ec2 instance to run arma?
this is not #arma3_scripting @lyric pasture ?
here is about SQF #arma3_scripting for Arma; I would say #server_admins for this setup
ill ask in there 👍🏻
if the command is broken, no can do?
no way I know of at least.
i'm having some difficulties. I'm wanting a light cone (added in Contact) to attach turret, so that the light moves with the turret. I'm using this to add it to the scope Memory Point:
this attachTo [turret1,[0.026,0.035,-0.028],"otochlaven"];
this setVectorDirAndUp [[0.361,0.932,0],[0,0,1]];
it attaches, but does not move with the turret. Does anyone know why?
what is "turret1"?
it attaches to the object's (selection) location, but not to the rotation @ornate marsh
Turret1 is the turret I'm trying to add it to, it's the AI CSAT turret I'm trying to add to. Would I have to have some sort of script to constantly update the rotation then?
most likely, but I can't help with 3D stuff
try maybe playing with various selection's positions difference and setPos/setVectorDirAndUp
Ok, will do
Im having a bit of a brain fart today, just wanna spawn an active smoke grenade on a marker pos using add action ...
This is what ive got, although its not working atm, pretty sure its completely wrong 😆 Would appreciate any advice
this addAction ["Target 1", "_smoke = "SmokeShellRed" createVehicle (getPos pos1)];
first, you don't need the _smoke = part, it's doing nothing in this case
and what is pos1?
is it the var name of a marker?
Got it to work with help from @warm hedge in the Arma 3 Hub server used
this addAction ["Target 1", {_smoke = "SmokeShellRed" createVehicle (markerPos "pos1")}]
Thanks for the input @sage dawn
ah it was a marker
Aye mate
the _smoke = part is still not really needed there
it doesn't hurt but it isn't necessary either
Ah okay, wonder why its there, I got that part from a BI Forums thread
It would be useful if you'd go about expanding the script, but you aren't so it isn't necessary.
`this addAction ["Target 1", {_smoke = "SmokeShellRed" createVehicle (markerPos "pos_1")}];
this addAction ["Target 2", {_smoke = "SmokeShellOrange" createVehicle (markerPos "pos_2")}];
this addAction ["Target 3", {_smoke = "SmokeShellRed" createVehicle (markerPos "pos_3")}];
this addAction ["Target 4", {_smoke = "SmokeShellOrange" createVehicle (markerPos "pos_4")}];
this addAction ["Target 5", {_smoke = "SmokeShellRed" createVehicle (markerPos "pos_5")}];
this addAction ["Target 6", {_smoke = "SmokeShellOrange" createVehicle (markerPos "pos_6")}];
this addAction ["Target 7", {_smoke = "SmokeShellRed" createVehicle (markerPos "pos_7")}];
this addAction ["Target 8", {_smoke = "SmokeShellOrange" createVehicle (markerPos "pos_8")}]`
Thats the full init line on the object that gives the addaction, not sure if its useful in that context?
Its for teaching Target Acquisition to a milsim unit, so needed to spawn a variety of colored smokes at different markers
in that situation the _smoke would only be useful if that execution script was then also doing something else with that grenade
Ah that may make sense then, the original thread was for stopping the smoke once a target had been hit
Hey, was just wondering how I can make this script limited to a certain range so that people cant snipe pickup intel or stuff this addAction ["Seize",{ deletevehicle (_this select 0); hint "You've seized an item."; }];
figured it, thanks
so regarding this
this attachTo [turret1,[0.026,0.035,-0.028],"otochlaven"];
this setVectorDirAndUp [[0.361,0.932,0],[0,0,1]];
The getDir/setDir doesn't work because the object itself doesn't rotate, it needs to get the direction of the barrel and not the base of the turret. So no idea on what to do
regarding the above point Lou made
@ornate marsh https://community.bistudio.com/wiki/weaponDirection
think that might work
i'll give it a look
Hey guys is it possible to remove the hardcoded arma actions like "Open Door" etc.? or to get the ids from them?
No, beside simple objects
hmm okay :/
Hi, started working on a map centred RTS mode, whilst marker movement have been simple enough to create I'm wondering if anyone would possibly know of any way to select markers on the map and run an event based off of that, similarly to Vindicta?
whats vindicta?
and you would need to create the logic behind such selection system
possibly something tied on mouseClick events
that checks if marker is under the cursor and then does stuff to it if it is
Is there a way to change the NATO symbol that's seen in high command over subordinate elements? I've got some mechanized infantry, and they show up as tanks from high command. Anyone know an easy fix?
@shadow sapphire see https://forums.bohemia.net/forums/topic/79914-customize-high-command-interface/?do=findComment&comment=1377974 maybe?
it seems there is a (A2) wiki page about it
https://community.bistudio.com/wiki/Military_Symbols
Both links are quite helpful! Thanks so much!
with pleasure; I admit I was at first "hm, easy 1s google sea— wait a minute" 😄
How to use code to determine whether a player is male or female?
there is no native female charaters
if you have modded characters you can proabably compare the character type
or if you mean what gender person sits at the computer playing, then Id say there is no script for that.
tks ,bro
hi so im back with my dumb questions
i'm doing a radio trigger like this to spawn a neo to practice shooting on
planething1 = [[1000, 1000, 1000], 180, "O_Plane_CAS_02_F", EAST] call bis_fnc_spawnvehicle;
wpdataplane1 = [a very very long thing of flight data];
[(planething1 select 0), wpdataplane1] spawn BIS_fnc_Unitplay;
(planething1 select 0) addEventHandler ["Killed", {
params ["_unit", "_killer", "_instigator", "_useEffects"];
deleteVehicle _unit;
}];
how do i disable the ai or remove all pylon weapons? because the ai kept hardlocking my rhino with an atgm
and second question, is there a way to make the 120mm cannons of a rhino, per se, reload faster?
… oh! A Syntax error 😋
private _planeData = [[1000, 1000, 1000], 180, "O_Plane_CAS_02_F", EAST] call BIS_fnc_spawnVehicle;
private _flightData = [a very very long thing of flight data];
private _plane = _planeData select 0;
removeAllWeapons _plane;
[_plane, _flightData] spawn BIS_fnc_Unitplay;
_plane addEventHandler ["Killed", {
params ["_unit", "_killer", "_instigator", "_useEffects"];
{ _unit deleteVehicleCrew _x } forEach crew _unit;
deleteVehicle _unit;
}];
``` @faint fossil
you could also not use BIS_fnc_spawnVehicle and just use createVehicle and engineOn
@faint fossil
he won't stop pinging you until you recognize his pun
sorry i was watching youtube and its also 2 am >_>
but thank you so much for the help! i'll try this
I wonder did Lou get any sleep because of that xD
and yes lol syntax error I get it hehe please end me ive heard this too many times
jk love you
what time zone is lou in?
UTC+1
I forgot I pinged you once with the quote, and seeing you posted your issue @ 6am (for me), I pinged you to be sure you would see the reply
that does not prevent me from joking around!
at least less people will do jokes in these days
... i dont get it what is the significance of "not" and "do"
just spent good 30 seconds thinking
i might be too tired lol
"I am the one who jokes here!"
I usually do bad/dad jokes, that's why
and due to lockdown, you won't suffer many jokes besides told ones
ah
i see lol
sorry to ruin your joke
okay that makes sense im not sure why i didnt see it the first time
while you're here uh... how to make cannon fire faster? e_e
google searches are coming up with anything i can understand
which cannon?
see https://community.bistudio.com/wiki/setWeaponReloadingTime to reduce time between shots
120mm cannon of a rhino, and thank you ill read through it
oh jesus okay
big code
so
i put this in the init field of the rhino
this setWeaponReloadingTime [gunner (vehicle player), currentMuzzle (gunner (vehicle player)), 0.1];
doesnt work of course, what am i doing wrong?
oh so
according to reddit
vehicle player is probably not your rhino
this doesnt work for 1 shot cannons
oh
okay um i found a copy-paste solution it seems
not sure exactly how it works but ill post it here in case anyone needs info
this addEventHandler ["Fired",{
_this select 0 setAmmo [currentMuzzle gunner (_this select 0),999];
_this select 0 setWeaponReloadingTime [gunner (_this select 0),currentMuzzle gunner (_this select 0),.01];
}]
^ very fast firing vehicles
Sorry mate. I did say my reasoning for doing so though as I am not sure if it is a "scripting" or a "GUI" issue.
Oke. No worries, I'll banish that message from here and watch for responses over there. Thanks.
Yea yup. Fully understand :))
thanks
how can I detect when a certain action (default, not added via script) is executed? the action is on the mouse wheel and is baked-in by the mod itself
none I can think of unless you can attach to an in-action variable, or use the inGameUI EH
https://community.bistudio.com/wiki/Arma_3:_Event_Handlers/inGameUISetEventHandler
maybe you can detect it based on what that action is doing?
so, detect not the act of trigger the action, but whatever triggering that action actually does
what kind of action is it?
Hello everyone... I am really new (and noob) in scripting and I need some help.
Do I have to set a public variable that "contains" an object (I publicVariabled the variable so I can make changes to the object from different machines) to nil after I delete the object with deleteVehicle command or it automatically deletes the variable too? Thank you all in advance!
so I have to set it to nil and then use publicVariable again to broadcast the deletion right?
not sure if publicVariable broadcasts nil too
but yeah, you have to do something to delete the variable, if you want it gone
it does, but you don't "have" to
but I don't see a reason why you want to delete it
Free some memory space????
16 bytes.. really?
all the effort for that
don't think thats worth it
you waste more memory space by just having that deletion inside your script code, which is also loaded into memory
Alright! I just thought that it is a good tactic to free as much memory as you can especially since you do not need it occupied anymore!
if you have hundreds of variables, with dynamically generated names that you'll never reuse, then that might be a good idea
but not for one, or half a dozen variables
I believe that in a persistent environment I may have about 35-60...
yeah doesn't matter
Is that too many?
no
Arma uses 4+gb of ram, most people have 16+gb stop worrying about a few kilobytes
Plus what ALiVE and some other mods will need! But, tbh I didn't know that deletion does occupy memory! Thought that it happens (probably will use some memory for that) and after that, it empties the memory space!
Ok mate... Cheers. Thanks a lot for the help! 🙂
deletion doesn't occupy memory, the script code that does the deletion does
all your script code is loaded into memory, longer scripts -> more memory usage
if you want to save memory, write smaller scripts, strip all comments and whitespace... (Thats a joke, don't do that, its stupid)
Scripts occupy memory when they are called right? and when they are completed they "empty" the memory space? Am I wrong here?
when you compile and store them in a function, they occupy memory too
the script code itself is stored in memory such that it can be executed. Execution itself uses more on top of that
Alright. I believe that I got the idea! Thanks a lot @still forum ... Really appreciate the help!
« Premature optimization is the root of all evil. » – Donald Knuth
make it work first 😉
I did this in the end:
player setVariable ["timeStarted", 0];
ringTheBell = '
params ["_target", "_caller", "_indexOfAction", "_action", "_localizedAction", "_priority", "_showWindow", "_hideOnUse", "_shortCut", "_isMenuVisible", "_event"];
player getVariable "timeStarted";
if (str _target == "campanellaPercorso") then {
if (player getVariable "timeStarted" == 0) then {
player setVariable ["timeBegin", serverTime];
player setVariable ["timeStarted", 1];
hint "Run!"
} else {
hint format ["You took %1 seconds to do the run", serverTime - (player getVariable "timeBegin")];
};
};
false
';
inGameUISetEventHandler ["Action", ringTheBell];
basically there's a bell the guy will ring, timer start, he do the obstacles run and ring it again in the end and it tells how much time it took
@flat elbow
on helicopter respawn, use createVehicleCrew
https://community.bistudio.com/wiki/createVehicleCrew
if you want to save memory, write smaller scripts, strip all comments and whitespace... (Thats a joke, don't do that, its stupid)
@still forum Just made it a bit more obvious 😂
I have just bought a server so my clan can play ops more smoothly im getting these messages in the web console
15:44:48 SteamAPI initialization failed. Steam features won't be accessible!
15:44:49 Error context {
15:44:49 ErrorMessage: File ServerRPT\server.cfg, line 59: '.': ';' encountered instead of '='
15:44:49 Application terminated intentionally
ErrorMessage: File ServerRPT\server.cfg, line 59: '.': ';' encountered instead of '='
Im getting these error messages this is what line 59 to 61 look like
// SCRIPTING ISSUES
onUserConnected = ""; // command to run when a player connects
onUserDisconnected = ""; // command to run when a player disconnects
doubleIdDetected = ""; // command to run if a player has the same ID as another player in the server
That's not #arma3_scripting
What the message says, you have a semicolon where a = should be. Probably right before L59
someone knows a way to draw a polyline (the line i can draw in the map with the mouse) via script? and also get it's parameters to save it?
I dont think there is a ready logic for such
@woeful sundial there is drawPolygon, but no "free-hand drawing" though.
this ^ being a map-control command
you can perhalps create polygons when the map is open and the button is pressed and it would be kind of drawing i guess?
Hi guys, I've come to a point where im just clueless. I want to receive data from the server. I call the function on the server with remotexeccall and my idea is, that I could set a global var on the client and wait until it's received via publicVariableClient. Would a remoteexeccall from the server to the client more efficient?
wait - what do you want from the server?
assign a variable to the scope of mission/object/unit?
like:
player setVariable ["timeStarted", 1];
Would a remoteexeccall from the server to the client more efficient?
probably
wait - what do you want from the server?
@winter rose
I want to retrieve informations from a database
probably
@still forum Is there any offical documentation on that topic?
the wiki
Can you provide a link or some resource? I only found a thread in a german forum which gives information about publicvariable and remotexec https://armaworld.de/index.php?thread/2659-remoteexec-vs-publicvariable/
I know that link but I think it does not help me with my initial question
can I ask what is the data that should be sent?
if it must be done on connection, use on player connection EH?
The client sends an id which is stored in the database and the function should give me an array back with detailed information
This happens not on a connection but mid-game
you could use remoteExec a server-side script yeah
Yeah I know but what is the best way to send the data back to the client?
I think I have two options: 1. remoteExec back to the client and populate my dialog and other stuff or 2. use publicvariableclient while using a waituntil to wait for the data on the client
I am no UI expert, both can do I think
remoteExecCall to server, he sends the variable via remoteExecCall back. Not sure where the problem is 🤔
Thanks I will have a look
class CfgSounds
{
sounds[] = {};
class WailAlarm
{
name = "WailAlarm";
sound[] = {"sounds\RedAlarm.ogg", 100,1};
titles[] = {0,""};
};
class IncomingAlarm
{
name = "IncomingAlarm";
sound[] = {"sounds\IncomingAlarm.ogg",db1,1};
titles[] = {0,""};
};
};
class CfgSFX
{
class Wail
{
sound0[] = {"\sounds\RedAlarm, -10, 1.0, 1000, 1, 0, 0, 0};
sounds[] = {sound0};
empty[] = {"", 0, 0, 0, 0, 0, 0, 0};
};
class Incoming
{
sound0[] = {"\sounds\IncomingAlarm, -10, 1.0, 1000, 1, 0, 0, 0};
sounds[] = {sound0};
empty[] = {"", 0, 0, 0, 0, 0, 0, 0};
};
};```
Whats wrong here?
your indent?
Hmm?
class CfgSounds
{
sounds[] = {};
class WailAlarm
{
name = "WailAlarm";
sound[] = {"sounds\RedAlarm.ogg", 100,1};
titles[] = {0,""};
};
class IncomingAlarm
{
name = "IncomingAlarm";
sound[] = {"sounds\IncomingAlarm.ogg",db1,1};
titles[] = {0,""};
};
};
class CfgSFX
{
class Wail
{
sound0[] = {"\sounds\RedAlarm, -10, 1.0, 1000, 1, 0, 0, 0};
sounds[] = {sound0};
empty[] = {"", 0, 0, 0, 0, 0, 0, 0};
};
class Incoming
{
sound0[] = {"\sounds\IncomingAlarm, -10, 1.0, 1000, 1, 0, 0, 0};
sounds[] = {sound0};
empty[] = {"", 0, 0, 0, 0, 0, 0, 0};
};
};
so, what is your error? it is missing ending quotes in CfgSFX
Ohh thats just discord xD
The error is something along the lines of end of line
1 sec
The end quotes are probably the issue
"probably" yes
look at the highlight and you'll see the error 🙃
denied
D:
a quick answer it will be
Do I have to reload the scenario for it to take effect?
to restart it only
And theres a zeus module, called play Sound
I've noticed all the sounds in there are SFX, not sounds.
So would this add those sounds to the Play Sound module?
I made a test and found out that the publicvariableclient approach is quite faster than the remoteexec approach:
21:41:29 "Started 1" -> Publicvariable
21:41:29 "Debug - Benötigte Zeit: 0.0830078"
21:41:29 "Started 2" -> Remoteexec
21:41:30 "Debug - Benötigte Zeit: 0.104492"
you are measuring the network latency
not the speed of pubvar/remoteexec
also I hope you don't actually mean "publicVariable" but instead "publicVariableClient"?
because sending the data to all clients, while just one requested it is pretty bad
and remoteExec makes it much easier to just send back to remoteExecutedOwner
also I hope you don't actually mean "publicVariable" but instead "publicVariableClient"?
@still forum Yeah of course
and remoteExec makes it much easier to just send back to remoteExecutedOwner
@still forum I only use publicvariableclient in combination with remoteExecutedOwner to send the data back to the client which makes my script easier
Just use the promise methods I sent ya basti
They work perfectly fine and are pretty much what you want
is there a wiki page that explains server / client separation?
trying to figure out where to execute this
i would assume clientside?
Does anyone know how I'd increase the number of magazines for the prowler HMG variant? I found the addMagazineTurret [magazineName, turretPath, ammoCount] command but was having difficulty finding the magazine name and turret path.
So i am most definetly missing something, I defined a function inside a file that is inside a folder called scripts under the mission folder, then in my initServer.sqf I prepare it:
TOV_fnc_SimpleConvoy = preprocessFileLineNumbers "scripts\simpleConvoy.sqf";
the file contains:
hint "AA";
Then I start the server, enter the mission, open the debug console and call it:
[] spawn TOV_fnc_SimpleConvoy;
And i get a generic error expression about the spawn call
What I am doing wrong?
Same with
TOV_fnc_SimpleConvoy = preprocessFile "scripts\simpleConvoy.sqf";
oh right, i have to call compile
dumb me
whats the script/fnc/event? for automatically adding access to object for zeus? sworn seen a biki but cant find it now
@flat elbow I'd suggest to make simpleConvoy.sqf a function in CfgFunctions and use that one
see https://community.bistudio.com/wiki/Arma_3_Functions_Library for instructions
Hi I'm here with more stupid questions
how would one make a functional VR target vehicle like the one in the virtual testing place?
and, to add on, how do you get the little vr circle target to work? i'd assume its a similar process
_>
The vanilla arsenal mission, is in the game files, you could open it and look into it
Or you could look at ACE, which also has a arsenal mission on github
https://github.com/acemod/ACE3/blob/master/addons/arsenal/missions/Arsenal.VR/initPlayerLocal.sqf
The VR target vehicles are just special VR classes
https://github.com/acemod/ACE3/blob/master/addons/arsenal/missions/Arsenal.VR/initPlayerLocal.sqf#L87
I'd say they should be available in 3den
what vr circle target not sure what you mean.
what do you want to do? Detect when someone walks into the circle? or is it a shooting thing?
thanks, its a bit late so ill go to bed but ill definitely try it tomorrow
and uh
the vr circle is like
a placeable thing thats under targets
its a floating white disc with some sectors
if you shoot it whichever sector gets hit will light up
its like a more sophisticated shooting target
but if you just put it in editor it doesnt do anything when you shoot it
The vanilla arsenal mission, is in the game files, you could open it and look into it
-- Dedmen
Sorry for the ping. @faint fossil look at the scripting parts.
If the circle is used in a training scenario or smth. you could extract that and look at it
they are usually in a missions_f pbo, probably in bootcamp
Is there a way to check all warlords sectors on whether they are targeted by either side once someone requests a fast travel and if they are disable fast travel for that sector entirely?
I tried to achieve this by putting the following code into the Init section of every sector but that obviously costs a lot of server performance and thus is no viable solution.
while { true } do
{
waitUntil {
(this == BIS_WL_currentSector_WEST || this == BIS_WL_currentSector_EAST)
};
this setVariable ['FastTravelEnabled',false,true];
waitUntil {
(this != BIS_WL_currentSector_WEST && this != BIS_WL_currentSector_EAST)
};
this setVariable ['FastTravelEnabled',true,true];
};
Is there any other/better way to do it?
@round scroll I can do that but i want the server and only the server to use that function
Hello, I have an array I in a script that I want to run on all clients connecting to the server. Right now it runs only locally on each machine.
How can I make it run and sync on all machines connecting?
@vagrant urchin you don't run an array? What are you doing with it
It's an array of units. Everytime a player connects to the server the unit the player occupies should be added to the array
But it works only locally
So if two players connect to the server, they can only see themselves in that array
use "on player connected" event handler, server-side, and publicVariable this array
else, there is allPlayers
@vagrant urchin ^
I'll try that and update. Thanks
I use the fast travel function for travelling across the map. How can I retrieve the fuel flow and fuel capacity to calculate the overall consumption?
you can use fuel and make a delta
That is the idea, fuel 1 indicates the full fuel tank already... But is the returned value precise enough?
…what do you mean?
check my wiki Sandbox, there is (ugly) code for fuel delta (click "Show text")
https://community.bistudio.com/wiki/User:Lou_Montana/Sandbox
So, to calcuate the maximum travel distance, I should get the fuel consumption time, returned by the monitor script, and multiple it by max speed? Is it the optimal way?
I have a 2 part question regarding ACE Framework. Part 1 - Can I execute a FNC within a condition statement? Part 2 - If so, how can I get an answer from the FNC to show the action.
@winter rose how can I get the unit that the player connected to the server posses?
I'm executing the script with the OnPlayerConnected event and OnPlayerConnected is executed in initServer.sqf
@unreal scroll no
you take fuel at time 1, you take fuel at time 2 (usually 1s later), you make the difference
then you divide the current fuel amount by the difference, and you have your fuel lifetime in seconds
I thought OnPlayerConnected returns the unit
this is the log I'm printing
Added new player to IL array - PlayerID: any, JIP: any, Unit: <NULL-object>
do you use the mission EH?
https://community.bistudio.com/wiki/Arma_3:_Event_Handlers/addMissionEventHandler#PlayerConnected
it seems that your code is wrong due to <any> being there
"then you divide the current fuel amount by the difference, and you have your fuel lifetime in seconds"
...and then I should multiple it by max speed, as I said, to get the distance. It is the long way, and it is not good enough, because I need to run time-depedent scrip to calculate it - but the teleport script doesn't have tiem for it.
I asked about calculating the average fuel consumption rate. I.e., _distance = (fuel _veh)/_somevalue
why would you multiply fuel consumption by speed? 🤔
oh wait I didn't user the mission event handler
Should the MEH be executed in initServer?
not "executed" but added yes
yes
okay I'll try that
Also, what is _this in the example in the link you provided?
handlercon = addMissionEventHandler ["PlayerConnected",
{
diag_log "Client connected";
diag_log _this;
}];
addMissionEventHandler ["PlayerConnected",
{
diag_log _this;
params ["_id", "_uid", "_name", "_jip", "_owner", "_idstr"];
}];
_this is the parameter provided to the code
[1,2,3] call { systemChat str _this; }; // outputs "[1,2,3]"
so would I use it like this?
addMissionEventHandler ["PlayerConnected",
{
[_uid, _jip] execVM "scripts\arrays_handler.sqf";
}];
arrays_handler.sqf
playerID = _this select 0;
isJIP = _this select 1;
don't forget to add params ["_id", "_uid", "_name", "_jip", "_owner", "_idstr"];
you can also use ```sqf
params ["_uid", "_isJip"];

what is the importance of params
oh wait nvm
Parses input argument into array of private variables
"why would you multiply fuel consumption by speed?"
To calculate the overall fuel consumption at given distance :)
The algorythm:
- Player select distance point
- Script calculates the fuel consumption
- Vehicle teleported to new position
- Vehicle fuel decreasing by calculated value
so it would be
so would I use it like this?
addMissionEventHandler ["PlayerConnected",
{
params ["_id", "_uid", "_name", "_jip", "_owner", "_idstr"];
[_uid, _jip] execVM "scripts\arrays_handler.sqf";
}];
arrays_handler.sqf
params ["_uid", "_isJip"];
diag_log format ["Added new player to US array - PlayerID: %1, JIP: %2, Unit: %3", _uid, _jip, player];
@unreal scroll fuel is not linearly consumed
it depends on your actual speed / engine RPM
you would need to make a delta of pos2 - pos1 and divide remaining distance by this
"more or less"
Engines are my specialty 🙂
There is always an average fuel consumption, for cruise speed. I don't need a very precise calculation, of course.
this is what it prints now
Added new player to array - PlayerID: 76561198736551323022, JIP: false, Unit: <NULL-object>
It still returns null-object
yes, the player joined the server
The problem is that OnPlayerConnected does not return the unit of the player
yeah, it does not
it is a -connecting- player, not a player entering the mission
computer connects to server, but e.g player still in lobby
Perhaps the respawn event would work if I listened to it instead of the PlayerConnected event?
why don't you use allPlayers? or BIS_fnc_listPlayers?
allPlayers apply {[getPlayerUID _x, didJIPOwner _x, _x]} on server would produce what you want i guess
That can work, but how can I make it run everytime a player connects
or rather spawns with a unit because connect doesn't seem to work in this case
init player local and RE to the server or something, entityrespawned or whatever might work too if u have respawnonstart enabled
using an Hit eventhandler mixed with a particle effect to spawn a small VR cube where a player gets hit
but I'm getting an error on line 1
bob addEventHandler ["Hit", {_this select 0 execVM "effect.sqf"}];
"",
"spaceObject",
0.5,
1,
[0,0,0],
[0,0,0.5],
1,
0.2,
0,
[0,0,0.5],
[0.75,0,0,1.0],
[0, 1, 0],
0.01,
0.08,
"",
"",
bob,
[0.75,0,0,1.0]
];```
what is line 1, and what is the exact error?
line one is
Drop ["\A3\Structures_F_Bootcamp\VR\Blocks\VR_Block_04_F.p3d",
the error is
Error type Array, expected number
I might have messed up the order of the arguments
the last one for example
is an emissive parameter marked as optional
if I want it does it mean I should have empty slots for every optional parameter before it?
yes, of course
I'll check that
but probably something else is in error aswell
it will throw another error once this is solved then
@smoky verge any update?
might have messed up the order because I was using an outdated set of parameters
I'm remaking it from scratch as we speak
okido, GL
Okay I'm using allPlayers
with a foreach loop
and it works
usPlayers = ["74234198002438570"];
publicVariable "usPlayers";
ilPlayers = ["765611980658345454"];
publicVariable "ilPlayers";
{
if((getPlayerUID _x) in usPlayers) then
{
[_x, ""] call BIS_fnc_setUnitInsignia;
[_x, "BI"] call BIS_fnc_setUnitInsignia;
};
if((getPlayerUID _x) in ilPlayers) then
{
[_x, ""] call BIS_fnc_setUnitInsignia;
[_x, "MANW"] call BIS_fnc_setUnitInsignia;
};
} forEach allPlayers;
except for the part where when a player respawns, everyone but that player get the insignia
We are 3 players in the server, when one respawns, the other two get their insignias, but the one who respawned doesn't
sleeping between the removing and adding seems to work
[_x, ""] call BIS_fnc_setUnitInsignia;
sleep 3;
[_x, "MANW"] call BIS_fnc_setUnitInsignia;
Just… why remove then set?
because if you had an insignia and you set it again
it doesn't work
others had the same issue
is this the only code you execute in the allPlayers code?
no need to publicVariable the uid lists (if they are only used here)
it's not, it just "waits"
but if the thing is to get the proper insignia, you could do it player-side (init and respawn), as BIS_fnc_setUnitInsignia is not server-only
what was the way to write stuff in sqf coloring?
I know it's not. As far as I understand in order to get insignias work properly in the multiplayer environment, you'd need to set it for every machine connected to the server
hi, Anglais
Do you know how to display the player name in dialogs plz ?
Drop [
"\A3\Structures_F_Bootcamp\VR\Blocks\VR_Block_04_F.p3d", //shapeName|String
"", //animationName|String
"spaceObject", //type|String
0.5, //timerPeriod|Number
1, //lifetime|Number
[0,0,0], //position|Array
[0,0,0.5], //moveVelocity|Array
1, //rotationVelocity|Number
0.2, //weight|Number
0.3, //volume|Number
0, //rubbing|Number
[0.03,0.03,0.03,0], //size|Array
[0.75,0,0,1.0], //color|Array
[0, 1, 0], //animationPhase|Array
0.01, //randomDirectionPeriod|Number
0.08, //randomDirectionIntensity|Number
"", //onTimer|String
"", //beforeDestroy|String
bob, //object|Object
0, //angle|Number
false, //onSurface|Boolean
-1, //bounceOnSurface|Number
[0.75,0,0,1.0] //emissiveColor|Array
];```
Now I have a Number where there is supposed to be an Array
but as you can see from there there is no problem
as you can see
no can see, what seems to be the error?
Is there a way to check all warlords sectors on whether they are targeted by either side once someone requests a fast travel and if they are disable fast travel for that sector entirely?
I tried to achieve this by putting the following code into the Init section of every sector but that obviously costs a lot of server performance and thus is no viable solution.
while { true } do
{
waitUntil {
(this == BIS_WL_currentSector_WEST || this == BIS_WL_currentSector_EAST)
};
this setVariable ['FastTravelEnabled',false,true];
waitUntil {
(this != BIS_WL_currentSector_WEST && this != BIS_WL_currentSector_EAST)
};
this setVariable ['FastTravelEnabled',true,true];
};
Is there any other/better way to do it?
Add a 5 second sleep to the wait until?
Is there no "current sector changed" event maybe?
Bis scripted eventhandler
@winter rose the errors says there is a number where there is supposed to be an array
if you check on the right I've marked what each line is and what there is supposed to be written in it
all arrays have arrays in them so not sure what I'm doing wrong
oh right it is
what does that mean exactly? 😅
all of them are RGBA
oh
why 2?
it is a transition for the whole lifetime
oh got it
you can have only one, or 10e10
so if I want 1 color I just copypaste it
got it
thanks
you got me searching for it D:
thanks for the help
it doesn't give me any error now
even though its not spawning the object 😞