#arma3_scripting
1 messages ยท Page 352 of 1
before the variable name, like this: _hello = "hello"
Instead of hello = "hello"
In his case it would be the name of a unit, most likely though
I think it's SUPER unconvenient that the variable he uses is called ain this case and you're saying things like "a variable" ๐
^
@tame portal ๐ ๐ ๐ ๐ ๐ ๐
Do you need to access them globally in any function?
If the answer is no, then add an underscore before the name
Surely no one else will use the name "a" and will cause a collision.
I'm laughing.
Alright alright I'll stop ๐
Those are the names he gave to the unit under attributes. You dont put underscores there.
yup, editor
Okay, then don't put an underscore ๐
This is Roques first foray into sqf, stuff is basic still :P
@little eagle I can't do these jokes because I'll get banned, you're just gonna get a rank removed ๐
Get banned for an innocent joke? ๐ญ
Banned for using underscores wrongly
I elevate the quality of this chat with it.
yup, im a noob
Its cool
im doint this as a love letter for another game
U wot? @astral tendon
im recreating a mission the Delta Force black hawk down game
Hello
Yes, I saw, enemy man, 500m east, just now
i wanna set a trigger to detect exac 4 players not only one
any idea?
or better say, a group of blurfor
inAreaArray
any way to move a control to the front? other than recreating it
inAreaArray wiki does not talk about group
_inAreaUnits = ((units group1) inAreaArray trigger1)
if (count _inAreaUnits >= 4) then {
systemChat ' there are atleast 4 dudes from group 1 in trigger1';
};
use units to get an array of units inside a group
count to count them
there is a size limit to the triggers work?
I have no clue what that means
the are size of the triggers
the are size of the triggers
I am unable to authenticate a question...
Is that a statement?
Triggers do not have a size limit. They can be 10m X 10m or 100km x 100km
if (isNull gunner _x) count [car1, car2, car3, car4];
this is a condition to a trigger
i wanna trigger when all those 4 vehicles have gunners
This works perfectly fine if i host locally, but on dedicated the _carrier vehicle isn't spawned.
the _sonicboom ones work just fine
{isNull gunner _x} count [car1, car2, car3, car4] == 0```
thats what it should be roque
Thanks Connor, it worked
triggerActivation [move1, move2, move3, move4];
i wanna this to be activated by a trigger to set off other triggers
but its gives a error expecting a object
because triggerActivation expects a trigger as the parameter.
https://community.bistudio.com/wiki/triggerActivation
I dont know enough about triggers to help you on that one, but the wiki should be able to guide you in the right direction.
i have a verry strange problem
the AI dones not move if they dont have a Player gunner
if i swap slots the car will move
but if i am not in the car they will not follow their setDriveOnPath
maybe something to do with ranks? are you their leader or something?
hmmm have you checked their family trees?
maybe one of them was wed to another king in a secret ceremony
how can this be any different? i create a local vehicle, why does it care about multiplayer editor vs dedicated? jeez
anyone know macros?
#define DESCFIND(var) ((_roleDesc find (toLower var))> -1)
if DESCFIND("recon") exitWith {
i don't know makros, i tried to understand them once. I found this to some use: https://cbateam.github.io/CBA_A3/docs/index/Macros.html
._.
Post problem, tag commy
works 7 times out of 10
I think there were a few a couple of days ago ๐
i'm on the border to insanity. mission works flawlessly on locally hosted dedicated, weird shit happening on remote dedicated. suddenly pictures not found that work despite not being found? objects spawning 100m under water that spawned at perfectly good height? jeez.
๐ค
well
i got one picture.
ONE.
its in the mission root
??????????????
i mean c'mon.
So loading screen does not work?
But does it work in single player/
or local dedi?
well it does work. is displayed perfectly fine. still "error: loading.jpg not found"
it works in SP, local dedi, but not remote dedi
path might be bad
besides, it is being displayed just fine.
yeah i lowercase everything.
and i don't get the error consistently, it pops up every other time
yeah works on win
thats not the weirdest stuff to, my aircraft carrier turns into a submarine on the dedi.
spawns under water no matter what. i'm on it for hours now, just doesn't want to spawn above the water line.
is there a script to increse the vehicle turret speed?
mkay so i logged the carriers position basically each frame and compared the outputs locally and remote, the position is supposedly identical. so my carrier is invisible? great.
_unit setSkill ['aimingSpeed',1];
@astral tendon
If ai, this might work.
this is to work with players too
_pos1 = ((getPosATL player) vectorAdd [300,0,200]);
_pos2 = ((getPosATL player) vectorAdd [0,300,200]);
_carrier1 = createVehicle ["Land_Carrier_01_base_F",_pos1,[],0,"CAN_COLLIDE"];
_carrier1 setPosATL _pos1;
_carrier2 = "Land_Carrier_01_base_F" createVehicleLocal _pos2;
_carrier2 setPosATL _pos2;
can someone explain that to me?
seems like setPos has zero effect on local vehicles?
ahh no, it is just the carrier.
_pos1 = ((getPosATL player) vectorAdd [300,0,200]);
_pos2 = ((getPosATL player) vectorAdd [0,300,200]);
_carrier1 = createVehicle ["Land_LightHouse_F",_pos1,[],0,"CAN_COLLIDE"];
_carrier1 setPosATL _pos1;
_carrier2 = "Land_LightHouse_F" createVehicleLocal _pos2;
_carrier2 setPosATL _pos2;
mmhm okay [_carrier1] call BIS_fnc_Carrier01PosUpdate; fixes it.
nice 6 hours spend.
still, there is a difference between createVehicleLocal and createVehicle when it comes to the freedom, and somehow it is also treated differently in MP.
doesn't help. BIS_fnc_Carrier01PosUpdate doesn't work in dedicated MP environment when used with createvehiclelocal apparently.
just to confirm, you executed BIS_fnc_Carrier01PosUpdate from the server right (in MP)?
no.
i'm creating a local vehicle? it isn't transfered over network? the server shouldn't know about it?
thats why i ask. BIS_fnc_Carrier01PosUpdate MUST be run on the server. You could try duplicating the function but without the isserver check at the start if you havent sorted it out already.
i've duplicated the function and removed the server check. it's being executed alright but it is not doing its job
or, well, maybe it is but the carrier is still invisible
is there a comand to change AI to stop following the road?
group1 setBehaviour "COMBAT";
https://community.bistudio.com/wiki/Arma_3_AI_Behavior#Danger
aware/safe make ai drive on road
no
setBehaviour only works to goups?
no, it also works on units, but affects the whole group anyway
for some reason my AI driver is struguling to get on a new possition i made in the middle of the road
he keeps going back and foward
i just added a extra point
Did that fix it?
no
i mean i added a extra point
and he just cant get in there
he just go with the car back and foward
stuck ๐
quick question here, (entities "Air") doesn't return anything, _forEachIndex returns zero every single time:
jesus, letme pastebin this shit
Ohhh ๐ค
what is the command to cancel the setDriveOnPath?
Yep, I did a _x isKindOf 'Air' Still nothing, this is hilarious.
OH DUH , Damn it all to hell. I gave it a unit variable on accident
Yeah, I think I've got it down now. Lol.
Had two pots already! ๐
Are you smoking indica? that shit makes you slow...
Not a smoker, that shit is bad for you.
Who knows ๐คท
macro....?
Macros in preprocessor?
can't say I do.
hahaha, sure enough.
i tink i got it
its looks like its mandatory to setDriveOnPath have two possitions
otherwise the unit will not move
I would only hope so.
car1 setDriveOnPath [[3690.78,11090.7,0],[3690.78,11091.7,0]];
i just edit one number and it worked
A path is a line segment, and a line segment needs at least two elements
But youre just doing this fornthe car to drive to that location? Other commands might work better for you
like I said earlier : doMove
oh my god, I still stuck at macros
๐ค
#define IFDO(var1,var2) if (!isnil {var1} && {!(var1 isEqualTo "")}) then {var2};
#define IFDOT(var1,var2) IFDO(var1,_target var2 var1)
#define OVERLOAD(var1) systemChat format ["%1's inventory has been overloaded by %2!",(typeOf _target),var1];
#define ADDITEMUNI(var1) if !(_target canAddItemToUniform var1) then {OVERLOAD(var1)};_target addItemToUniform var1;
#define ADDITEMVEST(var1) if (_target canAddItemToVest var1) then {_target addItemToVest var1}else{ADDITEMUNI(var1)};
#define ADDITEMBACK(var1) if (_target canAddItemToBackpack var1) then {_target addItemToBackpack var1}else{ADDITEMVEST(var1)};
#define IFLIST(var1,var2) if (var1 isEqualType []) then {private _nil = {for _i from 0 to (_x select 1) do {IFDO(_x select 0,var2)};false} count var1}else{IFDO(var1,var2)};
#define IFARR(var1,var2) if (!isNil {var1} && {var1 isEqualType []}) then {private _nil = { IFDO(_x,var2) false} count var1;};
// Code begins
IFDOT(_uniform,forceAddUniform)
IFDOT(_vest,addVest)
IFDOT(_backPack,addBackpack)
IFDOT(_helmet,addHeadgear)
IFDOT(_goggles,addGoggles)
IFARR(_commonItems,linkItem)
IFARR(_commonMedicalItems,ADDITEMBACK(_x))
IFARR(_commonExtraItems,ADDITEMBACK(_x))
help
Hey, that's better than what I would've done. high five
This is definately not how to macro, but, how do you macro?
I've read the documentation, but I lack the ability to macro
Tbh, it's quite useless macro and makes things unreadable, BUT, saved me ~10 lines of repeating code
phew
why not just use functions? macros like that are so fkn unreadable it's not worth it
Isn't the mentality -> If you repeat the code - > Function it
i dunno my but mentality is readability above all else
readability is good for when you are sharing or looking back at code later on. But final product is performance imo
does this look correct?
if(count(crew(_this select 0)) < 2 && (_this select 1) isEqualTo "driver") then {
(_this select 0) animateSource["DoorL_BackOpen",0];
(_this select 0) animateSource["DoorR_BackOpen",0];
};
this is placed in a getIn event handler, back door won't close.
position that was entered in as, returns a string. it's all lowercase on the biki
Yes but can you check? Even just a diag_log of _this
But that is a function
it's a function in a function in a function.... Didn't wanna go any deeper
The mind just doesn't understand the depth of it all! ๐
fnc_commonCode used in fnc_defaultCode used in fnc_unit ( can be used anywhere) but used on postInit
yep postInit = 1;
What's the change scope command called?
Lads i'm struggling a little bit to find the position in an array of a nested array if I only know certain info.
For example my array is
[ ["Cache_1",["Box_FIA_Wps_F",[2033.22,3448.04,63.1198]]],["Cache_2",["Box_FIA_Wps_F",[546.874,3248.17,39.8989]]] ]
How i'm struggling using examples from KK and one from Zeno's framework to search my array for that and return 0 or 1 for the array position that its in
_array = [ ["Cache_1",["Box_FIA_Wps_F",[2033.22,3448.04,63.1198]]],["Cache_2",["Box_FIA_Wps_F",[546.874,3248.17,39.8989]]] ];
_target = "Cache_1";
_found = _array select {(_x param [0]) isEqualTo _target;};//edit extra parenthesis //edit2 CAUTION case sensitive
_found = param [0];// because it's [["cache-1"...
_found params ["_name","_class","_pos"];
Maybe?๐ค
Also you can make array (slightly) readable
_array = [
["Cache_1",["Box_FIA_Wps_F",[2033.22,3448.04,63.1198]]],
["Cache_2",["Box_FIA_Wps_F",[546.874,3248.17,39.8989]]]
];
Oh yea that was just copying into discord. I'll give that a spin, its simmilar to what i've got at the minute.
If in trouble put
systemChat str _target;
systemChat str _found;
between the lines
So hold up, _found is returning "Cache_1" so what i'm after hopefully is to return 0 as the array ["",["",[]]] is element 1
Unless i've goofed
Reason being btw, so it doesn't sound crazy, is the array is actually created each session, its not set. So it'll create that array with the positions of those box's
// Get task list from profile
_taskList = ["mission_tasks_list",[]] call seed_fnc_getVars;
// check if task already excists and quit if it does
private _matchedTask = (_taskList select {(_x param [0]) isEqualTo _taskVar}) param [0,""];
if !(_matchedTask isEqualTo "") exitWith {systemChat 'tasks_fnc_add task already exists'};
Works on my machine โข ๐คท
That checks if "mission_tasks_list" is at element 0 though right?
_taskList = [["blu_task1",[WEST,["blu_task1"],["Liberate the town by any means.","LIBERATE TOWN"],town_3,"Attack","CREATED"],1,[{true},{false},{false}],[{},{},{}],"added"]]
blu_task1 is the unique taskID
_x param [0] means it will get the first (0) element of the array
because it's select { /*code*/} it will loop through all elements of _taskList;
_x = ["blu_task1",[WEST,["blu_task1"],["Liberate the town by any means.","LIBERATE TOWN"],town_3,"Attack","CREATED"],1,[{true},{false},{false}],[{},{},{}],"added"]```
_x param [0] /*"blu_task1"*/ isEqualtTo _taskVar /*"blu_task_1"*/ // true, so it returns it
_found in your first example. It should return a number is that correct?
_array = [ ["Cache_1",["Box_FIA_Wps_F",[2033.22,3448.04,63.1198]]],["Cache_2",["Box_FIA_Wps_F",[546.874,3248.17,39.8989]]] ];
_target = "Cache_1";
systemChat str _array;
_found = _array select {(_x param [0]) isEqualTo _target;};
systemChat str _found;
_found = param [0];
_found params ["_name","_class","_pos"];
systemChat str _name;
try
wait a second...
_array = [ ["Cache_1",["Box_FIA_Wps_F",[2033.22,3448.04,63.1198]]],["Cache_2",["Box_FIA_Wps_F",[546.874,3248.17,39.8989]]] ];
_target = "Cache_1";
systemChat str _array;
_found = _array select {(_x param [0]) isEqualTo _target;};
systemChat str _found;
_found = _found param [0];
_found params ["_name","_class","_pos"];
systemChat str _name;
lmao
_found = param [0] < false
_found = _found param [0] < correct
Its still returning odd- https://i.imgur.com/xCLWeMi.png
That's the correct return, what did you want to return anyway?
Well in the case of Cache_1 I want it to return 0 or in Cache_2 1 or Cache_3 2 as its the element number in the array
ugh, why?
unless i'm missing something for now deleting that element with what you've given
aah
in that case
_array = [ ["Cache_1",["Box_FIA_Wps_F",[2033.22,3448.04,63.1198]]],["Cache_2",["Box_FIA_Wps_F",[546.874,3248.17,39.8989]]] ];
_target = "Cache_1";
systemChat str _array;
_newArray = _array select {!((_x param [0]) isEqualTo _target)}; // added ! so it only returns the ones that don't have cache_1
_newArray should now only contain cache2
Oh wow yea thats perfect and works in the situation i'm using it in. Outstanding, never would have thought of that. Super appreciate it
Should use a namespace and not an array.
myTag_CacheNamespace setVariable ["Cache_1",["Box_FIA_Wps_F",[2033.22,3448.04,63.1198]]];
myTag_CacheNamespace setVariable ["Cache_2",["Box_FIA_Wps_F",[546.874,3248.17,39.8989]]];
myTag_CacheNamespace getVariable "Cache_2";
Depends on how big it gets I guess.
I'd use a LOCATION for this.
I'd use profilenamespace, because it would be nice to have persistance ๐
It is persistent yea, i'm not using profileNameSpace though, i'm using INIDBI2 to save to
I'm saving just the array
How big it gets?
Depends on map size. Wouldn't be anywhere more that probably 30 odd
I'm on Aliabad which is 5x5 from memory. SO theres a fair few grid squares (similar to Insurgency grid squares or MSO ones) and it bases how many to make off the amount of enemy squares
Are they all named Cache_N ?
PMF_Cache_N yea
_cz = ceil ((count PMF_Zones) / 16);
for [{_i=1},{_i<6},{_i=_i+1}] do {
It gets its number from the above
Maybe you don't even need the name then, because it's implicit.
I did think of that, but if say, I go "PMF_Cache_6" is element 5. The others then, the numbers remain so they aren't the same anymore
so i delete element 5. Element 5 then is PMF_Cache_7
And I didn't think it was ideal to then rename each of them and resave the array with their new names
_cnt = count PMF_Caches;
if (_cnt == 0) then {
_cz = ceil ((count PMF_Zones) / 16);
for [{_i=1},{_i<6},{_i=_i+1}] do {
if (markerColor _mkr == "ColorBLUFOR") exitwith {};
_CacheZone = selectRandom PMF_Zones;
_cacheZoneMarker = str(_CacheZone);
_gridHouses = [(getMarkerPos _cacheZoneMarker),50,2,true] call findHouses;
_cacheHouse = _gridHouses select 0;
_housePositions = _cacheHouse buildingPos -1;
_cachePosition = _housePositions call BIS_FNC_SelectRandom;
_cacheType = ["Box_FIA_Ammo_F","Box_FIA_Support_F","Box_FIA_Wps_F"] call BIS_FNC_SelectRandom;
_cache = _cacheType createVehicle _cachePosition;
_cacheName = format ["PMF_Cache_%1",_i];
_cache setVehicleVarName _cacheName;
_cachePosition = getPosASL _cache;
PMF_Caches pushBackUnique [_cacheName,[_cacheType,_cachePosition]];
publicVariable "PMF_Caches";
//Save array to INIDBI2
["write",["PMF","PMF_Zones_Caches",PMF_Caches]] call PMF_DB_Zones;
_cache addEventHandler ["killed",{[_this select 0] remoteExecCall ["cacheFromDB",2];}];
};
Thats the code for spawning the crates for the first time if theres none saved
Its a bit sketchy but it works until I clean it up a bit
_cacheType = selectRandom ["Box_FIA_Ammo_F","Box_FIA_Support_F","Box_FIA_Wps_F"];
They have this ^ now
Any performance difference? I'll change it now though
I guess its engine not function so should be faster
Command is always better than function.
And it looks better for sure.
setVehicleVarName has local effects, dunno if that's an issue.
Its serverside so shouldn't matter
Players only interaction with it is when they shoot the box and it is destroyed, but thats also a server eventhandler so It shouldn't cause strife
Whilst its kinda messy, i'm happy with what i've managed so far really. Its pretty fun i think anyway the mission
Getting stuck on some specific things but this channel bails me out. I feel like I've asked too many questions
_cache addEventHandler ["killed",{[_this select 0] remoteExecCall ["cacheFromDB",2];}];
^ This seems weird to me. You add an eventhandler on the server and it sends a function call to the server?
_cache addEventHandler ["killed",{[_this select 0] call cacheFromDB}];
???
Yea that was some confusion. If a player blows the crate up, whether its the player calling the eventHandler or the box
The killed eventhandler is fired on the machine that owns the box.
Not the shooter.
And even if it were the shooter, it would never fire on a client.
Because addEventHandler itself has local effects.
And is only executed on the server.
If it were an object witch changing locality, i.e. a car
Where the locality is transferred to the driver
Then this wouldn't work anymore if someones enters as driver.
Yea i've added to the player getInMan and getOutMan eventhandlers to save vehicle positions
GetIn(Man) is a bit different in that it also fires for remote objects, but also only if the eventhandler was added on the local machine.
Killed is more strict.
but what if a vehicle is moved after it has no passengers any more?
So, the vehicle only saves when a player gets out from the driver seat
When they get in, its removed
then added when they hop out
rather than updating as it moves
not an ideal solution to the problem
Why not?
you can move vehicles by means other than driving them
Slingload? How else you move a vehicle
Its something the lads playing on the mission are aware of. We don't use helicopters currently so its not something that crossed my mind.
crash in to it with another vehicle, slingload, getting arma'd...
rolling down a hill
It's good if getting thrown away with 15000 km/h thanks to PhysX by NVidia doesn't update the logged position.
I've rarely seen vehicles roll down hills without a driver
They can't. PhysX "Handbrake" is always on.
Again, even still, if a player parks like a spud and it moves, they're likely to get back in and correct it anyway
you're definitely both wrong on this one i'm afraid
Other than helicopters maybe sliding down a hill if a pilot ejects on a slope
Cars/tanks won't slide/roll down a hill without someone in it afaik
Yes.
Oh and boats can move after a player hops out
you are too trusting of this engine ๐
https://youtu.be/lu3VTngm1F0?t=100 as george Michael once sang. Ya gotta have faith
#define ADDITEM(var1)\
call {\
if (_target canAddItemToBackpack var1) exitWith {_target addItemToBackpack var1};\
if (_target canAddItemToVest var1) exitWith {_target addItemToVest var1};\
if !(_target canAddItemToUniform var1) then {OVERLOAD(var1)};_target addItemToUniform var1;\
};\
#define IFDOT(var1,var2) _target var2 var1
#define IFDO(var1,var2) if (!isnil {var1} && {!(var1 isEqualTo "")}) then {IFDOT(var1,var2)}
#define OVERLOAD(var1) systemChat format ["%1's inventory has been overloaded by %2!",(typeOf _target),var1]
#define LOOPARR(var1,var2) {IFDO(_x,var2)}count var1
#define IFARRAY(var1,var2) if(var1 isEqualType []) then {LOOPARR(var1,var2)} else {IFDO(var1,var2)}
macros are so annoying
don't work ๐ฆ
literaly spent 3 hours working on these, still nothing, shoulda just made normal code ๐ญ
yes, you should have
you think macros are smart but then you end up taking 3 hours to write something simple that doesn't even work
You are putting too much into them
yeah
#define IFDOT(var1,var2) _target var2 var1
why?
_target COMMAND ITEM
Yes, why?
cos macros are clever so it makes the code cleverer
why not ?
You're supposed to put the ugly stuff into the macro and give it a nice name, so you can write clean code.
#define SELECT_BY_NAME(array,element) (array select {(_x select 0) isEqualTo element} param [0, []] param [1, []])
private _array = [
["Cache_1", ["Box_FIA_Wps_F", [2033.22,3448.04,63.1198]]],
["Cache_2", ["Box_FIA_Wps_F", [546.874,3248.17,39.8989]]]
];
SELECT_BY_NAME(_array,"Cache_1"); // ["Box_FIA_Wps_F", [2033.22,3448.04,63.1198]]
SELECT_BY_NAME(_array,"Cache_2"); // ["Box_FIA_Wps_F", [546.874,3248.17,39.8989]]
Example from earlier.
If the macro does less stuff than want you have to do when you put down and write it, there is no point.
"LOOPARR" is not a nice name and leaves me more confused than before. ๐ฆ
loop through that array
lol ๐
I get it
it's bad
#define DESCFIND(var) ((_roleDesc find (toLower (var)))> -1)
#define DESCIF(var,var2) if (DESCFIND(var)) exitWith {_role = var2};
#define TYPEIF(var,var2) if (_typeName isEqualTo (toLower (var))) exitWith {_role = var2};
I got this now
I rewrote that script in normal sqf (mostly)
This one "seems" to work
๐
Anyone know why i get this ?
12:11:10 Call extension 'MainDll' could not be loaded: Insufficient system resources exist to complete the requested service.
Memory full?
Nope
Everything I find seems to either indicate that or a lockup
But no experience, sorry
Not a problem at all, thanks anyway
You might try #arma3_tools since apparently the C guys hang out in there
Allrighty thanks ๐
I read it as "loo-parr". Underscores!
Can anyone see anything wrong with this - it just doesn't work. The only error i can get when breaking down the code is line 16 _noOfPos not defined but it is.
_this params ["_buildings", "_classname", "_maxUnits", "_side", "_maxUnitsPos"];
{
_positions = [_x] call BIS_fnc_buildingPositions;
_noOfPos = count _positions;
if (_maxUnits > _noOfPos) then {
_noOfUnits = _noOfPos;
} else {
_noOfUnits = floor random _maxUnits;
};
switch (_side) do {
case ("CIV"): {
for "_i" from 0 to _noOfUnits do {
_pos = _positions select floor random _noOfPos;
_group = createGroup [civilian, true];
_unit = _classname createUnit [_pos, _group, "this setPosATL [getPosATL this select 0, getPosATL this select 1, (getPosATL this select 2)+1]; dostop this; this setDir floor random 720;"];
if (_maxUnitsPos == 1) then {
_positions deleteAt _i;
};
};
};
case ("OPF"): {
for "_i" from 0 to _noOfUnits do {
_pos = _positions select floor random _noOfPos;
_group = createGroup [east, true];
_unit = _classname createUnit [_pos, _group, "this setPosATL [getPosATL this select 0, getPosATL this select 1, (getPosATL this select 2)+1]; dostop this; this setDir floor random 720;"];
if (_maxUnitsPos == 1) then {
_positions deleteAt _i;
};
};
};
};
} forEach _buildings;
I had no idea there was one!
use selectRandom instead of _noOfPos and floor random
that is correct.
How to pass local variables into the switch?
that's not the problem
if (_maxUnits > _noOfPos) then {
_noOfUnits = _noOfPos;
} else {
_noOfUnits = floor random _maxUnits;
};
change to
private _noOfUnits = _noOfPos;
if (_maxUnits <= _noOfPos) then {
_noOfUnits = floor random _maxUnits;
};
you variable doesn't exist anymore at line 12. So switch can't see if if it doesn't even exist before the switch
Yea that worked, cheers
use private keyword more often. If you use it you'll see these problems more easilly
Ok will do. Why does the varible cease to exisit? Is it beacuse it's only defined inside the "if" statement
yes
local variables get deleted if you leave the scope
which the } from the if/else is doing
Yea, i was just stupid to not notice it...
Thanks for the assist.
When is the appropriate time to use or not use private
almost always private (Stolen almost always auto :D)
Always.
private makes your script faster.
Lol ok.
but only the private keyword. private STRING or private ARRAY variants are bad
can switch really be used with ARRAY types? Oo
internally using isEqualTo
Is it a good idea to use private in the main scope? Seems kinda pointless
you could also register your own type #Intercept and override the isEqual check to something custom. Which would for example match strings with objects in the switch... Or .. stuffz
_array = [1,2];
switch (_array) do {default {false}; case [1,2]: {true}}
Poor mans isEqualTo.
in the main scope no. What is main scope by your definition @atomic epoch
e.g. The first line of an sqf file
that may not necessarly be main scope
It will be if I use execVM
yes
main scope is the first SQF function right after the engine.
so your eventhandler's code. or init.sqf without any sub scope
In that case there is no performance profit. And nothing you could overwrite by accident. So yeah. In that case. no reason to use private besides visual/design preferences.
Stop using execVM and use CfgFunctions though...
I thought so, thanks
You can refer to the functions main scope as main scope, you just don't have to go bonkers with breakOut/To.
execVM compiles the function everytime == performance killer
I do execVM for iteration and fixes then Cfgfunctions for finalisation
use execLUA instead #Intercept
It also compiles the function everytime tho ๐
actual mainscope should not even be reachable
the famous all scope
Oh... Hm... Maybe... There is one callstack item above the first SQF code that get's executed if your SQF is a function call. I think..
I define main scope as the scope that when used exitWith in, ends the whole script instance.
so there might be one scope above you even in main scope..
But I am very tired and hungry and I'm very not sure. So.. Don't take that as truth
So every time you use spawn or execVM you got yourself a main scope
Or every time an eventhandler runs.
main scope is when the only thing above you is Engine. Not SQF.
Yes.
Isn't that just going to a non-existend scope?
breakout "#all";
//--- (breaking out from non-existing scope does the trick)
It just ends the main scope then.
Then report BIS_fnc_halt as broken to BI
But it isn't
Just meant as a joke
OK
I just love the way you write ๐
How so?
Hauso ein Haus mit O
Gesundheit.
Why are these people that need script help always here when I'm not. Timezones are evil!
Like, you always make sure to put a dot behind a sentence, you say OK in capital letters, I don't know man, just very rare when it comes to internet chat rooms ^^
No I'm not bored. I'm making a pizza and will then go to bed
They told me proper punctuation makes you look smarter and I do have to compensate.
LOL
I very much concur, Dedmen. I lost my sanity last night without you.
Like, when you said "I'm laughing." I assumed you were saying that in like a sarcastic manner ๐
Also this way I can complain about other people being stupid and/or lazy when they say something I disagree with without me having to address their actual point.
My pizza is boiling :u
I like sanity
I'd love to tell people that they are stupid.. But everyone would just think I'm rude
So while you guys are still here, you can maybe tell me why spawning an aircraft carrier at ASL altitude 0 and then setPos'ing people onto it a few seconds later with fixed offset works just fine in MP editor but leads to people spawning inside the carrier on dedicated server?
I know that i'm stupid so i'm usually not offended.
How deep into the carrier
deep. meters.
So on the water?
What's the position you're using for setPos?
thinking of this ... the carrier i try to spawn for a cutscene does the same thing, it spawns too deep, seems to be glued to ASL 0
it is a position i figured out by try and error. just a fixed value i entered
@waxen tide setPosASL? or setPos ?
What the heck is this again https://community.bistudio.com/wiki/setPosASL2
If you just spawn them half a meter higher just to make sure?
setPosASL2
yes dedmen, 2 meters even
i actually ran the same script on server and local, and works fine local dozens of times
Enlighten us commy
setPosASL2 is setPosWorld essentially, but not functional.
Great name they came up though
Hope they release a trailer next time for the new commands with the suffix "2"
Both names suck. This one at least mentions that it's actually ASL.
also i tried createvehiclelocal vs createvehicle on MP editor and dedicated server. on MP editor i can setpos the local vehicle how i want, on the dedi server setpos is ignored, can't do jack shit to the local vehicle altitude wise. Z height is just always 0
and i tried every single setPos command
Are any of the vehicles modded?
no, vanilla
You should definitely stick with setPosASL over water...
oh and it only applies to the USS freedom i might add, and yes i copied the BIS_fnc_Carrier01PosUpdate function, removed the if (!isServer) exitwith and still, no bueno
i am commy, i figured from the start on water ASL is a safe bet
You just don't have to take the command names seriously.
i spend 6 hours on that yesterday, trying to get something to work on a dedi server that i tested for DAYS locally on MP editor -.-
So you're spawning a carrier and then you're spawning AI on it?
oh and the weirdest thing? i have a camera i point at the carrier object. and it follows nicely a non-visible object.
well i spawn a carrier as local vehicle for a cutscene, and while the cutscene is running i spawn a carrier for people to actually use, and teleport them onto the carrier. i want to create the illusion that people actually move with the carrier from point A to B. both things work fine local but have huge issues in MP
cutscene carrier is invisible, and the carrier i want to put people on has the issue that people don't spawn on the correct height
discord ate a message.
Could maybe attachTo the people and free them when they're ready.
I guess it's a MP race condition thing where the player objects set their position before the carrier position is updated or something like that.
i figured as much, i put a generous sleep 5 in there since the cutscene easily covers that.
maybe i should locally check if the new carrier i spawned exists?
and then have a local script handle the setPos?
So I guess you can't just place the carrier with the real players on it at the start because that would interfere with the fake carrier and the cutscene, right?
oh you mean just attachTo the carrier they're already on and the move the carrier + people
well currently people spawn on a carrier in the middle of the ocean, no land in sight. then they choose a deploy point on the coast, cutscene, and then the carrier stands right next to the coast.
You could do that or just hideObject the real carrier during the cutscene.
oh the cutscene takes place in the middle of the ocean without the real carrier in sight.
i made the cutscene 100% local with createvehicle local to avoid timing issues.
Yeah, but the real carrier can appear in various places.
i made the cutscene 100% local with createvehicle local to avoid timing issues.
Very good idea.
Then it also might work for JIP...
does one wants to check if breakTo and breakOut are case sensitive?
I can do that.
well, now my carrier is hovering in the air. its okay, i'll just give the story a little spin and claim NATO has hovercarriers now.
systemChat "test begin";
call {
scopeName "MAIN";
call {
breakTo "main";
};
systemChat "MAIN";
};
systemChat "test end";
What I posted prints "MAIN", so not case sensitive.
MAIN should be printet with breakTo Oo
breakOut on the other hand should prevent that print ๐
Again another BI dumbness.
They store the scope in original case. and tolower everytime they check it. Instead of tolowering once inside scopeName
retest with breakOut?
systemChat "test begin";
call {
scopeName "MAIN";
call {
breakOut "main";
};
systemChat "MAIN";
};
systemChat "test end";
Does NOT print "MAIN" this time.
So, to make a function without functions library, I just
_myfnc = {blabla};
missionNamespace setVariable ["myfnc",_myfnc,true];
remoteExec ["myFnc",_target];
That's gonna work, right ?
So we've been adding showcase mission to our mod and we can't figure out how to add a working overview picture. Thing we use right now:
class CfgPatches
{
class WW2_MissionsWW2_p_WW2_Showcases_p
{
units[] = {};
weapons[] = {};
requiredVersion = 0.1;
requiredAddons[] = {};
};
};
class CfgMissions
{
class Showcases
{
class WW2_MissionsWW2_p_WW2_Showcases_p_German_Engineering
{
displayName = "[WW2] Tanks - German engineering";
overviewText = "Try out IFA3 Battle Tanks through the eyes of Wehrmacht tank crew.";
overviewPicture = "WW2\MissionsWW2_p\WW2_Showcases_p\German_Engineering.Baranow\img\view.paa";
author = "Jaki";
briefingName = "[WW2] Tanks - German engineering";
directory = "WW2\MissionsWW2_p\WW2_Showcases_p\German_Engineering.Baranow";
};
};
Does it complain about the picture not being found?
no, just not showing. for example if I push mission from editor to SP, its showing just fine
but as if it was part of the mod its not
Well, guessing some people will like this. Still reading through the notes now.
Added: A "Recompile Selected" button is now available in the Functions Viewer
Where do I find the classnames of things? I tried using the config viewer but what it gave me isn't working?
Like this, or something else? https://community.bistudio.com/wiki/Arma_3_CfgWeapons_Items
Exactly, but the only thing is, I'm looking for the class names of magazines from mods
Ha, I don't know why this one is funny to me. Damn bushes. Tweaked: The mass value of the b_leucaena_f bush was reduced in order to deal less damage to vehicles
Ah, sorry then.
I'm not sure where you'd find that. Which mod?
It's a few different ones. Two of them are the LAGO weapons, the Biken and KU5K.
Apart from opening the CfgWeapons from the function viewer, I'm not entirely sure. Maybe someone else would know! I'm waiting for the game to update, so :(
@little eagle https://www.youtube.com/watch?v=r7sSoiPdQzI thats how it is supposed to look.
You could try teleporting everyone with attachTo first.
Anyone got info / example of CfgDebugConsole thanks
private _attachObjects = _carrier nearObjects ["CAManBase", 50];
{
_x attachTo [_carrier];
} forEach _attachObjects;
_carrier setPosASL blah;
{
detach _x;
} forEach _attachObjects;
I am on 1.76 and there is no CfgDebugConsole.
Arma Update pushed, its on the change logs
The need for signatures is going to be more important now. Because without any verification, any joe smho can enable the debug console via addon
Ah, good to know. I will do that asap
"The need for signatures is going to be more important now. Because without any verification, any joe smho can enable the debug console via addon" This was already true.
Yeah, I though 1.74 had this already.
1.76 just fucks up the watch fields...
And has this mysterious CfgDebugConsole
https://community.bistudio.com/wiki/BIS_fnc_fire The function is global, so please do not put it in unit or vehicle init. Developers being serious ๐
if (isServer) then {
[this, "HE"] call BIS_fnc_fire;
};
What now?
You are entering a dangerous territorium here...
@little eagle yes, i was forgetting that this was the case in 1.74
[cursorTarget, currentMuzzle cursorTarget] remoteExecCall ["BIS_fnc_fire", cursorTarget];
Tweaked: Double slash comments in code in the Debug Console are now ignored Hurray!!
doesn't matter as you wouldn't get a return from it
unless you mean the whole code
whole code block. I'd be nice to copy // commented code to debug, beable to edit from there then copy back to script and maintain formating...
It doesn't fuck up strings containing //
Ah I see. let me test.
They changed some stuff around, so the prev / next is borked, but that will be fixed soon.
fix required with CBA?
Yea, it's CBA addition the next prev
at least I think, haven't played vanilla Arma for a while so xD
Also @cloud thunder it looks like formatting stays when you copy from the debug console.
It's already fixed on github and CBA will update once vipermaul awakes.
only annoying thing is that enter and tab don't work, so when pressing enter the code run's had that happen some times in live actions...
Shift enter
nice ones
yea know about shift enter there is no one for tab tho ๐ฆ
The Tab thing could maybe be fixed with mod.
I see no reason to have tab be tab out for this.
maybe CBA ^^
That's what I'm talking about.
๐
Is it true that house is sunk into the ground and replaced with wreck model when it is destroyed ? ๐ฒ
Yes.
don't they get deleted shortly after though since many updates?
hue
That's why our mission searching object is under the ground and failed to find, if the wreck model is deleted when our new mission is started. right?
I remember A2 when it created one ruin for each client
hefner
don't know what you mean @barnes#7447 but object can get buried in the damage model..
Destroyed building will not be deleted.
Ruin is a new one on top.
getPos test_b
[2003.42,2718.12,-100.301]
100 meters below ground. Not deleted after 10 minutes.
So what = more frames on server and client. Leaving the original building uder ground and deleting damage model or replacing damaged model with original model?
JIP syncronization considered?
No idea, better not mess with it.
Well I have noticed slight fps improvement deleting ruins when no players on server as oppsed to leaving everything as is..
If your performance is bad, then destroyed buildings are usually not the issue
Bad performance is not an issue. The question was reguarding optimization
Ohh, yeah when buildings get destroyed, the turn into objects you can edit with zeus....
You'd get more gains from making cars into simple objects when there is no one around them
I get the helos with all their sections in the model, but what's up with the submarines?!
Some don't have selections at all. Despite what is configured for it. None you can acess at least
I had the same thing occur with the tent hangars and the regular metal hangars
I tried deleting / hiding all buildings on malden and there was no increase in fps, by getting rid of everything that is on the other side of the island. Buildings need no optimizations.
Fish aiโข
Underwater stuff is an overloocked gimmick. I doubt anyone goes under the water at all...
@peak plover What?!?!? I go diving all the time
addMissionEventHandler ["BuildingChanged", {
params ["_old", "_new", "_isRuin"];
if (_isRuin) then {
_old spawn {
sleep 5;
deleteVehicle _this;
};
};
}];
Agreed, the fish are really bad.
But that only matter near the sea.
@little eagle any data witht that? does it help?
idk, I just wrote it because.
I'll save it. I'll give it a go when I do my clean up stuff again
Any new scripting stuff with new update?
hah that's cool
I can only imagine how many dick leaflets we are going to get in random missions
message for you, sir dickbutt leaflet
can someone tell me what the differences are in hosting a local server and "joining" it with the editor in MP mode and connecting to a remote, dedicated server, scripting wise?
Jeez. Civies already have enough to worry about
@waxen tide remote, you are not local to the server. Editor you are local to the server
Afaik
(isServer) command and also more than 1 instances of the engine, meaning if you global execute a function that will add 5 magazines, and there are 2 instances(serv+client), there will be 10 mags. But if you are local hosting you are 1 instance and only spawn 5.
You usually want to avoid running code on all clients/instances
Yep
drawTriangle runs pretty damn well
Good to know.
(now to start begging for a drawTriangle3D)
You can do that yourself, can't you?
drawIcon should suffice for that situation
You can draw lines, lik the 3d editor bounding boxes
I want to draw custom shapes, without having to make a model for it
fill shapes, that is
Physx traces yeah
I already use drawLine3D but that isn't so hot for what I want
You can return the bounds for an object and draw the lines
Ooohh..i see.
I could do so many cool things :[
Yeah Physx traces have never looked really quality anyways.
Or at least in whatever dx version a3 is. Dx11?
Any way to maintain control of my unit/player after createCamera?
ill check that out. thanks @subtle ore
Tried some sort of combinations like that. With no success. But will try these 2.
Wanna do some FlyBy etc. cameras for jets without hitting the ground ๐
I see, that'll probably work for you.
Another useful command for what you are trying to achieve
Yeah. I was worried about the switchCamera that is mandatory here.
But "It is not needed to switchCamera to the unit to be able to control it - it is needed to be able to fire with" should help ๐
Yeah its not needed. But switching between plane camera and custom camera functionality is there
So I've got this trigger that plays sound. How do I make it play to only the person who sets off the trigger?
Still no success
_cam = "camera" camCreate (player modelToWorld [0,400,2]);
_cam cameraEffect ["External", "Back"];
_cam camSetTarget (vehicle player);
_cam camCommit 0;
player remoteControl driver jet;
sleep 5.0;
objNull remoteControl driver jet;
_cam cameraEffect ["Terminate", "Back"];
camDestroy _cam;```
http://i.imgur.com/DjD94Wt.jpg somehow caching the result of this in the profileNamespace seems slightly overkill.
@sullen willow Shouldn't it be sufficient to make the trigger local?
!(isServer) && (player in thisList)
if (!isDedicated) exitWith {}; ๐ณ
haha
@sullen willow I think https://community.bistudio.com/wiki/say3D is local, you could call that on the player
right @little eagle
testing single functions locally because testing on dedi took my sanity last night.
Debug console function performance testing is borked.
It only allows one iteration. No way to measure it reliably.
well if a single execution takes 1.7 seconds, i kinda know the ballpark don't i?
so how do i do it properly?
SP I guess.
I'm not a religious person but i know what hell looks like. I've seen a glimpse of the abyss.
its called SQF.
Try finding the anti derivative of sqrt(tan(x)) if you want to know what hell looks like.
i'm the wrong guy to ask, i cheated on every single math exam.
Debug console in MP?
Yeah, I think I tried to make a chat head like that - like I used an NPC head and put it in the corner of the screen with some text (but it didn't always load the textures so I removed it)
But the thing I'm looking for is a way to put arbitrary 3d shapes in world space
the lines are great, I just wish you could do triangles and fill them with a solid colour, too
Yeah :/
getMarkerPos "marker2","marker2_2"
i need a car to follow multiples markers, how i do it?
AI setDriveOnPath ([array,of,markers] apply {getMarkerPos _x}), barring phone mistakes
car2 setDriveOnPath (["marker2","marker2_2"] apply {getMarkerPos _x})
is this right?
Yes @little eagle
there is a command to units do not follow formations?
btw that scipt seens to work
not to follow formation, not really-really.
you can set them in speedMode "FULL", that will make them rush/sprint to the destination
or you can use "unit move getPos destination" and only this one unit will move away from the group
@hasty violet Is this it? https://community.bistudio.com/wiki/visibleGPS
LoW DLC seems to have broken something, not entirely sure where to start...
Getting an occasional CBA-related error when using CBA keybinds for my addon:
18:36:31 Error in expression <s;
_params pushBack _x;
_blockInput = ([_params call _code] param [0, false] is>
18:36:31 Error position: <[_params call _code] param [0, false] is>
18:36:31 Error Generic error in expression
18:36:31 File x\cba\addons\events\fnc_keyHandlerDown.sqf, line 69
Thoughts?
Related code from cba_fnc_keyHandlerDown.sqf:
// check if either holding down a key is enabled or if the key wasn't already held down
if (_execute && {_allowHold || {GVAR(keyUpActiveList) pushBackUnique _xUp != -1}}) then {
private _params = + _this;
_params pushBack + _keybindParams;
_params pushBack _x;
_blockInput = ([_params call _code] param [0, false] isEqualTo true) || {_blockInput};
};
The keybinds worked fine before this game update, haven't changed anything in my addon and I don't believe CBA's been updated... Speraking of that, does cba have a discord?
try ace 3 slack
Sorry, thanks, & gotcha
Yeah that code must suck if somone is on a phone or <1080
Try reseting your .vars file
see if it still happens after that...
I'm still downloading update, so can't check myself ๐ฆ
Hmm... Still happening w/ reset vars file. I skimmed through the engine changlog, mostly still scratching my head atm
drawTriangles is pretty good up until 100k triangles
and crashes the game at around 300k \o/
erk I deleted all my test stuff for that
I was using drawRectangle with .paa textures to emulate non-rects and the difference between this and that is intense
I love drawTriangle ๐ฆ
I want to marry it
I've seen people use it for marking out play bounds for missions
Like marking off places you can't go if you're just using a small part of a larger map
private _car = "b_car_01";
nig_myStuff = {
missionNamespace setVariable ["test1",_car];
};
[] spawn {
call nig_mystuff;
systemChat str test1;
};
My question is
What happesn
Does _car get replaced by a string?
Or will it check for value of _car when it calls the function
hmm
so if i want it to replace _car i have to use a global var or a macro
hmm
kinda ok, kinda bad ๐ฆ
anyone getting weird behavior of the debug console after the patch?
They changed somthing about it
for me it's like the length of the code matters. same code works only after removing all tabs
very strange
:S
how bad is it to use global variables in a few scripts?
Better off using a new namespace?
_pod = ( [ position player, 0, "C_IDAP_UAV_06_antimine_F", CIVILIAN ] call BIS_fnc_spawnVehicle ) select 0;
player connectTerminalToUAV _pod;
{ _pod removeWeapon _x } forEach weapons _pod;
_pod addMagazine "1Rnd_Leaflets_West_F";
_pod addWeapon "Bomb_Leaflets";``` to fly the new drone around
blessed may be the new hide objects module
I have a problem.
I think it is a simple problem.
{
_eval = (([(AGLToASL _x),true,true] call Ivan_fnc_eval_position_cover) select 1);
diag_log format ["should be number %1", typeName _eval];
diag_log format ["should occasionally be 100 %1", _eval];
if (_eval isEqualTo 100) then
{
_spawn_pos_array pushBack _x;
};
} forEach _building_pos_array;
The if never equals to true, thus never being executed
3:04:46 "should occasionally be 100 75"
3:04:46 "should be number SCALAR"
3:04:46 "should occasionally be 100 0"
3:04:46 "should be number SCALAR"
3:04:46 "should occasionally be 100 93.3333"
3:04:46 "should be number SCALAR"
3:04:46 "should occasionally be 100 100"
3:04:46 "should be number SCALAR"
3:04:46 "should occasionally be 100 100"
3:04:46 "should be number SCALAR"
3:04:46 "should occasionally be 100 98.8889"
3:04:46 "should be number SCALAR"
3:04:46 "should occasionally be 100 87.5"
3:04:46 "should be number SCALAR"
3:04:46 "should occasionally be 100 50"
thats what the log throws out, so _eval occasionally equals 100
i was suspecting a type error or something ?! but to me the output looks just fine
@hasty violet can't keep up with everything ๐
(_eval > 99) gets me close, it equals true in 19 out of 241 cases. thats what i would expect.
but why the hell doesn't (_eval isEqualto 100) or (_eval == 100) work?
then it's probably a float precision issue... if it were me I'd have something like
if (abs (_eval - 100) < 0.01) then {
that's up to you, I don't know if _eval will ever be bigger than 100
it all depends how far away from 100 you'll willing to accept as 'good enough'
well i wrote a function that evaluates building positions
it does ~90 checks for surface intersections
and returns a value between 0 and 100
100 means total cover
a value of like 99 means that ~1 check failed of 90
shrugs
private _result = 0;
{
_check2 = [_size,30,_x] call Ivan_fnc_circle_check;
_result = _result + (_check2 select 1);
if (_abort) then {if (_result < (30*_foreachindex)) exitWith {
systemChat format ["%1", [_check_ceiling,((100/(30*_foreachindex))*_result)]];
[_check_ceiling,((100/(30*_foreachindex))*_result)]};};
} forEach [0.75,1.25,1.75];
[(_check_ceiling select 0), ((100/90)*_result)]
thats where the "100" comes from
you could try a round or ceil on _eval to smooth out that potential imprecision
mmhm yeah rather thinking if all 90 checks pass, i'll just straight output a 100 without math.
so any value below 100 might be nasty float, so not 100% cover
but 100 is 100.
yeah, that sounds good
thats kinda what i need from that function
in this case i want to place enemies in buildings that for certain can't be seen
1 failed check could be a window or something.
thanks for the help
no problemo
sometimes it's just good to type out the problem and the solution will come to you by itself
if (_result = 90) exitWith [(_check_ceiling select 0), 100];
that should do it
yeah kinda
i didn't even think of float since the log output was straight 100 ๐
dozens of smashed bugs later i got something to work. yay!
todo list still getting longer rather than shorter each day.
actually not really. its just that when you think of a simple feature and implement it, it creates problems. problems that require new functions you need to write to check new things.
also, of course, feature creep.
Oh hey, @still forum, you'd be happy to know I finally figured out Github and got my mission scripts up there :D
*happy*
Can't remember who else was interested in them, but hey, it's there now. Took a while, and a few repository restarts.
Wrote up a nice little README for it too https://github.com/Luronius/Nightstrike
But yeah, now you can see how messy my code is on GitHub :D
I will write tons of comments pointing out all your errors :3
Ha, thank you. I mean, it works for now, but any refinements or corrections / optimizations would be great.
I already have a couple.. But that code runs in scheduled so these minimal optimizations wouldn't be worth the effort of pressing a button on your keyboard
Ha, it's all good. I'm still not even sure how I'd see the comments, which is currently what I'm looking for. Was just happy to get it up and out there. I should actually release this mission some time soon, though I'm not sure if anyone was really wanting anything like this.
Oh, that makes sense. Thanks.
Oooh, I can comment on your comments!
Bit odd that they visually break the code and take up space, but I don't mind it too much. You're going to town though.
Done I think
Also operator2script and operator1script are essentially the same.
Consider turning these scripts into one and passing the operator into it via _this
Yeah, that has kind of bugged me for a while, needing to have two scripts for that. There's just so much at play here I couldn't be bothered wrapping my head around it, especially with how many different things need to happen. Just figured that was easier for now. Also, not sure, can the same script be run, while it's already running?
Yeah, I realize most of my issues come with the transition from me only knowing about publicVariable, and me learning about setVariable xD
Also, not sure, can the same script be run, while it's already running? dumb question :U
If you execVM twice.. Does the game instantly crash?
Sure it does! It's forbidden to do the same thing twice in SQF
@still forum is your avatar some furry related thing?
Maybe
๐ณ
just #arma3_scripting things :0
Damn forbidden scripts :(
Aw, BIS_fnc_VRSpawnEffect is rather disappointing looking :(
Just a lil' zappy sound and instant (in)visible state.
Expectations were had, that's where you went wrong ๐
Ha, too true. Was thinking, instead of an EMP, how about a cloak?! I mean, this works, but it doesn't look so good. Would love that glimmer effect from the new DLC, the one used on the memories.
Can't wait when they unEncrypt orange, there is much to learn ๐
Ha, shouldn't take too long :P I have a feeling they just used the particle system, but I know nothing about that, so xD
What would you want to learn?
Memory effect
How they seemlessly change scenarios, etc.
I've not played the dlc, but I've been told there's cool shit
some particle effects
I'd like to find out which one
Maybe I'll have time on the weekend.
All I've got, maybe if you own dlc, you get more?
Yeah these functions are a lot more readable and better than some for ex. tasks
@peak plover PM me Mission name please. Best would be the classname of the mission if you can get at that.
Can't, don't have dlc
.-.
I'll just assume they don't want us to get it until they have made the files into pbo
ebo is intended to prevent people that don't own the DLC from getting access to the content without paying.
It's not made to prevent modding or learning.
Yeah, but it seems like most stuff makes it to pbo in a few months or whenever next dlc is released
So if someone wants to know how something works. I happily help.
I'd like to know eventually, but I don't need/will use anything right now
I'm fine with it, because they have not kept it locked down indefinately...
I'm sure BIS would share all that data to people with good intentions. But how would they know/manage so many people.. That's why they don't
i have not looked into it at all, but i would guesstimate that arma decrypts the files with a key at runtime, so that key eventually makes its way to your computer. obviously smart people can decrypt the files if they want to.
i'm not interested.
but you guys are discussing it at length by now
I was only talking about ๐ช'S
i'm more interested why arma thinks that a balcony is a location totally enclosed by walls despite me doing 99 checks to avoid that
only occasionally tho
jeez. i bet it is detecting transparent rails as wall or something.
What r u doing @waxen tide ๐ค
hiding enemies. for easter!
lineIntersectsSurfaces [
_centerpos,
_offsetpos,
objNull,
objNull,
true,
1,
"VIEW",
"FIRE",
true
];
I'm using that for TFAR's object interception. So a closed Window intercepts but a open one doesn't
That should detect the railings of the railing.. but not detect anything if you go through the gaps
maybe you are only hitting railings by accident
I must say i'm happy with the optimisation aid from dedmen on this. the script evaluated 367 positions, 43 of which were deemed suitable, in 3 seconds.
well i get like 1% false positives
i can't see a systematical error
You could do some additonal checks after the first wave.
well the story goes like: players patrol a town, question civilians. certain conditions trigger an ambush. so i kinda need to spawn hidden enemies and have them sneak up on the enemies.
dedmen, i already do a 3 stage check. stage 1: ceiling. stage 2: 8 checks around in a circle. stage 3: 3x30 checks in 3 heights in a circle
obviously if i get a single fail, i abort checking for the pos
i also fetch the boundingboxreal value for the first encountered object, and calculate the max required check distance from that.
its precompiled functions but i do the check on-demand since its random towns. i thought about creating lookups and storing them in the server profilenamespace tho.
ah no i rely on the provided town center as input
you could also calculate at mission start and store the result on a variable on that building
well not sure that would work dedmen. what if there is a second building blocking a window?
then the check passes
i would do the check for every town in my town array and save the results i guess
But you could first filter out the 100% unsuitable positions. Like the ones on the balcony or on the outside of the building. I guess
true
but honestly atm the script seems performant enough to just be called live on demand
but i'm already using the profilenamespace of the server as a cache for map-dependent data i precalculate, so i might as well add that.
i can already envision it, my mission spawns and needs like 2ms total execution time because everything is in predefined lookup tables and my server profile file is 2gb
actually my lookup tables don't interfere with dynamics, quiksilver. i've indexed every single town on the map with a function and i precalculate data for each town
so it is as randomized as possible, i just save executing some stuff on runtime.
my beta tester found the house in question
the "balcony" on streetlevel?
just above the crosshair.
it is recognized as covered position.
weirdly i think he's having fun.
i think the rails are detected wrongly
probably i need to adjust checking heights
but the ceiling check should totally fail?
Not if it hit's the AC or the Antenna above.. I guess
Could it be that your position is a little bit into the ground? So the ceiling check actually hit's the floor?
no the indexed buildingpos'ses are always a bit above ground
like, half a soldier height?
ceiling check works fine on multiple other buildings. must be the AC or antenna or something
one check function to rule them all. i shall not rest until perfection was achieved.
my idea was to basically keep the map empty. no editor placed objects. no manually placed markers. just have a script molest the cfg and the map until i got all the data needed for mission spawns etc.
i tested a few community maps, so far it seems they comply surprisingly well with the same standards of the BI maps
sooo i hope to throw just any map at the mission without changes.
my server profile file is 2gb wuuuuut. does that not cause problems?
that was me joking about how it will be in the future
i'm currently storing 350kb in the profile. it was 1 .5mb but i optimised it a bit
golly gosh, i was going to say..
you should make your profile file 2gb though just to see what happens
i'm curious now
coughs
๐
if (object == "big_ass_barracks") exitWith {true};
would save at least a second execution time!
well i check if the house has doors, and only consider houses with doors. then i lock the doors, check the concealment of the positions, spawn my enemies, strip them of all guns and gear, set them passive and stop them, and then setpos them. then when the ambush is triggered, i equip them and set them loose.
_unit setUnitPos "DOWN"; ?
yeah sure, but works out for me so far.
i'm spawning the enemies before the players enter the town, yeah.
hence why i'm looking for buildings without windows/doors etc
i guessed thats the safest bet
hey lets make an ambush
1 week scripting later
one issue with "checkVisibility" that i encountered, is that you cant check from the players camera position, only their body.
Did you useeyePos?
nahhh to be honest i smashed most bugs, its like 99% reliable which is already "good enough"
i'll also dress them nicely as civilians to blend in with the others.
i'll actually leave this feature as it is right now and focus on the next one for the next mission part.
eyePos doesn't care about 3rd person, since it also works for remote machines and they don't know if you are in 3rd person or not.
Also fuck 3rd person.
i'm a realism fan but 1st person isn't all that realistic to me. you just lack the feedback from your body touching your surroundings, also your FOV is too small ...
not that 3rd person is perfect but......
waitUntil {cameraView == "EXTERNAL" || cameraView == "GROUP"};
player setDamge 1;
systemChat 'Die nerd';
i mean 1st person with like VR googles? great! 1st person with a monitor and small FOV ? meh.
plebs
1v1 me newb!
@little eagle I've always had vehicle drivers with 3rd person ๐ญ
just increase FOV then
you just lack the feedback from your body touching your surroundings
Why do you play cs:go in first person then?
st00ped ๐
i emulate 1st person vehicle driving by driving over every bush and street sign while following an S path.
i've never played cs:go in my life.
My point is, that's a bullshit argument for 3rd person
well i have no issues flying helicopters and putting them down in tight spots in 1st person, but infantry combat while utilizing cover? meh.
back to politics troll channel where he belongs
yes. yes yes. back to sqf.
eez. generate a full circle, then substract the smaller one in the middle.
don't delete mines, delete generated mine spawn positions. then foreach thru what is left and spawn mines on the coordinates.
bit of sin and should be easy surely
_perimeter True to return only positions on the area perimeter (optional, default: false) <BOOLEAN>
๐ฎ magic
but if it is exactly on the perimeter, then you need to generate multiple.
cba shit is cash, because you can define your own area, example 4
safepos seems to check lots of stuff, might be slow?
maybe do it like that, and randomize the number of points on the circle a bit, and generate multiple circles.
its simple math, so should be fast?
zero checks done to the map
....or just use sin for it's intended purpose
heresy!
yea that ADMM3 is exactly it right
its a function to calculate points on a circle. because you need that literally ALL THE TIME.
vectoradd seems surprisingly performant.
Is the debug console bork? Anything with multiple lines is not functioning for mme
might be... Lot's of debug console borking going on since KK started doing stuff on it.
lol gg