#arma3_scripting
1 messages ยท Page 323 of 1
Not sure if you can even have actions on WeaponHolders
@queen cargo So a ctrlsGroup would pretty much be the only option? What exactly do you mean by "merging together"?
exactly that @rotund cypress
I guess it would work fine, but does certainly not seem elegant. From what I've seen with 3DEN etc they're not using that for child displays, yet they show up upon the other display @queen cargo
3DEN is done a lot engine-whise
you also could create the UI dynamically using ctrlCreate
Ye maybe that is why...however using ctrlCreate does not seem like a good idea so I guess I will stick to a ctrls group then ๐
ctrlCreate most certainly would not be elegant ๐
ctrlCreate is pretty elegant actually
you just need to code your elements in position
that is all
some pretty simple process
you even could automate it
(converting from cpp to SQF/cpp)
Ah ye you mean getting the positions with getNumber or getText etc etc from a hpp
actually ... i mean using an external tool to transform
but that also would be possible
Aah, is there such a tool available somewhere? @queen cargo
not rly
would not that hard to write though ...
you also can catch all that via SQF though
it is more or less equally hard
The black box you are prompt with showing script errors how do you disable that as everybody in the server can currently see it :3
Theres no actual errors just undefined variables as they are defined in another file.
Another special question... dose anybody know how to modify this menu to only display 'vests' (Altis Life) searched every single file and cannot find it assuming i need to create a new life_fnc_ https://steamuserimages-a.akamaihd.net/ugc/836955342143152192/B5676221A7DC7B4133DE49F810053025DC1718B4/
You cant disable client errors showing up if they got scripting errors debug enabled when starting the game @narrow musk
Just fixed that it was in the server files i turned debug on and forgot to turn it off...
has anyone here done anything with cfgMusic?
im trying to figure out a way to get the music to fadeOut while its still playing and then stop the track once its muted
iv been looking at https://community.bistudio.com/wiki/fadeMusic but it does not work
nevermind i found the issue lol
/facepalm
is their anyway to stop a music track mid play?
I'm curious, is there a way to overwrite a terrain's geolocation via script somehow? Someone was setting up a MP server and was tyring to think of a way to keep people from using gamma from having the upperhand over people actually playing the game properly and using nightvision. I was thinking if you could overwrite the geoloc to somewhere where it doesn't get really dark at night, bam.
reason the fadeMusic was not working was due to aceHearing overiding the setting, so for the intro i disabled it
@sour drift will setting the date so that night time is under a full moon not work?
eh that doesn't have the best effect. For starters, there's still a period of almost pitch black before moon enters sky
and people using gamma still have upperhand.. if the sky was brighter, I'm thinking turning up gamma would blind you, but having nightvision would still be effective.. dunno maybe my thinking is flawed
only thing i can think of is by running some sort of postProcessing effect via script
on init or something.. dunno I know jack sht about scripting, I've just been making terrain for 2 years =p
im kind of in the same boat, but i can disect scripts and see how they work lol
still looking up how the addMusicEventHandler works
dont think you can use that to stop the current track playing
the addMusicEventHandler will return an event when the music stops playing but nothing about actualy stoping an already playing track
@sour drift is the mission some sort of PvP?
wellll I think they're planning on using Exile and tinkering with it a bit, less survival and more tactical or something
so yeah pvp
Wasn't really looking for a working script though, just was wondering if it would be possible, thanks =]
It would be the latitude and longitude settings in the terrain's config.cpp that would need to be overwritten... which I assume that would be the same as changing the starting time/date.
can i use: (findDisplay 46) createDisplay "someDisplayName"; To create a display that will show on the player's screen and not take over their mouse? If not how would i go about creating a display that will be constantly there, and not take over the player's control?
I guess you want "RscTitles"
ok, is that a kind of display?
@jade abyss
i am about to try this ```sqf
cutRsc [display name , "PLAIN", 10, false];
Yes
cool
so all i need to do is that, and then closeDisplay to close it?
This will show the dispaly, and the player will still have control of his character?
(findDisplay _coolRsc) cutRsc["","PLAIN"]; ?
Not even that
@jade abyss Tahnks
Are you implying it requires less or are you saying I'm not even in the ballpark?
on the wiki there are two syntaxs
one requires the findDisplay thing, the other doesn't which is correct?
e.g.
waitUntil { !(isNull (findDisplay 46)) };
41 cutRsc ["MyRscTitleName","PLAIN"];```
Also works:
```sqf
0815 cutRsc ["MyRscTitleName","PLAIN"];```
ok so 41 is the geneeric display that all other displays can be created on?
No, 41 is the one i used, because of: Distrikt41 ๐
ok so the idd of the display?
can't you also allow it to assign a random number?
why do i need a number at all? what is it's significance?
1,2,3 is a bad choice, obvioulsysfkingfon fkn hate that word
*obviously (hate)
lol
@subtle ore so that number is the numberr that cutRsc assigns to the dsiplay being created?
either way, i will try and figure it out
Oh, since 1.57 also with LayerName. Nice to know
You can also immediately remove resource with cutFadeOut command: ๐คท
ok, so one display/dialog can have many layers, each with its own number or name yes?
if not, don't worry, i will stop asking
Display, yes. imho it should also work with Dialogs.
ok thanks for your patience and your help
+Take care, that you have onLoad setVariable stuff set up.
Example how to access a specific Ctrl in an RscTitles Layer:
disableSerialization;
_Display = uiNamespace getVariable ["MyRscTitlesName",DisplayNull];
(_Display displayCtrl SelectedCtrlIDC) ctrlSetStructuredText parseText format["<t size='%3'><t align='center'><t color='#FFFFFF'>%1 | %2</t></t></t>",2, 5, (0.88 * safezoneH)];```
( (0.88 * safezoneH) = specific Size, so it's in every UI-Size the same height/width)
ok thanks
Example RscTitles. Makes things easier to play around with:
https://pastebin.com/Ac9yHmkX
F5 the page.
i need to do this so that when i go to create the RscTitle latter, in another script , it will know wht MyRscTitleName is?
like if i said ```sqf
35 cutRsc ["MyRscTitleName", "PLAIN"];
?
Yes, as long as it's in the RscTitles part of (e.g. for missions) description.ext
ok thanks, its weird, i haven't needed for createDialog, is that a different case?
createDialog usually works well, without the whole onLoad = blahblahblah thing
Otherwise you wouldn't be able to access it.
yeah that makes sense.
call My_fnc_To_Update_The_RscTitles; This fnc you put in the example, why do you need it, if you have already saved the RscTitle's name into the uiNameSpace?
nvm, i just found a blog on killzone kid about it
i will find all the answers i need there, thanks
rgr
@jade abyss it's all working now, thanks for you help
Is there any absolute textbook method for looping? Or is it completely contextual?
๐ค ?
๐ค
Oh come on now, I wasn't being that vague. I was implying something other than while{true} do {//this is definitely true};
and use forEach whenever it's applicable
there was a kill zones guide for that
Using something when it's applicable applies to most things
yeah but loops are common go to solutions when something can be done easier with event handlers and forEach
a forEach is a loop
but a more efficient one, isn't it?
Depends what you're doing exactly
as loops I meant while True and for
Specifically for iterating a collection
the common ones for newer to scripting
Count loops out perform forEach loops, assuming you don't need forEachIndex of course
oh, that's new for me
Really depends on what you're doing. At the end of the day, unless you're trying to shave fractions of a millisecond off, it's irrelevant ๐
yup, but some things just can be easier to write with forEach and Event handlers.
wish there was an engine function to either make player go out a vehicle with or without a weapon
write with forEach and Event handlers wondering what event could be catched via a game loop ...
you have to prevent him moving with weapon then in first place
there also is SwitchMove that might be helpfull
yeah I'm just using a EH getoutman and action switchweapon
I meant just an engine function like canWalk true/false
would require some more work though due to you being in need to provide the correct move for the correct gun
or forceWalk, whatever you know the drill
Is there a way to create a command from a function. Say if i had a function called mld_fnc_MyFunction that required 2 params. Is there a way that i can make into a command, so that i can just type ```sqf
[_test1 , _test2] function;
No
: ( thats annoying
i mean kinda like the way you can make bash scripts in linux, and then use them as commands later
but if no, ok ๐
macros is the closest you'd get
well you could create a function that you give params to and the function returns a value
if that's what you mean
say you want something like that
myaddedvalue = [15,30] call my_fnc_addup;
my_fnc_addup
_value1 = _this select 0;
_value2 = _this select 1;
_result = _value1 + _value2;
_result
@simple solstice yeah. i am doing that atm, but i was trying to get away from having to write spawn or call and My_fnc_ every time i want to run a function
dont use spawn unless you need to suspend
i need to suspend ๐
there's not other way then other than this or macros
๐
@limpid pewter Is there a way to create a command from a function. Yes Intercept can do that. But syntax would be function [_test1, _test2] or _test1 function _test2
intercept?
You need some C++ knowledge to use it though. And doesn't work with Battleye
But it does exactly what you need
@still forum is Intercept ever going to be whitelisted by Battleye or is that non-possible?
It is definetly possible. We aren't doing anything that Battleye considers as malicious anymore. But we never asked BE if they would whitelist it
Even if they don't want to.. The likelyness that they would accidentally whitelist it is quite high. They also whitelisted my script debugger that allows anyone to execute arbitrary scripts anywhere. While noone asked for it to get whitelisted
that's stupid.. whitelisting a potentially malicious private 'hack'
Yeah. But apparently Battleye whitelists everything if enough people try to load it over some time.
which can get problematic especially with the debugger ๐
Hi. I'm hoping some experienced scripters will see this xD
I have GunnerTurrets and CargoTurrets in my VTOL. I want the Cargo positions to be able to enter the gunner positions (in same compartment), but only when certain conditions are met. I dont want them to be able to do it when Guns are turned in.
can this be done in a script? (change compartment when animation == 1 or something?)
if you want to disable, create a dummy gunner
when condition is not met
if you want to enable
use addAction
ah so I can spawn an invisible gunner to take the spot? brilliant
@queen cargo
do you think you could post an example of using addAction for this purpose?
addACtion should be used to get a non-manable gunner slot manable
not to get it "forbidden" when default is that the slot is manable
to spawn a dummy, just add event handlers to the vehicle via addEventHandler
ok ty I will try
@still forum wait you have a script debugger, which can execute scripts anywhere and its whitelisted by BE because a lot of people downloaded it?
ArmA.Studio @delicate lotus is build around it
and yes, the range of ArmA.Studio was enough (that and the fact that the game always loads it)
exact details about how and why is not known though
did you read my msg?
ArmA.Studio
go
download it
put the debugger in your
or wait
mb i should link the wiki
yes pls
hf
it is stable enough
though i would recommend using the AppVeyor in-dev build instead
okay, thanks
no proble
m
if you need help, https://discord.gg/RRaPyb9
mb i also should start implementing the pbo-build feature
so many todos ...
Or maybe conditional breakpoints? :3 So that people actually really can execute arbitrary scripts? ^^
that actually is a thing of few minutes
more or less
requires new dialogue
can do that today if ya want
I have no need for that right now ^^
wait so you can execute scripts on normal game servers with that?
game servers not currently due to the debugger being limited to local computer right now
but it is planned down the road
You could join Battleye protected servers. And place a conditional breakpoint. And it's condition is arbitrary SQF.
But not anymore. As the Debugger should not be whitelisted anymore. I hope..
still you could edit variables with that
like the money on altis life
and then broadcast it using publicVariable
hey guys need some help
default {[visiblePosition _x select 0, visiblePosition _x select 1, ((_x modelToWorldVisualWorld [0,0.1,0]) select 2)+.5]};
_idc ctrlSetPosition [_sPos select 0, _sPos select 1, 0.4, 0.65];
yet i cant get it to move down
_idc ctrlSetPosition [_sPos select 0, (_sPos select 1) -0.9, 0.4, 0.65];
would that work
_idc = _ui displayCtrl (iconID + _forEachIndex);
whats number 2 from above comment
thats the full thing
im lost but thats not hard
yea i cant figure this out lol
my life
its prolly quiet clear but i do not undestand what you mean
it works but i cant get it to be above the head
its just going high
modelToWorldVisualWorld
i guess i should use the old 1
Anybody got the scripts that used to be hosted on the old altis life rpg website for the taxi?
Ah i dont expect you to share what you created somebody publicly released one, thanks tho :p
@narrow musk taxi as in an ai driver? if so epoch forums has smth like that public
No i mean the job taxi driver for altis life, that sounds pretty cool tho if i cant find it ill just create my own ai taxi for malden.
ah ok
Anyone know how I can locate the position of those hangar lights in Land_Hangar_F via script or am I going to have to find them all manually? Last I checked you could find a geometry position and select it?
maybe nearestObjects or nearestObject?
would that pick up on the lights? Because afaik they're just a part of the model they serve no purpose further than asthetics
Even worse, it doesn't even collide with bullets, objects. So I don't think commands like intersect or lineintersects would work since it's based off of raycast collision?
Could try https://community.bistudio.com/wiki/selectionNames on the object
And then https://community.bistudio.com/wiki/selectionPosition to get the model space position
Then https://community.bistudio.com/wiki/modelToWorld I guess.
I guess a crate is no entity?
@hollow lantern Huh? I'm not sure what you are talking about, it's the hangars.
I guess it wasn't related to your stuff ๐ sorry ^^
If selectionNames reports nothing then all you can do is to find the positions yourself. Best would be to get them in model space, so you can get them from any hangar once you fiddled with one.
@little eagle Well shit, I was hoping I didn't have to. Thanks for the help.
@hollow lantern yeah, no worries.
Is it possible to hide the player model but to keep the collision?
@hasty violet Yes. If your code get's recompiled a lot. So execVM for example.
But that's just because larger code needs more time to compile. And by including anything you are making your code larger
But if you use SQF in a responsible non-retarded matter. Then the answer is no.
Is there any way to remote control an object as a player so you're able to walk with it? No problem if a modification is necessary to solve that problem ๐
I wonder if you can do that to animals. I know with seagulls you can but haven't attempted other animals
@tough abyss Should work for fine
Not sure if this is the right topic to ask in but does anyone know any good guides/tutorials on battleeye filters? Trying to understand them
You'll probably have better luck in #server_admins
does anyone know if there is an empty or near empty dialog in the ui_f config that could be used as a base for scripted dialogs populated with ctrlCreate?
this works, in case someone needs it.
createDialog "RscDisplayHintC";
{
_x ctrlShow false
} foreach (allControls (findDisplay 57))
RscDisplayEmpty only has one control - the vignette. So it should be perfect for createDisplay, but not so much for createDialog.
As that would double show the vignette...
Is there a sexy way to get armas root dircetory ingame? Mission root is no problem, but i couldnยดt find arma root...
@pulsar anchor What for? I don't see any use for that ingame.
I guess for getting ArmA default assets? @still forum @pulsar anchor
But doesnt just \A3... work ?
If you have filePatching enabled you can load files outside of Arma directory (I think) But by default it already is inside Arma directory. So I don't see any use from SQF where you could need that
I'm also pretty sure you can whitelist file extensions like .php , html etc.
Ex: "\a3\ui_f\data\igui\cfg\actions\heal_ca.paa"
Its not about the assets, its about a extension dll. Just thinking about possibillities^^
serverTime or time for displaying server uptime to players? From what ive read, both suffer from sync issues and lag
what could you do with a dll by accessing it inside the engine @pulsar anchor ? you would only be able to read it as text at best?
serverTime is broken afaik. Time is not synced
use CBA_missionTime if you can
tho none of them are uptime really
not scripting, but !upt if using BEC
hey, how would i get an array of all the weapon attachments? maybe something like this```sqf
_muzzle = getArray (configFile / "CfgWeapons" / Myweapon / "muzzle");
or maybe ```sqf
_all attachments = getArray (configFile / "CfgWeapons" / "accesories");
First step would be using >> instead of /
@pulsar anchor Why do you need the Arma directory for an Extension?
You can easilly grab it within the extension.
@limpid pewter Something like this should work:
_compatibleItems = [];
{
_temp = getArray (configFile >> "CfgWeapons" >> _typeName >> "WeaponSlotsInfo" >> _x >> "compatibleItems");
_compatibleItems append _temp;
} forEach ["CowsSlot", "MuzzleSlot", "PointerSlot", "UnderBarrelSlot"];
_weaponClass = "";
_compatibleItems = [];
{
_temp = getArray (configFile >> "CfgWeapons" >> _weaponClass >> "WeaponSlotsInfo" >> _x >> "compatibleItems");
_compatibleItems append _temp;
} forEach ["CowsSlot", "MuzzleSlot", "PointerSlot", "UnderBarrelSlot"];
Change weapon class to your weapon
Even simpler than that, just found a BIS function that does the same thing, BIS_fnc_compatibleItems
So [_weapon] call BIS_fnc_compatibleItems
ahh nice thanks
@halcyon crypt oh thx! just saw it
Would there be a simple script I could place in the init of a turret to change which side it was on?
I can spawn turrets on different sides with a script, but I don't know how to place on in the editor, but have it be a different side than what it was designe to be.
Hey guys! I haven't had to bother people with my shenanigans in a while. So the goal today is to use startLoadingScreen until all playableunits are loaded in. Effectively preventing any initial desync from the mission. The problem: playerReady is reported as "undefined".
if (isServer) then {
"playerReady" addPublicVariableEventHandler {readyList = (readyList +1);
if (count readyList == {isplayer _x} count playableunits) then {
allReady = true; publicVariable "allReady";
};
};
};
if (hasInterface) then {
startLoadingScreen ["Loading My Mission"];
waituntil {!isnull player};
playerReady = true;
publicVariable "playerReady";
waituntil {(time>0) && (allReady)};
progressLoadingScreen 0.5;
//Batch of code
//Batch of code
//Batch of code
endLoadingScreen;
};
My guess is I'm not broadcasting allReady as intended
I assume you're creating the units via script? Or what else do you mean by "initial desynch"?
It's an extra step to ensure the mission starts at the same time for everyone
That is not desynch then.
Honestly, the easiest thing would be to just have the admin wait in the lobby until everyone loaded in.
The waituntil {!isnull player}; you're using has nothing to do with this, so you cannot use it like that.
wait in the lobby wait in the briefing
Does somebody know the decorated name for the RVExtensionVersion interface? It's not documented here: https://community.bistudio.com/wiki/Extensions
Where is that function even Documented?
Can you give me the function syntax?
void __stdcall RVExtensionVersion(char *output, int outputSize)
That will be RVExtensionVersion@8 then
Is there a generic rule why it is @8?
Is there any way of using something like find in nested arrays?
Sure, just iterate through your elements, however deep you need to go. BI have a function for this IIRC
I also think KK made a blog post about it
Well I have something like that
[[142,"Johnny"],[153,"Bob"]]
And I would like to search if for example 142 is present, and then select the string
Now im just doing it without nesting, by finding the id, adding +1 to it and selecting. Works fine, but I was just wondering if you can use find in nested arrays.
For something as trivial is this, your method is absolutely fine. They don't provide a command to do such a thing (all in one) AFAIK, so a basic SQF implementation is fine
ok, thank you ๐
is _this in Eventhandlers that only have one argument (Like Deleted) still an array with one element? Or is it the one argument as value?
Array @still forum
Thank you! Thanks to your advice I can keep working :3
And I know I did alot of stuff wrong yesterday
If handleDamage (https://community.bistudio.com/wiki/Arma_3:_Event_Handlers#HandleDamage) returns the value of it's damage parameter. Would the effect be equal to HandleDamage returning Nil ?
Yes. That would be Nil.
But does "default damage processing" equal the damage parameter's value.
The eventhandlers wiki is not very informative if a handler returns something or not. I guess I'll add a column
If it is build consistent the "default processing" is the damage value itself
Is it not possible to create a wiki account any more? I'm quite sure I had one but I it's not working any more (even password recovery not working)
would be nice
I'll PM you in a sec
void intercept::post_init() {
addEventHandler<eventhandlers_object::Fired>(sqf::player(),
[](object unit, string weapon, string muzzle, string mode, string ammo, string magazine, object projectile, object) {
sqf::system_chat(sqf::format({ "%1 fired %2 with %3 resulting in %4",unit,weapon,ammo,projectile }));
}
);
}
I'm happy now.
For RscDisplayInventory's control SlotPrimary and all the other controls that extend it: The config viewer says they have type 11
However, when the ctrlType command is used. It returns 103 (CT_ITEMSLOT).
This contradicts the descriptions of the command which reads
Returns number representing the type of control, which is also defined by type property in config.
Probably more #arma3_config than #arma3_scripting
@still forum alright ill post there but leave the information about ctrlType
Hey folks.
I am wondering if this already exists before I get started.
Looking for a way to have my players requistion weapons / ammo / etc
Whats out there so far for this?
@hearty plover Sry, what do you want to know? Maybe this helps ( https://community.bistudio.com/wiki/weapons ) , ( https://community.bistudio.com/wiki/magazines )
I want to run a script when a player honks a horn. I know that no Fired event happens on horn honks - is the only way to do what I want to override the mouse 1 like this post shows? http://www.armaholic.com/forums.php?m=posts&q=16472
I'm assuming a SoundPlayed event handler doesn't fire because it isn't coming direct from the player character, right?
Didn't think to check SoundPlayed yet
Does anyone know how to set the exported variables from the CBA mod settings? For example there are some TFAR variables that cannot be set from the module.
No worries found it - https://github.com/CBATeam/CBA_A3/wiki/CBA-Settings-System
@frosty cave I don't expect it to work, but if it does, lmk. I'm curious now.
from what I see in https://community.bistudio.com/wiki/Arma_3:_Event_Handlers it's a long shot
Anybody know a scripted approach to checking which CustomInfo panels a given vehicle has available? I've been checking the config for the classes listed in the BIKI article but some vehicles provide a Panel that isn't in the config. Eg the vanilla unarmed Hunter offers a MiniMap panel in the driver's seat, no MiniMap in the passenger seat, and doesn't have the related DisplayManager Components class in the config at all.
I wonder if enableGPS = 1; in the vehicle config is overriding any present or absent DisplayManager* classes
Question re performance: In a local-only script / client-side addon scenario, is there any benefit to storing a variable on the player object rather than the mission namespace?
or vice versa
In a basic test with strings, storing on the player object was faster, but retrieving was slower than the mission namespace - so it kind of balanced out. But are there any other best practice reasons?
i'm rtrying to limit an arsenal to a specific set of units
but nothings happening'
dodarray = [DOD1];
if (player in dodarray then {
{
["Open",true] spawn BIS_fnc_arsenal;
}
else
{
hint "You are not authorized for this equipment!"
};
any ideas?
if (player in dodarray -> if (player in dodarray)
oh derp
also you have an extraneous { after then
dodarray = [DOD1];
if (player in dodarray then)
{
["Open",true] spawn BIS_fnc_arsenal;
}
else
{
hint "You are not authorized for this equipment!"
};
//
no
thats not right
if (player in dodarray) then {
dodarray = [DOD1];
if (player in dodarray) then
{
["Open",true] spawn BIS_fnc_arsenal;
}
else
{
hint "You are not authorized for this equipment!"
};
//
dodarray = [DOD1];
if (player in dodarray) then {
{
["Open",true] spawn BIS_fnc_arsenal;
}
else
{
hint "You are not authorized for this equipment!"
};
//
hmm still nothing
dodarray = [DOD1, DOD2, DOD3, DOD4, DOD5];
if (player in dodarray) then {
{
["Open",true] spawn BIS_fnc_arsenal;
}
else
{
hint "You are not authorized for this equipment!"
};
youve still got that extraneous {
if (player in dodarray) then { {
Count your braces. The { and '}' should tally up the same
np, gl.
another issue i have been banging my head against: i'm trying to whitelist a virtual arsenal. I figured i could just put an array where the true is in this following statment:
["Open",true] spawn BIS_fnc_arsenal;
but it does not seem to work
am i reading the documentation wrong?
so it would be for example
"Open",["arifle_MXC_F"]] spawn BIS_fnc_arsenal;
@jagged halo addVirtualWeaponCargo is the function you are looking for, remove to remove a weapon vise versa
hey, i have a possibly quick and easy question. Is there a way to make all explsive devices (nades, rpgs, claymores,etc..) do way less damage to infantry?
you can edit the damage multiplyer in Ace i think
or it might be alive
can't remember
@jagged halo Not necessarily take a look at the function header: https://community.bistudio.com/wiki/BIS_fnc_addVirtualWeaponCargo
ex: [mySuperNeatBox,["myCatLauncher_F","myCookieLauncher_F","Rock_F"]] call bis_fnc_addVirtualWeaponCargo;
but if i want it to call on whatever box the script is attached to
instead of the named box?
that's where the first parameter comes into play mySuperNeatBox can be any object
ok does it have to be a weapon or can it be any equipment
you can also (see the biki link) automatically add the virtual arsenal action without an arsenal function call
it has to be a weapon in this instance, you have the same variants for items, magazines, and backpacks
ok so i need to seperate it out into lists, that might be the issue
theres no catch all for items in general?
ex: [mySuperNeatBox,["MyPinkBackpack"]] call bis_fnc_addVirtualBackpackCargo; etc.
are you talking about to deffer between items, backpacks, and weapons?
like i want to just dump the whole RHS items list i ripped out of a mission file
thats not seperated into types of gear
You could do something like this: {if(_x isKindOf["Rifle",configFile >> "CfgWeapons"];) then {hint "It's a rifle!";};} forEach mySuperRHSBigList;
might just be easier to seperate the things i guess
Not necessarily, I don't see as to why this would be harder than sorting them individually?
firstly, you have as tray comma at the end of that array
and parameter zero of that addVirtualWeaponCargo is not a string
ok
[anypotatobox, ["rhs_weap_m4", "rhs_weap_m4_m203"]] call BIS_fnc_addVirtualWeaponCargo;
like that?
Precisely.
That's when you make a function out of it or something. Whenever I run things multiple times I just call it with different params
ok so thats probably what i will have to do
[_box,_aow] call bis_fnc_addVirtualWeaponCargo;```
because i want the zeus to be able to add this code to a box which calls to the SQF that checks if a player is in an array. If they are in an Array they get acces to a specific list of items if not they get a hint.
Wait, Zeus can execute sqf? Since when?
through ares can it not?
this addAction["<t color='#FFFFFF'>Ammobox</t>", "AuthAmmo_PUB.sqf"];
Ooohh. My bad! I was thinking vanilla.
so it would add that which would hypothetically call to the sqf which would do the check
pubarray = [PUB_1, PUB_2, PUB_3, PUB_4, PUB_5];
if (player in pubarray) then {
[anypotatobox, ["rhs_weap_m4", "rhs_weap_m4_m203"]] call BIS_fnc_addVirtualWeaponCargo;
}
else
{
hint "You are not authorized for this equipment!"
};
but with this code is only works with anypotatobox
well addAction takes parameters differently.
selection zero is the object you added the action to, and selection one is the user using the action
Here, give me a moment and I will give you an example.
pubarray = [PUB_1,PUB_2,PUB_3,PUB_4,PUB_5];
[_obj, ["rhs_weap_m4", "rhs_weap_m4_m203"],false,false] call BIS_fnc_addVirtualWeaponCargo;
if (_player in pubarray) then {["Open",false] call bis_fnc_arsenal;} else{hint "You are not authorized for this equipment!";};```
this is super rough, but basically it adds the weapons but only opens the arsenal if the player is in your pub array there
and your this addAction["<t color='#FFFFFF'>Ammobox</t>", "AuthAmmo_PUB.sqf"]; should be just fine for this, as I believe the parameters are already passed from the action
ok thanks a lot i apreciate it!
yep.
Just make sure all of your pub array items exist in the game, otherwise it's not going to understand what to check for.
Yep, sure thing.
just one last thing @subtle ore when i plug that in the arsenal opens up but the items don't show
@jagged halo I made a mistake, params are backwards. Use this: params["_obj","_player"];
now its saying PUB_1 is not authorized
or wait
1 sec
yeah thats what it was before
no weapons
Hmmm..so the arsenal does open up though yes?
yes just no items
I could be totally be making a mistake here, stick with me here one moment
no problem
sorry im falling asleep, let me hit you up tomorrow
thanks for your help dude
Okay, not a problem. I'll figure this out, shoot me a direct message in the morning and I'll let you know. See you later.
Cheers!
blufor reportRemoteTarget [[[vehicle]] player, 60];``` this is wrong right?
example from the biki
yeah it's wrong. [target, time]: Array
needs to contain the two items, the target then then time.
yeh, so should just be [vehicle player, 60];
Yep.
Are there regular expressions in SQF or CPP/HPP?
nope
that's an extension (dll) to do it, but not sure if it's been updated for 64 bit
well, didn't he also have a tutorial for 32 bit extension conversion to 64 bit?
i need some help on making mission peramaters
iv alraedy got the peramater defined in the correct class
but im having an issue with getting an if statement to work with it in the init.sqf file
description.ext
class Params {
class f_param_headless
{
title = "Headless Client";
values[] = {0,1};
texts[] = {"Disabled","Enabled"};
default = 0;
};
};
init.sqf
//Headless Client
if (f_param_headless == 0) then
{
execVM "headless\HCInit.sqf";
HCDebug = 0;
};
i was thinking i could call it like this but its saying undefined variable
that shows me how to define one but not how to properly call it
you need to read further ๐
not seeing it cause the only one that is close doesnt show how it works
thats showing me how to defind peramaters of built in arma functions for that second link
Yep, mission had no idea what "f_param_headless" is on it's own
BIS_fnc_getParamValue returns a number by the way. So if((["f_param_headless"] call bis_fnc_getParamValue) > 0) then { ];
when a paramater is defined via the description.ext, the mission wont know about it before hand unless you make that call bis_fnc_getParamValue?
@subtle ore thank you for helping me understand how it works ๐
not sure if it will, but you could check what the function does in the 'functions viewer' (or on a properly extracted P drive) and do it yourself if it doesn't and you need it to
Hi guys, how can i set my cursortarget/move it to a certain target, in my case a house for a intro ?
cursortarget is what's in front of your cursor.. only way to change it is to point at a house
I need to set my view to the house
a house built in to the map?
No, its spawned
how? with a script?
Yes, i spawned it on briefing
k so it's createVehicle?
Yes
so if you want to do something with it in that same script you could use _house = createvehicle whatever;
or otherwise, you'll need to make it a global var like thehouse = createvehicle whatever
and then replace cursortarget with _house or thehouse
(the underscore makes it a local var)
But how can i set my view to it via the script
@dim owl Want's to create a camera for a Intro. Move it into the house via script. And switch the player view to it.
I think script commands for that are createCamera/setPos/ cameraSmth
yeh that's pretty much the opposite of what i thought you meant.. it's a bit more complicated because you need both the house and a camera position
Yeah or can i use my camera view on camsetpos ?
i can give you an example of what i use, but CBF editing it to look like an example, so just replace anything starting with ASOR
Ok
ASORGS_CameraTarget = YOURHOUSE;
ASORGS_Camera = "camera" camCreate _cameraPos;
ASORGS_Camera cameraEffect ["internal", "back"];
ASORGS_Camera camPrepareTarget ASORGS_CameraTarget;
ASORGS_Camera setPosATL _cameraPos;
ASORGS_Camera camCommitPrepared 0;
^to open the camera
player cameraEffect ["terminate","back"];
camDestroy ASORGS_Camera;```
^to close the camera
Okay thx
Hey guys,can anyone help me to set up the GOM Aircraft Loadouts script? I've set up description.ext, ive set up initPlayerLocal and i've set up a laptop to be an object that grants access yet the laptop still doesnt have any actions
hi
Has anyone come across the initPlayerServer.sqf stopping half way through the script?
Likely an issue with your code if it is stopping halfway through.
Sorry correction - its skipping random bits of code.
No visible script errors (using show script errrors).
Can't exactly help when I have no context.
Yea sorry, am just testing one last thing. Will provide a paste bin in a sec
It skips adding the weapons and backpacks for anyone after the first person to join.
Why are you doing all that in initPlayerServer?
Seperate it into initServer and initPlayerLocal.
Server needs to run and manage db stuff, server doesn't need to have a backpack and weapons ๐
Easier to manage too ๐
Oh fuck, Yep. Thank you for that, all tested and working now.
Sweet
Something that does scare me a tad bit is that any script in SQF sometimes just immediately skips over errors though.
Usuaully it's code that is ran in a couple of seconds and exits, I'm not sure as to why it does this.
Last night all players in my server were killed by some kind of explosions. Vehicles that had players in were blown up. Players who were on the ground were killed and thrown up into the air. Only those in small buildings like chapels were able to survive. None of the BE filters were triggered. I believe this is cuased by a hack, which has been openly sold online in my country. Is there a way to protect my server from this hack?
CfgDisabledCommands, CfgRemoteExec, etc.
Got a friend this is the server rpt log 'setting up client please wait' for alits life cannot find the problem thinking it could be exdb but all looks ok... any ideas?
very possible the hack has gotten past the filters as well
Ugh, Altis Life? Don't bother.
Hahaha
@narrow musk Line 765:
16:32:45 Warning Message: Script \life_server\init.sqf not found
Make sure you have it setup as follows:
@life_server\addons\life_server.pbo
A lot of the time, people don't pack up the pbo.
FFS
i JUST saw that an fixed it then open discord to see if i have any replys and BAM you found it
starting server now.
๐
HAHAHA it works thank you very very much!
Sure thing ๐
http://i.imgur.com/lcTEPko.png just cause I just found it in my gimp stuff folder ๐
@pulsar anchor 0_o
Holy shit, that is a huge difference. Freaking old crappy operators ๐
https://www.youtube.com/watch?v=ViJm9Tdpxzs does anyone know how to make this smoke effect?
Does anyone have problem with paramsArray?
it seems they're not initialized in the init.sqf
Anyone want to make a simple death & inventory logging system for a big wasteland community of mine? DM me!
Well I was going to start off my question with "anyone" but damn...
If I take a trigger and have it make ten AI fire a gun how can I make it where it's a split second delay?
Is it possible to add machine guns to a civvi vehicle?. Like add machine guns to a cessna (caesar) or something
You could try the addweapon command
http://i.imgur.com/4EahmMP.jpg like this? ๐ attachTo command
@tough abyss has experience doing that haha
They want to know about attaching guns to the cessna @tough abyss
Can setpos or vectorAdd not be used to lower an object?
It can.
See that @sharp jay ?
Ah, already figured it out thanks though
Also found out that the cessna cant deal with the recoil of a 30mm gatling
Is there any option to remove the footstepsound in MP mission without influencing other sound volumes?
@abstract shuttle I think @little eagle has a solution to switch the animation on each frame and the noise goes away.
Anyone has any idea of how to stop static guns from falling over? There is a slight slope and they just fall over.
if they are just visually simpleobject true or enablsimulation false does it. If they should be able to be used properly, they maybe could be attached to something without physix...
Yea they need to be used, ill look into the attachTo one tho thx.
hey, this is probably a stupid question, but is it possible, or is there a work around, for enabling the artilery computer on a non artillery vehicle.
So the reason i ask, is coz a mate is trying to add a mortar to a UGV, with the attachTo and the addWeaponTurret command. It has added it to the UGV and it fires, but we have no idea if there is a way to still use the atilery computer on that UGV/Mortar monster thing XD
is there a way to increase fatigue gain for a unit?
or modifying its current fatigue value?
I just typed "Fatigue" in the search box on the top right
I bet I am just retardet again
on the scripting commands page, use ctrl + f and search easily for commads, well atleast that's what i do
dat upvotes lol
So knowone knows any way to do what i was asking about above? or
This alternative syntax of getDir is confusing me. Is it even possible to make a player look directly at something such as a position?
player setDir (player getDir Pos1);```
@jade abyss Thats what I thought could work but in my case its not. Ive got a marker position which I need to make a player look at, but cant seem to figure out how to. Using that example would make the player look at whatever rotation the marker is
@jade abyss Ah yep you're right, im stupid. Was doing it the wrong way. Cheers ๐
Wait a sec, do things like gamelogics have the ability to have a direction?
Or is it always zero?
You can rotate them, but it doesn't have any effect (except on those it is relevant for)
Hmm, interesting.
Does anybody got an idea how to check whether a player looks at the head or torso of a unit? I tried to do this with
lineIntersectsWith [getPosASL player, player modelToWorldVisualWorld [0,3,0], objnull, objnull, true]
but I don't get a result
I know that my attempt is not an ideal solution cause it just checks if a unit is in front of the player
use Intersect instead
will try that thanks
eyePos ?
Not sure how to exactly use this. Let's make this whole thing easier by excluding the selection. So what's to do if you just want to detect who is in front of a player?
a player or the player?
cursorTarget/Object?
works only when I'm looking at the center of the target unit
but when looking at the head it's objnull
Whoops, ok, cursorObject seems to just detect the target unit when looking at the torso
I can't confirm that. For me cursorTarget also gives me the object if I aim a few centimeters besides it
cursorObject is very exact yes. But should still work if you aim at the feet. I think.
Your crosshair is right next to his feet aiming at the ground
nope, it's directly on it
or atleast the center of screen is
intersect, as i said before.
the cursortarget is exactly on his feet
+CursorObject > cursorTarget. I barely use cursorTarget anymore.
as you can see cursortarget still has it's benefits
Look trough your scope and aim at the foot again.
No Problems at all with both.
+If the object is not know to you -> cursorTarget might return nothing.
@tough abyss Never heard of that,
And Syntax (can't tag that name), the answer is no.
@๐ข๐จ๐๐ฃ๐๐ง#3254 โ
Your mistake was trying.
Excuse me?
It didn't work
Thats Discord Bullcrap, he is highlighted anyway.
Hahaha
eh someone said it mb for the tag
That question about removing the footstep noise comes up like every week. No idea why. It's still not possible with scripting only.
It's totally possible to have scripted inventory items, right?
If I had a script where a player could pick up razorwire fences, then redeploy that one, it would be possible to keep track of them having just the one, right? Like I wouldn't need to figure out a way to keep them from being able to create them from thin air as they placed them, right?
I'd like to say no to this, but I'm not sure I understand that question fully.
If you have a script that does X, then yes X is possible. Because you presupposed it to be possible by having it already.
@little eagle I think @shadow sapphire is trying to say: a static item like a soda can, is able to be picked up from the ground and be able to be moved around in the inventory of the player.
You'd have to create the soda can item, because the soda can that is in the game is just a prop and not an item.
So you'd need to make a CfgWeapons config for it.
Right, exactly. So the answer is: no, not in a mission. Possible in mod form
Pretty sure there are plenty mods that do this already.
Surely. Strike me down if I may say it. i think exile does this
I wouldn't know.
@shut flower you can get there by using some math and the player view vector
Hi, I've created a firing range with targets that I can control up and down.
It works in the editor preview, in a hosted session, but not in my dedicated server.
Use that to easilly profile where the heavy part of your code is
Player FOV probably doesn't change every frame. So no need to calculate it more than once
You should also cache config lookups in variables
every 0.1 s would be smooth enough
How can you even change FOV ingame?
Ah yeah.. okey.. Zoom ๐
It's a whole Nametagging system. a bit of code would probably not tell enough about the system
Using the integrated profiler is the best you can get.
I also have a experimental profiler that records every single script instruction. But that's too experimental to be of any use
the getX commands are not what's slow. The config lookup is slow
iterating through allPlayers IMO would be better than nearEntities Definetly not
getVariable != getNumber / getText
It's free
And it makes it really easy for people to help you
Well.. Let's say you want players 200m around you. You have 100 players on a server and none of them are around you
why would you want to
Isn't just using cursorObject enough for that case?
You only see their Name if you aim on directly on them. But performance wise that would totally be worth it for me
Need to know basis -> cursorObject
didn't realize thee was cursorTarget
I would imagine it's definitely easier to use it because targets are different from just objects.
cursorTarget was there long before cursorObject ๐ฎ
Well shit.
And cursorObject returns more stuff than cursorTarget
cursorTarget seems like the more useful one anyway, no?
Depending on difficulty they would show up on the Map then wouldn't they?
That code just made the problem worse ^^ The if check decreases performance by alot.
reveal (according to wiki) does nothing when knowsAbout is already bigger.
To accomplish that reveal has to check that itself
so you are doubling up on the check
anyone see what the issue could be with this code:
dodarray = [DOD_1,DOD_2,DOD_3,DOD_4,DOD_5,Commandant];
if (player in dodarray) then
{
this addaction ["Open Virtual Arsenal",
{ ["Open",true] call BIS_fnc_arsenal;
}];
};
}; ```
yeah
you can also use ["AmmoboxInit",[this,true]] spawn BIS_fnc_arsenal this automatically adds the action to your player
If you add it to the player you're never gonna get it off again
Also won't work.- @shut flower
ok, good to know that this is the init box
He want's the arsenal only for some people. As the code shows
AmmoboxInit gives it to everyone
Yes you're right
It's easy to give it to certain people
Already thought about it but the code looks alright to me
hmm ok thanks
On my phone so I don't have the code on hand
probably because im trying to do it through mcc
during the games progress
whats interesting is that adding an arsenal by itself works fine
@little eagle, the item doesn't need to be visible or interactive in the inventory, it doesn't need a count or an icon, but could you pick up the object, it disappears, then a hint pops up and says, you have X of object.
thats normally how you make intel and such items exist
like a platonic relationship between a man and his attractive female co-worker
completly hypothetical
is there a similar command/EH to achieve a looping sound just like the EH for the music. If not, i will have to loop it manually xD
there is a method of setting it up
to loop
its one of the variables
i cant remember how to do it but ive done it
Hey there! Is anyone having problems with the paramsarray command? Basically it doesn't work in the init.sqf
poor clients then ๐
pass it to global publicVariable'd variables
not really a smart move
I can postpone it for the clients, i was just wondering if i'm the only one with this problem
never had this error in the past
fair
I'm trying to make a parameter that changes gear for the mission:
I have this in my Description.ext:
{
title = "Gear For The Mission";
values[] = {1,2,3,4,5,6,7};
texts[] = {"AOR1","AOR2","MultiCam","MultiCam Alpine"};
default = 1;
isGlobal = 1;
file = "mission_scripts\gear_script\GearSelector.sqf";
};```
My question is, when GearSelector.sqf executes, is there a way to check which value of the parameter is selected?
yes
the parameter you have set are always global variables
paramsArray
but you can also use this https://community.bistudio.com/wiki/BIS_fnc_getParamValue
@tough abyss
What about this? https://forums.bistudio.com/forums/topic/84060-setting-up-multiplaryer-options-using-class-params/
Although it's arma 2, will it still work?
@tough abyss if you are looking for setting loadouts in MP, you could use Bohemias new system introduced with Apex. Should be bale to setup gera with that.
You mean the loadout selection screen of Apex? @rotund cypress
yep thats it
It's not what I need, I don't want players to choose their gear
Anyway, I got the script from the forums working
How long does a normal day in Arma at speed multiplyer 1 take?
okay
Hi. I attached an object in my init eventhandler (attachTo). Can I fetch this object from another eventhandler or do I have to attach it again? If so, can somebody send me an example code on how to do it?
wont that just return a list of whats attached? will I be able to perform actions on the objects using this?
If you have the object reference, you can do anything with it.
so it's returning the objects and not just strings?
Yes
thanks
yw
Return Value: Array of Objects
That kinda says it would return objects.
Anyone happen to know which LOD(s) lineIntersectsWith actually looks at for intersections?
All I remember is, that it's broken for soldiers.
I can confirm that too. My tumbleweed can't pick them up ๐
@thick ridge VIEW and NONE
NONE ??
Intersect takes primary and secondary LOD. Primary is VIEW and secondary is NONE
So it only takes one LOD.
You have a complicated way of saying that.
Dedmen, does it somehow fall back to Geometry
if no View Geometry LOD is available?
thanks for the info
If there is no view geo LOD, then the object would be invisible.
I think the only intersect command that can handle the GEO lod is LIS
Nope
VIEW, GEOM, FIRE work with intersect
Even when the model has no GeoLod, you can still check for VIEW
@thick ridge
@jade abyss is that also the case for the line intersect methods that don't accept LOD name(s) as inputs?
The colors, in the layers.cfg didnt exactly match the colors on the mask... I have now manually gone through and remade the mask manually. and have finally got the clutter working.
i highly doubt that
nametag script?`
https://github.com/X39/XLib/blob/master/X39_XLib_Modules/ModuleFunctions/X39_XLib_ShowFactionNamesAndRank.sqf
quite ancient module of mine
might be useful to ya ... might not
features a range of those lil nametag script thingies
looks larger then it actually is too though ... it is mostly just c&p with tiny changes
nearEntities should be way slower then allplayers with distance
X39 is arguing with reality now.
ohh yeha .. like i assume that allplayers just checks a list and performs most simple +- ops to get the distance between two points
instead of dynamically finding the players meaning that allplayers should be faster then nearEntities
weirdo ...
ohh wait
allUnits is a different thing
without an actual server with actual ppl on it we will never know
NOTE: For security purposes, this command will only run for 1 cycle in MP, unless in-game debug console is available via description.ext option or Eden attribute setting. not fully true
The explanation of nearEntities being faster is, that it's a very similar concept to what you're doing with the distance check. It's essentially the same loop, but in C++ land and since that doesn't have nearly as much SQF command with input validation etc., it's faster.
Pretty obvious tbh. We've been over this again and again.
just that it checks above different lists ...
So?
in the absent of any other object, yes
nearEntities should be faster
with a lot of entities close by allPlayers approach should be faster
The allPlayers approach will be pretty much always be slower.
You decreased the amounts of times you have to iterate through the count SQF loop significantly by filtering the array for distance and type (CAManBase) in C++.
Offloading work to C++ land will make the script take less time.
private [... "_showVeh", ...
...
_showVeh = if (!isNil "WH_NT_SHOW_VEHICLEINFO") then [{WH_NT_SHOW_VEHICLEINFO},{false}];
Could be:
private _showVeh = missionNamespace getVariable ["WH_NT_SHOW_VEHICLEINFO", false];
There is many similar lines so this should help a lot.
You made it messier than it had to be:
// If the unit is dead, shorten the range. Set name.
if (alive _u) then
{
_name = name _u;
}
else
{
_name = if (name _u isEqualTo "Error: No unit") then { "" }
else { name _u };
_range = (_range * 0.5);
};
Could be:
// If the unit is dead, shorten the range. Set name.
private _name = name _u;
if (!alive _u) then {
if (_name isEqualTo "Error: No unit") then {
_name = "";
};
_range = _range * 0.5;
};
https://community.bistudio.com/wiki/diag_captureFrame
Note: Only available in specific builds. See Performance Profiling for details.
hmm. All old info. I guess you have to try...
do you guys use remoteExec (RE) or publicVariable (PV) + pVEH design? and why
I've switched to remoteExec because I always found that the pveh design is a bit cumbersome
And considering it's newer and has more flexibility
E.g. easy jip & target control, I prefer it
I don't understand why allPlayers should be faster. nearEntities is basically searching a hashmap of a grid for units inside it. Then confirming the distance in engine.
And SQF code is generally slow. So doing the distance check in SQF is always slower than it staying in c++ context.
hmm. All old info. I guess you have to try...
No that's not old info.
@hasty violet 1.7ms per frame? That's not soo bad.
@hasty violet https://github.com/Whalen207/WH/blob/master/wh_nametags.Stratis/wh/nametags/fn_nametagDraw.sqf#L47-L50
GetVariable has a default value. As commy already said
https://github.com/Whalen207/WH/blob/master/wh_nametags.Stratis/wh/nametags/fn_nametagUpdate.sqf#L14
if !(WH_NT_NAMETAGS_ON) exitWith {}
Get's rid of all the indentation.
As commy already saidprivate ["","",""] is bad. That is executed at runtime. private _var is done at compiletime
https://github.com/Whalen207/WH/blob/master/wh_nametags.Stratis/wh/nametags/fn_nametagUpdate.sqf#L68
That is what ARRAY select CODE was made for. (https://community.bistudio.com/wiki/select alt. sytnax 5)
https://github.com/Whalen207/WH/blob/master/wh_nametags.Stratis/wh/nametags/fn_nametagUpdate.sqf#L95
what is this?
if true then true else false?
If statements are quite slow in SQF.
https://github.com/Whalen207/WH/blob/master/wh_nametags.Stratis/wh/nametags/fn_nametagUpdate.sqf#L159
you can use count which doesn't have forEachIndex and thus is a little faster.
https://github.com/Whalen207/WH/blob/master/wh_nametags.Stratis/wh/nametags/wh_nametagInit.sqf#L31
This is a nono for PvP. You could atleast filter by side. OR add a variable to enable/disable filtering by side
https://github.com/Whalen207/WH/blob/master/wh_nametags.Stratis/wh/nametags/wh_nametagInit.sqf#L96
https://feedback.bistudio.com/T123355
You can either suffer from that. Or move the if check into your _update function. But I'm not sure if the call+alive check is cheaper than compile+alive check + maybe call.
i always went for the weirdest approach
have a not-so-fast-function prepare everything that should be rendered ๐
and then the actual framehandler just displays that
whats in the dedicated arrays
Which is actually a good approach. Just prepare data in scheduled and read it in unscheduled.
If the data didn't get ready in time you draw the data from last frame. You don't really need to be frame perfect for Nametags. And if the scheduler is too full. It's to be expected that things will start to get laggy
i figured thats the best way (atleast from my testing) to handle a larger amount of players
and, well, objects in general to cover
does arma have an "image cache"? I notice when i first try to render icons in a per frame handler on the map, that when it hasnt loaded those icons before, theres a long pause. after that everything is cool, so there must be a cache.
how can i pre-cache those images
It's called VRAM.
๐
@frosty cave Yes there is. Restarting Mission also doesn't fix it. Rename the files (e.g. Pic.paa -> pic1.paa) is the only way to "workaround" atm -.- pretty shitty
thanks yall
I don't think you can preload images by displaying them off screen, but a scripting only solution could be to display them very small (like one pixel) or simply transparent.
@still forum
I was referring to this part:
Versions with performance profiling
98699
98711
98809
These beta builds contain performance tools normally not available for a retail version. These builds will be a bit slower as a result, and is therefore not intended for a general use.
Those are A2 builds. I'd just delete that tbh. Who cares about A2.
Oh yeah. I'll update it with a link to the perf/prof thingy
If your question is, "what version do I need for this" and all info under "Versions with performance profiling" is 5 years old.
๐ฆ
Fixed now
Hey , i need some help with a health regeneration function im working on. ```sqf
params ["_unit", "_hitSelection", "_damage","_cause","_projectile","_hitPartIndex", "_instigator","_hitPoint"];
healing = false;
if (!(_damage> 0.99)) then {
_i = _damage * 100;
player setDamage _damage;
sleep (4);
while {_i > 0} do {
healing = true;
_dmg = _i/100;
if (!healing) exitWith {player setDamage _dmg};
_i = _i -4;
sleep (2);
player setDamage (_i/100);
hint str _i;
};
healing = false;
} else {
player setDamage _damage;
};
btw, all the params are passed into the function when the "handleDamage" EH is triggered
looks like scope issue
yeah thats what i thought might be the case, but i can't figure out how
each time you call this, it is running in its own instance, healing variable is not shared between instances I assume
I don't sqf really, but I think you need a global variable, and call the global variable from global space each time
and somehow tie that to player
ok
yeah healing is a global var, but maybe because when the handleDamage EH is triggered, i spawns the function, that global var isn't in the same scope as the one in the while do loop
is that what you mean?
I don't think global variables can be used like a reference
I think you have to call it from the global namespace every time you use it
like you need to assign the change back to the global space
I don't think global variables can be used like a reference
Wut?
?
i don't sqf, so i may be wrong
i mean are all global var in mission available in every file, from default?
I assumed you hvae to call it from some area using a function
but i don't know how the var isn't being seen in the if exit with statement
abc = 1; Global Var
abc = 1;
publicVariable "abc"; PublicVar
_abc = 1;
local Var
Just to avoid missunderstandings.
hey Dscha, can you take a look at my function above, and see if you can see why it won't work then?
@jade abyss
if (!(_damage> 0.99)) then { <- Makes not much sense
@limpid pewter
I think I know what might be wrong.
call {
if (true) exitWith {
systemChat "1";
};
systemChat "2";
};
systemChat "3";
What do you expect this prints in chat?
โ wrong
1 2
1, 2, 3 is wrong
1,3
Stop guessing
So, why is it 1 and 3?
Your exitWith thing might only escape that while loop and you expect it to end the whole script?
ok, that makes sense,
so then i should have another if exitWith jut after the while do then?
so that when it exits the while do it will also exit the if then?
I guess? It's hard to make sense of your function tbqh.
he wants it to set healing to false though? after his healing is done? so he can heal again later?
while he is in healing loop, he doesn't want another healing loop to go
Your exitWith just exits the while Loop
When I export CBA settings for like STHud and TFAR, can I just paste that straight into the mission init? Is that how it works?
^ This. The script just continues after the while loop
@leaden summit You copy paste it into a file named cba_settings.sqf
yeah dscha, i understand that now, but will putting another exitWith (with same conditons) after the scope of the while do loop then exit the scope of the if then?
Cool thanks commy
Nope, no idea why commy mentioned that ยฏ_(ใ)_/ยฏ
ok, nvm thanks for you help, will just need to use trial and error for a bit, will report results
Dscha, it looks to me like the script tries to use exitWith like return
Not rly^^
exit the script, not only the scope of the while loop
there is nothing after the while loop though....?so just existing that loop...is fine?
the whole function?
"[6:37 AM] Sneaky_Moldi: btw, all the params are passed into the function when the "handleDamage" EH is triggered"
Yes. DamageEH?
yes using the handleDamage EH
DamageEH fires multiple times, at each hit
means -> 1st hit -> healing = false;
2nd hit healing = false;
3rd healing = false;
always exiting "if (!healing) exitWith {player setDamage _dmg};"
@jade abyss yeah thats the idea
i don't want the script to heal if you get hit again
DamageEH fires multiple times, at each hit
oh, why is that
So this is auto regen.
ok, so one for chest, one for leg, etc..?
the first set to false, may be more likely issue
Yes Moldi
ok thanks
the second firing of event, sets that value to false
^ this tbqh. No need for an eh here.
<- Halfgod in black.
btw yes commy it is an auto regen, basically i want the unit to start healing after 4 seconds of being hit. if the unit is hit again, it stops the healing process and starts it again
Commy lost his glasses again, he is typing for ages now.
Why do people do this?
if (!(_damage> 0.99)) then {
When they could do this instead?
if (_damage <= 0.99) then {
yeah idk, it was 2 in the morning
Yes, start it outside in a loop.
Just make it one loop that runs from mission start to end and that does nothing if not wounded.
ok, so the handleDamage EH is useless for this application then?
I'd say so.
ok
DamageEH:
LastTimeDamaged = diag_TickTime;
[]spawn
{
while{true}do
{
uisleep 4;
if(LastTimeDamaged + 4 < diag_TickTime)then
{
DoYouDamageStuffInHere;
};
};
}```
Just an example to get the idea.
uiSleep, so you can heal in SP by pausing the game. ๐ค
Who cares about SP
Someone might
that doesn't bother me commy, it is solely a MP mission
See ๐
but thanks for the headsup
Use that above as base, that works with -> If Hit -> Update the time. LastTimeDamaged + 4 = Time+4s
So it just updates, when the last time you get hit was min. 4s earlier
I vaguely remember healing by pausing the game actually being a bug in some FPS years ago.
ยฏ_(ใ)_/ยฏ
to calrify this ```sqf
DamageEH:
LastTimeDamaged = diag_TickTime;
would be this in the initPlayerLocal.sqf or whateversqf
player addEventHanlder ["HandleDamage", {LastTimeDamaged = diag_))tickTime;}];
Without ))
Handler instead of Hanlder
ffs, leave me alone XD
wrong chat
+Rememeber to use TAGs, when using GlobalVars
anyway, as usualy you guys are always a good help. thanks
e.g. SM_LastTimeDamaged = diag_TickTime.
OFPEC tags!!
yeah makes sense, neat and tidy