#arma3_scripting
1 messages ยท Page 477 of 1
@unreal siren That's a bug in the call to the script.
hey, how can i use include to create custom actions in ace_interaction ?
Any tips on solving?
Hey could someone help me with vertor retation
I have an object that is slightly rotated. I want his retation to be zero, as if he was flat on the ground
probably
object: Array - Vector in format:
1: Yaw
2: Pitch
3: Roll
EDIT : Found it : [_Veh,[0,0,0]] call BIS_fnc_setObjectRotation;
@compact maple have you taken a look at this yet?'
https://ace3mod.com/wiki/framework/interactionMenu-framework.html
While i think the ace docu is minimal at least this is there, somewhat
in short
create an action with ace_interact_menu_fnc_createAction
then add it to either a class or an object with
ace_interact_menu_fnc_addActionToClassor ace_interact_menu_fnc_addActionToObject
With the two last ones you need to say where the action should be found
@meager heart Try creating it inside a controls group, you will encounter that there. (if nothing been fixed since then)
Got some good info for debugging my problem. Maybe somebody can help me out?
https://pastebin.com/nnP6sPFX or https://gyazo.com/0c86953011b4ffa095041200623ae5f2
life_RscPicture can I use ctrlSetStructuredText parseText format to change the background image?
@meager heart its the name of an object it just takes that variable name and creates an explosion ontop of it
So I'm using display with listBox on top of camCurator, does anyone has any idea if I can somehow block the mousewheel camera zoom when the mouse is over the listbox?
@hollow thistle Use _cam camCommand "manual off";
Does this disable all camera engine key handling?
It disables moving and zooming
Ok, ty.
So I need to find when cursor is over the listbox and disable the zooming then.
Yep and "manual on" to resume
How do I change the background image
of a Life_rscpicture ?
Outside the .hpp file
CONTROL(6969,_card1) ctrlSetStructuredText parseText format["images\draw\box.jpg"];
Cause that ain't fucking working :p
@unborn ether rgr
Hey guys, I need some help on my init.sqf. Ive created a cinematic intro of a briefing but when i try to use radio chat, nothing appears? I have tried everything and i just cannot get this to work. The script is here: ```cutText ["", "BLACK FADED"];
[0,0,false] spawn BIS_fnc_cinemaBorder;
Ryan playMove "Acts_A_M01_briefing";
sleep 5;
titleCut ["", "BLACK IN", 10];
player playMove "AmovPercMwlkSnonWnonDf";
sleep 1;
Ryan sideChat "Are we all ready? Yes?";
sleep 4;
Ryan sideChat "Right okay we have got alot to get through so if we all could settle down it will make life a hell of alot eaiser";
sleep 8;```
So yeah everything works other than the radio chat which is annoying but any help would be massively appreciated ๐
altis life game mode made by tonic.
i was free killed in a role play experience server.
๐ฎ !
@prime fox if the guy receiving the message isn't a BLUFOR, you will have to put the message as global, or use a custom channel, I figured that out 1day ago with a bit of help. Kinda sucks, an option to just display the messages to players instead of a side would be the best.
So with knowsAbout How can I pull out info on what type of unit the AI sees?
Or would that be some other function?
Parts of this too: https://community.bistudio.com/wiki/targetKnowledge
๐ฑ
so yes targetKnowledge will return "position error" and "target position", maybe will works for you...
So I know the AI basically auto-detect the source of say artillary if it hits around them
So I would use like select 7;? That way I can get basically the grid of said unit?
yeah... also maybe checkVisibility or lineIntersectsSurfaces will helps (idk what are you doing there)
I basically want to exploit the nature of the AI detecting enemy arty positions by default, and in return counter-battery them(Assuming AI is crewing a artillery piece)
I'm pretty newish to scripting. So I just assume.
- I need to determine if target is artillery
- Get coordinates
- Use one the arty functions to get the AI to fire mission said coordinate.
Two basic approaches that may work. If you determine the artillery unit (allUnits filtered with those driving an artillery or perhaps you just have the unit that needs blasating) then you can use knowsAbout to determine if they know the unit, anything above 1.5 is knowledge of being an enemy. The other way is targetsQuery which goes from all the units that unit knows about and provides some filtering so you can then get the shorter list of units and check for driving an arty.
Then determining if the unit is in a mortar is probably just name (vehicle _unit) == "mortar" or something pretty similar.
maybe just event handler Hit ๐ค
You can make it more advanced: attach 'fired' EH for artillery. When it fires its mortar round, spawn a script to monitor shell's position every few seconds. If it gets within range of an artillery radar, you log the launch position with some accuracy.
As I remember by default AIs spot artillery many kilometers away if the artillery kills someone from their squad. I might be wrong.
@heavy patrol Hey cheers for replying man. Yeah i got it working at 2am this morning haha. I was a survivor unit and the guy doing the talking was an officer. Turns out that i had to be a rifleman in order to receive the messages, annoying that when i am stuck on a piece of script, it is always something so small that's stopping it from working.
wait what, a survivor is considered different of a rifleman at the point of not receiving messages ? WTF ARMA
Well, on my side the issue is, I still can't make any good looking chatter because I'm using the Independents to make a guerilla scenario.
yeah ikr haha. took me like 4 hours to figure it out because i would never have thought blufor survivors are not classed as regular Blufor ๐. And i'm not sure what your problem is? Is the text just not showing or?
yeah, but that's because I'm using sidechats and groupchats, and these events work only for BLUFOR not INDIE, I think I'll need a big script file to change this but I'm a noob at scripting.
I'm pretty sure there's a logic handler or something like that but I just can't find it
hey guys, i'm fooling around with tvSetPicture but i can't display the picture in true colours ... it just stays black without being set to by tvSetPictureColor. does someone have any bones for me?๐
hey there. Trying to place some crew in the USS Liberty bridge, on the seats. The best way I've found is to attachTo the unit to the ship with proper offset, and it works good, but when I make him play an animation with switchMove, the animation is played stuttering, like one or two refresh a second, no more. Any idea on how to avoid it ?
nvm, wrong baseclass definition, thanks anyway
@vernal mural as far as I know, no way to avoid that. It has something to do with attach to and characters.
Hi guys me again. Im wanting to addAction on a bed and once activated, time skips for two hours. I know how to do this normally however, im wanting to only allow the player to see this and select this once another certain trigger has been activated. I can't figure out how and would love to know how. Cheers in advance ๐
@heavy patrol Ah right yeah im not too sure man. Worst comes to worst you can always set your side to blufor, change the loadouts and change your faction relationship status to how you want although that would be a massive ballache haha
is there an easy way to have two objects attach/place via two memory points? E.g. the Nimitz has a shuttle_start memory point, the plane has a pos_launchbar memory point. The end result would be that both points are together. Currently I use modelToWorld for both, measure the distance2D and then move the plane in the direction of the shuttle_start. Anything more elegant?
when using getOut and getOutMan event handler, is there a way to check what action has been performed (get out, eject, or moveOut command) ?
Trying to make a script where it changes the uniform when an add action is completed, I have tried various different ways and it always comes back with an error, where am I going wrong? ```titleCut ["", "BLACK", 0.2];
comment "Remove existing items";
removeAllWeapons this;
removeAllItems this;
removeAllAssignedItems this;
removeUniform this;
removeVest this;
removeBackpack this;
removeHeadgear this;
removeGoggles this;
comment "Add containers";
forceAddUniform "UK3CB_BAF_U_CombatUniform_DDPM_ShortSleeve";
addItemToUniform "FirstAidKit";
addItemToUniform "SmokeShell";
addItemToUniform "Chemlight_green";
addItemToUniform "UK3CB_BAF_556_30Rnd_T";
addVest "UK3CB_BAF_V_Osprey_DDPM9";
addItemToVest "ACE_EarPlugs";
addItemToVest "ACE_personalAidKit";
for "_i" from 1 to 2 do {this addItemToVest "ACE_morphine";};
addItemToVest "ACE_tourniquet";
addItemToVest "ACE_IR_Strobe_Item";
for "_i" from 1 to 2 do {this addItemToVest "UK3CB_BAF_9_17Rnd";};
for "_i" from 1 to 3 do {this addItemToVest "UK3CB_BAF_556_30Rnd_T";};
addHeadgear "UK3CB_BAF_H_PilotHelmetHeli_A";
comment "Add weapons";
addWeapon "UK3CB_BAF_L85A2";
addPrimaryWeaponItem "UK3CB_BAF_SUSAT";
addWeapon "UK3CB_BAF_L131A1";
comment "Add items";
linkItem "ItemMap";
linkItem "ItemCompass";
linkItem "ItemWatch";
linkItem "ItemRadio";
comment "Set identity";
setSpeaker "ACE_NoVoice";
sleep 3;
titleCut ["", "BLACK in", 0.2];```
Have also tried this before each one so i.e this addItemToUniform and it returns the error undefined variable this tried _this i.e _this addItemToUniform and it returns with the generic missing ;
It seems to be around line 14 each time where it goes wrong, so right below comment "add containers";
Syntax: unit addItemToUniform item You're missing part of the syntax for that command.
Same for forceAddUniform
You need to give those commands the unit object somehow. this works in a unit's init field. addAction will pass default parameters, one of which may be the unit, depending on how you have it set up.
Also, in general, never use comment unless you have some specific reason to (it's infinitely slower than using //)
It doesn't help that the default arsenal exports use it. =p
@round scroll I suppose you could give memory point of the 1st object you attachto to the attachTo command and for the offset you give reverse offset of the memory point of the object you attach, obtained with selectionPosition. You could vectorMultiply it by -1 to reverse. Not tested but I think the theory is sound
Yeah thats just how the arsenal exported it @ruby breach I was going to remove it. @digital hollow when I put this so it says this forceAddUniform "UK3CB_BAF_U_CombatUniform_DDPM_ShortSleeve"; for example it returns an error
The add action should pass it over but doesn't appear to
Is this code going in the addAction? this doesn't mean anything in an addAction code section. Look at the wiki page for the default parameters that are passed in.
No this is in a seperate script thats activated by an addAction
this addAction ["<t color='#22FF00'>Change into Flight Gear</t>","Scripts\FlightGear.sqf",[],1,false,true,"","_this distance _target < 4"]; this addAction ["<t color='#22FF00'>Change into FOB Uniform</t>","Scripts\BaseGear.sqf",[],1,false,true,"","_this distance _target < 4"];
addAction passes the following parameters to the code being called sqf params ["_target", "_caller", "_actionId", "_arguments"]; . You would need to use _caller (if using those params) or _this select 1 (if not using params) rather than just using this
So it would have to be _caller forceAddUniform "UK3CB_BAF_U_CombatUniform_DDPM_ShortSleeve";
If you put the params line at the top of your code block/function, yes
Right gotcha, thanks for your help ๐
// Params
params ["_target", "_caller", "_actionId", "_arguments"];
// Remove Existing Items
removeAllWeapons this;
removeAllItems this;
removeAllAssignedItems this;
removeUniform this;
removeVest this;
removeBackpack this;
removeHeadgear this;
removeGoggles this;
// Add Containers
_caller forceAddUniform "UK3CB_BAF_U_CombatUniform_DDPM_ShortSleeve";
_caller addItemToUniform "FirstAidKit";
_caller addItemToUniform "SmokeShell";
_caller addItemToUniform "Chemlight_green";
_caller addItemToUniform "UK3CB_BAF_556_30Rnd_T";
_caller addVest "UK3CB_BAF_V_Osprey_DDPM9";
_caller addItemToVest "ACE_EarPlugs";
_caller addItemToVest "ACE_personalAidKit";
for "_i" from 1 to 2 do {this addItemToVest "ACE_morphine";};
_caller addItemToVest "ACE_tourniquet";
_caller addItemToVest "ACE_IR_Strobe_Item";
for "_i" from 1 to 2 do {this addItemToVest "UK3CB_BAF_9_17Rnd";};
for "_i" from 1 to 3 do {this addItemToVest "UK3CB_BAF_556_30Rnd_T";};
_caller addHeadgear "UK3CB_BAF_H_PilotHelmetHeli_A";
// Add Weapons
_caller addWeapon "UK3CB_BAF_L85A2";
_caller addPrimaryWeaponItem "UK3CB_BAF_SUSAT";
_caller addWeapon "UK3CB_BAF_L131A1";
// Add Items
_caller linkItem "ItemMap";
_caller linkItem "ItemCompass";
_caller linkItem "ItemWatch";
_caller linkItem "ItemRadio";
// Set Identity
_caller setSpeaker "ACE_NoVoice";
sleep 3;
titleCut ["", "BLACK in", 0.2];```
Still returning an error, line 30 _caller addHeadgear "UK3CB_BAF_H_PilotHelmetHeli_A";
missing ;
why are you sometimes using this and sometimes _caller?
this is only valid in very specific cases. And I'm guessing your's isn't
That might be your problem. If it is. Then not finding it before is your fault for not looking at the whole error message
because it tells you exactly where the problem is
Well not finding it, would obviously be my fault? Dont believe I blamed anyone else in what I said.
Actually I'm complaining about you not posting the full error message
if you did that it would've taken me half a second to find the issue
If you read what I said though it returns the error on a different line in the message
yes.
I know
That's why I said what I said
The full error message shows more precisely where the error is
Line numbers are quite often incorrect
Actually in CBA/ACE for example. They are always incorrect.
Right so the first part I'm having to change to _caller instead of this which I missed when I changed to caller? thats possibly the problem?
could be yeah
Guys i know you are busy with someone else but if after or if you have the time can you help me with description.ext for custom sounds? I have looked everywhere and i Still cannot get my sound to play. It comes back with no error however, the sound / music just does not play for some reason. The description.ext is here: ```class CfgMusic
{
tracks[]={};
class Music1 {
name = "Music1";
sound[] = {"\sound\basem", db+0, 1.1};
titles[] = {0,""};
};
};``` Cheers a million if you can, im still getting used to description.ext's in arma 3 because i hate them and can never get sounds working.
For reference. Here is the actual complete error
for "_i" from 1 to 3 do {this addItemToVest "UK3CB_BAF_556_30Rnd_>
17:47:28 Error position: <this addItemToVest "UK3CB_BAF_556_30Rnd_>
it points right at the this
@prime fox also no error in description.ext?
https://community.bistudio.com/wiki/Description.ext#CfgMusic looking at that the first thing I notice is the missing file ending
@still forum Yeah no error mate, it is just not working for some reason
how are you playing the music?
I have tried to use, 'playSound "basem"'; playMusic "basem"; and also tried to select it on the trigger effects
both are wrong
you should use playMusic
and the name of your music is Music1
not basem
oh
You should be getting errors about that though
The wiki page I linked shows to use it. It also shows playMusic "MyIntro" below it to play the MyIntro from the snippet above
YESSS!! Got it thanks a million! I just copied and pasted the CFG music and edited it around, added playMusic "Music1" like you said and now i got it working. Legend man thanks! Been trying this for 4 hours straight and gave up trying a while a go because I couldn't do it. Im guessing with sounds, its just the same but with sound?
what the sounds or music?
sounds
Should be able to get the sounds working now you told me to use the class name instead of the other name. It sounds so obvious now I know what to do, cheers again man
how would I say LeaderScore == ZERO ? Null ? because obviously 0 = false so I can't put that in
LeaderScore is a public variable I created
and LeaderScore == 0 gives me a Generic error
Only you can know what your variable contains
well I do know : A number
mmmh ...
indeed, mybad, I had set the default value to " " so it coudn't work
is it possible to have :
waitUntil {getPosATL Veh == [_randomPosMapNoWater select 0, _randomPosMapNoWater select 1, (_randomPosMapNoWater select 2) + 7000]};
It looks like it's expecting a number and not an Array
Use isEqualTo to compare arrays.
great thanks
@quartz coyote Are you trying to compare two positions for equality? Where one position is position of object?
one position is position of object
@quartz coyote use distance instead equal, all numbers is float, not integer
like this ?
waitUntil {Veh distance [_randomPosMapNoWater select 0, _randomPosMapNoWater select 1, (_randomPosMapNoWater select 2) + 7000] < 0};```
distance cannot possibly ever by <0
You'd have to get very high on drugs on a international philosophy conference for that to make sense
well since that seems to be obvious to you... it's isn't for me ๐
and I never took drugs ...
or almost ๐
oooh
I seeee
you know how far something that's 0 meters away from you is..?
sorry
yes
indeed
I understand
waitUntil {Veh distance [_randomPosMapNoWater select 0, _randomPosMapNoWater select 1, (_randomPosMapNoWater select 2) + 7000] < 1};```
is that a position in the sky?
indeed
might be a little hard to hit exactly that.
mmh
@quartz coyote you waiting when heli or plane reach some point?
especially with a scheduled waitUntil that might only check the position once a minute...
I'd say impossible with a plane
might want a couple hundred meters as tollerance probably
Veh setPosATL [_randomPosMapNoWater select 0, _randomPosMapNoWater select 1, (_randomPosMapNoWater select 2) + 7000];
waitUntil {Veh distance [_randomPosMapNoWater select 0, _randomPosMapNoWater select 1, (_randomPosMapNoWater select 2) + 7000] < 1};```
huh?
what use does the waitUntil even have?
when you set it's position it will be at that position
well for some reason it doesn't ...
some times it's higher, sometimes lower
probably due to my setposATL
and terrain hight changing
I should probably us setPos
Higher or lower is all relative. Higher or lower compared to.... what?
@ruby breach well setPosATL is compared to Terrain no ?
ATL is going to be relative to the terrain; unless that's not what you want, in which case using ASL is probably better
above terrain level
could say that it's "compared to terrain" yeah
yeah plus i'm messing up my random position aswell
@tough abyss thanks, that worked nicely with the vectorMultiply
is it possible to make AI shoot dogs? Even when i create them as a unit instead of an agent the ai will ignore them.
I create them like this
(group player) createUnit [_type, position player, [], 0, "FORM"];
I am looking for a solution to make ai recognize them as enemy and not manually program them to shoot them
Maybe
Dog addRating -10000; ```
ahah, give TK point to the dog, does that works just like for civilians ?
iirc that won't do as a dog does not inherit from camanbase
and yeah it did not work
Attach invisible enemy target?
like an AI?
Here, instead of shooting the poor puppy let me just have em. I swear they'll all be friendly in 3 months
Quick question if I want the script to run on every player when one player activates it what would I put? remoteExec VM "Scripts/Scriptname.swf"; ?
and then if (isServer) then { }; in the script?
[[], "Scripts/Scriptname.sqf"] remoteExec ["execVM", -2]; //executes on (all) players only
``` https://community.bistudio.com/wiki/remoteExec
Maybe he has a Super Wicked File
@inner swallow
swf = Ascended SQF (top secret)
Have no idea about the rogue "VM" between remoteExec and the string though. (Virtual Monkey, does the execution)
swf = shock wave file
He is programming flash with action script ๐
๐ฑ
now i gotta cry because i also do that at my job
That was just a typeo haha
special warfare function
@ruby breach so I wouldnt need if isServer in the script?
As long as you pass -2 as the target, no
Fantastic, cheers
0 - Everyone, 2 - Server Only, -2 - Everyone except Server
If I was hosting the server would -2 not run on mine then?
correct
in which case, [0,-2] select {isDedicated}
(i think, my memory is rusty)
[[], "Scripts/Scriptname.sqf"] remoteExec ["execVM", [0,-2] select {isDedicated}]; //executes on (all) players only```
okay, no, because that's running on a player and isDedicated will always be false
I don't remember, but something like that ๐
wtf is that code after the select??
it is uh... stuff
either something very similar works, or this works, i can't remember exactly
yeah okay
i mean you don't need the {}
but that should work
(not in this context but [0,-2] select isDedicated is correct as far as i can tell)
aha, for this you'd want isServer
[-2,0] select isServer @halcyon creek
Ill give it a shot
No, dedicated is also a server you will be executing on dedicated with that expression. Donโt reinvent the wheel, BIKI has all the code you need
Add if isDedicated exitWith {} to the file that will be executed and use 0 for target. Clear and simple, the script will abort on dedicated every time.
If you have headless client you will need to abort on it too unless you consider it a player, which it is by default
@tough abyss that's run player side
At least, that's what I understood from his initial description
Have you tried action with MoveToxxxxxx?
I just do setdammage and hide object lol
@still forum Is there a way to delete a Vehicle (called "Veh") and create a new one (Called "Veh" as well) and still keep a loop with Veh in it running ? Doesn't the Veh var get updated with the new vehicle ?
deleteVehicle
setVehicleVarName
Veh = _newVehicle
Dunno what you mean with "keep a look with Veh in it" doesn't make any sense in my brain
loop sorry
when I SQF deleteVehicle Veh; Veh = "B_Plane_Fighter_01_F" createVehicle _Pos; my loop gives me the error "Veh variable undefined"
My loop is in a side script
do it in unscheduled
sorry I still have problems understanding what is scheduled and unscheduled
unscheduled means the engine will execute it as soon as possible and not stop executing it until it is done. Everything else will wait for your script, basically. Scheduled means it is added to a scheduler and, together with all the other stuff running, given 3ms execution time per frame. Which means you have no clue when your script will be finished exactly, and scripts might not finish in the order you issue them into the scheduler. Use unscheduled for timecritical stuff, basically realtime, and scheduled for everything else.
You can issue massive scripts that take minutes to complete to the scheduler, and the game will largely be unaffected (depending on the situation, what your script accesses, etc) If you try to do that in unscheduled, i think the game will look up until your script is done or more likely the engine will abort your script after time X.
like Spawn is unscheduled and Call is Scheduled ?
it should say on the wiki page.
you might wanna bookmark: https://community.bistudio.com/wiki/Category:Scripting_Commands_Arma_3
I use that everyday
it's just the knowledge behind that scheduled thing
I can't get what is what
and how to identify it
but thanks for trying to explain !
Can someone at least link me a post where I can read something about it
?
thanks
Hey lads me again haha, I'm trying to create a chat.sqf but I'm having some problems. I have grouped up some units along with the player in the same group. Set everyones group identity however, when i try to script in sideChat, it comes up with wrong names. If i try group chat, it just stays on 1. Any help?
@quartz coyote You might also want to look at this: https://community.bistudio.com/wiki/Initialization_Order
So what @still forum wanted to say is : Call your script so it will be unscheduled ?
Right now i've understood f
got it
But i don't understand what this will change in my situation ...
what ever I do it doesn't change anything ...
I tryed calling the loop and calling the deletevehicle, nothing changes, the Veh is undefined after deleteVehicle
๐ค
Your best bet would be to add some check if the vehicle is null or the variable is nil. Something like
if (isNil "Veh") exitWith {};
if (isNull Veh) exitWith {};
//CODE
Hey guys! I read a changelog for a scenario, why would you do this? I thought compile was better.
Tweaked: All spawn compileFinal preprocessFileLineNumbers replaced with execVM.
execVM is shorter, about 45+ characters are gone... ez to write now /s
if you're not trying to hide your stuff, just use cfgFunctions... ๐คท
Hey, has anyone had any trouble with MoveInDriver not working for newly spawned AI units?
player addMPEventHandler ["MPRespawn", {
_veh = "OPTRE_M12G1_LRV" createVehicle position player;
_newGroup = createGroup [east, true];
[Player] joinSilent _newGroup;
_driverDude = "OPTRE_UNSC_Marine_Soldier_AT_Specialist" createUnit [position player, group player];
_nul = [_driverDude,_veh]spawn {
sleep 1;
Player moveInGunner (_this select 1);
sleep 2;
(_this select 0) moveInCargo (_this select 1);
};
}];
trying to make a gauss-Hog deathmatch, where players spawn in a vehicle, with an AI driver, so they can essentially solo the vehicles, but the AI never seems to get moved into the vehicle.
Damn, I got no idea.
Might be something specific to using ace3 and OpTrebuchet mod.
Also using vcom AI
Why don't you just waypoint them to get in? Or am I misunderstanding?
I'd like it to just instantly happen on respawn.
I want the player to respawn in the gunner seat of a vehicle with an AI driver in the driver seat.
nvm I found it.
type createUnit []:
doesn't return a reference to the unit.
wow.
player addMPEventHandler ["MPRespawn", {
_veh = "OPTRE_M12G1_LRV" createVehicle position player;
//_veh = "B_LSV_01_armed_F" createVehicle position player;
_newGroup = createGroup [east, true];
[Player] joinSilent _newGroup;
_driverDude =_newGroup CreateUnit ["OPTRE_UNSC_Marine_Soldier_AT_Specialist" ,position player, [], 0, "FORM"];
_driverDude moveInDriver _veh;
Player moveInGunner _veh;
}];
This works fine lol
is it possible to set textures on the screens on the USS Liberty?
i didnt see anything in the config listed in the hiddenTextures so i was hoping BIS was going about it another way
@meager heart Won't server startup be noticably slower with execvm?
yes it will be slower vs function
Vs call precompile processfilenumbers?
Mission restarts are instantanious right now, the UI loads on the client almost overlapping the ArmA loading screen. Server loads the objects from the database before the player can notice right now.
check this > https://community.bistudio.com/wiki/execVM
My bad - I meant call precompile vs a function
well... CfgFunctions does exactly that ^ in better way and automatically... with extra options...
more info there > https://community.bistudio.com/wiki/Functions_Library_(Arma_3)
So it's cleaner & faster, if I were to redo everything to work as a function...
imo 100% yes, but it's up2u
I'm probably overthinking this.
fnc vs compile preprocessefilelinenumbers
Function1 = Time: 0.000497217, Time: 0.000498389, Time: 0.000497119
Function2 = Time: 0.000497803, Time: 0.000501709, Time: 0.000498877
I'd have to be writing an actual game for this to add up
if you want the "real performance benchmarking" you can ask @still forum how to do it
@unreal siren Tweaked: All spawn compileFinal preprocessFileLineNumbers replaced with execVM.
for on the compileFinal is just idiotic and you'd only do that if you had no idea what the F you were doing.
Second
spawn compile preprocessFileLineNumbers is literally equal to execVM.
But execVM is still retarded for everything that you call more than once. Because you are recompiling the whole script everytime.
@quartz coyote call is not unscheduled. Don't know why the other people are trying to tell you that. It's wrong.
call just keeps the scheduled-ness. call in scheduled stays scheduled. call in unscheduled stays unscheduled. spawn always makes things scheduled.
and isNil {code} always makes things unscheduled.
So do
isNil {
deletevehicle
Veh = createVehicle
};
@kindred lichen you might also want assignAsDriver for AI before you moveIn.
@still forum oh.... Thanks...
@unreal siren fnc vs compile preprocessefilelinenumbers
You are doing something wrong there.
Function = compile preprocessFileLineNumbers "myFile.sqf";
Then profile
call function
vs
call preprocessFileLineNumbers "myFile.sqf"
and see the difference.
@still forum I just can't understand why this will enable VEH to be undated with the new vehicle inside my loop
undated?
you mean updated?
p is quite far from n to be a typo
The problem is that scheduled script will just pause inbetween
so it pauses after you deleted the vehicle and before you create the new one
Also Veh is a stupid variable name and may break at any time
Because it's such a short variable name without a tag
anyone else might also happen to reuse that variable
and then you'll be like "whaa? Why is it suddenly not working anymore I didn't make any errors anywhere"
I see
So SQF isNil
That's going to pass the full code and pause only when it's finished ?
yes
So my Loop containing Veh will never get the update due to pause between deletevehicle and createvehicle and will only get the update when the createvehicle will finish ?
probably it's time for sqf blogs links... ๐
I can't understand shit when I read. I need a conversation
And it also doesn't really explain this
a scheduled script may pause at any time. And it can theoretically pause for up to several hours
So it could be that you call deleteVehicle Veh and after that the script doesn't continue executing for an hour
meanwhile you other script comes along and tries to do stuff with Veh but that was just deleted.
yea I understood that. Thats why : If I understood corretly the perpous of the isNil {}; is that it will pass the code without pausing and will not give time to my other script to see that Veh has been deleted right ?
isNil {} will freeze the entire game until it's code finished executing
no other script can be executed inbetween
Ohhhhhh I see
now it's cristal clear
I'm a slow learner so thanks for your patience man.
How long is too long (in ms) for a function to complete execution in a non-scheduled environment every second?
depends on how much fps you want
especially every second. If you have consistently slightly lower FPS the player doesn't notice it as much as sudden fps drops
I'd say don't go over 5ms. But that's already a drop from 60->45 fps
I was hoping someone could give me a hand with a question I had. I have a mission that requires that players have access to a limited arsenal, but not be given the ability to load any pre-saved loadout they may otherwise have. I found a script that disables the "load loadout" buttons in the vanilla arsenal UI, but players can still use the keyboard shortcut of Ctrl+O to open the loadout screen. Is there any way I could disable the shortcut as well?
[ missionNamespace, "arsenalOpened", {
disableSerialization;
_display = _this select 0;
{
( _display displayCtrl _x ) ctrlSetText "Disabled";
( _display displayCtrl _x ) ctrlSetTextColor [ 1, 0, 0, 0.5 ];
( _display displayCtrl _x ) ctrlRemoveAllEventHandlers "buttonclick";
}forEach [ 44146, 44147 ];
} ] call BIS_fnc_addScriptedEventHandler;
There is the script in question
@still forum Thanks. This is for a script running server-side (potentially where AI will be running if not using a HC), so I'm just wondering how long a func should run before performance impact on AI is noticeable.
5ms sounds like a good shout
Great, thanks!
Is there any way I could disable the shortcut as well?
https://community.bistudio.com/wiki/ctrlEnable
@blazing quiver
/*
Buttons controls ID's
HIDE 44151
RANDOM 44150
SAVE 44146
LOAD 44147
EXPORT 44148
IMPORT 44149
TRY 44346
*/
[
missionNamespace, "arsenalOpened", {
params ["_display"];
_display displayAddEventHandler ["KeyDown", {_this select 3}];
{
(_display displayCtrl _x) ctrlEnable false;
(_display displayCtrl _x) ctrlShow false;
} forEach [44151, 44150, 44146, 44147, 44148, 44149, 44346];
}] call BIS_fnc_addScriptedEventHandler;
```did that ^ long time ago, but afaik still works
hey @still forum ? Is there a reference doc that I can read about the communication tower added by TFR > 1.0, please ? Or is it enough to be close to it in order to increase the radio range ?
what is TFR? And how am I related to it?
Ahhhh
If your radio can reach the tower. The tower will retransmit it
But the transmission loss add's up.
If the tower is 2km away behind a hill and you have 50% transmission loss. The tower will retransmit the signal with 50% loss. And the loss from Tower->Receiver is added on top of that
there is no documentation besides the headers in the functions.
https://github.com/michail-nikolaev/task-force-arma-3-radio/blob/1.0/addons/antennas/functions/fnc_initRadioTower.sqf#L17
Why the tower retransmit with loss? Gameplay reasons? Or is the loss not signal strength, but more like "part of the signal" that never reached in the first place?
Ok great, thank you !
@still forum Gotcha. So I should revert the changes he did back to spawn compileFinal preprocessFileLineNumbers? Or spawn compile preprocessFileLineNumbers?
@errant jasper second one exactly. Distorted signal arrives. Distorted signal gets retransmitted
@unreal siren you shouldn't do anything at all. Re-read what I wrote
for on the compileFinal?
what?
I was trying so hard to comprehend
Gotcha
So it's the compileFinal that was no bueno
The Final is useless.
And if you remove the final then it's just equal to execVM so you might aswell just use execVM
I see. What makes it useless?
HDD vs memory block, I thought it's purpose was to write to memory
probably a doc or page I'm overlooking
It's useless because it just does literally nothing
compileFinal marks the variable as final if you write the script to it
you never write it into a variable though
so.. useless
@rocky mortar Re: the code you posted in #dev_rc_branch, you're going to error during _object = call newobject; because newObject needs arguments to return a value. Beyond that point, I'm pretty sure that _object is just going to be nil
yes. That's the problem
he wants to somehow keep private variables valid in that script even though he leaves it. That's just never going to work
newobject returns a scope wich should still have acces to private variable until the scope is unreferenced
Hey guys. I've come here looking for advice. Currently I have an issue with Zeus. I'll make it short. I'd like to play it competitevly and also with free range for Zeus camera, but ability to spot players is giving an advantage to Zeus. What i'd like to do is to hide player (and all opposing faction units) while they are not in sight of friendly units. hideObject does not work, as it seems completely removes model therefore AI cannot spot them at all. I saw GetTactical achieved results similar to what i want, but its SP only so same technologies may not apply here. I'm looking forward to any suggestions. Cheers!
afaik hideObject has local effect, so maybe you can try remoteExec it on zeus (as target) aka it will be hidden only on zeus client... ๐ค
Yeah, run a script that hideObjects the units you want on the client you want them hidden on
If ai is local (i tested it only hosting, not dedicated) they cannot detect unit. A guy can just stand 5m away and shoot them all and all AI do is run around like headless chicken. It might work on dedicated, but i'm not sure if spanned AI is local to Zeus player or server. Also i would like to make it hosting friendly.
ex. ZEUS hideObjects all players, this will make all players invisible for the zeus
yeah, ai spawned in zeus is local to the player spawning them most likely
you need to get a script to move the units from player client to server or headless client
@rocky mortar What is is that you want _result to return?
He wants it to return "billy"
Pretty sure he wants to use newobject as a constructor for class instantiation.
The following would then be used as a setter ["_set_prenom", "billy"] call _object;
But that's just not going to work.
[_unit] join (group _caller);```
`join` also change the side of _unit? e.g. _unit was a civillian, now change to _caller's side, west ?
try this in debug console >
player spawn {
hint str [side group _this];
sleep 3;
[_this] joinSilent createGroup east;
hint str [side group _this];
};
I am having a issue when someone join my server everyone else there gear disapears off them so the vest,helmet and backpack?
@meager heart thanks.
@dark swallow donโt put your gear code in unit init
@tough abyss thanks
@ruby breach result expected is billy as it was set just before
anyway to get createVehicle to create the vehicle on the deck of the carrier?
possit = getPos loc;
possit set [2,200]; //adjustment to be above the carrier deck
signCircle ="Sign_Circle_F" createVehicle (possit);
hint str(possit);
even with offsetting the z axis, createVehicle is still placing the object on the ground at the bottom of the sea
@rocky mortar newobject returns a scope no it doesn't. You can't "return" a "scope"
What do you mean ?
closures works in some other langage that bring variables of parent scope to child scope
But SQF is not an JS. I doubt they would implement that even if asked.
I guess it would require a lot of internal changes.
closures works in some other langage <- There is your Problem. Sqf != AnyOtherLanguage ๐
@hollow thistle yes perphaps, but it could be so powerfull
Could be. But imagine what bugs would be able to be made by inexperienced scripters.
:D
And SQF was kinda made to be accessible even for random "Jon Doe".
: )
put a variable into a namespace.
I wonder why. Are code blocks stored serialized?
They are compiled to VM instructions and stored along with the string of the code (that you get back when you str)
code blocks are code.. literally.
They don't have a stack. No variables. No nothing
Yeah so no way it would hold reference to private var so it is not unrefernced.
Tl;dr don't ever think about closures ๐
not even know what that is. I could give you script commands to get/set variables to current scope or any higher scope. That would do that too.
But why? Just use a frickin namespace instead of shitty dumb workarounds that will never work.
Idk, don't ask me.
The guy just wanted to use practices from JS.
But SQF is SQF.
Or php
give me C++ anyday
Intercept ยฏ_(ใ)_/ยฏ
lol
Intercept-Python ยฏ_(ใ)_/ยฏ
i dont understand how private variable go along code across the different scope
it's just a guess, I think the variables are deferenced when the brackets close.
dedmen said above why it wont work.
The scope is stored on a stack of scopes. If you leave the scope. It's removed from the stack. Because why keep something in memory that can't ever be accessed again and has absolutely no use?
And when the scope is removed from the stack. It's deleted.
true.
yes that's what i understand, but "has absolutely no use" according the closure the example, there is a usage ๐
Wich one?
can you give more details?
I just don't understand why you would want to take the hard and impossible way. Instead of just using a namespace or an array
The closure here is used to create some kind of OOP code, go with namespaces for that in SQF and you will be fine.
namespace are public
if i use namespace the variable will be share with all the whole code
use multiple namespaces then?
in fact it s not really a problem of workaround
cause i have already some public workaround
it was to raise a request for evolution that could bring a lot of things
Like?
Sry, but for me it sounds just like "Opening the possibility to break more things"
No matter how often you ask it's not gonna happen ^^. It's a major change in the scripting system that no one besides you ever asked for
closure are a master piece dscha, you should look for documentation on this
I am not asking to "look for Demonstration", i was asking for an example from you.
ยฏ_(ใ)_/ยฏ
Clearly the best option is to write your own language inside SQF and provide your own features.
https://github.com/DavisBrown723/SQF_plusplus_Transpiler
Don't look at the code btw
prototype btw
Like: What would be the benefit in it
Data encapsulation.
IMO in sqf they would be kind of "nice to have" but not necessary to have as we have other ways of doing same/similar things.
And the benefit of it would be? (asking again)
well you can have it... i thought it's clear ๐
private _thing = createVehicle ["Sign_Circle_F", player modelToWorld [0,0,30], [], 0, "CAN_COLLIDE"];
```into the console ^ and look up @dry egret
in order to make AI shoot the player dog I had to resort to this
https://i.imgur.com/BEAeNZd.jpg
Luckily you can make the thing fully invisible with setObjectTextureGlobaltoo bad the shadow will stay
at leat the dog has now an "inventory"
Angel dog
now i need to make it fly
just flip the attachTo around ๐
that dog shadow there... ๐
yea... one of the many downsides playing as a dog, i had to reverse engineer ace throwing and dragging a bit
๐
but hey, you can get into vehicles now, drag downed people, pick up that grenade and run into the enemy
Advanced K9++ ๐
you can always look at the now messy code i made. Right now focus is jsut to make stuff work, kind of
https://github.com/diwako/playabledog
requirements are cba and ace, tho i accidentally launched with acre, so woops
you can remove init.sqf with enableSaving [false,false]; and just add in description.ext > saving = 0;
good to know.
yeah, afaik it does exactly the same
Is there a good tutorial around classes for a slow witted person?
No more like classes people define in missions
glances at Dedmen
I am afraid you do not define classes in mission really. What exactly do you mean?
SQF is not an objective based language sadly
class CfgCompositions {
class test {
#include "test.sqe"
};
That structure is from Larrow's eden comp spawn script for example
What the hell is that even? It's not in https://community.bistudio.com/wiki/Category:Scripting_Commands_Arma_3 and it isn't in https://community.bistudio.com/wiki/PreProcessor_Commands either. I demand my money back.
that's just a custom class defined in description.ext.
It doesn't do anything on it's own. But it can be read from script.
"uses the same syntax as the config.hpp file"
is there more documentation on that?
my wiki fu is weak today
Well thanks so far ๐ค
https://community.bistudio.com/wiki/Class_Inheritance has about 2 sentences of basic information.
Not defining the load order will guarantee you to end up in a world of pain and horror.
Been there done that โ
@waxen tide that is exactly #arma3_config ๐
Really? Good thing you mention it, i had not noticed.
#define DEBUG_DEV getNumber( missionConfigFile >> "LARs_spawnComp_debug" ) isEqualTo 2 Oh there is a missionConfigFile? splendid
that's description.ext
next to mission.sqm
the normal configFile is config.cpp inside mods pbo's
the entirety of it?
@still forum Thanks for helping me with the compile methods! It clicked. The new code is much more readable.
shouldn't the missionconfig show up in the config viewer?
So, I've been trying to figure out how to kill the lights on a map that I'm working on a scenario for. I've managed to kill most of the lights but for some reason these once keep staying on. I've tried to find the class name for them by outputting the objects located near me but still no success. Is there anyone out there able to help me out? https://imgur.com/a/zB8gN18
This is what I got so far, the map is set on Chernarus 2035 which uses CUP objects sadly, and no it's not a zombie mission...
{
for "_i" from 0 to count getAllHitPointsDamage _x - 1 do
{
_x setHitIndex [_i, 0.97];
};
}
forEach nearestObjects
[
player,
["Lamps_Base_F", "PowerLines_base_F", "Land_PowerPoleWooden_F", "Land_LampHarbour_F", "Land_LampShabby_F", "Land_PowerPoleWooden_L_F", "Land_PowerPoleWooden_small_F", "Land_LampDecor_F", "Land_LampHalogen_F", "Land_LampSolar_F", "Land_LampStreet_small_F", "Land_LampStreet_F", "Land_LampAirport_F", "Land_PowerPoleWooden_L_F"],
600
];
That light that's staying on on your screenshot doesn't even have a pole or a bulb :u
I'd say bug report to CUP's feedback tracker with that. If the light is really there floating in the air like that
That's the thing it does it on several buildings, when I kill all of the lights in the area it becomes brighter even :S but yea I'll report it to them as well
In order to run something in "preinit" do I just make a preinit.sqf file?
or is it somewhere else like description or something?
So if I define a function in cfgFunctions it gets ran?
it compiles on mission start i believe
If you mark it as preInit, yes
I'm trying to remove all the rocks and bolders from a map, and hideObjectGlobal is suggested to be run in preinit.
@inland badger I think you iterate through wrong array
getAllHitPointsDamage will always return array of 3 arrays
Not sure if it will help with your issue though
{_x setHitIndex [_forEachIndex, 0.97]} forEach (getAllHitPointsDamage _x select 0)
@meager granite cheers mate, I'll give it a try and see if it works ๐
_hostage setCaptive false;
[_hostage] joinSilent (group _caller);
In Host Server mode, _hostage joins our group and become WEST faction from CIV, but Dedicated Server mode, the _hostage do not join our group and still CIV faction. any tips to solve?
setCaptive is AL
[_hostage,false] remoteExec ["setCaptive",_hostage];
[_hostage] joinSilent (group _caller);
Explanation, setCaptive has to run on the machine the unit is local to. joinSilent is actually global and it should work on any machine. Make sure that _calleris defined
it is possible find out which commands need to be called locally when using the wiki, here the setCaptive command https://community.bistudio.com/wiki/setCaptive
I will give a try, thanks guys.
Quick Question: Variable aren't case-sensitive, right?
Example: Capwell and capwell will be the same variable?
yes
yEs
trying to get a vehicle to have a set distance between eachother in a convoy, on the commnuity wiki it states theres a command for it (https://community.bistudio.com/wiki/setConvoySeparation) and the given example is this vehicle setConvoySeparation 20; however when I put this in a vehicles init field it returns and error stating that there is a genreic error in the expression and it is missing ;
any ideas?
Are you actually defining vehicle?
Nope, so say if the variable name is mast1 it would be mast1 setConvoySeperation 20;
use thisinstead of vehicle
vehicle is a command to get the current occupied vehicle of a unit, you are putting this into the init field, so you can simply use "this"
If in script, yes (assuming mast1 is a variable for an object). In an init field, you would use this
Thanks for the help, im going to use the fact its 6.50am here to put such a simple and obvious oversight on my part as the excuse ๐
@still forum following my previous question about TFAR antennas, if I understand the headers correctly, in order to create a new tower by script I should
1 - create the object
2 - call TFAR_antennas_fnc_initRadioTower on it
3 - call TFAR_antennas_fnc_pluginAddRadioTower ??
According to the code initRadioTower seems to use a CBA delay function to call pluginAddRadioTower, so maybe the third step is useless ?
plugin stuff is called by initRadioTower. You shouldn't touch that
Good, thanks
If you want to move the tower. You have to call initRadioTower again for each position update
Is the old position still considered as a valid tower ?
yes
wait
not after you call init again
so if you move the tower but don't call init. Everyone will think the tower is still at it's old place
I see, it is linked to the object, it will know that a tower is already created with the given object and will update the former position instead of creating a new one. Good to know
@still forum again asking questions about TFAR ^^ what if a tower retransmit a player's signal, and another tower is reached ? Is the signal broadcasted adding its own deterioration ?
like : player1 ==> towerA ==> towerB ==> player2 with each players and towers only in range with their direct neighbors ?
Good to know. So if I want to ensure a good radio connection between a base and a remote location, I have to make sure that the base tower is able to reach the remote location, and the other tower is able to reach the base.
Alternatively, a single one tower is enough if placed half distant of the base and target location, and if personnal-carried radios are powerful enough to reach the tower.
Okay thanks. Lots of side missions ideas there !
there is also a global radio range modifier. Can be used to reduce the range of every radio (Like turning the 152 from a 5km into a 2.5km radio) to make radio towers be more worth it
Playing on Altis, the map is wide enough to make the towers worthy, even without reducing the range of radios : indeed, a 5km remote location is still reachable but with a horrible signal loss. Adding radio towers in secured locations (on a persistent mission) will allow to enhance the global communication network for future battles and objectives in the area. However, I will check this modifier, maybe we can tweak it to force the deployment of relays in some very remote and isolated places. More gameplay possibilities !
Btw there is also TFAR discord in #channel_invites_list
ohhhh great ^^ further questions will be in a better place there
Might be a bit off topic and have nothing to with arma 3
Greetings, (using google sheets) I'm attempting to have information show up in the red info box depending on what sector I have highlighted.
I have made a flowchart as to how I see that working. From what I understand I may need to have a script written for this, however if it is at all possible to achieve this using the available functions, that'd make my life a lot easier. Any help would be appreciated. Thank you.
https://cdn.discordapp.com/attachments/476107547221164042/477113735031291934/unknown.png
the flowchart as mentioned above(edited)
https://cdn.discordapp.com/attachments/138772603694350336/477116625225646083/unknown.png
You would probably have to use another technique since you cannot capture simply clicking on a cell (see https://productforums.google.com/forum/#!msg/docs/JBhprb-b6x0/5FSuFQjHEQAJ ).
Once you find a mechanism to detect "cell" selection, you can use JavaScript to get the cell coordinate and read / write the proper cells.
Also second image looks like a game of Battleship: "You sank my Starship!". Also yeah, this is definitely be off topic.
I wonder if there is a way to use ACE arsenal to define what items a crate contains, and then make this content accessible only with the vanilla inventory system ?
Lol don't mind my comment ๐
:/ I did mind it
@vernal mural isn't used that way. You could use the export function on BI arsenal. And input it into a box's init
Mh, good idea. Will check
I make an AI man sit with switchMove. Is it possible to make him automatically stop the animation and engage enemy when his behavior automatically switches to COMBAT without waitUntil {(behaviour _this) == "COMBAT"; }; and without polling his behavior in a loop?
I am actually thinking, maybe to make AIs sit on benches it would be better just to make bench-vehicles through an addon?
Hey buddies,
Anyone know what the aspect ratio is that's used for all weapon pictures extracted from their configs? For example; ```sqf
_picPath = getText (configFile >> "CfgWeapons" >> _classname >> "picture");
Or are they all different?
Thanks mate, will try that.
Hello, Is this possible ?
if ({_x distance Object < 50} forEach playableUnits) exitWith {}; ```
I want to detect when no playableUnits are at 50m from an object
no that's.. yes it's possible.. but what you are doing doesn't make sense
forEach returns only the result of the last value
so you are checking here if the last unit inside playableUnits is less than 50m away
ah
playableUnits findIf {_x distance Object < 50}
Use this to find the first unit inside playableUnits that's closer than 50m
if you don't find any. That means there is no unit
if (playableUnits findIf {_x distance Object < 50} != -1) exitWith {};
genius ....
thanks
other question, if at the end of a script, I decide to execute the same script, will the 1st script end while the second is booting of will the 1st stay active because init command was in it
?
and spawn ?
because the call waits till the script is done executing
whereas spawn continues right away
so if I spawn Script2 then Script1 will close without any trouble
but it I Call Script2 then Script1 will stay open ?
ye
okay thanks
{
if (side _x == "EAST") then {
_x addEventHandler ["Killed",
{
switch (_x isKindOf) do
{
case "Tanks":
{
//Code incl. other params for isKindOf and default
};
};
}];
};
} foreach allunits;
How do switch isKindOf ?
You.. don't
I don't want a bunch of Ifs
Like... Well. I guess... Maybe
switch true do
{
case (_x isKindOf "Tanks"):
{
//Code incl. other params for isKindOf and default
};
};
Like so maybe?
I'll give it a try, hopefully :3
Anyone free still? I need some help on this: https://pastebin.com/3mTjSmwe
Bascially, when a unit is killed, detect what kind of unit, add points to an array, display points.
๐ค
maybe you can try >
private _rewards = []; //--- array with rewards
private _types = []; //--- array with types
private _index = _types find (typeOf _unit);
CUR_Points_Available_Array = CUR_Points_Available_Array + (_rewards select _index);
```something like this ^
(isKindOf "Tank") != (typeOf == "Tank")
won't work. Unless you specify every type for every vehicle of type tank and so on
yeah, list with classnames will be huge... ๐
Heya, I had an Idea to place for example a door down and to make it so only few ppl can access it, open/close it. Is there a way of doing that? Any help would be apprechated. Maybe where to start or so c:
opening/closing doors is just done via scripts
so yes. you can do that
If you made the door yourself you already know how adding the open/close action works. But I guess you didn't?
Did not mean like a normal door, ment like backalley fence or something. I am not into scripting. x)
@hollow lake Depends, what kind of door and who can use it. Once you know those things, you should be able to. If you made the door, add it to the config, if not; try script wise.
Can you create a camera view (in any way) so that the player watching the camera feed hears also the direct channel VOIP at the camera's position?
simple way of doing that might be to just hide the player, disable him and tp him. switchCamera might work but idk if the camera also picks up audio. Could also use selectPlayer to temporarily move player to a camera object?
Wait
Are _vars automatically private now?
Or at least, private to the file and not the scope?
Wait, nevermind. I read that wrong.
File was using the new private _myvar thing
Eh? New?
As in, past two years new... lol
private _varis just to tell that it is a whole new variable, youc an go into another scope with call and stil have access of the private vars outside teh call
private _var = 1;
[] call {
hint str _var; // 1
private _var = 2;
hint str _var; // 2
};
at least how i understood it, tho i write my functions without call for reference to never run into some kind of reference issues
Anyone knows how to remove a magazine by its ID? https://community.bistudio.com/wiki/magazinesDetail
Can't
I submitted a ticket suggesting that a while ago: https://feedback.bistudio.com/T124736
(among other things)
it never got any attention, and probably never will, but at least I tried
Is there a good way to find this error? Bad conversion: bool
About 30 lines of it.
Namespace error IIRC
21:17:48 Global namespace not passed during: true
21:17:48 Error in expression <true>
21:17:48 Error position: <true>
21:17:48 Error Local variable in global space
21:17:48 Global namespace not passed during: false
21:17:48 Error in expression <false>
21:17:48 Error position: <false>
21:17:48 Error Local variable in global space```
I have literally no idea how to find this. lol
undo the last thing you did, ideally.
That's probably a fuff up in the profileNamespace
you won't have much luck searching for it
without a engine debugger
Oh
It's addon related
meta.cpp/mod.cpp whatever
hidePicture and hideName don't take booleans
1/4th my mods use "true" or "false" when it should be 1 or 0
what are meta.cpp and mod.cpp actually good for? i mean in what context are they fully utilized?
mod.cpp ingame icon. Main menu/arsenal/editor
meta.cpp is just metadata for workshop items. So the game knows from where it comes
someone should write a wiki article on those files.
someone should add important missing information to that article.
which?
when a client queries the server over steam, only the "name" from mod.cpp and "publishedid" from meta.cpp is transmitted. nothing else.
doesn't really fit into there. That's not mod.cpp's fault
publishedid is used by the launcher to recommend the mod if missing, name can be altered to whatever. if name is missing, folder name (of server) is used as modname.
shrugs
i was pondering about putting it on mods section of dedicated server setup page, but the google captcha on the wiki defeated me. thrice.
bots are now better at captchas than i am, apparently.
kinda weird people write so much rubbish into their mod cpps btw. some mods have publishedid = 0
and now they mess up and put bool in there?
It's also a problem in the mod.cpp as well
Asked in another channel, figured it would be more appropriate here. I'm looking to limit the range of the automated turrets such as the Praetorian and the Centurian. Is there a way to alter their range to something like 2km? Currently, the Centurian can lock on and fire from 16km away. Didnt want people getting missiled at their base.
Can CutRsc accept a filepath?
afaik only classes defined in RscTitles config
if you want show some pictures on screen you can use ctrlCreate
that will be like 2 lines of code...
Yeah, I kept messing up while defining my RscTitles lol
Why am I even looking at here if I donโt know a shit about scripting
Is there a way to find out where the positionCameraToWorld is for every player? I need to check if some camera (mostly for zeus) is near a location.
basically i want to activate trigger (enable simulation) if a camera is near it, that already works. I just need a server side solution to let that trigger stay enabled globally for everyone if at least one camera is close.
Is there any way to have a player control both the driving and gunning of a tank at once? since WASD shift ect is not usually used for the gunner position.
put an ai in the driver seat, since tanks dlc that is a thing already out of the box
So he will follow your exact orders ?
Thanks! i clearly have played to little latley.
{player setDir 145.776} remoteExec ["bis_fnc_call", 0];
This works unreliable, i get it to work once on a script file but then it does not work on a client, that script is called by the server
[[],{player setDir 145.776}] remoteExec ["call", 0];
That will fix it and make it work 100%? any back ground on why that was happen?
Yes, it should work, your syntax was wrong from what i think.
@still forum This doesn't work ...
if (playableUnits findIf {_x distance (getMarkerPos "FlagTraining") < 50} != -1) exitWith {};```
@digital jacinth put a trigger in editor and add positionCameraToWorld in the condition, on each client it will be local to client
yeah thatis not what i want. I want the trigger to globally active for everyone even if one positioncameratoworld is near
it is about simulation enabling the triggers so the checks are only active if someone is near
You have to make it monitor global var and public var it, the statements are also local means every local instance of the trigger has to fire at once
@quartz coyote what does doesn't work mean?
It seems to exit with even though I'm inside rang
Oh hold on
I'm an idiot
It should be a > instead <
noo... actually not...
I thought you wanted it to exit if there are units within 50m
if you swap that it will exit if any unit is not within 50m
That's what I want. I want it to exit is no playable unit is within
yes.. That's what that does
find the first unit that's within 50m
if no unit is found. exit
Hi everyone, Im trying to create a simple script that "switches" an action to either turn some portable lights on or off but its not working as intended. The action keeps stuck on the initial one instead of processing the else line, despite the variable having changed.
https://pastebin.com/VKc57Few
local variables don't carry over into different scripts
the code of your addAction is a different script
it cannot see your _lightsOn Variable
So i should remove the underscore to make it a global one?
or should it be a public one?
global, remove the underscore
and could you explain how the hint function in the addAction code does seem to pick up on the correct value?
public is for sharing between clients (or client-server)
ah thanks for sorting that out for me SuicideKing ๐
and could you explain how the hint function in the addAction code does seem to pick up on the correct value?
just look at your code?
it's in the same script file i.e. the variable is local to that script
_lightsOn = "0";
hint format ["_lightsOn off %1!", _lightsOn];
I don't understand why you even have to ask why _lightsOn is "0" at that point
you set the variable to "0" so of course it's value will be "0"
yeah I needed that slap in the face ๐
you have _lightsOn = "1"; within the addAction too
exactly
working now, not quite as intended yet but ey
now to figure out how what to add in the addAction to make it end the while loop and refresh the action
hmm it doesnt remove after sleeping either :/
Why don't you just use addAction condition field?
Ive been trying for days to get this language figured out but its pretty complicated imho
you mean something like putting an addaction in the condition field of a trigger?
https://community.bistudio.com/wiki/Arma_3:_Event_Handlers/addMissionEventHandler#EntityKilled
Does entitykilled run on the frame after the entity dies?
ah so i would end up with one single action "lights on/off" instead of two actions
ie. if a car explodes when does entity killed run, before or after the explosion?
id like to show the specific action ๐
@still forum what the name ๐
maybe something in that direction >
private _id = command_monitor addAction ["text off", {
params ["_target", "_caller", "_id", "_args"];
if (missionNamespace getVariable ["var_ligts", true]) then {
{_x setDamage 0.9} forEach [gate_light_l, gate_light_r];
_target setUserActionText [_id, "text on"];
missionNamespace setVariable ["var_ligts", false];
} else {
{_x setDamage 0} forEach [gate_light_l, gate_light_r];
_target setUserActionText [_id, "text off"];
missionNamespace setVariable ["var_ligts", true];
};
}, [], -1, false, true, "", "local _target"];
๐
^
condition maybe wrong there... with local
Has anyone ejected units out a vehicle when it get destroyed?
I have an issue when a destroyed vehicle will make dead bodies dissappear
thanks sldt1ck ill try to figure that out
would have never figured that out myself xD
thanks alot
setting the variable on _target would allow you to have multiple actions
addMissionEventHandler ['EntityKilled',{
params [['_killed',objNull]];
if (isNull _killed) exitWith {};
if (_killed isKindOf 'Man') exitWith {};
{
[_x,(getPosASL _x)] remoteExec ['setPosASL',_x];
false
} count (crew _killed);
}];
I want to eject units out of destroyed vehicles so the bodies don't dissapear
Anyone done this and know if this mite have issues?
My only concern is that it might not fire fast enough and still cause bodies to become invisible ( I think this is a feature in the vanilla game )
Solved
are simpleObjects similar to fixed map objects in terms of network and overall performance? i'm wondering since i spawn them dynamically but for some (bigger ones) it would make more sense to leave them instead of despawning them, when out of range. bad idea? ofc i'd make sure to only spawn stuff once in each area
are simpleObjects similar to fixed map objects in terms of network and overall performance?
maybe not exactly the same, but similar, yes, afaik
cool graphs. what's super simple?
simple objects created from shape not config name.
You cant for eg. change their texture etc.
aha, thanks
//fn_rescueHostage.sqf:
.......skip...........
_pow setCaptive true;
_pow setVariable ["notrescued", true, true];
.......skip...........
[
_pow, "Rescue Hostage",
"\a3\ui_f\data\IGUI\Cfg\holdactions\holdAction_connect_ca.paa",
"\a3\ui_f\data\IGUI\Cfg\holdactions\holdAction_connect_ca.paa",
"(_target getVariable 'notrescued') AND {(_this distance _target) < 5 && alive _target} ",
"true",
{}, {},
{call MY_fnc_hostageJoin;}, // Code executed on completion
{}, [_anim], 10, 6, true, false
] remoteExec ["BIS_fnc_holdActionAdd" ,0, _pow];
.......skip(taskcreate & trigger)...........
//fn_hostageJoin.sqf:
params ["_host","_caller","_id"];
[_host] joinsilent (group _caller);
_host setCaptive false;
_host setVariable ["notrescued", false, true];
_host domove (position _caller);
removeAllActions _host;
.......skip...........
```I'm getting in trouble about hostage joining on Dedi-server. The hostage joins the squad only when Squad leader run the <Rescue Hostage> action. he does not join when squad member do the <Rescue Hostage> action(actually join the squad for 1 sec and gone). And he also join the squad when I'm the only member of the squad and do the action. Any clues?
well i assume for some reason the group leader (i'm assuming is AI) removes the hostage after it joins the group
when it's just you then you are the leader
It's MP Environment. and group leader is not AI.
you can try it this way ```sqf
{call MY_fnc_hostageJoin;}, // Code executed on completion
```sqf
{
params ["_target", "_caller", "_actionId"];
[_target, _caller] remoteExec ["MY_fnc_hostageJoin", 2];
_target removeAction _actionId;
},
and the function will be >```sqf
params ["_target", "_caller"];
[_target] joinsilent (group _caller);
_target setCaptive false;
_target setVariable ["notrescued", false, true];
_target domove (position _caller);
@quasi rover
thx, I'll give it a try, I need other player to test.
When pressing Ctrl+O in the GUI editor (trying to import an existing UI I made to make changes) the screen just flashes a loading screen for a split second and nothing happens. Am I missing something?
Nevermind, got it to work; apparently have to hold down the Ctrl+I for like 10 seconds for it to work.
So I guess there's engine level commands for Bis_fnc_selectRandom, what's a good way to visualize/test https://community.bistudio.com/wiki/selectRandomWeighted ?
that is engine solution for BIS_fnc_selectRandomWeighted not for BIS_fnc_selectRandom and there is comment with "tests" ๐
I was being lazy and stuffing my arrays with duplicates, lol
that is engine solution for BIS_fnc_selectRandom > https://community.bistudio.com/wiki/selectRandom
I wasn't very clear, my bad. I ,know about selectRandom, selectRandomWeighted is more what I need.
stuffing my arrays with duplicates
maybe this will help > https://community.bistudio.com/wiki/arrayIntersect
(Example 2 from there ^, maybe ๐)
(even if you planned to have duplicates lol)
Yeah, awsome to know!
๐ค
I've just had an idea... making an SQF interpreter and interfacing it with Intercept to spawn my script in a pure separate thread ๐ค did anyone ever have this idea?
Pretty sure there are better and more exciting ways of crashing Arma
Why? Another sqf interpreter runs its code. When there is something like unit setPos it interfaces the engine through Intercept.
No. The interpreter is not the problem
what happens if the unit suddenly changes position while the graphics renderer tries to render it on your screen?
What happens if you suddenly stop a sound. While the sound engine is trying to play it?
Yes I get it. But I thought that intercept solves this problem, or not?
I didn't work with intercept but I assume there is a way to wait until the engine has halted for this frame if I execute something like setPos through intecept
Yes...
Wait for a onEachFrame handler and execute it in unscheduled while the rest of the engine is halted
IDK maybe @queen cargo will like this idea, I've seen he is working on an SQF VM. Maybe what I'm suggesting could work with some limitations, like not changing states of ingame objects. Still could be useful for creating worker threads for calculating numbers.
No it doesn't.
On Linux you can execute some few script commands in parallel.
But you can't on windows
Theoretically it should be possible.. Though... Not with arma itself
I could make sqf-vm with actual threads
But that is because I barely have anything to actually create Race conditions
Besides global variable access
No parallel things on Windows? I mean, CreateThread and launch an instance of a VM inside it for every spawned script. Global variables and functions are going to be a problem indeed.
๐คฆ
It's not like I didn't try.
The pool allocators for gameData types are not threadsafe
Was talking about my very own sqf-vm @still forum
It works on linux because the pool allocators don't exist there
I know what you are talking about. I'm still talking about Arma
๐
Though... When you are already using intercept... Then there barely is a reason to use sqf anyways ๐คทโโ๏ธ
Then one would be able to avoid messing with C++ and compiling it. One would just write standard SQF code and let it consume as much CPU as it needs.
You could implement SQF VM inside intercept and remove all the script commands with side effects.
๐ค
that actually is a quite funny idea
and it would be already possible without much to do
If you have something that is heavy on calculation and you run it on a seperate thread then you could at least capture from intercept all you need then run your calculation on a separate thread and then rejoin to the primary one to apply to the game engine to apply your effects. But you can't be calling even gets in parallel.
we would need a async call that returns something like a std::future.. inside SQF
Which I already wanted to make for things like database interaction or TFAR
Yes that would be a reasonable abstraction as would be channels or async. But I think the end result would still end up pretty limited since a lot of decisions often need game data part way through the algorithm. The only use case I can really think of is something with substantial AI calculation, where you could arguably export world information (terrain and objects) and then just pass enemy location information and get macro orders back.
The amount of cases which have large calculation and small data input isn't all that big from a game perspective.
I thought, getting game world data is even less a problem than setting it
you cannot execute any SQF commands that take arguments or return values in parallel
don't you already have your own commands and datatypes?
and when that is done: you actually do can run sqf in parallel
though ... it is a different vm entirely
but ... well ..
for the intercept plugin i mean
new commands would be pretty much:
createVMdestroyVM <VM><VM> execute <STRING>
with the new datatype beingVMcontaining the whole sqf-vm vm
sqfception
and you need a way to get data back out
because waiting for the VM to execute in a different thread wouldn't be that helpful
SchedulerV2
ye ... forgot that one @still forum ๐
If Intercept can call SQF functions then the VM can return data back
If the intention is to block whenever ever you want to run SQF commands specifically, what's the point? You're still relying mostly on a single thread
And compiling and executing the code in a second thread and piping the results back will probably take more time and effort than just executing that script right there in the main thread when you need it
Sounds more logical if you want to do something not relying on the engine, like database interaction, like Dedmen said. But if your plan is to block continuously?
no the SQF vm would execute asynchronously
But it'll just have commands that don't interact with the world
so.. math stuff. Basically
Yeah the calling script would have to wait. Then spawn a script in the external VM to, for instance, plan a route or calculate something. When calculation is done the VM would send the data back through intercept then into some queue in the game's SQF VM. The difference is that the external VM will not be bound to 3ms run time per frame, nor it will share resources with the ingame VM.
Indeed the only application I see for it is, probably, AI mods which would always be hungry for more CPU
Give me a example of some math calculation which doesn't require ANY data from the game world that runs for over 3ms
AI would probably need information from the world wouldn't it?
No ofc we need data from the game world. If as you say we can't execute any SQF commands in parallel, including ones that only take game world data, we in a trouble. We would have to serialize requests by external VM through Intercept, which would have to sync to the game engine. ๐ค We would have to cache retrieved data to yield more performance ๐ค
I think you need to ask the question whether it's actually needed. Unless you have some massive algorithm planned, chances are it's going to run quicker synchronously unless you've already pooled threads
No I don't have anything in mind yet. It's just a quick idea I've had: if X39 VM is ready enough, could it be interfaced to game through an Intercept layer, to let others spawn scripts to achieve more performance for their algorithm. From what I see it's still quite hard.
pff ... at least the idea of using sqf-vm with intercept would be no problem
only thing: there is no interaction unless it is explicitly done
and the sqf-vm project is already ready for that kind of tasks
hell ... you all can try it whenever you want ๐คท
the current release version may not be on-pair with what is currently available
to achieve more performance
Whilst adding another layer of abstraction on top of another
but there is a discord bot and i lovely share binaries at any time
well ... theoretically, it would allow to utilize more cores ... but i also doubt that there is much use ๐คท
maybe some caching stuff ... could get useful ... but ... ye ...
in the end it probably will still be smarter to just write the intercept plugin to do that task for you
Yeah making an intercept plugin is better. But I would have to compile the C code for linux as well. Then test it there. I'm sure not everyone can do that. Also it looks like not many addons use intercept currently. Is there a list of addons based on Intercept?
script profiler, script debugger,
That's about all of the public ones ๐
is ther a way to disable input for some keys?
I would love to see a tutorial video about Intercept. The Dokumentation is kinda hard ro read and understand
I don't think I've ever seen a tutorial video about a c++ library ๐ค
in regards of sqf-vm
most up-to-date snapshot is available at https://x39.io/projects?project=SQF-VM
How would I go about accessing my mission parameters ingame?
At the very least, returning them.
IE GRLIB_csat_aggressivity or whatever
par ?
The parameters, or variable behind it
they are stored in global variable BIS_fnc_storeParamsValues_data... probably you can, but that will be more hax than scripts ๐
ah
is there a way to see if the user is interacting with a display with exception of display 46
depends on what you mean by 'interacting with'
Basically when you can see the mouse
And you arenโt moving your character around by moving it
So selectRandomWeighted, if an item is set to 0.8, it's 20% less likely to be selected than normal? What about 1.5?
What are the best conventions for this? going over 1x or under?
@tough abyss you want to know if a user opened a dialog ?
ye
well, you can create a loop that check if a dialog is opened, use dialog
Try setFormDir https://community.bistudio.com/wiki/setFormDir
Together with setDir
and this too))
Is there an animation for putting an helmet on ?
I don't think I've ever seen someone use /. so I'd guess no
sqflint&vscode != arma
i know
might very well be that it handles it differently
just checking if it could work
it depends on the sort of path i believe
in some cases it does support it
it others it doesn't
same thing with leading slashes
best is using \ which is always safe
so conclusin better dont use it and keep \
yep
thx
One question around Init EVH: when does it trigger? Does SQM placed vehicles trigger that? etc. Thanks.
anyone know how to overwrite initWorld and demoWorld in CfgWorlds?
Is there a way to call the arsenal in a way that pulls from the box it's called on?
(And reduces the count of the objects in the box as used)
if you use the ace arsenal, the first part is trivially easy. generate an array of stuff in the box and hand it to the ace arsenal as whitelist. Reducing the amount of stuff in the box and limiting the player(s) to that i recon would require a lot of custom scripting. You can look at Hearts&Minds/Antistasi mission, i think both? (at least one of them) has an arsenal that is limited in amount, players basically fill it with enemy looted gear to extend the stuff they have. But it is a bit buggy (if a player takes out an object, it will disappear entirely all other players have to re-open arsenal for it to re-calculate the available amount)
Totally understand
For somebody who understands how UIs are updated and whatnot, forcing an update would be trivial I think, but probably not worth my time right now to figure out... lol
And that case is exactly what I was trying to avoid
I need a little help if someone has a moment. I have coding experience, but 0 experience with Arma Scripting. I decided recently to play around with it a little.
Here's what im trying to do. I am trying to make a round trigger area that when its activated by a player, spawns a stalker anomaly from a mod, somewhere within it. Ive managed to figure out how to spawn the anomaly directly where the trigger is, but Im struggling to figure out what to add next to make the location semi random.
This is what i have so far.
the parameters of the createFog are [Pos, Size, booleanIsSquare]
https://community.bistudio.com/wiki/Category:Scripting_Commands_Arma_3 <-- you wanna bookmark that
https://community.bistudio.com/wiki/Category:Arma_3:_Functions <-- you wanna bookmark that
https://community.bistudio.com/wiki/BIS_fnc_randomPos
@waxen tide Thank you I will.
I think i actually found something to un elegantly smash into place while I learn by imitation and documentation.
Do you think you could look at something for me and just let me know if this is not the right way to call a variable?
_nul = [thistrigger, 10, true] call anomaly_fnc_createFog;
Works perfectly to spawn my Fog cloud right in the middle of the trigger.
_loopCount = 0;
while {_random_pos_in_trigger isEqualTo [] && _loopCount < 100} do {
_random_pos_in_trigger = trigger_spawn call BIS_fnc_randomPosTrigger;
_random_pos_in_trigger = _random_pos_in_trigger findEmptyPosition [0, 0, "vehicleType"];
_loopCount = _loopCount +1; //Prevents infinite executions with severe hit on performance if no position can be found
};
_nul = [_random_pos_in_trigger, 10, true] call anomaly_fnc_createFog;```
Doesn't seem to spawn anything. Am I calling ``_random_pos_in_trigger`` wrong?
Did you enable script errors?
-showScriptErrors Enables on-screen script error reporting (ARMA 2 v1.03.58627)
Very handy for basic script debugging.
You should also check C:\Users\Zombie\AppData\Local\Arma 3 for an .rpt logfile, it will also contain script errors
To debug the code you posted, my first step would be to see what's inside the variables step by step, and verify they contain what you think they contain. So i would do like:
_random_pos_in_trigger = [];
_loopCount = 0;
while {_random_pos_in_trigger isEqualTo [] && _loopCount < 100} do {
_random_pos_in_trigger = trigger_spawn call BIS_fnc_randomPosTrigger;
diag_log format ["%1", _random_pos_in_trigger];
_random_pos_in_trigger = _random_pos_in_trigger findEmptyPosition [0, 0, "vehicleType"];
_loopCount = _loopCount +1; //Prevents infinite executions with severe hit on performance if no position can be found
};
_nul = [_random_pos_in_trigger, 10, true] call anomaly_fnc_createFog;
diag_log writes to rpt logfile, systemchat shows up ingame in chat.
if you get no output at all, then your while condition actually never equals true, and thus your while loop is never even executed once. If you get one output, then your while condition is true at first, but then turned to false during the first loop.
Ehh thats nothing. X39 has written some external sqf interpreter, Awooooo wrote some intercept stuff for fancy debugging, and i probably missed a lot more cool stuff.
The arma scripting isnt exactly very user friendly from what ive seen.
Wish it was like lua or something that ive worked with before.
Maybe Arma 4.
It's okay, you'll develop a love-hate relationship with it over time.
Also maybe check http://killzonekid.com/arma-debugging/
oh btw that "format" command is really nice, it even works for undefined vars. will simply throw out "any" without any script error.
and with format you do not need to care what type it is. literally eats any data type afaik
diag_log {_random_pos_in_trigger}
22:17:02 {_random_pos_in_trigger}
lol
clearly im very good at this (sarcasm)
not sure why that came out as a string.
Err {} ? In sqf that's usually code brackets. Never even tried it like that. Try
diag_log format ["Debug info: %1", _random_pos_in_trigger];
my man.
oh also if you add like ``````sqf``` before your code you get fancy syntax highlighing in discord. Like the cool kids ๐
๐ค
bangs head on desk
I think you have an empty array.
Heh i'm just the nightshift guy, okay?
What's trigger_spawn? Trigger name?
i was just looking at that
im running a test right now replacing it with thistrigger
oh you working in that init field of that trigger, yes?
OH THAT DID SOMETHING
};
_pos set [2,(_pos#2) - 2];
_trg = createTrigger ["EmptyDetector", _pos];
_>
22:25:45 Error position: <createTrigger ["EmptyDetector", _pos];
_>
22:25:45 Error Type Any, expected Number
22:25:45 File diwako_anomalies\functions\anomalies\fn_createFog.sqf [anomaly_fnc_createFog], line 41
22:25:45 "Debug info: [<null>,<null>,-2]"```