barbolani
Member-
Content Count
1197 -
Joined
-
Last visited
-
Medals
Everything posted by barbolani
-
How to check variables inside Array
barbolani replied to barbolani's topic in ARMA 3 - MISSION EDITING & SCRIPTING
The rpt says there's an error on this script, sometimes... Sometimes script stops with no error, and even worse: the final hint does not appear. Ok, maybe you see where I'm not seeing. I have an external script which checks this one with a scriptdone and sometimes it fires, sometimes not. I assign some local variables to global variables in case the global ones change in the middle of the foreach, nothing gets messed up. Also some external arrays like ciudades which mean the markes is assigned to a certain type of zone so it spawns/despawns in some way. Here's the code: if (!isServer) exitWith{}; cercanos = []; debugperf = false; debugdist = false; private ["_tiempo"]; if (debugperf) then {_tiempo = 0;}; while {true} do { if (debugperf) then {hint format ["Tiempo transcurrido: %1 para %2 marcadores", time - _tiempo, count marcadores]; _tiempo = time;}; _marcadores = marcadores; _mrkAAF = mrkAAF; _mrkFIA = mrkFIA; sleep 0.2; { _marcador = _x; _posicionMRK = getMarkerPos (_marcador); if (_marcador in _mrkAAF) then { if (({(_x distance _posicionMRK < distanciaSPWN)} count amigos > 0) and (not (_marcador in cercanos))) then { if (debugdist) then {hint format ["%1 está cerca, lo movemos a cercanos", _marcador]; sleep 2}; cercanos = cercanos + [_marcador]; if (_marcador in colinas) then {[_marcador] spawn createAAFcolinas}; if (_marcador in ciudades) then {[_marcador] spawn createCIV; [_marcador] spawn createAAFciudades}; if (_marcador in power) then {[_marcador] spawn createAAFpower}; if (_marcador in bases) then {[_marcador] spawn createAAFbases}; if (_marcador in controles) then {[_marcador] spawn createAAFcontroles}; if (_marcador in aeropuertos) then {[_marcador] spawn createAAFaerop}; if ((_marcador in recursos) or (_marcador in fabricas)) then {[_marcador] spawn createAAFrecursos}; if ((_marcador in puestos) or (_marcador in puertos)) then {[_marcador] spawn createAAFpuestos}; }; if (({_x distance _posicionMRK < distanciaSPWN} count amigos == 0) and (_marcador in cercanos)) then { if (debugdist) then {hint format ["Nos hemos ido de %1, lo movemos a lejanos", _marcador]; sleep 2}; cercanos = cercanos - [_marcador]; }; }; if (_marcador in _mrkFIA) then { if (({_x distance _posicionMRK < distanciaSPWN} count enemigos > 0) or (({(isPlayer _x) and (_x distance _posicionMRK < distanciaSPWN)} count amigos > 0) and (not(_marcador in cercanos)))) then { if (debugdist) then {hint format ["%1 está cerca, lo movemos a cercanos", _marcador]; sleep 2}; cercanos = cercanos + [_marcador]; if (_marcador in ciudades) then {[_marcador] spawn createCIV;[_marcador] spawn createAAFciudades}; if ((_marcador in recursos) or (_marcador in fabricas)) then {[_marcador] spawn createFIArecursos}; if (_marcador in power) then {[_marcador] spawn createFIApower}; if (_marcador in aeropuertos) then {[_marcador] spawn createNATOaerop}; }; if ((({_x distance _posicionMRK < distanciaSPWN} count enemigos == 0) and ({(isPlayer _x) and (_x distance _posicionMRK < distanciaSPWN)} count amigos == 0)) and (_marcador in cercanos)) then { if (debugdist) then {hint format ["Nos hemos ido de %1, nuestra distancia es de %2 lo movemos a lejanos", _marcador, player distance _posicionMRK]; sleep 2}; cercanos = cercanos - [_marcador]; }; }; } forEach _marcadores; }; hint "Distance check bugged!!!!!!!!!!!!!!!!!!!!!!!!!!!" Thank you for your time!! -
How to check variables inside Array
barbolani replied to barbolani's topic in ARMA 3 - MISSION EDITING & SCRIPTING
Thank you very much Larrow, but giving you the set of scripts is something which will need lots of time from. It's a very complex mission whith spawn/despawn system based on players position, markers position and which side owns the marker via ARRAY. An that interacts with the conquering script (change the marker name from array A to array B) so in the next check will spawn units from the other side. Anyway I've tested more and the distance check script crashes with clean arrays, so the error must be somewhere else. -
How to check variables inside Array
barbolani replied to barbolani's topic in ARMA 3 - MISSION EDITING & SCRIPTING
Thanks friends, But no luck. I have my array with an any when I hint format it. I have a conditional with Larrows lines (tried also _x instead of "_x" and it seems everything isNil) and it does not detect the any. The array modification has something as stupid as: when FIA conquers the marker, then: aafmarkers = aafmarkers - [marker]; fiamarkers = fiamarkers + [marker]; Works most of the times, but sometimes I find aafmarkers with an any, and my spawn/despawn scripts go to hell (but even if I solve this, the spawning can be messing up with something else) @Johnny: the mistake is wanted just for example purposes. Array performance is not a problem (yet) -
UPSMON Updated to ArmaIII
barbolani replied to cool=azroul13's topic in ARMA 3 - MISSION EDITING & SCRIPTING
I'll give you the general idea: With the onMapSingleClick command you may allow the player to click on the map and store in a variable the exact position where he's clicked. Now knowing this position you can move the marker to that position. This kind of features I think will never be in UPSMON suite, as it's focused on AI optimization, not AI management by the player. I'll be more specific. You have your marker, let's say "Patrol1" You place a radio trigger, repeatedly, name it like "Move Patrol1 patrol zone". On activation put: onMapSingleClick "'Patrol1' setMarkerPos _pos; onMapSingleClick ''; true"; This will allow you to change "Patrol1" position. UPSMON patrol groups associated with "Patrol1" should move to the new position and patrol around -
UPSMON Updated to ArmaIII
barbolani replied to cool=azroul13's topic in ARMA 3 - MISSION EDITING & SCRIPTING
Check this: https://community.bistudio.com/wiki/onMapSingleClick and this: https://community.bistudio.com/wiki/setMarkerPos -
How do I keep my Helicopters in Formation?
barbolani replied to BEAKSBY's topic in ARMA 3 - MISSION EDITING & SCRIPTING
forget about using unitplay with formations... as you will record different flights and never will be as accurate as you need. If you want formation attacks like it could be done in a CoD cutscene. The only way I know is to use attachTo, while updating dir and vector of the escort choppers constantly to match the leader, and it will be tacky, as it is on CoD.... -
AI Playing Basket Ball
barbolani replied to Ice_Rhino's topic in ARMA 3 - MISSION EDITING & SCRIPTING
I've seen that, but I think it was on some edition of CoD or Medal of Honor.... -
Location size and angle
barbolani replied to stlassen's topic in ARMA 3 - MISSION EDITING & SCRIPTING
you are correct. Sometimes the zero angle is weird, and sometimes the size is very small, what I make is to take the biggest between x and y and place circles instead of ellipses, and if the size is less than x meters, increase the size. -
How to improve AI without a mod?
barbolani replied to Smoerble's topic in ARMA 3 - MISSION EDITING & SCRIPTING
Yes, UPSMON has those features and many many many more, like detecting dead bodies and making the AI react.... -
Low FPS and Mission Editing
barbolani replied to Kydoimos's topic in ARMA 3 - MISSION EDITING & SCRIPTING
If so, a super simple EH "FIRED" and a check on "PUT" does the job. -
blow ammo cache question
barbolani replied to jandrews's topic in ARMA 3 - MISSION EDITING & SCRIPTING
workaround: if ammocaches do not return true with !alive in any circumstance, try to attachTo the ammobox any small object that works with !alive, maybe you cand hideobject it too.... -
Low FPS and Mission Editing
barbolani replied to Kydoimos's topic in ARMA 3 - MISSION EDITING & SCRIPTING
Idea: you can make an array of elements where you stored any fired object if _this select whatever == "PUT" then arrayofmines = arrayofmines + [_this select whateverelse]; and then make a loop check if those are still alive or not exploded and a check of their position... -
AI path finding - bumps into stones and walls when driving a car
barbolani replied to Heeeere's johnny!'s topic in ARMA 3 - MISSION EDITING & SCRIPTING
Uhm, I allways thought this would be the no1 bugfix to be done. It's absolutely a stopper of good City scenario building. But seems it's not the priority... Nice idea the bunny one. -
Triggers, passing variables from in game editor to sqf file
barbolani replied to gobi42's topic in ARMA 3 - MISSION EDITING & SCRIPTING
uhm, the snippet I gave you has a failure. It won't despawn units all the units inside the trigger, If they are closer to the player than triggersize,they will keep alive forever, while if the player enters again, it will spawn again units + the non deleted ones. Better use this, inside of a trigger independent, repeatedly, on deact: {unit = _x; if ((side unit == independent) and (unit in thislist)) then {deleteVehicle unit; if ({alive _x} count (units group unit) == 0) then {deleteGroup group unit};}} forEach allUnits; Make sure, the AO is smaller than the trigger size, so the player won't see them spawning and despawning. I make this kind of things with UPSMon, marker size at least half of the triggersize, indeed I don't use triggers I use distance checks to the marker center. -
Triggers, passing variables from in game editor to sqf file
barbolani replied to gobi42's topic in ARMA 3 - MISSION EDITING & SCRIPTING
on Deact, assuming you want to despawn AAF units: {unit = _x; if ((side unit == independent) and (unit distance player > sizeofyourtrigger)) then {deleteVehicle unit; if ({alive _x} count (units group unit) == 0) then {deleteGroup group unit};}} forEach allUnits; -
trigger not firing for player if in AI vehicle
barbolani replied to -ami- mofo's topic in ARMA 3 - MISSION EDITING & SCRIPTING
{(vehicle _x in thislist)} count playableUnits > 0; Try that! (Not an MP expert, I'm afraid) -
Locking enemy inventory
barbolani replied to DroopyPiles's topic in ARMA 3 - MISSION EDITING & SCRIPTING
Assuming you are BLUFOR, on init.sqf: {if (side _x == EAST) then {_x addEventHandler ["Killed",{_unit = _this select 0; removeAllWeapons _unit; removeAllItemsWithMagazines _unit}]}} forEach allUnits; -
Locking enemy inventory
barbolani replied to DroopyPiles's topic in ARMA 3 - MISSION EDITING & SCRIPTING
Are the units spawning or are all editor placed allready? -
Locking enemy inventory
barbolani replied to DroopyPiles's topic in ARMA 3 - MISSION EDITING & SCRIPTING
Use a killed eventhandler on enemies, when dead, delete all weapons, ammo and items? -
Which is better for max performance?
barbolani replied to Icaruk's topic in ARMA 3 - MISSION EDITING & SCRIPTING
I discovered this on Antistasi, I use that snippet to spawn groups in random positions around a marker. After a few checks I noticed 1/5 times units were spawning in water. Asked in the forums and that was the answer: no reliable. Changed to way of doing this and no water spawning since. Don't ask me why, but as performance wise it is almost the same, no worries... -
Which is better for max performance?
barbolani replied to Icaruk's topic in ARMA 3 - MISSION EDITING & SCRIPTING
For unknown reasons, seems conditions in a while loop are not reliable... I recommend allways a while {true} and inside of it, a condition with exitwith if no eternal loop is needed. I noticed that in a script like this: _pos = whatever position; while {surfaceIsWater _pos} do {_pos = whatever method of searching a new pos; sleep 1}; The results of that where position in water, don't ask me why, instead of that I had to do this: while {true} do {if (!surfaceIsWater _pos) exitWith {}; _pos = whatever method of searching a new pos; } -
Enemy occupation system (eos)
barbolani replied to bangabob's topic in ARMA 3 - MISSION EDITING & SCRIPTING
Requires a modification of the trigger statements created in EOS. But can be done. The variable _actCond in eos_core contains the conditions under the units spawn or not, and you may see everything depends on isplayer and playableunits. For example: _actCond = "{(vehicle _x in thislist) and (side _x == WEST)} count allUnits > 0"; But having more units to check (in this case, all) may cause performance issues. In my spawn/despawn systems what I do is to create an array of units which will be the ones who will fire the spawn. Not all of them, just the "attack" ones, so if you make the array in your init.sqf: friendlies = units group player; And on any spawned unit you want to make an "attack" unit: friendlies = friendlies + [_unit]; And in the case of EOS you put this: _actCond = "{vehicle _x in thislist} count friendlies > 0"; There you go, the check is only made for the units you want, not all the units. Don't forget to make a script which deletes the units from the array if they die, or get deleted, just friendlies = firendlies - [_deadunit]; so even if they die, and you leave them on an eos place, eos will despawn if you leave the area too. -
Triggers, passing variables from in game editor to sqf file
barbolani replied to gobi42's topic in ARMA 3 - MISSION EDITING & SCRIPTING
editor placed trigger and editor placed marker??? BTW when you are referring to markers, anything must be between brackets, except of course if you assign them to a variable, the variable doesn't need brackets. Example: _myMarker = "MyMarker"; deleteMarker _myMarker; is the same than deleteMarker "MyMarker"; If both are editor ones, just do it by hand. One trigger, one marker, on act of the trigger nul=["nameofthemarker"] execVM "whatever.sqf"; -
Bunker stick to the ground
barbolani replied to barbolani's topic in ARMA 3 - MISSION EDITING & SCRIPTING
That may mean bury them too much if the slope has a lot of inclination, but the problem anyway is the same: how much I bury them? I need a variable result to know if the getPos bunker is in a terrain with 0,1,30% inclination / gradient. There must be a way, because BIS_fnc_findsafePos does something like that to select plain terrain... EDIT!!! AAAAAHHHH Found it! http://forums.bistudio.com/showthread.php?165757-Object-Fortifications-on-slopes&highlight=ground+slope -
Hi! I'm dynamically spawning and despawning units with bunkers. When the spawn zone is for example on the top of a hill, it does not stick to the ground, and that's ugly. I know the solution is around setVectorDirAndUp, a command that exceeds my understanding. But what I cannot reach is how to dynamically know which values to assign from the terrain data on the position it's spawning. I think there was a snippet around for this, but couldn't find anything. Someone? Thanks in advance.