- Joined
- May 24, 2016
- Messages
- 339
So the things is, my map is often filled with much team 1 ai units running around, so the team 1 heroes are constantly getting stopped by them. I do NOT want to use windwalk, since it cant be casted if you hide it's buttong icon, moreover I still want to save hero's collision with units from other teams.
So the things is, I thought like, why not recycle all team 1 heroes in a group, and then check for team 1 ai units around? If they are around, than you are able to walk through them.. But only if are in a really close range, sine turning off collision might let you to just walk through obstacles too
If you do remember a nice unit collision system on the web, please share with me, Ill be grateful!
So the things is, I thought like, why not recycle all team 1 heroes in a group, and then check for team 1 ai units around? If they are around, than you are able to walk through them.. But only if are in a really close range, sine turning off collision might let you to just walk through obstacles too
JASS:
loop
set f = FirstOfGroup(Team1Paladins)
exitwhen f==null
set g=CreateGroup()
set bol = false //local boolean bol
call GroupEnumUnitsInRange(g,GetUnitX(f),GetUnitY(f),60,null) //60 might be enough... right?
loop
set f2=FirstOfGroup(g)
exitwhen f2 == null or bol == true
if IsUnitInGroup(f2,Team1AIUnits) and not IsUnitDead(f2) then
set bol == true
endif
call GroupRemoveUnit(g,f2)
endloop
if LoadBoolean(Hash,GetHandleId(f),StringHash("CollisionBoolean")) == false then
if bol == true then
call SaveBoolean(Hash,GetHandleId(f),StringHash("CollisionBoolean"),true)
call SetUnitCollision(f,false) // im sorry I cant recall right now what is that function name, but it's close to real one
endif
endif
call GroupRemoveUnit(Team1Paladins,f)
endloop
If you do remember a nice unit collision system on the web, please share with me, Ill be grateful!