• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

KB3D - Knock back 3D

Status
Not open for further replies.
Level 22
Joined
Sep 24, 2005
Messages
4,821
I'm using normal WE, maybe you misunderstood what I said, I fixed the errors on the map. I downloaded it again and opened it on WE, the loop errors popped up, then I fixed it, renamed the map fixed.w3x, then uploaded it. The errors are fixed man...
 
Level 22
Joined
Sep 24, 2005
Messages
4,821
I already told you, GroupEnums require boolexpr not code:
call GroupEnumUnitsInRange(g, x, y, KB3D_AlwaysPos(AoE), Filter(function KB3D_True))
 
Level 22
Joined
Sep 24, 2005
Messages
4,821
Don't apologize, I was just saying I already did. Your heart must be pumping from all the action from your mom. XD
 
Level 22
Joined
Sep 24, 2005
Messages
4,821
This System is flawless xD ~~ the best
I wouldn't say that dude, if it's flawless then you don't need to add anything further to it, which means no more updates are necessary, including bugfixes.
 
Level 16
Joined
Jul 31, 2012
Messages
2,217
hey guys, i have some exciting news... at least they seem to be for me...
the thing is.. i managed to make the KB system, destroy destructables ...
like when 'common' spells destroy trees
the KB3D is now able to destroy all 'possible' destructables >> this does not include brdges, pathing blockers, elevators...
only the things you can right click on them and order the unit to attack it

this feature is simple, but really cool when you see it in the test map:
KB3D_KillDestructables
 
Level 18
Joined
Sep 14, 2012
Messages
3,413
JASS:
if IsUnitType(U, UNIT_TYPE_DEAD) then
else
Still useless xD -> Use not

JASS:
        elseif not((LoadBoolean(udg_KB3D_HA, 48, Loop)) and ( IsUnitType(U, UNIT_TYPE_STRUCTURE))) then
                if not(LoadBoolean(udg_KB3D_HA, 49, Loop)) and ( IsUnitType(U, UNIT_TYPE_MECHANICAL)) then
                    return false
                endif
        endif
-> Fix indentation
JASS:
        elseif not((LoadBoolean(udg_KB3D_HA, 48, Loop)) and ( IsUnitType(U, UNIT_TYPE_STRUCTURE))) then
            if not(LoadBoolean(udg_KB3D_HA, 49, Loop)) and ( IsUnitType(U, UNIT_TYPE_MECHANICAL)) then
                return false
            endif
        endif

JASS:
loop
        exitwhen udg_CP_HiddenItemsIndex == 0 //Use equality :p
        set udg_CP_HiddenItemsIndex = udg_CP_HiddenItemsIndex - 1
        call SetItemVisible(udg_CP_HiddenItems[udg_CP_HiddenItemsIndex], true)
        set udg_CP_HiddenItems[udg_CP_HiddenItemsIndex] = null
    endloop
->
JASS:
loop
        exitwhen udg_CP_HiddenItemsIndex <= 0
        set udg_CP_HiddenItemsIndex = udg_CP_HiddenItemsIndex - 1
        call SetItemVisible(udg_CP_HiddenItems[udg_CP_HiddenItemsIndex], true)
        set udg_CP_HiddenItems[udg_CP_HiddenItemsIndex] = null
    endloop


JASS:
if KB3D_CW(x,y) then
else
    return 1
endif
->
JASS:
if not KB3D_CW(x,y) then
    return 1
endif


JASS:
function KB3D_Bounce takes unit U, real x, real y, integer Loop returns boolean
    local group g
    local unit u
    local real Angle
    local real S
    local real R
    //---------------------------
    if KB3D_BounceDetection(U,x,y) == 0 then
        return false
    endif
    //---------------------------
    if KB3D_BounceDetection(U,x,y) == 1 and LoadBoolean(udg_KB3D_HA, 60, Loop) then
        set Angle = LoadReal(udg_KB3D_HA, 5, Loop)*57.29578 + GetRandomReal(-15,15) + 180
        set S = LoadReal(udg_KB3D_HA, 2, Loop)
        set S = S*.8
        set R = 1.5*S/.03125
        call KB3D_Add_Bounce(U, Angle, S, R, true, Loop)
        return true
    endif
    
    //---------------------------
    set g = CreateGroup()
    call GroupEnumUnitsInRange(g, x, y, KB3D_InBetween(100,KB3D_GetUnitCollision(U)*2.5,999), null)
    if KB3D_BounceDetection(U,x,y) == 2 and KB3D_FilterLoop(g, Loop) != null then
        set u = KB3D_FilterLoop(g, Loop)
        set Angle = (Atan2(GetUnitY(u) - GetUnitY(U), GetUnitX(u) - GetUnitX(U)) *57.29578) + GetRandomReal(-15,15) + 180
        set S = LoadReal(udg_KB3D_HA, 2, Loop)
        set S = S*.8
        set R = 1.5*S/.03125
        if LoadBoolean(udg_KB3D_HA, 60, Loop) then
            call KB3D_Add_Bounce(U, Angle, S, R, true, Loop)
        endif
        set Angle = Angle -180
        if LoadBoolean(udg_KB3D_HA, 61, Loop) then
            call KB3D_Add_Bounce(u, Angle, S, R, false, Loop)
        endif
        set u = null
        return true
    endif
    //---------------------------
    return false
endfunction
You never destroy the group nor nulling it.

JASS:
            else
            call SaveBoolean(udg_KB3D_HA, 52, Loop, false)
            endif
-> Fix indentation
JASS:
            else
                call SaveBoolean(udg_KB3D_HA, 52, Loop, false)
            endif


JASS:
    if not (LoopD == 0) and not (Damager == null ) then
        call UnitDamageTarget(Damager, U, LoopD, true, false, AType, DType, WEAPON_TYPE_WHOKNOWS)
    endif
->
JASS:
    if (LoopD != 0) and (Damager != null ) then
        call UnitDamageTarget(Damager, U, LoopD, true, false, AType, DType, WEAPON_TYPE_WHOKNOWS)
    endif


JASS:
    if not (Fx == "") then
        if ( z > 20 ) then
            if not (Attach == "") then
                call DestroyEffect(AddSpecialEffectTarget(Fx, U, Attach))//attach the effect on the unit if he is flying
            endif
        else
            call DestroyEffect(AddSpecialEffect(Fx, x, y))//create the effect on his location if he is not flying
        endif
    endif
->
JASS:
    if (Fx != "") then
        if ( z > 20 ) then
            if (Attach != "") then
                call DestroyEffect(AddSpecialEffectTarget(Fx, U, Attach))//attach the effect on the unit if he is flying
            endif
        else
            call DestroyEffect(AddSpecialEffect(Fx, x, y))//create the effect on his location if he is not flying
        endif
    endif
-> There is many things like this -> Prefer != to not for readability.


set B = ( not(StopTime == 0) and ( Time > StopTime ) )
->
set B = ( StopTime != 0 and Time > StopTime )


Okay so I didn't rewrite every one of your not to [/icode]!=[/icode]
 
Status
Not open for further replies.
Top