#arma3_scripting
1 messages ยท Page 522 of 1
is the trigger set to detect these units? like an "opfor" trigger won't be triggered by blufor
๐
Are there any restrictions using an image (as .paa) as an UI background?
no, just that they still need to be 2^x ร 2^y (256ร512, 1024ร128, etc)
Alrighty
how to use sleep command in triger activation? I want to use a little "pause" there
put your sleep and code after it in a spawn
Hey, how can I reset variables value back to 0 when it reaches certain value?
I have variable A = 0, every time you do stuff it gets +1 and it works fine, but I'm wondering how would I make it so when A = 5 it resets back to 0
omg never mind I just answered it lol
Rubber duck debugging: it's less embarrassing when your rubber duck is a rubber duck on your desk instead of a public discord channel =p
it's better on paper ๐
joke aside, rubber duck works
Use % @maiden warren
A = (A + 1) % 5
When A + 1 == 5 , A will be assigned 0
I'm using _backpack = "UK3CB_BAF_B_Carryall_OLI" createVehicle [5981.75,6329.81,0]; to create a backpack on a desired position, which works perfectly but is there a way i can add items to that backpack ? Also if i would spawn a box is there a way to add "addactions" on spawn ?
addItemCargo addWeaponCargo addMagazineCargo and so on script commands
Nevermind
_backpack addWeaponCargo ["M16",4];
made it work but I'm using something else to achive my desired functionality
@swift crane you want to delay activation statement execution after trigger detection happened? Set trigger activation delay https://community.bistudio.com/wiki/setTriggerTimeout
What do I need to do to make an objective complete after doing a certain action like killing something
Hey can someone explain my why my function doesn't work if i use call but it does if i use spawn? It's dependent on arguments so I think calling it doesn't pass them where as spawning them does.
Cannot sleep in unscheduled
spawn makes sure script is in scheduled
call might cause it to be unscheduled
execVM is a spawn. Thus it works
yup, I just forgot to remove some sleep lines that i had for debugging
Another question, why Isn't function viewer letting me recompile the function?
Im working with CfgFunctions for the first time. Is there an attribute to make it compile instead of compileFinal?
but if you use call in scheduled then aren't you still in scheduled?
yes
Yes. There is a allowRecompile entry for cfgFunctions
don't know at which level you need to set that
I think in the function itself
@tough abyss ๐
You can set it in mission config afaik and then recompile selected function from viewer
does this also affect BIS_fnc_recompile?
yes
When an object is deleted with deleteVehicle, does it's variable get removed from memory since it becomes nil?
"yes"
And what about an array of objects when each object gets deleted?
Well, I think an array-variable assigned to object doesn't get deleted because arrays are referenced in SQF, so it will be deleted only when it's dereferenced everywhere
^ this is not what you ask about here And what about an array of objects when each object gets deleted?
so, how's array of objects going to be different from one object? I don't understand
So I'd have to manually nil it to get it deleted from memory? Im trying to make a persistent mission so I'm making sure that no variables stay in memory once they're not needed
oh, your array will become an array of null-objects if you delete all objects from the array
Use private variables they are deleted when scope ends
@tough abyss I would but i need certain other functions to access the variable before removing it.
toss them around via arguments to functions
without passing them as arguments
and why is that?
because I said functions but I meant triggers
what are inside variables and how many do you have? Understand that trying to clean after yourself could be counterproductive
Im working on objective spawning. Need to use triggers for checking if its complete and doing cleanup of remaining junk that was spawned by the objective function
Since the mission is going to be persistent and dynamic im trying to make each mission a thing of its own without overlapping with any previous one.
you might look into my (or other) OOP implementations for SQF
I was going add auto serialization of member variables to it... in future not far away
OOP?
well what is your "mission"? It's a few variables I assume, per every "mission" ""object""?
so you might want to save states of your object into profile namespace...
as I understand it
Yeah a couple of variables such as target object, array of enemies spawned by the mission and similar
you can go like this of course: per every mission create an array, in the array every element ID corresponds to some variable, then you have some global variable with is array with missions... ๐คท
or you can go this way:
https://github.com/Sparker95/Project_0/blob/development/Project_0.Altis/Location/Location.sqf
but my OOP implementation isn't one for SQF, there are a few other implementations
i am creating a gas mask overlay via CutRsc and it will cover the scroll menu now,what can i do?setting its layer number to lower nor higher didnt do anything
What @astral dawn said. You can create location object and setVariables on it, then delete object when done and all the data will disappear with it
well yeah creating dummy objects is also an option actually
CBA has something like createNamespace AFAIK
which creates a dummy... namespace where you can setVariable, getVariable
and then simply delete the namespace
in fact CBA uses exactly arma's Location objects for that xD
the namespace will be object, because you cannot create proper namespace in Arma
yeah create function like mission_fnc_delete, which will run cleanup code for your object, then do deleteVehicle _object;
I can create a game logic to use as a namespace and then at the end of its use just make it delete itself
locations are not network synced so no danger to overwrite those vars remotely
no gamelogic will be global object, you don't want to do that
this is where you do not reinvent the wheel but use tried and tested methods
BIS use a similar tactic as I have seen in their task framework, but they use missionNamespace for all 'objects', and generate unique names for every new 'object'
but you can't save an object handle into profileNamespace by the way ๐ค
I didn't try but I guess it makes no sense
They cannot serialize between different sessions
you will need to serialize just like you do in c++
is there a way to make it a condition within "IF" when the player has equiped a weapon ? any weapon, just the fact that he has one equiped
my brain is working like a charm today already found out sorry
oh. it seems agents can't drive.
edit: they can, but not with "VEHICLE PLANNED" mode (setDestination)
"LEADER PLANNED" works just fine.
I once wanted to become a Frankenstein by createVehicle a unit and force him to do something.
Didn't succeeded for now.
But you actually can animate it the same way.
it's actually a weird request, but wasn't there a way to trigger FADE by script?
@winter rose fade?
the copy protection, degrading the game little by little
Oh, well you can just spawn empty while's
fork bomb, that I know ๐
If you seeking for some normal way, I don't think there is
I wanted to see it by my own eyes ๐ข
CutRSC
player setPos [11775.2,2833.33];
//GEAR
removeAllWeapons player;
removeAllItems player;
removeAllAssignedItems player;
removeUniform player;
removeVest player;
removeBackpack player;
removeHeadgear player;
removeGoggles player;
player forceAddUniform "U_BG_Guerrilla_6_1";
//SIDE
//MESSAGE
cutText ["<t color='#ff7800' size='3'>TEXT</t><br/>", "PLAIN DOWN", -1, false, true];``` thats the teleport script I currently use and i would like to change the players side if he teleports any chance i could do this ?
but there are title effects inside the trigger properties yes
@winter rose
@thin pond group the player to the side'
[player] joinSilent (createGroup east);
@high marsh wait what? sorry, I didn't get this ^^"
Under Trigger Effects in the trigger, select the TM overlay in the UI Overlay dropdown menu
Although, it looks like as I am testing them now. None of them work?
They should be their own resource in config
so you could use cutRSC
I was talking about FADE effects, as if I cracked the game; not splashscreens though
naaah :p
FADE not as in fade in or fade out, FADE as F.A.D.E, the copy protection system
FADE (or DEGRADE) is digital rights management software developed by Codemasters. It operates by detecting if a game has been pirated, and initially allows the player to use the game normally. It then gradually degrades certain game features over a time, eventually rendering...
maybe one cannot trigger it manually, IDK
I don't think that's some open to use context in Arma as application
@high marsh I cant seem to make that work as it gives me an error "objecttype expected array"
@thin pond you can remove everything from player with a single command, for example
player setUnitLoadout "C_Soldier_VR_F";
BAM! bare unit
oooh
text="img.paa"; ๐
Yeah but I have a case where it does not really work - still trying out stuff before I ask
why doesnt it work
What doesnโt work?
does that actually work?
cause I am not able to move the dialog by dragging. That's what I intentionally wanted to do after that flag set to true
you set moving=1; on the control that you want to click to move, and then movingEnable=1; on the display itself. i do believe there is more options than just 0 and 1, but idk what they do.
MovingEnable does shit in Arma3
Add style ST_TITLE_BAR to control you want to move and it should do it
when adding the style to a ControlsBackground - will all normal Controls be moved with it?
crap can't change it's style since it's the picture
Is there any way to set vehicles as medical vehicles by classname ? Back in the days you could define it through the editor modules
Does anyone know a way to open the vehicle garage on one single vehicle so I can edit it's appearance? The Achilles mod has this included and I'd like to do it with a script
@leaden venture I'll second on this... looking for the same thing
they use a modified version of BIS_fnc_garage. you can find it on their github
https://github.com/ArmaAchilles/Achilles/blob/master/@AresModAchillesExpansion/addons/functions_f_achilles/functions/replacement/fn_garageZeus.sqf
https://github.com/ArmaAchilles/Achilles/blob/master/@AresModAchillesExpansion/addons/functions_f_achilles/functions/replacement/fn_garage.sqf
hm i dont quite know how to get this working with a set "customization area" and a "addaction"
also im running into problems with "cuttext" as some of the awesome german letter (รค,รผ,รถ) are not being displayed sometimes
crap can't change it's style since it's the picture this is not how styles work, they are bitflags, you can combine different styles together. But I donโt think backgroundControls are meant to be interacted with, so Iโm at a loss why would one want to do that @frigid raven
@winter rose @high marsh fade is not enabled in the steam version. Maybe it was back then. Not anymore/currently.
@frigid raven ui config questions are #arma3_config
๐
@still forum thanks for the intel!
Splendid!
Bye for now
Hahaha! Beware of the ยฉ ^^
If a mission file needs additional .sqf files, where do the additional files go<
In the mission folder
safe
So i have a maker my_marker. I want to copy it somehow so I can delete it now and just "revive" it later with the same attributes. Besides saving all of its information markerPos etc. and just create a new one. - is there a convenient way to do so?
hide it by setting alpha 0?
Nah I really want to recreate the marker
and remove the old one
cause of server restarts etc (persistence stuff)
private _oldMarker = copyMarker "myMarker";
private _newMarker = createMarker _oldMarker;
just thought something like this exists mybe
fair enough. i dont think there is anything simpler than saving the individual attributes and applying them later.
okay then ๐ฆ
@frigid raven where are you saving it?
extDB3 and/or MongoDB webservice why?
well I see the point here - up to that point I have to strip all parameters from the marker anyway to store it in a database eh?
nevermind tho - already found a way now
Make a serialize function to store it in a string and de-serialize to load from it
aye that's what I am about to do
Hey, just wondering if i could grab some help real quick, basically i have a large script in my init.sqf. is there a way i can put that code into a custom sqf file and call it to the init.sqf?
put into file.sqf
and just write
[] execVM "file.sqf" in your init.sqf it will execute the code in file.sqf
Why not call it? Execvm will do the script asynchronously
Ill try that now but for it doesnt work on my add action code when i do that even when i call it
#include "script_component.hpp"
/*
* Author: xetra11
*
* serializes a marker to a hash object
*
* Arguments:
* 0: _marker <STRING> - name of the marker
*
* Return Value:
* _serializedMarker - <CBA_HASH>
*
* Example:
* Trivial
*
* Public: No
*
* Scope: Global
*/
params [["_marker", ""]];
if (_marker isEqualTo "") exitWith { ERROR("_marker was empty string") };
private _serializedMarker = EMPTY_HASH;
{
private _value = [_marker] call _x;
[_serializedMarker, "marker_param_" + _forEachIndex, _value] call CBA_fnc_hashSet;
} forEach [
{ _this select 1 }, // simply storing the name
{ markerPos _this select 1 },
{ markerSize _this select 1 },
{ markerShape _this select 1 },
{ markerText _this select 1 },
{ markerBrush _this select 1 },
{ markerDir _this select 1 },
{ markerColor _this select 1 }];
DEBUG("marker serialized");
_serializedMarker;
Looks a bit hacky but can this actually work?
why not just put everything into one array. And store that as one entry
And why have _this select 1 everywhere. Why not just pass the marker as _this?
You are needlessly wrapping it into an array and pulling it back out everytime
I see yea the hash doesn't make sense since I only need it within the serialization and deserialization function. Therefore it also can just be an array
{
_serializedMarker pushBackUnique ([_marker] call _x);
} forEach [
{ _this }, // simply storing the name
{ markerPos _this },
{ markerSize _this },
{ markerShape _this },
{ markerText _this },
{ markerBrush _this },
{ markerDir _this },
{ markerColor _this }];
@still forum better?
no
๐
now you are pluggin array into markerPos
๐ ๐ซ
This addaction addaction ["<t color='#FFFF00'>Virtual Garage Mod</t>", {GarageMkrName = "VG_Vehicle"; call VG_map_click}]; only works when the code is in inti.sqf but if i make it into its own sqf file it does not work even if i try call the correct sqf. im really new to this stuff and the forms are down so this is the only other place i know thanks if someone can help
you removed the "getting out of array" part. But not the "wrapping into array" part on the call
[_marker] call _x -> _marker call _x ?
๐
โญ
@long bolt well that doesn't make any sense.
you could check your RPT log for errors. Or add diag_log's to your second sqf file to make sure it's actually being executed
What are you adding that action to? the left parameter is missing in what you copy pasted
well i was doing addaction ["<t color='#FFFF00'>Virtual Garage Mod</t>", {GarageMkrName = "VG_Vehicle"; call VG_map_click.sqf}]; so its it own file but the init says im missing a ; so i tried execVM but tbh i dont really know what im doing
your addAction doesn't have the left parameter
it needs to know what to add the action to
this won't work in init.sqf, it doesn't exist.
Use the variable name of the object. Which you can define in the editor
Ill try do that now
i have this in my init.sqf now laptop addaction ["<t color='#FFFF00'>Virtual Garage Mod</t>", {GarageMkrName = "VG_Vehicle"; call VG_map_click.sqf}]; and the action shows on the laptop but nothing happens when i select the action, sorry if this is very basic but im just getting started.
call VG_map_click.sqf
That's a syntax error
. are not allowed in variable names
I assume you are trying to execute a script in a file?
call cannot execute files
Oh is there a recommendation to what i could use instead?
i would use the wikki but its down
No it's not down
execVM VG_map_click.sqf
You could use execVM too
No that's also syntax error
you still cannot use . in variable names
if you want a string, you have to make it a string by putting it in quotes
im trying to call a sqf file
oh it is too thanks
there is no such thing like pop for an array right?
params [["_serializedMarker", [],
["_newMarkername", ""]]];
if (_serializedMarker isEqualTo "") exitWith { ERROR("_serializedMarker was empty array") };
private _markerName = _serializedMarker deleteAt 0;
if !(_newMarkername isEqualTo "") then { _markerName = _newMarkername; }; // set override marker name
private _deserializedMarker = createMarker [_markerName, _serializedMarker deleteAt 0];
{
[_serializedMarker, _forEachIndex] call _x;
} forEach [
// omitting marker name element
// omitting position
{ _this select 0 setMarkerSize _this select 1 },
{ _this select 0 setMarkerShape _this select 1 },
{ _this select 0 setMarkerText _this select 1 },
{ _this select 0 setMarkerBrush _this select 1 },
{ _this select 0 setMarkerDir _this select 1 },
{ _this select 0 setMarkerColor _this select 1 }];
DEBUG("marker deserialized");
_deserializedMarker;
Please review the deserializer. Why? Because I want to be clean with this one.
_this select X :U
What is that foreach loop? that's definitely wrong
you are calling _serializedMarker setMarkerText _forEachIndex
setMarkerText doesn't take number
did you mean _serializedMarker select _forEachIndex ?
Oh btw.
your serialization code
_serializedMarker pushBackUnique ([_marker] call _x); The unique is wrong. What if you have same name and "brush"? suddenly dir will be on index 5 instead of 6. Because the duplicate brush entry is removed.
two good points
{
[_serializedMarker, _serializedMarker deleteAt 0] call _x;
} forEach [
// omitting marker name element
// omitting position
{ _this select 0 setMarkerSize _this select 1 },
{ _this select 0 setMarkerShape _this select 1 },
{ _this select 0 setMarkerText _this select 1 },
{ _this select 0 setMarkerBrush _this select 1 },
{ _this select 0 setMarkerDir _this select 1 },
{ _this select 0 setMarkerColor _this select 1 }];
Cmon thats right now...
"myMarkerNameYeah" setMarkerSize 5
etc.
(praying)
That.... might work. Is quite inefficient though.
And you are passing an array (_serializedMarker) as argument to the setMarker commands.
They don't take arrays tho
{
(_serializedMarker select _forEachIndex) call _x;
} forEach [
// omitting marker name element
// omitting position
{ _deserializedMarker setMarkerSize _this },
{ _deserializedMarker setMarkerShape _this },
{ _deserializedMarker setMarkerText _this },
{ _deserializedMarker setMarkerBrush _this },
{ _deserializedMarker setMarkerDir _this },
{ _deserializedMarker setMarkerColor _this }];
DEBUG("marker deserialized");
_deserializedMarker;
How bout this?
And you are passing an array (_serializedMarker) as argument to the setMarker commands.
I don't understand what you mean here: [_serializedMarker, _serializedMarker deleteAt 0] call _x; ->_serializedMarker deleteAt 0 isn't an array?
@still forum oh cmon now!
You pass _serializedMarker as first argument
then you pass _this select 0 which will return _serializedMarker to setMarkerSize
damn
_serializedMarker is an array though. You are passing an array to setMarkerSize. setMarkerSize doesn't take array
you're right yeah
I hate my life
stop critisizing (wtf this word) my english! You are not allowed to do so. Only SQF critique is allowed here
... oh u have that color
uh...
He's a drunk
Yeah how about you don't bother all moderators for random nonsense?
Looks like my jokes backfired
I think I gonna take a pause and won't bother you guys for a while ๐ thx so far
Maybe we need #english =p
Hey, @tough abyss:, big thanks for the fullcrew command, ive got how to use it only now)
I need some help to understand uiNamespace. I got a display and if i click button 1 something should happen, button 2 something else. Problem is i need the player object (or position of it) in the button code. So idea is to push a variable into the uiNamespace and get it there.
Questions:
- uiNamespace is local for every client, but has a global synchronised right?
- uiNamespace for client 1 is different to uiNamespace for client 2?
- same variable names can be used in both uinamespaces?
i need the player object
Just call the player command
really, the display is local?
uiNamespace is local for every client yes
but has a global synchronised right what does that mean?
uiNamespace for client 1 is different to uiNamespace for client 2 it's local only. so yes.
same variable names can be used in both uinamespaces? they are completely seperate.. so yes.
Yes. UI elements are local
They aren't rendered on a server and then screenshotted and sent to you ^^
all namespaces are local only, and seperated
Unless namespace is an object
Unless you set it globally
the namespaces between 2 clients are different, even if it's the same object
Each client has it's own local namespace for the object
Does setVariable on uiNamespace with public flag set work? Technically it could.
Everything is local
Something is synced over network and something is not but each client has own local instances of everything
We take "global" effects as something that syncs automatically.
namespaces don't.
Fighting for definitions ๐
word fiiight!
IMO a venture into Multiplayer should be started with the premise that "Everything is local" and then build on it
When you want to complain about bad hitreg. But notice that the shooter just pulled his network plug to make you stand still while he shoots at you
I think you can delegate hit reg to server but you will be fighting Arma every step of the way
deleteVehicle on FiredEH and remoteExec createVehicle to server with velocity ๐
Maybe donโt even need to delete, just have hit box local to server
Don't know how one would do that part
With difficulty
You can have local vehicle created on server that would mimic server instance of the player
And have it collect the damage
The bullets exist on server, in the worst case they could be recreated
I wonder if setShotParents could trigger hitpart if it is set to some local unit
Any way to use exitWith or something alike to exit out of a loop as well as a script, without simply setting a flag then exiting when out of the loop?
breakTo/breakOut
Thanks, didn't really want to have to specify scope, but I guess there's not much else.
didn't really want to have to specify scope why is that, does it bite?
goto's make raptors rise
this addAction ["Drag", { player playAction "grabDrag"; player forceWalk true; _this select 0 switchMove "AinjPpneMrunSnonWnonDb"; _this select 0 attachTo [player , [0, 1, 0] ]; _this select 0 setdir 180; player addAction ["Drop wounded", {removeAllActions player; player playMove "amovpknlmstpsraswrfldnon"; handle = [] spawn {things = nearestobjects [_this select 0,[],4];{detach _x} foreach things}; thethings = nearestobjects [_this select 0,[],4];{_x switchmove ""} foreach things; }];}]; //This is a script to grab wounded... However im trying to add action to drop the wounded. Instead the unit being dragged does not detach, and the animation for that unit being dragged continues and does not cancel. Any ideas?
attachedObjects use that instead of searching near objects
Thank you i have figured out the rest.
yo people anyone knows what should I write in the trigger section to make everyone who enters that area to go unconscious?
Depends on whether you want it to work for units on foot, units in vehicles, both, etc, etc
{ _x setUnconscious true; } forEach thislist``` or, if the trigger is server-only, ```sqf
{ [_x, true] remoteExecCall ["setUnconscious", _x]; } forEach thislist``` @smoky verge
wow thats incredibly accurate thanks, basically need to make everyone on a plane unconscious
@ruby breach
In that event, thisList would return the aircraft. You'd need to cycle through the vehicle's occupants with crew and do what Lou posted
What would be the best way to pass an array on to a called function?\
as an argument?
Mhmm
[] call func
_array = ["A","B","C"];
[_array] call fnc_Placebo?
yea. or _array call func if it is the only argument.
I have a couple I want to send.\
works however you want, as long as it is infront of the call
same goes for spawn and execvm
_arrayOne = ["A","B","C"];
_arrayTwo = ["D","E","F"];
[_arrayOne,_arrayTwo] call fnc_Placebo?
Sweet, thanks
And I will select that by doing:
_arrayOne = _this select 0;
_arrayTwo = _this select 1:
In the func
the formatting of it doesnt matter, just as long as you're using the right syntax.
Mhmmm
This Discord channel is a godsend
Thank you @robust hollow
Hmmm any idea why it would be considered undefined? I currently have it in an addAction if that means anything.
show how you're using it
params [
"_target"
"_caller"
]
_styleOpen = "<t size='1' font='PuristaSemiBold' color='#58D3F7'>";
_styleClose = "</t>";
_variable = "Hamburger"
_array = ["Apple","Pear"]
_target addAction
[
format ["%1SomeAction%2", _styleOpen, _styleClose],
{[_caller,_variable,_array] call fnc_Placebo}
];
yea thats not how it works
Visual Studio suggests that my [] called are possible undefined.
the action code executes in its own instance so those local variables wont be available
I see
is there any way to get around that?
Or would I have to consider not calling the func within addAction?
_target addAction
[
format ["%1SomeAction%2", _styleOpen, _styleClose],
{
params ["", "_caller", "", "_arguments"];
[_caller,_arguments#0,_arguments#1] call fnc_Placebo;
},
[_variable,_array]
];
Fantastic
So kinda like how I have done the styles?
format ["%1SomeTest%2", _varA, _varB]
The _arg# refers to the variable?
is select, so its just selecting that index of the _arguments array
which yes in this case is your variables [_variable,_array]
Oh sweet! can I use #0 instead of select 0 anywhere?
almost anywhere yes. i've had an issue using it in one case, perhaps in macros, im not sure now.
has anyone ever found the acceleration due to gravity for arma? I wanted to spawn people above a certain point on a TP pole and be in air for a certain time but if I use 9.8 m/s^2 it doesnt seem to add up
Hey @robust hollow
What were these empty strings in the params?
params ["", "_caller", "", "_arguments"]
I see
it should work, not sure why u have an error
Is there a way to get the Description of a vanilla map marker?
what do you mean by "the Description"?
thats just markerText, though i assume thats not what ur talking about exactly. are you referring to location markers?
๐
maybe another question... is there a way to "intercept" the creation of mapmarkers?
I'd like to create other markernames as _USER_DEFINED #2/4/1 etc.
you could override the default functionality on that UI to use ur own function.
idk if itl work simply by removing all buttonclick events on the ok button, if it doesnt you could hide that button and make a new one in its place
that being said, i dont think you could replicate the "show to" functionality without creating your own sqf version of the system.
i havent seen any commands to modify that setting so i assume its an engine only thing
Shame the factions created by Orbat don't work in DRO/DCO
they just spawn vehicles and no infantry
@queen cargo that is a sexy mod
actually yes - but I don't want to have any other mod dependency but CBA tbh
So I try my own stuff in an later iteration ๐คท
I hate frameworks etc. I always write my own stuff ๐
was more "take this as reference" then "take this as it does exactly what you want"
Profiling spawned scripts with Arma Script Profiler, is it possible or not? Or some other tool for doing it?
you may want to ask @still forum on this one and check the #arma3_tools channel
Hmmm
_array = ["Apple","Pear","Eggplant"];
_item = "Apple";
_variable = _array find _item;
hint str(_variable)
Any idea why this is giving me -1 (Not found)?
because ur missing semicolons
more because this is not the actual code
_item = "Apple";
_variable = _array find _item;
hint str(_variable)
SQFBOTToday at 2:06 AM
[HINT] 0
[WORK] <NOTHING> nil```
Corrected\
yea, that gives 0 so it isnt the problem code
Okay, shall look deeper.
paste what ur actually using?
is it possible to print output executed script code in game?
sorry, not the resulted output, but the code executed of the script called?
he wants to print the line content i think
__FILE__ and __LINE__ are the closest you can get, I think, without too much effort, if we understand the question correctly
https://community.bistudio.com/wiki/PreProcessor_Commands#FILE
Will give it a test
How would I grab, lets say, the last char in a string?
private _string = "12456789";
_string select [count _string - 1,1]; // "9"
Would you mind breaking this down for me?
I struggle to understand what is happening with [count _string - 1,1]
I guess count will count the number of characters?
string select [start index,length]
Hi, somebody know if i can get result from server function with a simple call?
//Server function
_Display = ["RscDisplayOptionsVideo","RscDisplayStart"];
{
_return = getText (configFile >> _x >> "onUnload");
} forEach _Display;
_return
//get result
[] call _serverfuction;
are you getting that result on the server as well?
nope client
to return it on a client you would need to broadcast the result.
hmm shit
that snippet isnt going to work how you intend anyway
i'm just trying to compare server display to client to see if client have modified display.
i recommend gathering that info on a vanilla client in editor and saving it to a file in the mission. it means you will need to keep it up to date but greatly reduces the network load.
it has been a few months since ive encountered modified display events though.
idk if ur server is more vulnerable than mine as i have things locked down pretty tight, but as far as skids modifying the events it isnt as common as it used to be.
scratch that
i don't run server actually, but i try to prepare myself against script kiddies, before lunching server.
i have good script.txt but i've seen its client sided. most of cheat providers bypass it.๐
i have disable somes command with Cfg Disabled Commands useful but don't know if its bypassable.
it has no effect during preinit
So if i'm not wrong i can't get result of a script from server if i call it on client?
sorry but i'm beginner
if you call a script on client, it will execute on the client.
you cannot get a result from a server-executed script without broadcasting it
I am trying to make a reversed checkbox attribute for 3den menus that disables the rest of the attributes in the controlgroup when it is enabled/true. I am having difficulty with an 3den attribute onLoad/AttributeLoad EH, the onCheckedChanged works as intended, the values are saved in the mission.sqm appropriately, but the onLoad event does not enforce the fade/enable on the controlgroup's attributes. Is there something special about the 3den attribute timings via onLoad/AttributeLoad or how they get enabled/displayed that is overriding these effects? https://pastebin.com/raw/S5155211
If there is something strange/some engine solution for creating the 3den menus I think I will just switch to a visual/texture change and use the standard checkbox that works as intended, just reversing the value read in functions.
i dont have an answer for your problem so am no real help to you, but cant [true,false] select bool be simplified to !bool?
params [
"_nodePos"
"_index"
]
_array = [
["nodeA", "Range", [0,0,0]],
["nodeB", "Airfield", [0,0,0]],
["nodeC", "Explosives", [0,0,0]]
];
{
if (_index == _x) then {
_x set [2, _nodePos]
}
} forEach _array;
Am I doing something wrong with this condition?
what is _index?
and i assume you know what _x is?
0 == ["nodeA", "Range", [0,0,0]] for example
never going to be true
As far as I know _x is the position in the loop forEach
you're after _forEachIndex
_x is the element
that is a over complicated way to do it though
(_array#_index) set [2,_nodePos];
you should really be sending actual snippets. is hard to give proper help when you keep sending examples like this.
Okay, I guess I just keep trying to want to understand this one step at time, but if its making it hard for you guys then ill just post the whole thing as is. Probably just a better way to redo it all. This has just been a project with a simple goal, just for the sake of trying to learn.
its just hard to tell what you're trying to do exactly when you ask for help on a snippet with missing semicolons and doesnt read like code you could actually use. that snippet for example being the _array resets to default every time you call the script so the whole thing is useless.
Object (Map) Init:
[
this,
"0",
getPos this
] call RGTA_fnc_teleportNetwork;
Note: there are multiple maps.
RGTA_fnc_teleportNetwork:
params [
"_target",
"_tpIndex",
"_position"
];
_styleOpen = "<t size='1' font='PuristaSemiBold' color='#58D3F7'>";
_styleClose = "</t>";
private _tpTar = _target;
private _tpPos = _position;
// Establish Array
_tpList = [
["tpNodeBase", "Base", [0,0,0]],
["tpNodeRange", "Range", [0,0,0]],
["tpNodeExplosives", "Explosives", [0,0,0]],
["tpNodeIsland", "Island Runway", [0,0,0]],
["tpNodeUSS", "USS Freedom", [0,0,0]],
["tpNodeRGS", "RGS Posidon", [0,0,0]]
];
//Assign Array Coords
{
if (_tpindex == _x) then {
_x set [2, _tpPos]
}
} forEach _tpList;
// Setup Actions
_target addAction
[
format ["%1Base%2", _styleOpen, _styleClose],
{
params ["","_caller","","_arguments"];
[_this select 1, _arguments#0,_arguments#1] call RGTA_fnc_teleportPlayer
},
[_tpTar,_tpList]
];
hint "Function/Script Has Ended";
RGTA_fnc_teleportPlayer: (Nothing Yet)
params [
"_caller",
"_tpTar",
"_tpList"
];
I understand, thank you for your patience
why do you write the index as a string?
During the init?
yea
and the point of this script is to add an action to the object so you can teleport to the specified location?
Mhmm
is the action argument supposed to be [targat,allLocations] or [target,selectedLocation]?
Oh! About the addAction, I planned to loop the addAction too, to include all the actions.
I just have Base as the only action for now.
Just wanted to put that out there.
selectedLocation I think?
If I understand that question correctly.
Perhaps I should rather add the entries to the tpArray along the way and rather not edit them into a predefined array...
this is more sensible i think:
https://gist.github.com/ConnorAU/d4cd09e65662ff0135b4c565b5efc9ea
Only wanted to have to move a single object around, not the object and a marker.
Each TP destination has a TP itself.
Reading through it now Connor\
so you want all teleports to show, except the one you are at ?
tpNodeBase this is the object ?
just call it once, and it should setup all tp nodes.
showing every option but itself
but you will need to hardcode positions.
Yup, now I play the game of pick-the-code-to-copy-paste and the purpose of my project is void.
I appreciate your input @wary vine, but you provide a lot of different stuff in your code revision, that I am left wandering what does what and I may as well have Googled the best way to arrange a TP function and copied it.
I'd like to follow @robust hollow advice on this one because it follows my structure and I can make sense of it. I'm really trying to make sure I understand every part of this, bit by bit. Yea its 6am and I just stared at a sad 100 lines of pathetic code for over 8 hours, but I'm hella done just copy-pasting.
Question, why is _selectedLoc private?
because its good practice to private your local variables unless your rewriting the variable from a parent scope
Could I ask you to please help me loop the addAction so I can wrap this up?
So anyone can walk up to any of the nodes
tpNodeBase, tpNodeRange, tpNodeExplosives, etc...
And interact on the object to be teleported to a selected destination node
@edgy dune gravity constant in Arma is 9.8066
@ebon ridge no, the results of profiling spawned scripts would make no sense and be completely useless.
No there is no other tool. But you could enable instruction level profiling, that way you atleast see the instructions of the spawned script.
Is there any way too add slat cages and other garage attachments to vehicles in game via script?
what a non resource intensive way to make AI not to lay down in trenches?
_unit setUnitPos "up", but this prevents them to put a knee down
@velvet merlin roadway surface with ai stance type?
@still forum You mean to say in general that profiling a spawned script makes no sense or just in the context of the Arma Script Profiler (i.e. in the context of frame based profiling)?
frame based profiling. The profiler can't see when the scheduled script starts/ends executing in a frame. It can only see the overall start and end
i guess https://community.bistudio.com/wiki/Arma_3:_Event_Handlers#AnimChanged + nearestObject
for surfaceType you would need a custom surface below each trench from what i understand
@still forum oh okay thanks ill try that. also I didn't realize how many symbols are in ur name till i got on my phone lol
kju you could do a line intersect check straight down to see if unit is over a trench.
is that cheaper than nearestObject? also fully reliable?
more expensive, but probably more reliable
Thanks Dedmen. I was very interested when I saw the profiler somehow uses scope of private variable. Do you know if it is it possible to leverage private scope in sqf directly (e.g. always call this function on a variable when it goes out of scope or something), or only via plugin/intercept?
Basically I would like to make profile scopes for my spawned code without needing to worry about exitWith/throw breaking it. Being able to say "call exitscope" when you exit scope would be pretty useful. Something like a finally block.
in sqf directly No. Intercept does this by just executing code in the destructor. There are no destructors/objects in SQF
@digital hollow nearestObject is only unreliable if you have other objects next to the trench and the infantry would be further off from the center than to the nearby misc object? or in some other sense
yeah, plus it's skinny, right? so you could be "near" but not over the trench
@velvet merlin just a texture in roadway should do the trick
yeah good point
texture in what sense? to link a cfgSurface and use the parameter to have AI not crouch?
class floor_inside: GdtStratisConcrete
{
files = "dlazbain";
character = "Empty";
soundEnviron = "int_tiles";
AIAvoidStance = 1;
};```
zpai
alright. wasnt sure if that parameter works also for non terrain surfaces
+ lyingLimitSpeedStealth = 0;//2;
+ crouchProbabilityCombat = 0;//0.4;
+ crouchProbabilityEngage = 0;//0.75;```
did anyone play with these by chance?
on that note i also found an obscure config parameter during DZ SA dev to toggle AI behavior to walk only/or also run/sprint in buildings - cant think of it any more though
Hi everyone! In ACE3 mod i can use flashlight on map, when it's to dark around player. How ACE3 checks light level around player?
๐
@still forum thx a lot!
revealMine is not doing the job, the AI still steps on it, is there other way to avoid mines to be trigered by AI or a side?
why have mines if they are not supposed to blow up?
Hello Arma community.
I am currently trying to create a task where you have to collect an item.
I have an item with the variable name "money1".
I have a trigger, in this condition I have: money1 in (VestItems player + UniformItems player);
In the On Activation for the same trigger I have hint "Task Complete"
This trigger is sync'd to a Set Task State to change the task to "Complete".
For some reason this is not working, can anyone spot why this may be? I referred to this video when attempting this: https://www.youtube.com/watch?v=LNLfJL3SUn8
@young current Because players were to supposed to blow up.
@long pewter money1 is variable name you need class name. Also you cannot put vanilla money in inventory.
@tough abyss god dang it, I've got a mod that has briefcases of that sweet sweet cheddar that I was going to use. Is there any other way around it you can think of?
Not sure if this is possible, but can you create a trigger that activates once X amount of variables are within the trigger area?
I said vanilla, if you have mod that makes money an inventory item then you can check if user has it in inventory
@long pewter, I am sure there is a way to create a trigger that activates in the manner you're saying, however, you could just use a normal trigger and have the activation conditions be for anybody and then when anybody is in there, have the trigger activate a script that checks more specific stuff.
Hello is any bug known on command enableEndDialog ? Because I have a blackscreen in my custom death scene. Confirmed 100% it's that command because I disabled it in my script and I didn't have that blackscreen anymore.
Found nothing in feedback tracker
Enables the dialog buttons to be shown during the OnPlayerKilled script.
why do you even use it?
Because I want to ?
custom death scene
I mean it's fine if you don't want or cannot help. Just don't be negative ? You know that thing that pisses people off ?
๐คท
I mean do you know what this command is supposed to do? It is very old command which is probably deprecated by now, I am just curious if you know what you're doing, because I have no idea when to use it
I see.
It's a command that triggers the dialog buttons on the death screen ๐
I have a custom death screen launched in playerKilledScript.sqs which is supposed to replace the default A3 screen.
If you don't add in enableEndDialog then you just have an deathscreen without any exit button and you just get stuck in your own game ๐
I would assume its either not reading your playerKilledScript.sqs, or something may be fighting your dialogue creation. It is definitely an old one if its still using sqs rather than sqf. There may be an easier way to create a custom death dialogue if you can't get enableEndDialog working correctly for you.
Is there a way to add slat cages or garage attachments to vehicles with a script without opening the garage?
HeliosToday at 09:39 Is there any way too add slat cages and other garage attachments to vehicles in game via script?
And I told you already, yes, they are animations
It's a command that triggers the dialog buttons on the death screen from what I can see when enabled one of the 2 displays will be used "RscDisplayMissionEnd" - almost entirely black screen or "RscDisplayMissionFail" a mission end screen with restart and continue buttons. Which one is displayed is complicated and depends on mission end. One other command that does what enableEndDialog does is failMission, where you can actually pass what kind of end you want which again will have a say on which display is to show @quartz coyote
Ah well that is very useful ! I'll dig into that man thanks !
@dim terrace what are the AIAvoidStance values for what effect? Is there one that forces them to stand? In my bunkers (and vanilla as well) AI cant hit enemies because to fire they kneel first, fire against the wall, then stand up again to check on the enemy...
Does anyone know of a sqf static analyser, i.e. sqf lint?
Cool. Thanks
what better for performance, use trigger to wait when condi met, or use spawn with sleep?
trigger with cond. Is same as spawn with waitUntil and sleep 0.5
@still forum thx
well roughly same. Trigger also collects units in trigger area. If you don't need that then... Trigger more expensive
if you don't need 1000 triggers or their alternatives, I guess, use whatever is more convenient for you ๐คท cost of a custom SQF statement can't be lower than cost of SQF statement
any advices, how to find legspikes on missions? i test my mission on MP - everything was ok, but when we played on Dedic, random fps drop occurs, rpt file - no error, -showScriptError was enabled, and nothing
profiling
allUnits ~120, on small area 50x100
diag_captureSlowFrame
@still forum your profiler? ๐
for rare fps drops that might be less useful as it constantly captures.
Maybe you need to give your server more bandwidth? I mean the basic.cfg file, although I am not a pro at servers
The Arma profiling only captures the one rare laggy frame
server fine enough on most missions
Do you mean low server FPS or low client FPS by the way?
Although if you say it's an FPS drop, not a desync, then yeah, probably do what Dedmen said. So, arma has a special profiling build, which you download and run instead of your standard arma executeable. Then you can use diag_captureSlowFrame commands and other diag_ commands, which will do profiling of engine. Dedmen's profiler is for profiling SQF scripts, not engine.
my profiler can profile engine too. But it's more useful for constant low fps. Less useful for rare drops
Ok didn't use it much, sorry
need to catch the drop yourself. Wheras with captureSlowFrame catches it for you
Wanted to fix debugger today.. But didn't happen sadly.
i'm not sure what u mean, server or client FPS.
fps drop on clients, for all.
profiling build should be on server, or on client its enough?
all was lagging ๐
There is also dedicated profiling build for all platforms, so you can profile dedicated server process too. But you would have to diag_captureSlowFrame on dedicated (through remoteExec), then transfer it to client to visualize... I forgot how to do that ๐ฆ
it saves to text file on server
would need to pull manually
but if you have clientside lags you don't care about serverside much
someone can help me with this error File 'addons\missions_f_epc_video.pbo' not found.?
i was surprised with that lagspikes, cause all logic was on serverside
Steam was too stupid to properly delete it months ago
lag* not leg. Leg is the thing you use to walk
sry for my bad English
so, what scripts are running on client then? if there are any heavy client side scripts then they will affect client obviously, if they do engine heavy tasks, like asking engine to find all trees in 10km radius. Although you have said previously that it worked allright in your self-hosting test, so IDK ๐คท
almost all triggers except connected with Tasks (will rewrite it to FHQ TT) are serverside. scripts also run only on servers. run third-party script for locked doors - sushi_scripts, but we havnt any problem with it on another mission
@tough abyss How did you find that information, can't find anything a part from the raw "RscDisplayMissionEnd.sqf" & "RscDisplayMissionFail.sqf"
the displays are in config. sqf scripts are just a on the side thingy
how can I identify the correct config to look into
Just look into a AiO config
what is an AiO ?
Oh ! All In One
gotcha
can't get a hold on what I need ...
I'm just stupidly looking into things that are not related
I can't find it .................
can't open the cfg file so I tried with the cfg viewer but that shit is such a mess I wouldn't find anything even if I tripped over it
"can't open" ?
well when I open a cfg file it's binarised
where did you get that "cfg" from
and what is a "cfg" ?
Arma has .bin and .cpp configs
and you can just debinarize it
what are config.cfg then ?
Arma 3 tools CfgConvert
and why not just pull a AiO config like I told you. You have everything in there. unbinarized
yeah I googled it
i'm getting slightly better aint I ?
๐
Found it !
thanks !
how can I identify the correct config to look into type utils 2 in debug console, type in your class and look at SOURCE ADD-ON(S): line, will tell you what addon it is in
@tough abyss look at what I found ๐
https://forums.bohemia.net/forums/topic/143885-bis-kill-cam/
Magic Karel : (["HealthPP_black"] call bis_fnc_rscLayer) cutText ["","BLACK IN",1];//MUF-black in (remove black screen that was launched in FSM PP)
^
that ain't the solution after all ...
Quick question about extensions, is it possible to execute SQF from an extension without using callExtension?
@tough abyss Hory crap, I totally missed that message. I thought I was ontop of the discord. Thanks and sorry for the double post. Saved my neck man.
@final gale so you mean, the C++ part of your .DLL calls an SQF code directly?
Intercept can do that(I think??), and much much more, consider doing Intercept addon instead
I forgot about Intercept, and I would use it but I want this to be a standalone extension and I'm only going to need the sqf call once, but in that case how does intercept execute sqf?
Only with intercept or with the same methods intercept uses such things are possible by DLL only
Can anyone tell me if theres a fail? ๐ Try to make a Indiciator for my Audi A7 which looks like that https://prnt.sc/n1qj5e
https://pastebin.com/2PKY6Mv7
I would just run a script that runs through it once after key press or long duration activation instead of just running it constantly
Also, just use a for loop for that, use the step number as the selection index number
@paper echo consider using local variant of setObjectTexture and trigger the script globally instead, you are spamming network for no good reason atm
It's a classic net switch M242, except it's only when you're signaling to turn ๐
Not to rubber band about
Can you give me a good reason why this is so important that it synchronises blinks precisely?
None, I was joking.
Net switch = inducing network lag to other clients to gain local competitive advantage over others
No, you can send tonnes of data before arma chokes on it
Depending on how many players you have, sure.
To exclude a client from global effect sync is impossible without directly targeting remote execution to the non affected players.
paramWeather = "maas_server_weather" call BIS_fnc_getParamValue;
paramFogValue = "maas_server_fogValue" call BIS_fnc_getParamValue; //main fog value
paramFogDecay = "maas_server_fogDecay" call BIS_fnc_getParamValue; //fog decay
paramFogBase = "maas_server_fogBase" call BIS_fnc_getParamValue; //fog base altitude
if(isServer) then
{
switch paramWeather do
{
case 1:
{
//clear
diag_log "[MAAS WEATHER]: Recieved input of 1, setting to clear";
{0 setRain 0; 0 setOvercast 0} remoteExec["call",0,"maas_jip_weather"];
};
case 2:
{
//partly cloudy
diag_log "[MAAS WEATHER]: Recieved input of 2, setting to partly cloudy";
{0 setRain 0; 0 setOvercast 0.5} remoteExec["call",0,"maas_jip_weather"];
};
case 3:
{
//raining
diag_log "[MAAS WEATHER]: Recieved input of 3, setting to raining";
{0 setRain 0.5; 0 setOvercast 0.5} remoteExec["call",0,"maas_jip_weather"];
};
case 4:
{
//storm
diag_log "[MAAS WEATHER]: Recieved input of 4, seting to stormy";
{0 setRain 1; 0 setOvercast 1; 0 setGusts 1} remoteExec["call",0,"maas_jip_weather"];
setWind[20,20,false];
};
};
0 setFog
[
paramFogValue,
paramFogDecay,
paramFogBase
];
forceWeatherChange;
};
A little confused as to why this only works with execution after game start and not with lobby parameters or server init?
idk if its scripting but if im adding a UserAction in config.cpp of a Vehicle is it possible to put in the Statement a sleep?
like
statement="vehicle player animate [""ClignotantsGaucheStart"", 1];sleep 1;vehicle player animate [""ClignotantsGaucheStart2"", 1];";
@paper echo I would make it a separate looping hide/unhide animated mesh part that's on top of your lights. And then make a global hide parent bone for it so you can show or hide them just by hiding/showing the parent bone
This way you won't need any fancy scripts like that.
@velvet merlin i've seen that, but it only covers "no prone" and whatever is behind that jira link is not accessable for public
@austere hawk there is no force only standing via surfaces. so either you tweak the other parameters i posted above, or go for the scripted approach (also posted above)
"the other parameters" - none of them appear to adress AI stance
Hello all,
I am creating briefing with next that is in a stringtable.xml.
with createDiaryRecord where do I put the HTML coding ? In the stringtable or in the command line ?
player createDiaryRecord ["Diary", [localize "STR_h_one", localize "STR_p_one"]];```
if in the xml, it has to be escaped (<br>)
There is a difference between \n in a string. And a real newline
and I think diary is html. So </br> or <br> or something like that
<br/>
okay
so i'll send all that to HTML.... but I kindof wanted to keep it in Stringtable since I have translations
๐ฆ
aaaaaaaaaaaah Nice !
working !
thanks
oh and Lou had mentioned the <br> but I was too dumb to recognise it I apologise
Hi everyone! How i can shoot from mortar by script?
@quartz coyote ok. Now try to level-up this task. I want to fire mortar without anyone in them ๐
@lost copper
for "_i" from 1 to 5 do
{
[] spawn {
_pos = (that's up to you);
_exp = "Sh_82mm_AMOS" createVehicle [(_pos select 0) + ((random 20)-10),(_pos select 1) + ((random 20)-10), 400];
_exp setVelocity [0,0,-150]
};
sleep (random 2) + 2;
};```
@quartz coyote it is creating ammo with start velocity and direction. But i need to fire from real mortar for triggering Fired EH.
a real mortar without an AI in it .... ?
Yeah
uh ...
I try to explain
In ACE3 mod i can add ammo to mortar from inventory by ACE Action. Like in that video:
https://youtu.be/9d9lnQ6vGsE?t=192
But now player needs to get in mortar after loading mortar and press LMB.
I want to create process like it works in real life:
https://youtu.be/3Tk3-cQ40tw?t=75
Can't help, i'm not good enough for that.
So i need a script, which fires a mine from mortar automaticaly after loading mine in mortar without clicking LMB on gunner's seat.
@quartz coyote thx for your conversation ๐ค
Anyone can help?
there is the different fire commands you can try to use
but for any weapon to fire there needs to be someone in there to operate it
either a player or an AI
@young current so it's impossible to fires a weapon without shooter?
yes
you can put in an invisible AI shooter and remove it after firing if you like
but no shooting without a shooter
@young current that can be a solution. One of my friend give me an another idea. Can i add AI behaviour to mortar like it works with UAV?
UAV has invisble AI drivers and gunners
So only adding invisible AI shooter if shooter slot is empty and fire by command...
yes that should work
@young current thx for your help, it will be a looong evening ๐ฉ
Hi, somebody can help me with this
{
_x params ["_class","_expectedOnLoad","_expectedOnUnload"];
private _onLoad = getText(configFile >> _class >> "onLoad");
private _onUnload = getText(configFile >> _class >> "onUnload");
if !(_onLoad isEqualTo _expectedOnLoad || (_onUnload isEqualTo _expectedOnUnload)) exitWith {
//
};
} forEach [
["RscDisplayMainMap","[""onLoad"",_this,""RscDiary"",'GUI'] call (uinamespace getvariable 'BIS_fnc_initDisplay')","[""onUnload"",_this,""RscDiary"",'GUI'] call (uinamespace getvariable 'BIS_fnc_initDisplay')"]
];
the problem is _onLoad seems to be equal to _expectedOnLoad when i output with diag_log, but the game says it's not equal and exitwith is triggered.
output
_onLoad = [""onLoad"",_this,""RscDiary"",'GUI'] call (uinamespace getvariable 'BIS_fnc_initDisplay')"
_expectedOnLoad = [""onLoad"",_this,""RscDiary"",'GUI'] call (uinamespace getvariable 'BIS_fnc_initDisplay')"
_OnUnLoad = [""onUnload"",_this,""RscDiary"",'GUI'] call (uinamespace getvariable 'BIS_fnc_initDisplay')"
_expectedOnUnload = [""onUnload"",_this,""RscDiary"",'GUI'] call (uinamespace getvariable 'BIS_fnc_initDisplay')"
diag log the output of both the isEqualTo's too
@still forum all output is here
output _onLoad = [""onLoad"",_this,""RscDiary"",'GUI'] call (uinamespace getvariable 'BIS_fnc_initDisplay')"
_expectedOnLoad = [""onLoad"",_this,""RscDiary"",'GUI'] call (uinamespace getvariable 'BIS_fnc_initDisplay')"
_OnUnLoad = [""onUnload"",_this,""RscDiary"",'GUI'] call (uinamespace getvariable 'BIS_fnc_initDisplay')"
_expectedOnUnload = [""onUnload"",_this,""RscDiary"",'GUI'] call (uinamespace getvariable 'BIS_fnc_initDisplay')"
check the result of the isEqualTo's
Like I said.. I don't like repeating myself
I already saw that you posted that stuff. No need to post again
the result of isEqualTo's is true there is difference thats why i dont understand.
so both equalTo's return true. But the exitWith still triggers? makes no sense.
Are you sure the exitWith triggers
Not really paying attention me says that you're comparing strings, where "call (" != "call ("
tab vs spaces maybe
@ruby breach ho yes u right strange, spaces can cause difference?
When comparing strings? Yes
@tough abyss says bis fnc init display returns nothing https://community.bistudio.com/wiki/BIS_fnc_initDisplay
He's not comparing return values, just the code as a string
did you even look at the code? ^^
He is calling the code at original post
huh? no?
And then is trying to params _x
no, he's not
Ah no he doesnโt
i"m just trying to fix a spyglass function that dont work anymore cause of bis update.
its for comparing client display to display in array
Others codes have missing โ even more confusing
make sure tabs vs spaces match up
in debug consol
getText(configFile >> "RscDisplayMainMap" >> "onLoad");
result is
"[""onLoad"",_this,""RscDiary"",'GUI'] call (uinamespace getvariable 'BIS_fnc_initDisplay')"
My array [["RscDisplayMainMap","[""onLoad"",_this,""RscDiary"",'GUI'] call (uinamespace getvariable 'BIS_fnc_initDisplay')"]];
this is the good way or not?
sorry but i"m not good in this.
Obviously different
Canโt rely on string comparison, BIS can change statements whenever they want
Whatever you are doing you are not doing it right
Discord doesn't show us tabs vs spaces
Obviously different
Huh?
"[""onLoad"",_this,""RscDiary"",'GUI'] call (uinamespace getvariable 'BIS_fnc_initDisplay')"
"[""onLoad"",_this,""RscDiary"",'GUI'] call (uinamespace getvariable 'BIS_fnc_initDisplay')"
Certainly not obviously different to me
It is on my screen
In the first line it looks like a tab yours looks like space
Discord doesn't transmit tabs
I canโt post pic Iโd show you
Well on the second one it splits into a newline
the space is the same if you copy paste
You post has single space
I assume you copied from that?
That looks like tab
Well it could have some non printable char dragged along
Which would make string different
Talking about image you posted
The image doesn't have tabs
it's a discord screenshot
THERE ARE NO TABS IN DISCORD
guys pastbin show tabs?
@Dedmen for me its just looks the same
to me too
that's why i told you to log the output of the isEqualTo's
which you still didn't tell me if you did and what results you got
hmm ive edit a bit just deleted Onunload wait a sec
hmm now i'm seeing a real difference.
{
_x params ["_class","_expectedOnLoad"];
private _onLoad = getText(configFile >> _class >> "onLoad");
if (_onLoad != _expectedOnLoad) exitWith {
diag_log format ["onLoad : %1 expectedOnLoad : %2",_onLoad,_expectedOnLoad];
};
} forEach [["RscDisplayMainMap","[""onLoad"",_this,""RscDiary"",'GUI'] call (uinamespace getvariable 'BIS_fnc_initDisplay')"]];
Result exitWith is triggered
output
onLoad : [""onLoad"",_this,""RscDiary"",'GUI'] call (uinamespace getvariable 'BIS_fnc_initDisplay')
expectedOnLoad : [""onLoad"",_this,""RscDiary"",'GUI'] call (uinamespace getvariable 'BIS_fnc_initDisplay')"
This canโt be real result, expectedUnload is invalid string
Looks like the game is trolling me
it has the quote on the end because @tough abyss removed thes tarting but not the ending quote
it is valid
So.. Were there tabs in there now or not?
The only way to be sure is to log not the string but toArray
diag_log format ["onLoad : %1 expectedOnLoad : %2",toArray _onLoad,toArray _expectedOnLoad]; log this @tough abyss
onLoad : [91,34,111,110,76,111,97,100,34,44,95,116,104,105,115,44,34,82,115,99,68,105,97,114,121,34,44,39,71,85,73,39,93,32,99,97,108,108,32,9,40,117,105,110,97,109,101,115,112,97,99,101,32,103,101,116,118,97,114,105,97,98,108,101,32,39,66,73,83,95,102,110,99,95,105,110,105,116,68,105,115,112,108,97,121,39,41]
expectedOnLoad : [91,34,111,110,76,111,97,100,34,44,95,116,104,105,115,44,34,82,115,99,68,105,97,114,121,34,44,39,71,85,73,39,93,32,99,97,108,108,32,32,40,117,105,110,97,109,101,115,112,97,99,101,32,103,101,116,118,97,114,105,97,98,108,101,32,39,66,73,83,95,102,110,99,95,105,110,105,116,68,105,115,112,108,97,121,39,41]"
dont know why i'm not getting " at the end of onLoad.
Because it's at the start
before the onLoad
it's part of the diag log
you are logging a string. thus it logs quotes
you could alternatively just not log a string, diag_log takes anything
There is a tab
so there is a tab?
9 is tab 32 is space
how do you set a texture of a vest with setObjectTexture?
@Dedmen @tough abyss I have just understood, thanks for ur helps.
sorry for the time you lose with me xd.๐
As I said this approach you are taking is not reliable as BIS are free do what they want with onload statements
Hardcoding your version is asking for trouble
@tough abyss ive just tried to fix it, i have not write this.
@tough abyss not sure if you can... Actually.. Don'th think you can
@tough abyss yes u cant do that xd.
how?
or generally set the texture of a vest through console
@tough abyss You have to modeling vests or helmets, you cant use this command for vests or helmets.
To be fair it is "yes, you can" and "no, you canโt". "Yes, you canโt" is pretty confusing
All these native english speakers and their being used to phrases always being the same
english is not my native language
Guys i have question, the impact of a global var on the network, vary with the number of players or not at all?
a public var is sent to each player once
you send it to the server once.
And the server then sends it to every player once
so the players all just see one variable.
The server sees the variable*playercount
hmm so more players, more the network will be use with public var?
on the serverside yes
but also in general. Server has to send position updates to everyone
more players == more clients to send data to
It doesnโt automatically resync so unless you broadcast it again it will only be sent to JIP so minimal impact
hmm i see thanks for the info.
why is my respawn addaction adding duplicate actions from time to time. dupes happen mostly when the server is laggy or player dies alot in quick succession:
player addEventHandler ["Respawn",
{
player addaction ["<t color='#7396ff'>UTIL EARPLUGS:</t> ON",
{
_myPlayer = (_this select 0);
_actionID = (_this select 2);
_earPlugs = _myPlayer getVariable "DW_UTIL_EARPLUGS";
if ( _earPlugs == 0 ) then {
_myPlayer setVariable ["DW_UTIL_EARPLUGS", 1, true];
_myPlayer setUserActionText [_actionID, "<t color='#7396ff'>UTIL EARPLUGS:</t> OFF"];
2 fadeSound .20;
hintsilent str "EARPLUGS ON (-80%)";
}
else {
_myPlayer setVariable ["DW_UTIL_EARPLUGS", 0, true];
_myPlayer setUserActionText [_actionID, "<t color='#7396ff'>UTIL EARPLUGS:</t> ON"];
2 fadeSound 1;
hintsilent str "EARPLUGS REMOVED";
};
},
"args", -400, false, false, "", "(alive _this)", 5, false, "" ];
}];
how can i prevent it from creating duplicates?
Try adding action to _this select 0 instead of player
Might want to try MPRespawn as well
I'm new in coding. can u help me find the error? it says that ";" is missing {if ((side _x) == resistance) then {_x dissableAI "ALL"} else {}} forEach allUnits;
it should say where the semicolon is missing too
or the general area at least
my guess is you misspelt disableAI
you dont need else {} if you dont have any code to execute when the condition is false
you should edit ur scripts in a text editor with syntax highlighting so you can see easier when a command is spelt incorrectly
@swift crane A good editor is Visual Studio Code, has SQF extensions!
Btw, does anyone know what might the issue be in the followinf scenario:
Mission file works perfectly fine on player hosted server. Doesn't work well at all when hosted on Dedi. Any ideas of what could stop some scripts from being executed or smth?
visual code nowadays has even something that is finding more bugs then SQF-Lint does ๐คฃ
though ... not public afaik
hey all am trying to make a costom ui panel carmra for a gun sytem on a vic i have the panel art work done in paint shop but dont know how to get this panel to show inside the carmra system any help is more than welcome at this point. am trying to do this please see video timestamed his https://youtu.be/Kigx15FEPfg?t=1162
please also not that we have the model also the ui interface we made with pant shop just looking to find out how we implent this to are gunner cammra
Is there a way/tool to see all of the global and public variables present in the mission? Like function viewer but shows all of the variables in missionNameSpace. I've read up on allVariables but is there a "Var Viewer" ?
allVariables missionNamespace select { !isNil { missionNamespace getVariable _x } } apply { missionNamespace getVariable _x }
there you now have a var viewer
Nil vars are deleted from all variables on mission namespace AFAIK
private _allVars = allVariables missionNamespace select { !isNil { missionNamespace getVariable _x } };
private _control = (findDisplay 46) ctrlCreate ["RscListbox", -1];
_control ctrlSetPosition [0,0,1,1];
_control ctrlCommit 0;
_allVars apply
{
private _index = _control lbAdd _x;
_control lbSetTooltip [_index, missionNamespace getVariable _x];
};
might work
If I want custom loadouts, how faster is createUnit from custom unit class than setting loadout through script exported by Virtual Arsenal?
I mean, performance of setting loadout through scripts, maybe there is something I am not aware of because of which I should favor setting up units in cfgVehicles rather than setting their loadout through script? no?
I am going to spawn units dynamicly, like ~20 of them or more sometimes
cfgvehicles just needs to send classname over network. And all the loadout adding is done in engine
with script you ofc are doing the loadout stuff via script, and it needs to be propagated over network too
But... The work isn't worth it. Just use scripts
so, you don't think that it's going to slow down creation of multiple units a lot, right?
no
Cool, thanks!
It's interesting. If I need stuff to be put into backpack, do I still need a separate backpack class?
This is not what you asked initially, you asked to create unit with certain class in order to get loadout you wanted as far as I understood. You can just setUnitLoadout on existing unit with the same class thus avoiding creating a new unit
Allright, let me refine my question: I want to add custom unit loadouts for AIs in my mission. Question is, which way to go: export script from Virtual Arsenal or create configs for units. So far, the script approach seems to be better. Thanks.
You measured the speed?
No not yet
well, vs speed of developing configs...
Because you need to make them every time at runtime? Yes of course
BTW you can export loadout into config from virtual arsenal just hold shift
Or Ctrl shift https://community.bistudio.com/wiki/Arma_3_Arsenal
๐ค I guess it doesn't export a backpack for me?
I might be wrong but I was studying some standard arma configs for soldiers, so light AT NATO soldier has this backpack class specified: B_AssaultPack_rgr_LAT
And here's what this backpack class looks like, it specifies what items the backpack has:
class B_AssaultPack_rgr_LAT: B_AssaultPack_rgr
{
author = "Bohemia Interactive";
_generalMacro = "B_AssaultPack_rgr_LAT";
scope = 1;
class TransportMagazines
{
class _xx_NLAW_F
{
magazine = "NLAW_F";
count = 2;
};
};
};
So, are you sure that I can export backpack items with the arsenal?
If you export config it will export backpack name and when you load from config it should apply this backpack with its config content
Because this is how loading from config works in engine
but will it export a backpack config with it's items?
that's what sparker asked
ofc the backpack config entry for the unit is there
I dunno try it
Ok, gonna try that, thanks!
Allright, the backpack items seem to be added properly if I export into config and then use setUnitLoadout, unfortunately it removes all weapon items
And... WHAT O_o setUnitLoadout: 700 us, running same loadout exported from arsenal as SQF: 60 us ๐ฎ
Any idea why config setUnitLoadout is so slow?
anyone here good with Life mods?
What's the problem?
Hey everyone, I imported my first weapon today but I'm somehow to stupid to get a custom firing and reload sound in the config, can someone help me out?
I guess config questions go to #arma3_config
oh my bad, misclicked
Line 142 fails on life_server\init.sqf
Unknown var fed_bank, any ideas? Is it just looking for an object called that?
/* Set the amount of gold in the federal reserve at mission start */
fed_bank setVariable ["safe",count playableUnits,true];
[] spawn TON_fnc_federalUpdate;
yes. by default fed_bank is the red container inside the main fed dome, if you have renamed or deleted it, this error will occur.
fed_bank being the variable name of the object
And... WHAT O_o setUnitLoadout: 700 us, running same loadout exported from arsenal as SQF: 60 us ๐ฎ that doesnโt look right, you sure? I get sqf taking longer than applying from config
ok, also any tips for getting started or any videos for altis life scripting. Anything to get me up to pace with deving in this gamemode would be awesome
30 lines of code in sqf including loops and not including comments, how on earth you get 0.06ms itโs a mystery to me @astral dawn
And shame on you for making me fire up PC
@severe bolt reading someone's code is not a good way to start IMO, try to do something on your own without touching any other's ready code first, who knows how improperly it may be done really...
any videos?
hmm... I can't recall when I ever studied programming by videos ๐คท
Same but they help sometimes
I started by reading someone elseโs code and looking up wiki for the meaning of the commands, is there any other way like university course one can take?
did the same ^. i actually started out by rewriting life systems to be less shit.
made it a bit easier because i could see the end product, just needed to make it work better.
anyone able to tell me where im missing a ; if _dam is greater than 0.5, then;
post the actual script
https://community.bistudio.com/wiki/a_greater_b
did you copy from the description instead of the syntax/example?
used a example from another page
if(_dam > 0.5) then
{
};
post your code
we have no idea what is actually causing the error until you do
Player getHitPointDamage "Leg";
_dam = HitPointDamage "Leg;"
if(_dam > 0.5) then
{
playSound "LegBreak";
[] spawn
{
_sound = ASLToAGL [0,0,0] nearestObject "#soundonvehicle";
sleep 1.2;
deleteVehicle _sound;
};
};
_dam = HitPointDamage "Leg;" // <--
if(_dam > 0.5) then
also HitPointDamage isnt a command
private _dam = player getHitPointDamage "hitlegs";
i feel like you have copied that whole then snippet right off the wiki so its worth noting: you dont need that spawn unless the sound goes on for longer than you want it to.
i did
lol
i have no idea what im doing and just going off of wiki and trial and error
it doesnt throw an error
but doesnt play the sound
does the sound exist?
AI are bad drivers because make then good drives would require too much processor power?
anyone know why it wont play the sound?
Quick question. Iโm trying to create a while loop but Iโm struggling with how to implement it in Arma (much more familiar with Java). Long story short, I want to setDir the AI (+= 10) until it faces the player.
_unit setdir (getdir _unit + (_unit getRelDir player));
no loop required
makes me wonder why commands like getRelDir when alt syntax for getDir does the same thing
is it for "oh I didn't realize that already existed because there wasn't a command blatantly named getRelDir"
Awesome. Would you happen to know how to increment it by 10?
that will immediately set the direction of the AI to face the player
so you want it to increment by 10 every few seoncds?
Basically. Tested it manually myself and it works pretty well
getDir _unit; // 90
_unit getDir player; // 188.47
_unit getRelDir player; // 98.446
they dont appear to do quite the same thing
i do see what you're saying though for this specific case, getRelDir is unnecessary. wasn't aware of the getDir alt syntax.
private _dir = _unit getRelDir player;
while {_dir > 15 && _dir < 345} do {
_unit setDir (getDir _unit + 10);
uisleep 1;
_dir = _unit getRelDir player;
};
something like this would probably work. my test ai keeps turning back to the original heading though so i assume you already have something worked out to stop that.
doWatch and lookAt aren't going to get 10 degree increments without getting the position relative to the direction facing
I was more or less referring to keeping the AI on target and not turning away
After the original script executes
Why do you need the increment then?
So basically, I was looking at Arma 3 (again), and I saw how the AI just seemed to pivot almost perfectly in place. I did a basic setDir script for the AI (at 2 degree increments) and it looked basically the same
This isn't the case with certain statuses
weapon raised for example, you might observe this
Still, itโs not a bad idea for CQB situations to create your own AI turn
Couldnโt you if you wanted to create an animation and have it executed depending on the circumstances
Yes, a lot of the ai behvaior uses FSM to do this
Well, thatโs basically what Iโm aiming for
if i read the wiki right if I do
"hello" remoteExec ["hint", clientOwner];
that will only hint "hello" to the local client? so say I have this inside an action menu like such
_this addAction ["hint thing",
{
"hello" remoteExec ["hint", clientOwner];
}];
clientOwner being the local client sure. But why would you execute something remotely to yourself?
i was gonna hint the vertical speed of the aircraft when the action was clicked
then just use hint. It'll only have effects local
hint format["Vertical Speed: %1",(velocity _veh) # 2)];
ive had it where it would do that globally,perhaps thats cuase I was using the MCC execute block in zeus
ye
Hmm, I think my brain is crashing... count command returns total count of all elements in array.. how do I toggle through each element, thinking my best option is to use addaction.... but kinda lost on how to toggle through the element
how do I toggle through each element uhh, depends what ur trying to do but any loop will work. apply, count, findif & foreach being the obvious picks because they all set the current element to _x.
Trying to toggle through the array with an addaction without having to use the select command....as the array is dynamically updated...
i completely forgot about select ๐ข
what do you mean by toggle through the array?
Yeah, I'm using !isnull to check the element has a value... for example at the start of a scenario we may have [1,2,3] ... some time later that same array is now [1,2,3,4,5] . The amount of elements in the array can change at any time.
Just wanting to toggle select 0, select 1, select 2
But because the array is dynamically updated, I can used the select command
Each element in the array is an object
use a for loop from 0 to 2?
Yeah thats what I first thought, that would work perfectly is the array always had 3 elements
If the array*
Is there a command that returns current element?
depends on the kind of loop
the ones mentioned above all use _x. the other loops dont but you can set a counter to increase with each iteration and select from the array that way. eg in a for loop _obj = _array # _i;.
i honestly still dont understand how any of the loops dont work for what you're trying to do.
Aha! ^^^^ thank you! "For loop" ... apologies, it's been a long day. I knew I was having a brain fart
Hi Arma friends. How would I create a trigger that activates once an item enters an area?
what kind of an item? some specific one or any item?
Yeah a specific item, I've gave it the variable name "i1"
just to be clear
its an inventory item, not unit or vehicle
would be helpful if you explain what you want to do
Yeah, the task is for the player to raid a house, pick up this item - a briefcase of money from a mod I have downloaded - and bring the item back to base.
so the item would be carried by a unit?
One way would be to check the contents of inventory for anyone in the trigger area
and if the item is in someones inventory then the trigger activates
That would be ideal, how is that done?
Im at work so can only throw ideas at you. Look up how trigger conditions work and use thislist to get all the units in the trigger area and then look up commands to list inventory items of a unit and loop that to all thislist units with for each for example and check that list if it contains your briefcase item
Use Take and Put EHs instead @long pewter
would this work for what he asked?
{
_items = items _x;
if("money_class" in _items) then {somethingHappens}
}forEach thisList;
@tough abyss Can you explain please?
Thank you Arma brothers
Anyone had any problems with arma-s respawn function, so that after while and some dying enemy comes somehow "friendly"? They will ignore player completely(also both in coop)
I am using Kaartomedias "AI Spawn Script Pack 1.0" and game is usually CO-OP with a friend.
Respawn is done by description ext as instant with 30s timer with no gear.
is there a way to get all the variables in an array which names start with "varName" and then push them all to another array?
private _newArray = _oldArray select {_x find "varStartsWith" == 0};
you mean something like this?
