#arma3_scripting
1 messages · Page 451 of 1
It depends on the situation and please note I’m no professional either. But either use a while loop or add some event handler... Not at my pc I’m sure someone can help you.
In what way will you use it? You could bodge it together....
i need an AI convoy with there lights on at dusk when the sun is up, so before the AI's automatically switch there lights on
you would have to cycle (maybe onEachFrame) and turn lights on (maybe a action or something)
i can turn the lights on with a truger, but then the AI automatically turns them off a frame latter
VERY ANOYING
Run a script that waits until the time you want them to turn off https://community.bistudio.com/wiki/daytime and then use the previous command and turn them all off
Is there a way to make playSound3D move with the object? I know that say3D and others already do that but i need to use playSound3D because Im not willing to write 4000 scipts in description.ext for each sound file I have
@sand grotto I’ll be home in 3 ish hours or so I’ll help you out then if you can’t get it working
lol i leave for work in 3 hours 😭 , i appreciate it, i will keep trying and if i can't get it ill come to you.
@astral tendon No.
Rip
That's what say3D is for.
I know...
4000 scripts in description.ext scripts???
Description.ext#CfgSfx @astral tendon
Does playSound3D actually work with mission sounds in MP now? Have vague recollections of it not working in MP because the path to the mission differs on clients and you must supply the path?
RemoteExec?
? For what purpose?
Muzzleflash, you just generate the filepath dynamically by using str missionConfigFile
I understand that. But isn't it same problem as setObjectTextureGlobal. Basically, you supply an absolute path to a command that then tries to apply that globally on all machines. For addons this works fine (they have the same path on all clients), but for missions the absolute path differs on all machines depending on which drive they installed Arma to and their windows username?
setObjectTextureGlobal would be fucked, that's right. If it needs an absolute path. I think it does, which is the real problem.
You can always use setObjectTexture instead though.
But when playing in MP, wouldn't the expression that strips part of str missionConfigFile yield something like ".......\commy\Local\Arma 3\MpMissionCache\__curmp__.pbo" then you append "sounds\mysound.ogg" and pass that to playSound3D?
Oh right. It's a global command exactly like setObjectTextureGlobal.
Now I get what you mean.
You could play it for all filepaths of every client and hope no one has the exact same profile folder path so the sounds double up. lol
Lot's of RPT spam though I believe.
Yeah. Maybe even a dialog box with sound not found, not sure.
But I vaguely recall it being one of the reason I moved to remoteExec'ing say3D instead.
Those commands should just take relative paths of missions. Unbelievable. That would be easy to do too.
Yeah definitely. But guess BIS never needed it themselves...
is is possible to set a max width of a combobox ?
https://img.c0kkie.de/c0kkie_27-04-2018_23-58-16.png
A line break would be helpfull
rip
I dont know
I know you have whole height for height, but I dont think there is an option for width
already searched, but nothing like that
any idea commy to do a line break or something like that? 😄
\n

