Hello again!
I am working on a script which checks if a unit is on a position where another unit was earlier. Right now the position has to be totally the same (same X, same Y) otherwise the script wont see the position of the unit to be a position another (or the same) unit has been already.
So I made this script of which I will post some below to be able to explain what I would like.
_trigger = _this select 0
_list = list _trigger
_tempObj = ObjNull
_b = 0
unit_oldpos = [[0,0,0]]
_unit = _list select 0
#start
_i = 0
~2
#checkpos
_unitPos = GetPos _unit
_unitPosX = _unitPos select 0
_unitPosY = _unitPos select 1
_unitPosZ = _unitPos select 2
?((_unitPosX == unit_oldpos select _i select 0) and (_unitPosY == unit_oldpos select _i select 1) and (_unitPosZ == unit_oldpos select _i select 2)) : goto "same"
_i = _i + 1
if (_i < (count unit_oldpos )) then {goto "checkpos"}
goto "explode"
#explode
player sidechat "explosion should be now"
unit_oldpos = (unit_oldpos + [_ExplosionPos])
goto "start"
#same
player sidechat "already exploded here"
goto "start"
Now I would like an extra area of lets say 10 meters around an old position to be added to every "unit_oldpos" just so that if a unit is
within 10 meters of an old position (X and Y) the script will consider the position of a unit to be the same.
But making it like this:
?((_unitPosX == unit_oldpos select _i select 0 + 10) and (_unitPosY == unit_oldpos select _i select 1 + 10) and (_unitPosZ == unit_oldpos select _i select 2)) : goto "same"
wont work, that will just move the pos 10 meters.
Changing the code to
?((_unitPosX <= unit_oldpos select _i select 0 + 10)
wont work neither, now all values lower or equal will be considered true. It should only be for a 10 meter radius.
I really have no clue if this is even possible and if so how to do it. I guess maybe some math???
I never understood math...............not a single thing
Thanks again for your help.