• 🏆 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!
  • 🏆 Hive's 6th HD Modeling Contest: Mechanical is now open! Design and model a mechanical creature, mechanized animal, a futuristic robotic being, or anything else your imagination can tinker with! 📅 Submissions close on June 30, 2024. Don't miss this opportunity to let your creativity shine! Enter now and show us your mechanical masterpiece! 🔗 Click here to enter!

Really weird trigger handle bug?!

Status
Not open for further replies.
Level 3
Joined
Dec 16, 2010
Messages
31
I've attached the example map with the small amount of code.


Situation:

I have a single struct, with two triggers. Both triggers register in TriggerRegisterUnitInRange() and go to different boolexpr.

In one of the boolexpr, the handle of GetTriggeringTrigger() matches the trigger that was registered.

In the other boolexpr, the handles don't match (wtf?). The weirder part is that if I get rid of some of the code in the second one (the if statement and the unit = null) then it seems to work.

code:
JASS:
library AdvancedProjectile initializer initShowBug


module Projectile

    trigger collisionTrg1
    trigger collisionTrg2
    
    static thistype ref

    
    static method createNormal takes nothing returns thistype
        local thistype this = thistype.allocate()
        local unit u1 = CreateUnit(Player(0), 'hpea', 0,0,0)
        local unit u2 = CreateUnit(Player(0), 'hpea', 0,0,0)

        set ref = this

        set collisionTrg1 = CreateTrigger()
        call TriggerRegisterUnitInRange(collisionTrg1, u1, 200.0, null)
        call TriggerAddCondition(collisionTrg1, function thistype.inRangeEnum)

        set collisionTrg2 = CreateTrigger()
        call TriggerRegisterUnitInRange(collisionTrg2, u2, 200.0, null)
        call TriggerAddCondition(collisionTrg2, function thistype.inRangeEnum2)
        
        return this
    endmethod
   
   //This one doesn't bug out, handle id's match
    static method inRangeEnum2 takes nothing returns boolean
        call BJDebugMsg("This: "+I2S(GetHandleId(ref.collisionTrg2))+" should match "+I2S(GetHandleId(GetTriggeringTrigger())) + " <-- And it does. wtf..")
        return false
    endmethod
   
   
    //this one shows different handle id's
    static method inRangeEnum takes nothing returns boolean
        call BJDebugMsg("This: "+I2S(GetHandleId(ref.collisionTrg1))+" should match "+I2S(GetHandleId(GetTriggeringTrigger())) + " <-- But it doesn't!?")
//this line (the comment) causes the bad handle id --- lol?
        return false
    endmethod

endmodule

struct ProjectileStruct
    implement Projectile
endstruct

function ShowBug takes nothing returns nothing
    call ProjectileStruct.createNormal()
endfunction

function initShowBug takes nothing returns nothing
    local trigger t = CreateTrigger()
    call TriggerRegisterTimerEvent(t, 1.0, false)
    call TriggerAddAction(t, function ShowBug)
endfunction

endlibrary

Does anyone know what might cause this behavior?
 

Attachments

  • ShowTriggerBug.w3x
    17.7 KB · Views: 55
  • BugPic.jpg
    BugPic.jpg
    39.2 KB · Views: 81
Last edited:
Level 3
Joined
Dec 16, 2010
Messages
31
I updated the code to make it much simpler and yet still show the bug.

The strange thing is, a single line, or some whitespace seems to be causing the bad handle id of the trigger.

If you completely remove the line where it says "//this line (the comment) causes the bad handle id --- lol?" then the handle works fine.


Anyone else able to reproduce this bug? I have added a cropped screenshot to show you what I see.
 
Status
Not open for further replies.
Top