you would need to insert ^^ after ever x characters
\n
is how you make a new line
I've not delved into controls yet (I plan to extensively soon though) but have you tried specifying a scrollbar on the control? (No idea if this will solve that issue)
Not sure if RscCombo has scrollbars.
Snagged from this forum post (https://forums.bohemia.net/forums/topic/179510-lbadd-problem-with-combobox-help-needed/) and also BIS wiki (https://community.bistudio.com/wiki/DialogControls-Combo) about combo boxes not populating (Not the same issue at all but its on the root topic I suppose): sqf class ComboScrollBar { color[] = {1,1,1,0.6}; colorActive[] = {1,1,1,1}; colorDisabled[] = {1,1,1,0.3}; thumb = "\A3\ui_f\data\gui\cfg\scrollbar\thumb_ca.paa"; arrowFull = "\A3\ui_f\data\gui\cfg\scrollbar\arrowFull_ca.paa"; arrowEmpty = "\A3\ui_f\data\gui\cfg\scrollbar\arrowEmpty_ca.paa"; border = "\A3\ui_f\data\gui\cfg\scrollbar\border_ca.paa"; };
Really not sure if that will prevent the content from exceeding the width though :/
is already
class vorlagen
{
type = 4;
idc = 8111;
x = safeZoneX + safeZoneW * 0.386875;
y = safeZoneY + safeZoneH * 0.54555556;
w = safeZoneW * 0.315625;
h = safeZoneH * 0.03111112;
style = 16;
arrowEmpty = "\A3\ui_f\data\GUI\RscCommon\RscCombo\arrow_combo_ca.paa";
arrowFull = "\A3\ui_f\data\GUI\RscCommon\RscCombo\arrow_combo_active_ca.paa";
colorBackground[] = {0,0,0,0.5};
colorDisabled[] = {0.2,0.2,0.2,1};
colorSelect[] = {1,0,0,1};
colorSelectBackground[] = {0,0,0,1};
colorText[] = {1,1,1,1};
font = "PuristaMedium";
maxHistoryDelay = 0;
sizeEx = (((((safezoneW / safezoneH) min 1.2) / 1.2) / 25) * 1);
soundCollapse[] = {"\A3\ui_f\data\sound\RscCombo\soundCollapse",0.1,1.0};
soundExpand[] = {"\A3\ui_f\data\sound\RscCombo\soundExpand",0.1,1.0};
soundSelect[] = {"\A3\ui_f\data\sound\RscCombo\soundSelect",0.1,1.0};
wholeHeight = 0.3;
class ComboScrollBar
{
color[] = {1,1,1,1};
thumb = "\A3\ui_f\data\gui\cfg\scrollbar\thumb_ca.paa";
arrowFull = "\A3\ui_f\data\gui\cfg\scrollbar\arrowFull_ca.paa";
arrowEmpty = "\A3\ui_f\data\gui\cfg\scrollbar\arrowEmpty_ca.paa";
border = "\A3\ui_f\data\gui\cfg\scrollbar\border_ca.paa";
};
Those German classnames tho.
😛
😛
Snurtzelrump
Sorry I couldn't help! Maybe in a month I'll stumble on the solution and try helping again haha
and script is atm
{
_cMessageCombo lbAdd format["%1",__x # 1];
} forEach _data;
_x not __x
yea c&p mistake 😛 in the script its correct
Is there a better way to loop n times other than forEach [1,2,3,n]?
for "_i" from 1 to _n do {
};
Awesome, thanks!
@junior stone did you get it sorted ?
the PPEffect filmGrain seems to only deliver coloured grain... anyone know more about it?
anyone know why when i call BIS_fnc_moduleEffectsSmoke it does nothing, am i missing any information for it?
how do you call it?
createvehicle [ "BIS_fnc_moduleEffectsSmoke",getPosATL _thing vectorAdd [0, 0, -4.5],[], 0, "can_Collide"];
getPosATL _Thing findEmptyPosition [5,5,"BIS_fnc_moduleEffectsFire"];
tried both
Err...wtf. why not make a particle source or at least create a smoke shell?
it's not a vehicle, it's a function
yah im new to this
it takes a logic as parameter, afaik
still learning lol
Anyone know where to find weapon class list? The wiki has a nice list but it's not copy and paste friendly, it gets images and random text.
_list = "true" configClasses(configFile >> "CfgWeapons") apply {configName _x};
need it to spawn via script
its randomly gen crash
like hunt the heli crash type thing
You cannot create modules mid mission and expect them to work, as none of the arguments are set on them.
_module = "ModuleEffectsSmoke_F" createVehicleLocal getPosATL player; // ← note the createVehicleLOCAL, needed for modules
[_module] call BIS_fnc_moduleEffectsSmoke;
@marble basalt
Did you try this?
yup, works
Modules are Logic, so I expected createUnit to be needed.
re-setPosATL the module, so it's spot-on target
Does the effect stick to the module now?
no, just tried
moved the module and the smoke is still happening at the same position.
I guess you could grab the "#particlesource"
tbh, I'd just create the effect by script and ignore the module.
private _colorRed = 0.5;
private _colorGreen = 0.5;
private _colorBlue = 0.5;
private _colorAlpha = 0.5;
private _particleLifeTime = 50;
private _particleDensity = 10;
private _particleSize = 1;
private _particleSpeed = 1;
private _particleLifting = 1;
private _windEffect = 1;
private _effectSize = 1;
private _expansion = 1;
private _emitter = "#particlesource" createVehicleLocal [0,0,0];
_emitter attachedTo [_object, [0,0,0]];
_emitter setParticleParams [["\A3\data_f\ParticleEffects\Universal\Universal_02",8,0,40,1],"","billboard",1,_particleLifeTime,[0,0,0],[0,0,2*_particleSpeed],0,0.05,0.04*_particleLifting,0.05*_windEffect,[1 *_particleSize + 1,1.8 * _particleSize + 15],
[[0.7*_colorRed,0.7*_colorGreen,0.7*_colorBlue,0.7*_colorAlpha],[0.7*_colorRed,0.7*_colorGreen,0.7*_colorBlue,0.6*_colorAlpha],[0.7*_colorRed,0.7*_colorGreen,0.7*_colorBlue,0.45*_colorAlpha],
[0.84*_colorRed,0.84*_colorGreen,0.84*_colorBlue,0.28*_colorAlpha],[0.84*_colorRed,0.84*_colorGreen,0.84*_colorBlue,0.16*_colorAlpha],[0.84*_colorRed,0.84*_colorGreen,0.84*_colorBlue,0.09*_colorAlpha],
[0.84*_colorRed,0.84*_colorGreen,0.84*_colorBlue,0.06*_colorAlpha],[1*_colorRed,1*_colorGreen,1*_colorBlue,0.02*_colorAlpha],[1*_colorRed,1*_colorGreen,1*_colorBlue,0*_colorAlpha]],
[1,0.55,0.35], 0.1, 0.08*_expansion, "", "", ""];
_emitter setParticleRandom [_particleLifeTime/2, [0.5*_effectSize,0.5*_effectSize,0.2*_effectSize], [0.3,0.3,0.5], 1, 0, [0,0,0,0.06], 0, 0];
_emitter setDropInterval (1/_particleDensity);
There.
_object is whatever you want to attach it to.
ty mud
Multiple Username Disorder
But I haven't changed my nick in 12 years.
Jesus, this name is almost half as old as I am.
cant seem to get fire to work
This is smoke.
tbh, I'd just create the effect by script and ignore the module.
not sure how so trying to use module
just trying to add small fireballs on the ground near smoke
in a random radius
How is this executed?
_module1 = "BIS_fnc_moduleEffectsFire_F" createVehicleLocal getPosATL _li_end;
[_module1] call BIS_fnc_moduleEffectsFire;
Not what, how. I mean. From where.
So debug console?
I mean, somehow your script has to be executed. Where did you put these lines?
params ["_object"];
private _colorRed = 0.5;
private _colorGreen = 0.5;
private _colorBlue = 0.5;
private _timeout = 0;
private _particleLifeTime = 2;
private _particleDensity = 20;
private _particleSize = 1;
private _particleSpeed = 1;
private _effectSize = 1;
private _orientation = 5.4;
private _damage = 1;
private _emitter = "#particlesource" createVehicleLocal [0,0,0];
_emitter attachedTo [_object, [0,0,0]];
_emitter setParticleParams [
["\A3\data_f\ParticleEffects\Universal\Universal",16,10,32],"","billboard",1,_particleLifeTime,[0,0,0],[0,0,0.4*_particleSpeed],0,0.0565,0.05,0.03,[0.9*_particleSize,0],
[[1*_colorRed,1*_colorGreen,1*_colorBlue,-0],[1*_colorRed,1*_colorGreen,1*_colorBlue,-1],[1*_colorRed,1*_colorGreen,1*_colorBlue,-1],[1*_colorRed,1*_colorGreen,1*_colorBlue,-1],[1*_colorRed,1*_colorGreen,1*_colorBlue,-1],[1*_colorRed,1*_colorGreen,1*_colorBlue,0]],
[1], 0.01, 0.02, "", "", "",_orientation,false,-1,[[3,3,3,0]]
];
_emitter setParticleRandom [_particleLifeTime/4, [0.15*_effectSize,0.15*_effectSize,0], [0.2,0.2,0], 0.4, 0, [0,0,0,0], 0, 0, 0.2];
_emitter setDropInterval (1/_particleDensity);
if (_damage > 0) then {
_emitter setParticleFire [0.6*_damage, 0.25*_damage, 0.1];
};
private _lightSize = (_particleSize + _effectSize)/2;
private _light = createVehicle ["#lightpoint", [0,0,0], [], 0, "CAN_COLLIDE"];
_light setPosWorld (getPosWorld _emitter vectorAdd [0,0,0.5]);
_light setLightBrightness 1.0;
_light setLightColor [1,0.65,0.4];
_light setLightAmbient [0.15,0.05,0];
_light setLightIntensity (50 + 400*_lightSize);
_light setLightAttenuation [0,0,0,1];
_light setLightDayLight false;
There. That should work.
Everytime i see setParticleParams application i feel a bit deranged
why?
Could've just copy pasted what I wrote but w/e ¯_(ツ)_/¯
Wow just found out that any ctrl that has MouseEnter|MouseExit|MouseMoving doesn't react when you press and hold LMB|RMB and move your cursor to its area
trying to add to add magazines and weapons to one weaponholdersimulated is this the right thing for it to spawn it and how do i make mags spawn with it
or just spawn a gun with a mag in it?
@marble basalt Depends. WeaponHolderSimulated is PhysX version of WeaponHolder that whats exactly created when your unit drops a weapon on death. It does ragdoll and stuff. Don't think its a good idea to place multiple items, like weapon + mag in the same holder of that type, as it probably will look awkward.
ok
another way for "custom sounds with playSound3D"
/*
_soundPath = [(str missionConfigFile), 0, -15] call BIS_fnc_trimString;
_soundToPlay = _soundPath + "Sounds\test.ogg";
playSound3D [_soundToPlay, player];
_soundPath = [(str missionConfigFile), 0, -15] call BIS_fnc_trimString;
_soundToPlay = _soundPath + "Sounds\test.wav";
playSound3D [_soundToPlay, player];
*/
//--- Description.ext
__EXEC (MISSION_ROOT = __FILE__ select [0, count __FILE__ - 15])
//--- script
private _missionRoot = parsingNamespace getVariable "MISSION_ROOT";
playSound3D [_missionRoot + "file_name.ogg", <soundSource>];
``` @astral tendon
how can i make a gun spawn on the ground with a mag in it or near it with a script
private _holder = "WeaponHolder" createVehicle (position player):
_holder addWeaponCargoGlobal ...
_holder addMagazineCargoGlobal ...
... stand for anything according to syntax
still says missing ;
show your code
its good figured it out
made it spawn it two seperate ground holders one for the gun and one for ammo
be nice to have it in both but eh
Old problem really
i tryed to figured it out already but no juice
Also @meager heart thanks for the script but i also need the sound to follow the unit, so I did on the hard way with Say3D
¯_(ツ)_/¯
Not sure if this is the right channel, but I want to give the static AA defenses normally on blufor over to opfor. How would I go about doing this in the eden editor?
0 spawn {
private _g = createAgent ["Goat_random_F", [0,0,0], [], 5, "NONE"];
private _h = "groundweaponHolder" createVehicle [0,0,0];
_g setPos (player getPos [0, getDir player]);
_h addWeaponCargoGlobal ["srifle_EBR_F", 1];
_h attachTo [_g, [0,0.25,1]];
private _lootHolder = "groundweaponHolder" createVehicle (player modelToWorld [0,2,0]);
_lootHolder addWeaponCargoGlobal ["srifle_EBR_F", 2];
_lootHolder addMagazineCargoGlobal ["20Rnd_762x51_Mag", 10];
private _secondlootHolder = "groundweaponHolder" createVehicle (player modelToWorld [0,5,0]);
_secondlootHolder addWeaponCargoGlobal ["launch_RPG32_F", 3];
_secondlootHolder addMagazineCargoGlobal ["RPG32_HE_F", 5];
};
``` paste it in to the console ^ https://imgur.com/a/osjELaY @marble basalt
@meager heart Have you tested this in MP with another person? Because PS3D has global effects, and the PTF is different for everyone, yet PS3D and therefore PNS getVar is only ever executed once locally on one client.
yep, was couple missions with that way ^ and was no troubles, everyone was able to hear it (sc missions with custom sound alarm), commy 🤷
Yeah, but did youhave to globally execute PS3D?
yes ^
That'd mean N^2 network messages, potentially a lot of file not found rpt spam, and rarely doubled sounds if the paths match on two machines.
This is certainly intersting behavior that warrants doc just to show how dumb it is.
And gives insight.
btw [(str missionConfigFile), 0, -15] call BIS_fnc_trimString; works just fine also 👌
?
it works!
I don't think we're talking on the same level. ¯_(ツ)_/¯
sure
you said > PNS getVar is only ever executed once locally on one client
and server
what is the problem ?
(i dont get it srry)
Okay, playSound3D is a command with global effects, right?
yep
Means that if you executed it on machine A, it will send the filepath of the soundfile to every other machine, right?
yes
But the filepath is different on every client, so only on Machine A and every client that happens to have the same filepath the sound will be played. Everywhere else it will print an error and be silent, correct?
yes, but if you make a function and execute it global ?
Then every client sends a filepath to every other client. And a sound will be played everywhere.
BUT
kinda spam you mean ?
For every client, a message will be send to every client. N^2 network traffic.
N - 1 file not found messages.
And rarely, doubled up sounds on at least two machines.
got it now
Those are my objections in which I say, it only kind of works.
rgr
The nasty thing is that it will behave correctly when NOT remotely executed in local MP testing, because both clients share the same filepath as they are on the same computer.
that was trouble in b4
Probably a cause of a lot of confusion, and only now I fully understand what's going on. Or might go on. Haven't thoroughly tested it.
also i remember that is only one way to make it work if cba enabled
i mean RE it globaly
CBA_fnc_globalExecute is just a wrapper for remoteExec BIS_fnc_call.
in b4 was using bis_fnc_mp also for that 😀
The method of remote execute really isn't interesting for this topic though. It will behave the same with all of those, as they're universal.
well... thanks... i feel how my level is slightly changed now, commy 😄
I just dragged you down. 👌🏼
nooo
There's no going back. Can't forget things at will. Entropy increased and you're stuck with me in hell now.
I tried to disable Simulation in a MP Mission. But when I disable the simulation in the attributes, my objects nevertheless falling down like simulation is enabled. I also tried to use:
lamp1 enableSimulationGlobal false;
lamp2 enableSimulationGlobal false;
lamp3 enableSimulationGlobal false;
lamp4 enableSimulationGlobal false;
lamp5 enableSimulationGlobal false;
lamp6 enableSimulationGlobal false;
on initServer.sqf
Yeah, because the lamps probably fall down before that script ever runs.
they have enough time to falling down 3.5 metres and turned into a lying position?
Maybe?
How I can realise a solution?
never worked with preInit comamnds if that should be a solution
"preInit commands" don't exist.
maybe just objects init will works
Is this with any mods?
object initialization fields are called b4 the initServer.sqf 😀
I also disabled visibility of these objects because these objects are carrier of own generated light sources. they are visible at all. (put the visibility of in the attributes. but I will try to use object init.
)
Is this with mods or without?
with mods. just using RHS, Firewill Aircrafts and ACE+TFAR+enhanced Movement+achilles.
and CBA...
Lamp classname?
if (isServer) then {
["Land_Camping_Light_F", "init", {
params ["_lamp"];
private _position = getPosWorld _lamp;
private _dirAndUp = [vectorDir _lamp, vectorUp _lamp];
[{
params ["_lamp", "_position", "_dirAndUp"];
_lamp setPosWorld _position;
_lamp setVectorDirAndUp _dirAndUp;
_lamp attachTo [commy_lampHolder];
}, [_lamp, _position, _dirAndUp]] call CBA_fnc_execNextFrame;
if (isNil "commy_lampHolder") then {
commy_lampHolder = "Building" createVehicle ASLToAGL _position;
};
}] call CBA_fnc_addClassEventHandler;
};
This ought to work if executed in preInit.
work this with all lamps with this classname on the map?
have to execute it once, nice. How I use it as a preInit? never worked with using preInit
But it absolutely has to be put in preInit, otherwise it does nothing.
Sec.
class Extended_PreInit_EventHandlers {
My_Tag_missionPreInit = "call compile preprocessFileLineNumbers 'XEH_preInit.sqf'";
};
And then you put a file called XEH_preInit.sqf into your mission root folder.
Renamed the event because could be used for anything.
because of the name of this sqf, it will be found by CBA and executed automatically because it is a predefined standard name?
Extended_PreInit_EventHandlers is the predefined standard, My_Tag_missionPreInit just has to be unique since you don't want to overwrite anything.
And XEH_preInit.sqf is arbitrary convention / for simplicity.
so again, there is a XEH_preInit.sqf in my mission root folder with the following content:
class Extended_PreInit_EventHandlers {
My_Tag_missionPreInit = "call compile preprocessFileLineNumbers 'XEH_preInit.sqf'";
};
You can change My_Tag to whatever you want. That's just placeholder for an OFPEC tag.
But yeah, that should work.
just confusing me because I execute this sqf by it self.
and where I put this one:
if (isServer) then {
["Land_Camping_Light_F", "init", {
params ["_lamp"];
private _position = getPosWorld _lamp;
private _dirAndUp = [vectorDir _lamp, vectorUp _lamp];
[{
params ["_lamp", "_position", "_dirAndUp"];
_lamp setPosWorld _position;
_lamp setVectorDirAndUp _dirAndUp;
_lamp attachTo [commy_lampHolder];
}, [_lamp, _position, _dirAndUp]] call CBA_fnc_execNextFrame;
if (isNil "commy_lampHolder") then {
commy_lampHolder = "Building" createVehicle ASLToAGL _position;
};
}] call CBA_fnc_addClassEventHandler;
};
?
Into the XEH_preInit.sqf
both code segments are have to be put into the sqf?
ah okey, so im not longer confused xD
lol
I skipped that part.
This is the woodhammer method. If they still fall after this, idk. ¯_(ツ)_/¯
Doesn't matter where.
okey
The part where it hides the lamp can be put there too.
does you script need traffic during the mission or is it just one command that don't have to be checked during mission?
I think attachTo may cause traffic.
But the script itself only runs once per lamp and is otherwise just memory.
You could experiment with enableSimGlobal instead of attachTo , but for now I'd try this one.
Because I have to look. This Mission have 60 Clients in the final Event it does should run on a good performance as possible.
But finally, thank you for your spend of time.
The attachTo would be the only thing that could cause load after the mission start in what I wrote.
Currently it works well. They are not falling down in MP
Yes. Sec.
what exactly I have to change. It seems that I have only exchange the attachTo command with enableSimulationGlobal false; But there is an array with commy_lampHolder linked to line 18.
commy_lampHolder thing can be deleted, as you no longer attach anything to it.
Is it possible to get to use a MACRO inside the debug console?
No.
Only files can be preprocessed.
Debug console has no file.
Macros are resolved by the preprocessor.
like this?
if (isServer) then {
["Land_Camping_Light_F", "init", {
params ["_lamp"];
private _position = getPosWorld _lamp;
private _dirAndUp = [vectorDir _lamp, vectorUp _lamp];
[{
params ["_lamp", "_position", "_dirAndUp"];
_lamp setPosWorld _position;
_lamp setVectorDirAndUp _dirAndUp;
_lamp enableSimulationGlobal false;
}, [_lamp, _position, _dirAndUp]] call CBA_fnc_execNextFrame;
}] call CBA_fnc_addClassEventHandler;
};
I currently hide nothing, just wanted to try disable simulation globale first
ok
The only potential issue I see here is, that they still fall down and are only put in place around postInit. So they could still take fall damage and cause collision damage during the loading screen etc.
Atrributes deactivated enable damage. But It could also be to slow.
okey, enableSimulationGlobal false; doesn't work. They are still lying down on ground
Anyway to override a bis functions ? I saw that not possible with cfgfunctions
I think this is because they get their sim disabled on the server, but still fall on the client and the sim stuff only gets done once they're already down.
but the Server and the client are desynchronized now or not? Should the Server not to be resynchronize it?
@little oxide Only if you put allowFunctionsRecompile = 1; into your mission, but it means that the whole functions library is recompiled every mission start, meaning your mission loads slower.
Blaze, the point of ESG is to no longer synchronize the object.
No way to do it with addon and pboprefix ?
With addon you just put A3_Functions_F into required addons and overwrite their configs. That's easy.
You can edit CfgFunctions with addon just fine. I do it in a few places.
Ok thanks
@ruby turtle
if (isServer) then {
["Land_Camping_Light_F", "init", {
params ["_lamp"];
private _position = getPosWorld _lamp;
private _dirAndUp = [vectorDir _lamp, vectorUp _lamp];
[[_lamp, _position, _dirAndUp], {
params ["_lamp", "_position", "_dirAndUp"];
_lamp setPosWorld _position;
_lamp setVectorDirAndUp _dirAndUp;
_lamp enableSimulation false;
}] remoteExec ["call", 0, true];
}] call CBA_fnc_addClassEventHandler;
};
This.
oh okey, we removed the frame CBA funct.
["Land_Camping_Light_F", "init", {
params ["_lamp"];
private _position = getPosWorld _lamp;
private _dirAndUp = [vectorDir _lamp, vectorUp _lamp];
[{
params ["_lamp", "_position", "_dirAndUp"];
_lamp setPosWorld _position;
_lamp setVectorDirAndUp _dirAndUp;
_lamp enableSimulation false;
}, [_lamp, _position, _dirAndUp]] call CBA_fnc_execNextFrame;
}] call CBA_fnc_addClassEventHandler;
Alternative idea. Drop the isServer and do the code on every client.
enableSimulationGlobal -> enableSimulation
whats the difference? no server communication is needed anymore?
The script runs once on every client, meaning that every client updates the position to whatever it had when it was created.
So and that means its a more performant way as it the global command will be?
because of it uses only memory space?
Because it works
Like.
The 4k textures of random asset mod cause like ten times the slog a hand full of attachTo's can ever hope to cause.
the last variant doesnt work, I think attachTo is the best way you offered me
so and now I have to look about hideObjectGlobal
setPos after enableSimulation ? 🤔
kinda suggestion yes...
if (isServer) then {
["Land_Camping_Light_F", "init", {
params ["_lamp"];
private _position = getPosWorld _lamp;
private _dirAndUp = [vectorDir _lamp, vectorUp _lamp];
[{
params ["_lamp", "_position", "_dirAndUp"];
_lamp enableSimulationGlobal false;
_lamp hideObjectGlobal true;
_lamp setPosWorld _position;
_lamp setVectorDirAndUp _dirAndUp;
}, [_lamp, _position, _dirAndUp]] call CBA_fnc_execNextFrame;
}] call CBA_fnc_addClassEventHandler;
};
Why not, but I still think they fall down on the clients that JIP before ESG is synched.
HAve you a config example for override BIS functions @little eagle ?
class CfgFunctions {
class A3 {
class GUI {
class initDisplay {
file = "whatever";
};
};
};
};
A3_Functions_F in requiredAddons
But i need to put in my folder all the script that have already the BIS one
because tested and said me another script missing
Did you overwrite file outside of the deepest class?
Why override a function?
To have it do something else.
if (isServer) then {
["Land_Camping_Light_F", "init", {
params ["_lamp"];
private _position = getPosWorld _lamp;
private _dirAndUp = [vectorDir _lamp, vectorUp _lamp];
private _fnc_glue = {
params ["_lamp", "_position", "_dirAndUp"];
_lamp enableSimulation false;
_lamp hideObject true;
_lamp setPosWorld _position;
_lamp setVectorDirAndUp _dirAndUp;
};
private _args = [_lamp, _position, _dirAndUp];
[_fnc_glue, _args] call CBA_fnc_execNextFrame;
[_args, _fnc_glue] remoteExec ["call", -2, true];
}] call CBA_fnc_addClassEventHandler;
};
If this one ^ doesn't work then I'd give up on ESG.
It's working thanks @little eagle
👌🏻
Weird idea: copy it and modify it, afterwards call the copy
Because, i wanted to not setVariable 7 times to lock a door on my house in public
that overload the network for nothing, one var is fine for what I want to do
savage
it's good to have dedicated server for testing sh.. things 😄
//--- from the console
0 spawn {
private _lamp = "Land_Camping_Light_F" createVehicle (player modelToWorld [0,5,0]);
_lamp enableSimulation false;
private _position = getPosATL _lamp;
_position set [2,1.5];
_lamp setPosATL _position;
};
//--- object placed in editor, with this in init
0 = this spawn {
if (!isServer) exitWith {};
_this enableSimulationGlobal false;
private _position = getPosATL _this;
_position set [2,1.5];
_this setPosATL _position;
};
this ^ https://imgur.com/zdiHrqj
But that's what I wanted to avoid. Having to manually change the height etc.
oh... i see
I imagine the ideal solution to work for every lamp even those you place afterwards with being able to rotate and move them in the editor and without having to put scripts into their init boxes.
init boxes < imo it's like triggers, ez way for new guys in editor 🤷
The problem with them is that they're invisible unless you click on them in the gui.
Guess you can edit the mission.sqm
And having to manually put down a position is frustrating.
I'd get annoyed by that quickly.
Init boxes are the best way to do object-specific configuration.
True, but this one is for 6 lamps, so more like class specific.
Yup. Just wanted to say that they are not universally bad
I also use triggers to mark areas for some specific purpose, like sectors, minefield, etc.. But it is only used to aid the mission designer. When the proper script runs, it find the proper triggers, reads their data, and deletes them.
Since they added inArea, I like markers more. I find a script to be way less confusing than all those options in the trigger ui.
But you have to hide those in preInit right to avoid people seeing them on the map - at least for those areas not intended for players to know about?
And triggers ignore units in vehicles. That's the absolute most dumb bullshit in this game probably.
Yeah, can't believe they never changed that in Arma 1, Arma 2, Arma 2 OA, Arma 3, Arma 3 Apex, Arma 4 (oops spoiler) 😃
markers are on the map and if you give them descriptive names, the second guy editing the mission should understand.
I meant for players
You can make markers invisible to the players and still see them in the editor.
I hope they don't cut too many features from A4. New engine is always scary.
Where do you do that?
Did what?
Make the markers invisible to players in the editor while still being able to see them?
Also wish they would make them somehow visible in the 3d view..
Alpha -> 0
Then I can't see them in the editor
Oh you mean in preview?
No? In Eden editor (2d view).
¯_(ツ)_/¯
Well, that is why I still prefer triggers that are then deleted later.
Well if you're smart enough to understand all those dropdown options. :/
also if that trigger for position, there is option "Copy position" 🤷
I ignore all the options for my purposes. Just writing something special in the text field like: <SECTOR> , or <SPAWN_AREA> . When the mission initializes a script just processes each and delete them.
So you invented a trigger eating machine that craps out scripts? To utilize the ui parts?
Does not necessarily craps out scripts. A single script might just go through each and record the area e.g. for side missions in some variable. Then nothing is running after that.
Just writing something special in the text field like: <SECTOR> , or <SPAWN_AREA> .
thats how BI use them also, in they missions ^
They do.... Damn now I feel bad.
lol
That's awesome. Does it utilize inArea?
My code? Depends on what it does later it might.
Like this
private _triggers = [0,0,0] nearObjects ["EmptyDetector", 99999];
private _sectors = _triggers select {triggerText _x find "<SECTOR>" != -1};
MY_MissionAreas = _sectors apply {triggerArea _x};
{deleteVehicle _x} forEach _sectors;```
Nothing that can't be done with markers, just prefer triggers.
And inspired by your CBA lobby naming, I may also add additional information in the text: <SECTOR> @ Lakka Town @ 200 (that can of course also be done using markers).
The only reason I had to do this clumsy @ thing is, because that's the only way to sent information to people in the lobby.
Now that I think about it, I should probably just do: <SECTOR> @ ["Lakka Town", 200] because then I can use parseSimpleArray on the second part and forget about manually de-padding.
Is there a variant of parseSimpleArray that does not error out when giving not an array - then I can get rid of the separator symbol fully?
joinString splitString out the white space.
Oh, white space is these chars:
#define ASCII_NEWLINE 10
#define ASCII_CR 13
#define ASCII_TAB 9
#define ASCII_SPACE 32
// White-space, used by the SPON_stringTrim* functions.
#define WHITE_SPACE [ASCII_TAB, ASCII_SPACE, ASCII_NEWLINE, ASCII_CR]
Found a, uhhhm, workaround for parseSimpleArray that does not error out on bad data:
private _data = parseSimpleArray ("[" + _origArrayStr + "]") select 0;```
Oh, yeah. You need it to be an array in the first place.
You are allowed to select one past the last element of an array? Just yields nil?
Yes.
It only errors at count + 1
Despite count
not being any element
It's weird.
Hmm, guess it might be something they "inherited" from C/C++ where you may construct a pointer one element past an arrays end, but not dereference it...
Or they just screwed up a check and intended for it to error starting at size/count, but forgot a - 1.
And now it's here to stay due to bwc.
in c++ you might construct a pointer anywhere. Not just one past the end
param
I vote for the "forgot" variant
_array param [10] // <- nil no error
Dunno about C++. But in C, am pretty sure that constructing arbitrary pointers is undefined behaviour by the standard, though in practice nothing bad will happen.
It's just a number. Until you dereference it.
Same for "one past the end" as anywhere else
You could look it up, Dedmen.
I'm very sure they just have a index > array.size then error
off by one errors are very common
Then maybe I have read too much stack overflow then. But have seen many places where it indicate the things you are allowed to do with pointers by the standard in C/C++ is quite restricted, though in practice nothing bad happens. Even converting pointers to integers to store them, then later converting them back is apparently tricky to get right (in these sense of not breaking the language specification and getting UB).
hello my responsibility
I want to get the arma 3 backup account, this is ascam as the account holder gift but I have the arma 3 in the backup account
🤔
I am from turkısh
google translate xd
arma 3 alcam 2. i have an account but i have arma 3
Are you sure that is a #arma3_scripting question?
Can you setVariable on terrain objects?
no
"generally" not.
Houses you maybe can. But they might get deleted once the house gets out of view distance
Ok thanks
they get streamed out/in.
Don't know about server.
But also depends on the type of terrain object. Things like bushes or trees might not be able to hold any variables
why not try`?
Quite interesting. I wonder if this wud break me saving the terrain objects into car as ref.
I'll be at PC in like 6hours. Gotta try that
Intrieguing
"terrain objects" is a kinda broad term. Big Stones are also terrain objects. Just as bushes, trees, fences, houses, lamps, streets
Hmm yes
and you definetly cannot set variables on terrain stones. You cannot even get them via cursorObject or alike
Are you sure about that?
you can get them via cursorobject i believe
But it would not surprise me. Was unable to acquire the gas station signs on Altis to remove. Just a p3d no classname.
if that doesnt work, nearestobjects returns them 😛
nearestTerrainobject maybe. But doesn't that just return model path and not an actual object?
^^ in many cases I believe this is the case.
Objects don't need to have a classname.
E.g. super simple objects, or the gas station signs.
and not an actual object? It returns objects and you can set variables on them
cursorTarget doest work on it, cursorObject often does
Question is if the variables are synched in case we're talking about setVariable public.
And if JIP works etc.
Streaming keeps the variable.
etc.
Just tried a rock.
nearestTerrainObjects [player, [], 3] -> [425794: limestone_01_02_lc_f.p3d]
myObj = nearestTerrainObjects [player, [], 3] select 0
myObj -> 425794: limestone_01_02_lc_f.p3d
myObj setVariable ["test",123];
allVariables myObj -> []
[myObj getVariable "test"] -> [<null>]
doesn't work. Even though you can get the actual object value instead of just a model path
Grrr I already closed Arma. One minute...
"Stealing a car is cosidered a serious crime on Malden."
this one always got me
"National tree of Malden is the stone pine (Pinus pinae)"
cursorObject returns the stone. Same as nearestTerrainObjects
nearestObjects also returns it
- create a hash
- key is [<stone>,"varname"]
There, saved the day once again.
setVar equivalent on terrain objects
Yes.
Wow I thought it was more magical
lol
I guess that is f8ne
The magic is to have concepts for many simple things.
And then to put them together in the right order.
🤔
I guess u can have key followed by data
And keys in separate array from data
Etc.
Magic?
just a identifier so you know that's a hash and not just a random array
The #0 is so pointless. Getting rid of that in A4.
Using var nan3space must be faster than sqf
stones have no var namespace
Create location and setvar instead of array
How to link the stone to the location?
Pos or object
hash works cuz anything can be keytype. Namespace (atleast without Intercept-CBA) only have string keys
I learned hard way
Saving to profilenamespace I need to stringify before saving
At least they stopped malicious code from running
But I completely broke my game a few times on boot when profile loaded
Leaky code type
I had mixed and probably mistake saving it
But sometimes it seems to randomly execute code
lol what?
global namespace not passed.
"true"
Seen that error before?
Ye
Yeh, before in theory u could join malicious srv. And get sth that kills ur player or just crashes gam3
Something can corrupt profilenamespace. Which causes the engine to execute code from inside it. While it doesn't have a namespace yet and then prints that
Can you inject code with that in mp?
It don't work anymore afaij
didn't try yet. If you store and load code in pns and execute that in MP then obviously yes
Vanilla should be safe. But custom mods...
I save stuff to pns
ya said it runs on its own.
A2 oa had that and I think it was in the latest patch notes
A2 yawn
Yeah
cough there is one type of hash that would be considered as even more serious crime on Malden than just stealing a car cough 😄
🤔
yes! exactly that ^... no drugs at all 😄
hash tablets
Sounds sketchy, I'm calling the mods
🚓
I'd expected there to be neither at worst.
Disco rd supported by tobacco companies
I wouldn't be surprised in the least.
how it works... it looks like it was tobacco company in b4
@little eagle well tabacco is kinda not widely forbidden, while weed mostly is.
What is the law? What does the state? The free man follows his own fate.
What?
😄
Morgan Dedman
They should number the panels. I read it in the wrong order again.
I am currently creating trigger areas for a script i am working on. It works in sp, but does not work on a dedicated server. I am kind of scratching my head on this one.
I already debugged the trigger statements, they are all true except the inArea check. meaning it is not detecing acre_player inside the trigger area, hwoever as said before, in sp it works.
if(!isServer) exitWith {};
params[["_obj",objNull],["_power",1000],["_frequencies",[ [0,999999] ]],["_effectiveRange",1000],["_falloffArea",500]];
if(isNull _obj) exitWith {};
private _pos = getPosATL _obj;
_trg = createTrigger ["EmptyDetector", _pos];
_trg setPosATL _pos;
_trg setVariable ["jammer_active", true, true];
_trg setVariable ["jammer_object", _obj, true];
_trg setVariable ["jammer_effective_radius", _effectiveRange, true];
_trg setVariable ["jammer_falloff_radius", _falloffArea, true];
_trg setVariable ["jammer_power", _power, true];
_trg setVariable ["jammer_frequencies", _frequencies, true];
private _radius = _effectiveRange + _falloffArea;
_trg setTriggerArea [_radius, _radius, 0, false, _radius];
_trg setTriggerActivation ["ANY", "PRESENT", true];
_trg setTriggerStatements ["this && thisTrigger getVariable ['jammer_active',false] && alive (thisTrigger getVariable ['jammer_object',objNull]) && acre_player in thisList", "[thisTrigger, acre_player, true] call diw_acre_fnc_addJammerToPlayer", "[thisTrigger, acre_player, false] call diw_acre_fnc_addJammerToPlayer"];
_obj setVariable ["jammer_zone", _trg, true];
Any ideas?
Where is acre_player set? (not familiar with the acre setup)
acre_player is used like ace_player. it is basically the CBA function to get the current player or remote controlled unit
so, how is the dedi supposed to know where is the player? On a dedi, player is objNull
true, only the client has that set
this is however on the client side and not server side
i also found the next head scratching thing
https://i.imgur.com/L8cGCtM.png
ace_player is the same as player, except that it reports the unit you remote control if you do instead of the player.
Think of it as currentUnit.
It is meant to be used instead of player everywhere, so your scripts work while remote controlling AI with zeus.
well this script is server side (or nowhere at all): if (!isServer) exitWith {} ;
Lou, the trigger is not created locally only.
the trigger is created on server but is global to all machines
Is this the target debugging menu?
yes
@errant jasper oh, right
I assume acre_player is the same as ace_player, since you can use acre without ace, and jonpas found ace_player to be useful.
Probably so you can speak as the unit you remote control as zeus.
https://community.bistudio.com/wiki/createTrigger
See the note at the bottom
oh i am an idiot, i set the target scope to server in the target debug menu, of course it is then null...
yet the inArea check is false.
target debugging is awesome.
create the trigger, sleep for 2s, then init it maybe
Wish it was enabled by default.
Under which conditions is ACE_player/acre_player != player ?
maybe you can change setTriggerActivation "ANY" to > "ANYPLAYER" 🤔
@errant jasper when remote contorlling a unit
@meager heart any needed for remote controlled units sadly
@digital jacinth As in remote controlling UAV/UGV right, unlike teamswitching ?
nah, remote controlling as in zeus remote controll an AI unit
Ah yeah, that would be a more common occurrence. Thanks.
Seems like maybe there should be a CBA_player instead, since both ACE_player, and acre_player basically delegates to the CBA "unit" player event.
also that trigger is set to "repeatedly" but there is no setTriggerTimeout 🤔
Muzzleflash, the whole player events thing was made for ACE, because it was needed to make stuff work, and make it work with reasonable overhead.
Then ACRE wanted it too, and probably other people as well, so it got ported to CBA.
ACE_player was a thing at that point, so instead of the variable being set via an ace event, it is set via cba event.
Can't just rename the variable as well. Would break a ton of things.
I don't like that it is named "x_player". Too confusing with theplayer command. It's more of a currentUnit or avatar. My fault, because I made it originally as AGM_player.
AGM_Core_fnc_callCustomEventHandlers
This shit makes me nostalgic.
Hey all.. how might I go about getting a light to actually give off light in an area around it. I thought the CUP Red lights would give off light but they don't apparently.
A real quick search found a script for making an exterior red light on a helo but that didn
didn't work. (Made sure variablenames and such lined up, and no dice)
Are you asking how to create a flare?
🤔 No such thing in this game.
Well then. Thats a bummer, theres no way to create a lightsource to attach to something at all?
BI never put much stock in interior design :)
Of course there is.
Sorry I should have clarified I meant a light source not like a standalone light via scripting.
I basicalyl want to attach the light source to the light object which doesn't seem to work.
The object itself I mean.
params ["_object"];
private _lightSize = 1;
private _light = "#lightpoint" createVehicleLocal [0,0,0];
_emitter attachedTo [_object, [0,0,0.5]];
_light setLightBrightness 1.0;
_light setLightColor [1,0.65,0.4];
_light setLightAmbient [0.15,0.05,0];
_light setLightIntensity (50 + 400*_lightSize);
_light setLightAttenuation [0,0,0,1];
_light setLightDayLight false;
What is a "light object"?
An actual light. Like a wall lamp. I mean to say something that has a lightbulb and should give off light lol
Specifically this light
Those are automatically on all the time I believe. And when it's dark, you can see the light.
Red_Light_EP1
No idea what that is.
Just use the script I posted? It attaches a light to _object.
Uhm?
_light setLightUseFlare true;
_light setLightFlareSize 3.0;
_light setLightFlareMaxDistance 1000;
Some more commands. Flare that I told you about.
@vagrant mango _light setHit ["light_1_hitpoint", 0.92]; to turn it on 0 to turn it off... Dont ask why its just arma
He's not trying to turn it off.
0.92 smt turns it on
dmg that is
Dont know why it just is like that last time i tested
Red_Light_EP1?
you can just setDamage it
Any light i tested in arma
0 -> on
1 -> off
You got it backwards.
0 is ON
1 is OFF
Because if you shoot the light, it goes kaputt.
Damage increased.
Oh yea it actually is a bug interesting :P
https://www.dropbox.com/s/3sqsa33fpl9v6u0/chrome_2018-04-28_21-13-29.png?dl=0
Ooops 😛
I still dont understand why turning it on and off is directed by damage if damage is not 1 but hey
I have no idea what you're trying to say. Can you formulate a proper sentence?
The Turk was easier to understand.
And he used Google Translator in language no one gives a shit about.
Should i write it in macros so you understand?
English would be enough.
Why are you telling someone, that asks how to add a light, how to turn a light off? 🤔
I'm confused
He's confused too.
I still dont understand why turning it on and off is directed by damage if damage is not 1 but hey
Like wtf does that mean?
Because if you spawn a light during daytime it will not turn on during the night if you dont first set some dmg to it and then reset it to 0.
Last time i checked at least
It is controlled by damage, because if you shoot a light it goes off. Using setHit just exploits that.
Okay now that was a coherent sentence. And it's new to me.
Script copier here, would like to ask if my idea is feasible and how to implement it. As is the script aint working (I keep respawning as BLUFOR) and I reach out for positive help. Trying to create a "dynamic respawn" by letting individual players spawn differently depending on number of deaths.
In initPlayerLocal.sqf
_TotalDeaths = 0;
player addEventHandler
[
"Respawn", // When player respawn...
{
_TotalDeaths = _TotalDeaths +1; // on player respawn add 1
if (_TotalDeaths == 2) then // If deaths is 2 then...
{
_newGrp = createGroup EAST; //Greate new east group
[(_this select 0)] joinSilent _newGrp; // join new group
} // Player is now OPFOR/EAST
else
{
if (_TotalDeaths == 3) then // if deaths is 3 or more then...
{
call BIS_fnc_EGSpectator; // move player to specatator
}
else
{
};
};
];
You need a global variable for this.
The code block inside the Respawn eventhandler is a different script instance.
It runs way later than the part of the script that adds the eventhandler.
And repeatedly for each death of course.
So it being a different script instance means, that no local variables are carried over.
_TotalDeaths is a local variable.
Change that to a global variable and you're golden.
Ie remove the _
Also, a technicality, but important imo. You named the variable "total deaths", but actually it's about "total respawns", not "deaths".
Since global variables are shared in all script instances, the names of the variables of different scripts could collide and cause errors.
Which is why global variables are usally tagged. With an OFPEC tag.
So you should use, idk, James_TotalDeaths.
Why James ? Hahahaha i did not ask the question
Oh, sorry. It scrolled too far 😛
Because James is just a very cool name
Haha 😂
also spectator should be initialized when player not respawned yet 🤔
you can terminate it after respawn
total deaths being 2 could remove the eventhandler from inside using _thisEventHandler and add a killed eventhandler starting the spectator.
Thank you, appriciate the help!
If you need help with them sure
But this is not really a "post your random script snippets here" channel
No. You will very quickly get a ban for that
🤦🏼
enjoy your ban
@open vigil ^
strike
And just like that, stupid was washed away.
More like do not pass go, do not collect $200
_praise be unto ye, @open vigil _
Hello there guys, a quick question, i'm making a script where the engine should choose a number from 1 to 10, if that number is higher than 5, then it should execute a certain script, what i currently have is this:
´´
selectRandom [1,2,3,4,5,6,7,8,9,10];
if < 5 then {
for "_i" from 0 to 6 do {
_testPos = selectRandom [getMarkerPos "pos1",getMarkerPos "pos2", getMarkerPos "pos3", getMarkerPos "pos4"] ;
_TakGroup = createGroup resistance;
_typeofgrp = selectRandom [(configfile >> "CfgGroups" >> "Indep" >> "LOP_AM" >> "Infantry" >> "LOP_AM_Fireteam"),(configfile >> "CfgGroups" >> "Indep" >> "LOP_AM" >> "Infantry" >> "LOP_AM_Rifle_squad")];
_TakGroup = [_testPos, GUER, _typeofgrp] call BIS_fnc_spawnGroup;
_ranWay = getMarkerPos "oav";
_TakGroup addwaypoint [_ranWay,0];
}
}
´´
would this work?
how about
if((random 10) > 50) then {
};
if((random 10) > 50) then {
for "_i" from 0 to 6 do {
_testPos = selectRandom [getMarkerPos "pos1",getMarkerPos "pos2", getMarkerPos "pos3", getMarkerPos "pos4"] ;
_TakGroup = createGroup resistance;
_typeofgrp = selectRandom [(configfile >> "CfgGroups" >> "Indep" >> "LOP_AM" >> "Infantry" >> "LOP_AM_Fireteam"),(configfile >> "CfgGroups" >> "Indep" >> "LOP_AM" >> "Infantry" >> "LOP_AM_Rifle_squad")];
_TakGroup = [_testPos, GUER, _typeofgrp] call BIS_fnc_spawnGroup;
_ranWay = getMarkerPos "oav";
_TakGroup addwaypoint [_ranWay,0];
}
}
Something like that?
I guess that works..
But that will make it ALWAYs execute right?
but move testPos variable beneath the if statement. No need to run that more than once
no
I want a 50 - 50 chance, so could i change it to if ((random 10) > 5) then {
if((random 10) > 5) then
{
//if a random number between 0 and 10 is more than 5 then execute this
};
yup thats what i was aiming for, just was unsure if it would work, anyways, thanks a lot, ill try it, im kind of new in scripting so thanks
((random 2) > 1)
One last question
is the syntax for the Independent properly used?
if((random 10) > 5) then {
for "_i" from 0 to 6 do {
_testPos = selectRandom [getMarkerPos "pos1",getMarkerPos "pos2", getMarkerPos "pos3", getMarkerPos "pos4"] ;
_TakGroup = createGroup guer;
_typeofgrp = selectRandom [(configfile >> "CfgGroups" >> "Indep" >> "LOP_AM" >> "Infantry" >> "LOP_AM_Fireteam"),(configfile >> "CfgGroups" >> "Indep" >> "LOP_AM" >> "Infantry" >> "LOP_AM_Rifle_squad")];
_TakGroup = [_testPos, GUER, _typeofgrp] call BIS_fnc_spawnGroup;
_ranWay = getMarkerPos "oav";
_TakGroup addwaypoint [_ranWay,0];
}
}
createGroup needs a side. Either resistance or independent
I was also getting an issue on this line:
_TakGroup = [_testPos, GUER, _typeofgrp] call BIS_fnc_spawnGroup;
That also requires a side. Same as above
but according to Wiki, independent is interpreted like GUER
Only when converted to a string
So it should be:
_TakGroup = createGroup resistance;
_TakGroup = [_testPos, GUER, _typeofgrp] call BIS_fnc_spawnGroup;
Right?
Just FYI, ```sqf
(side player == independent) //returns true
(side player == resistance) //returns true
(side player == guer) //returns nothing
oh lol ok, ty
Corrected
_TakGroup = createGroup resistance;
_TakGroup = [_testPos, INDEPENDENT, _typeofgrp] call BIS_fnc_spawnGroup;
Have patiente on me please hahaha
Worked!
Thx a lot
When I define Leaflets, is it possible to put the text into arabic letters?
missionNamespace setVariable ["GUER",resistance,true];
missionNamespace setVariable ["CIV",civilian,true];
put that in the beginning of your code
Can anyone help me make a formula to make a distance value drop based on speed an height?
cDist = 800;
h = 100;
s = 100;
cDist = (cdist - ( ( floor(((h*1.5/100)*s)/100) * 25) ))min cDist;
is it possible to set a delay between commands in a trigger
Sure
//onActivation
_handle = [] spawn {
hint 'triggered';
sleep 5;
hint 'triggered 5 seconds later';
};
@sand grotto
i put that in between my commands?
hint
is a command
U put ur commands around the sleep
What is ur current trigger code?
oh i see
Those hints would come instant and 2nd one 5 second later
get 2 helicopters to take off a sencond apart
oke thx bae 😃
👏🏻
_handle = [] spawn {
pilot1 enableAI "MOVE";
sleep 1;
pilot2 enableAI "MOVE";
};
this look good?
@peak plover
sweet that worked thx man
hell yeah
Btw u can post code in discord by pressing the key under escape and writing like this:
(copy paste the following 5 lines into chat)
```sqf
// comment
pilot1 enableAI 'MOVE';
sleep 1;
```
it will look like this:
// comment
pilot1 enableAI 'MOVE';
sleep 1;
three x ` (no space)sqf <-- the sqf part is important
@sand grotto
tilde key is the name of the key
very cool thanks @peak plover
hey fellow scripters, got a problem for you guys.
_mounted_veh setVehicleAmmoDef 1; will reload guns with the config ammotype and loadout but it will also reset passengers in FFV seats.
Anyway around that?
Sorry for the nooby question, but what's the best way to define functions in a functions.hpp while keeping functions organised into different folders? If I use class Whatever { class Functions {}}; and group everything together I can call the functions in-game, but not when splitting them up into different folders and referencing the folders with file = "functions\systems"; etc.
Anyone know an example out there that'll clear it up for me?
@ivory nova you need to create a class for each function inside the systems folder
class systemsthings
{
file="functions\ystems";
class fn_coolFnc{};
};
Hm, this is what I have (removed all but one of each function)
tag = "RND";
class Macros {
tag = "RND";
file = "functions\macros";
class randomColour {};
};
class Systems {
tag = "RND";
file = "functions\systems";
class createActions {};
};
};```
make sure each of the functions have a fnc_ or fn_ tag in front of them
ohhhh
each function declaration in the functions.hpp? or the files themselves?
I forgot the fn_ in the file it seems
hm, seems to add the fn_ automatically
files themselves
hm, i see, yeah have the fn_ in front
i could be just speaking out of my ass, but last time i remember that's how you do it.
yeah, it's strange, can see the functions in the functions viewer this way, but can't actually call them anymore
oh well, will just have to name files better instead of folders (:
thanks for your help man!
No worries, it does still work with the folders. I used it the other day in a mission, has to be something in the setup.
Greetings, I could use some assistance.
I want to use Addon free radio for my kp liberation mission. However, there is a script conflict as the mission already defines class CfgSounds.
Addon Free Radio wants their script installed in the Description.ext
#include "AFAR\f\SFX.hpp"
sounds[]={};
};```
Liberation frameworrk has a define in a hpp file
```class CfgSounds
{
sounds[] = {};
class parasound
{
name = "parasound";
sound[] = {"res\c130.ogg", 1.0, 1};
titles[] = {};
};
};```
What would be the best way to merge these so they don't conflict?
class CfgSounds
{
#include "AFAR\f\SFX.hpp"
sounds[] = {};
class parasound
{
name = "parasound";
sound[] = {"res\c130.ogg", 1.0, 1};
titles[] = {};
};
};
🤔
Too late.
😔
Yesterday I had a problem with a trigger not working properly in mp, I guess I figured out why that is the case.
commands like setTriggerStatement, setTriggerArea and setActivation are not broadcasted through network and you gotta remoteExec those...
well yeah. I did not check that beforehand. Asked for help here as well and I think not many know this. But hey you never stop learning and sometimes cursing sqf in the process
anyone got a script to show all weapons in a RscList?
does anyone know if the old trick of switching group side by adding a leader with probabilty of presence = 0 causes any problems for players on dedi?
i want a group listed under blufor in lobby but be opfor ingame
Foley, I am not aware of any issue with that, although I never heard of this. I assume not many people use this, so it may be broken, or it may work out nicely. I'd say you try it yourself, and should it cause problems, think of a different solution or ask for one again here.
It's not how I would do this.
Tom, I assume no.
Any specific question about RscList or ground weapon holders?
how would you do this commy, i dunno of any other options?
initPlayerServer.sqf
Give all the slots a specific var name, e.g. OpforUnit1
and then put into initPlayerServer.sqf:
isNil { // force unscheduled so one can reference potentially undefined variables without getting bothered
params ["_unit"];
if (_unit in [OpforUnit1, OpforUnit2, OpforUnit3]) then {
if (isNil "commy_OpforGroup") then {
commy_OpforGroup = createGroup east;
};
[_unit] joinSilent commy_OpforGroup;
};
};
@digital pulsar ^
thanks
so i heard Player AllowDamage is detected is it true?
"detected" ? what?
https://community.bistudio.com/wiki/isDamageAllowed can be used to detect if damage is allowed
i mean its detected by Anitcheats
It can theoretically be detected.
Depends on the anticheat if it detects that or not
any other way to have god mode other than Allowdamage?
HandleDamage eventhandler
does it work on players?
player removeAllEventHandlers 'HandleDamage';```
Like that?
Think so yeah
than if i wanna remove it , its like this sqf player addEventHandler 'HandleDamage';
??
Is it possible to mix wave respawn and regular fixed time respawn?
For example, when player dies he has to pick respawn point. If he picks base, he respawns after ten seconds. If he picks FOB he respawns when ten other players on his side want to respawn on the FOB.
Basically I'd like to create more cohesion in respawn based game modes.
Those who played Squad could be more familiar with where I'm going...
@molten folio you may have that the other way around
as evidenced by add and remove
If your intention is getting around anticheats you should very quickly stop chatting about it here...
^ This is where my thoughts went first
The nerve of some people. ¯_(ツ)_/¯
If you have to ask here, you will not be able to outsmart the cheat fix.
lads, is there a config or setting for artillery fire randomness?
No, what're you trying to do?
adding randomness factor of where the shells land
this works but doesnt add randomness to each shell
_artmark = getMarkerPos 'TarMark';
[mortar1, [_artmark getPos [200 * random [- 1, 0, 1], random 180], '12Rnd_230mm_rockets', 3]] remoteExec ['doArtilleryFire', mortar1];
and you can't execute the 2nd line 3 times which would randomize each shell but because the artillery vehicle won't shoot 3 shells if it gets the same command 3 times
Have you tried changing that 3 to 1 and to copy paste the line two times?
"and you can't execute the 2nd line 3 times"
Oh, so it only fires once if you order it 3 times at once?
yeah, it kind of overwrites the previous command
Makes sense kind of.
im thinking there must be some kind of AI config or something
But I recognize the code and it's nice that it at least fires once now.
It's not AI config, it's just the dispersion of the weapon config.
It's not something you can edit with scripts. You'd need an addon for that. And even then, you'd need some math to predict which angles create what scatter.
I'd still do a script, just rewrite it. Bit more complicated.
shit
maybe I can get around it by placing 3 artillery and seperately ordering them 1 command each
_artmark = getMarkerPos 'TarMark';
[[mortar1, _artmark], {
params ["_mortar", "_artmark"];
private _weapon = currentWeapon _mortar;
for "_i" from 1 to 3 do {
private _ammo = _mortar ammo _weapon;
private _position = _artmark getPos [200 * random [- 1, 0, 1], random 180];
_mortar doArtilleryFire [_position, '12Rnd_230mm_rockets', 1];
waitUntil {_ammo != _mortar ammo _weapon};
};
}] remoteExec ["BIS_fnc_call", mortar1];
Is it really true that mission params values must be integers only? I'm just checking it out and it seems to be working fine when using float values. Also BIS is using float values in "ReviveMedicSpeedMultiplier" of their revive implementation.
Am I missing something or is wiki outdated?
"Values; must be integers; has to have the same number of elements as 'texts'" -- from wiki
You could try it. I wouldn't trust the wiki if I see it used somewhere in a different way.
@gaunt dagger What I wrote ^^^
As I said it seems to be working fine, I'm just wondering if it will not cause problem somewhere where I have not expected them 😄
Ok, so I guess wiki is outdated then.
It's not unheard of that the wiki is outdated, or was never correct about something to begin with.
in b4 (BIS_fnc_getParamValue) it was working even if you have no text element for some value, it was just empty but working 😀
@little eagle I'm guessing this one is for waiting for the artillery to reset?
waitUntil {_ammo != _mortar ammo _weapon}
It's waiting for the ammo of the mortars weapon to change.
Basically waiting for it to shoot, then repeat the for block again.
3 times.
That just sends the whole indented code block to the machine of the mortar.
yeah, i was confusing your solution with something else 😛
This doesn't handle the gunner dying or running out of ammo, but honestly, for a mission script it's good enough :P
yeah, it adds a bit of delay between each shot but its acceptable
cool thanks for that
it adds a bit of delay between each shot but its acceptable
Does it?
That's surprising.
in a loop, how would I go about executing something once without exiting the loop? Brain is a little fried right now, need some ideas.
_doThat = false;
while { true } do
{
if (not _doThat) then {/*stuff*/ _doThat = true;}
}
Multi use,
position is checked to see if it's near a location,
and if it's near a location then diag_log something,
of course though I don't want it doing that endlessly in the log.
So you see my dilema
@winter rose Interesting I guess.
So you want to quit the loop as soon as you have a hit?
No, I want it to continue to loop, but only execute something once instead of multiple times like it would if the condition could be true for a long period of time. For this, I am just looking at the player position and checking if it's near a location, and then logging it.
I don't want the log to be totally full if the player stays in a location more than a minute. I think what lou posted is a fair solution
So some parts of the loop should be on a different timeout.
here, letme post an example
We're approaching Spaghetti code here fast. I can already tell.
most certainly
I haven't ranted about how loops are shit in a long time here.
params[["_unit",objNull,[objNull],["_code",{},[{}]]]];
while{alive _unit} do
{
_cPos = getPos _unit;
if(!(_cPos isEqualTo getPos _unit)) then
{
call _code;
};
};
(I don't think this will work, feel free to correct me. Just brainstorming here).
Since the player position will be changing frequently I don't want it to be relentlessly calling the code.
There's no sleep in that loop.
You're running the same loop 1000 times every frame. :P
Sure, but that's not really the point.
I originally had a suspension time of 3 seconds.
But the same thing, every 3 seconds it'll go "WAAAAH. Execute this shit"
also move one ] in to _unit
Yep
_cPos = getPos _unit;
if(!(_cPos isEqualTo getPos _unit)) then
It seems to me that this is rather pointless?
Correct
getPos _unit should always be equal to getPos _unit, no?
Wait, no. Because it's different.
Say, if at one point it's grabbed and it's grabbed at another time then they're different
I cannot decipher the purpose of this script, and I'm really trying.
Pass Unit to evaluate position of -> Pass Code to be executed when position of unit has changed -> loop while unit is alive -> execute passed code if unit's position is different from last
suspension is needed for this to work at all
The positions of units always change, because all they have to do is to twitch and they've moved a micrometer.
sure, and I'm not really concerned about accuracy of position
Well then the position check is pointless, because it will always be even so slightly different. Due to rounding alone.
how would you go about this then?
Hmm.
Do you see what I mean?
Yes I do see what you mean. I'm just curious as to how I would do that.
subtract a meter from each and make sure it's either equal or above it? 🤷
params [
["_unit", objNull, [objNull]],
["_code", {}, [{}]]
];
private _position = getPosWorld _unit;
waitUntil {
if (_position vectorDistance getPosWorld _unit > 1) then {
_position = getPosWorld _unit;
call _code;
};
// condition to quit
!alive _unit
};
😱 ,
Waituntil???
Why not? It has only one code block and is therefore better performance wise in every way than while.
It also always suspends at least one frame, so the missing sleep is taken care of too.
I'd still add a sleep. Well I never would use a loop like this, but w/e.
makes sense.
This resembles event based code, so I underestimated it when I said Spaghetti.
You can replace
call _code
with
isNil _code
if you want it to do the exact same thing, but execute the _code in unscheduled environment.
Oh, yeah i forgot about that.
i'm just curious what that thing should do ? like every unit movement "something" 🤔
hint "Don't move!"; 😄
Execute code every time the unit moves a meter.
It doesn't do anything on it's own. It's basically the polling for your own custom ObjectMoved eventhandler.
😮
Well, except that this is one loop for each _code. So it's still very basic and bad atm.
i was thinking maybe it was for some sort of restrictions... or... for some mission thing
Modified it to pass old position and new position + custom parameters. I dunno, it works okay.
Do you plan to use this with multiple _code's on the same object?
how do you mean?
Well, use the function that creates this loop - the one you posted / I edited - at least twice or more on the same _object.
WIth different _code.
No, I plan to be able to make a new function that can set the used code after it's set. so no need to run it multiple times
as well as an exit variable
If you'd manage to have it run only one loop, but potentially execute multiple _code, you'd basically have an eventhandler that's based on polling. But if you don't want to use it more than once per object, then I wouldn't worry about it.
You should still add a sleep, because if you do this on a lot of objects, you eat through the 3 ms or whatever it was pretty quickly, and then the mission stops being fun.
lol, will do.
It's not like a unit will move that quickly every few frames anyway.
sport hatchback 🚗 with tweaks will do the trick lol
👌🏼
hey any ACE scriptors on here, i have an issue with getting an ACE interaction to show up from inside a vehicle. I got the action to show up outside the vehicle, but not while in say the drivers seat. How would one go about creating that action?
ace_interact_menu_fnc_createAction or config?
- 9: Other parameters [showDisabled,enableInside,canCollapse,runOnHover,doNotCheckLOS] <ARRAY> (Optional)
I guess enableInside has to be true.
oh lol never noticed that,, thanks commy. to make sure i understand, those are as an array correct? as in a bunch of booleans? ([true, true....false])
Yep. You can just use
[nil, true]
though.
Is there any way to refill all magazines of a unit, including ones in your containers?
The thing is that you only get shown the action of your vehicle when inside one. Unless this one is set to true. Then it passes the action the the vehicle or something.
That's what believe at least.
ah, my hope is to have the action available both inside and out of the vehicle too
but i guess if anything, i can just create 2 actions, each with different params
@unborn ether What do you think how many lines of script that would take? Guess and I'll post the solution.
Well it either 1 line, or its like i see it rushing through all the fucking getUnitLoadout
One.
_unit setUnitLoadout [getUnitLoadout _unit, true];
unit setUnitLoadout [loadout, rearm]
rearm (Optional): Boolean - Partially emptied magazines will be refilled when the loadout is applied - Default: false
¯_(ツ)_/¯
oh man. OH MAN
I was thinking about that for like 40 minutes
Arma give it back please (
I never tried this btw., I just thought of it.
I didn't even know there is a such argument there
I was damn sure there is just one
oh man. OH MAN
öhman 👌
googles öhman
If it were me, this syntax wouldn't exist, but instead we had a
refillMagazines
command.
rearm - provide with a new supply of weapons
refill - filling a container again
and even description :Partially emptied magazines will be refilled 🤷
its like modelToWorldVisualWorld
self explanatory*
Hey guys i want to make our mechanized units known to the enemy using reveal. It works fine on local MP but doesnt on dedicated. What does in this case the effect: local mean? I run the script on the server on Ai units so it should be fine in my opinion. But they dont know about me. Do i have to run it where the target is local? or is it best used globally?
@knotty mantle EL (Effect Local) means that result is applied only to a command instigating PC. So if you call that on server, it will happen only there.
yeah but if the ai that is on server knows about my IFV it should attack it.
But it doesnt
It does on local MP though.
And i dont understand why.
local MP?
editor multiplayer.
[_group, _target] remoteExec ["reveal"];
???
Even if its local MP its still MP, other players wouldn't see the result, so yes ^
Demellion i understand what a local effect means. I dont understand how reveal can have a local effect.
also maybe _group reveal [_target, 4]; < with value ?
i used it with value
Its better to reveal a unit to a whole group then, instead of just one client
it is revealed to Ai on the server. and it always reveals to the whole group according to the biki page.
and @little eagle thanks that is the solution we are currently testing. But i asked more for my own understanding.
Hello there! Is there a list/resource somewhere where I can look at the Tanks DLC depreciated and new classnames?
What I have already found: Marid, separate CSAT cluster bomb for planes, new Mine cluster magazines for CSAT with _O ending.
general scripting question here, does creating a zeus module mid mission have the potential to not work as fully as one that is present at mission init? i seem to be having poor performance from zues modules created in the following manor:
_zeus = (createGroup sideLogic) createUnit ["ModuleCurator_F", (getPos _player), [], 0, ""];
_player assignCurator _zeus;
//there is more code under here to get all addons from cfgPatches but you get the general idea```
I've completely forgotten the command to recompile a script while ingame, does anyone remember?
anyone got a simple if true statement then do blank, else if false do blank?
@tough abyss that's a thing??
yes
i just always restarted a mission or had the file i needed called via an execvm then saved changes and it ran the most recent version i saved
sucks if you're doing what i'm doing spawning multiple vehicles via an execvm
does anyone know how to setup extdb for a mission file bc i made a wasteland mission file but it doesnt save shit atm
databases are only achieved by arma wizards
xD
nah
i almost have inidb installed
if ya find out leme know, especially if that shit is friendly to other mods.
but inidb is sooo slow
kk
DB's in general require servers don't they?
lol, i got a gameserver but dont use it
ye
F, i was hoping to make one for this ravage mission i've been making but i cbf to make a server
well ravage has a build in save system im pretty sure
ravage mod*
i spend 2hrs making a wasteland mission file from scratch xD
Fug
And yeah ravage does but it sadly doesn't save cars 😦 and it sometimes freaks out for zero reason
i mean i could help setup INIdb
that is a database that saves it as a file on your pc
server pc*
I'm switch to mission maker chat for this
k
i've accomplished a database using extDB3, but its for my own custom gamemode, not for wasteland
although i've never set up wasteland, i would assume the only real thing you would have to setup would be the protocols in your sql_custom folder
nah i need to set it up inside my mission file
PM me your copy of wasteland? i've gotten really familiar with how extDB3 works so i might be able to reverse engineer it?
sure
What is the debug console command to recompile a script, so I don't have to restart the game each change?
It's a function iirc. BIS_fnc_recompile
You can also look in the function viewer for required required parameters
Wiki seems to be to no avail
yo mudnut
What
Anyone know the tag for hideobjectglobal in cfgre
hideobjectglobal
dosent work
Yeah its in command
class CfgRemoteExec {
class Commands {
class hideObjectGlobal {
allowedTargets = 2;
jip = 1;
};
};
};
I got it, just realized I put hideobjextglobal
oh, ok
Get an editor and download sqf autocomplete.
I just am way to in love with sublime
I already have
I'm using ST3 too.
its a shitty auto complete
I type "hid" and then tab twice.
Good switch.
just switched to sublime as loadtimes
atom is a bit aids on that
sublime is instant
Exactly. Preach!
Atom is fine if you ask me, larg files losd slowly yes. But everything else seems to work just fine