On an unit creation, unit life == full ?

Troll-Brain

You can change this now in User CP.
Reaction score
85
I'm wondering if only structures which are building enter the map with not full hp.
I think so, but maybe i miss a case ?

For starters :
And no even preplaced unit enter the map with full hp, their life is modified later internally in the map script
 

Komaqtion

You can change this now in User CP.
Reaction score
469
What ?!

Sorry, but I can't understand a thing there :S
Please, you really need to improve your grammar...
 

Troll-Brain

You can change this now in User CP.
Reaction score
85
Hmm interesting, inside a TriggerRegisterEnterRegion boolexpr, the unit life is full, but inside a trigger condition, with the same event, the life is equal to 10 % of unit life max.
 

Komaqtion

You can change this now in User CP.
Reaction score
469
You mean you set a unit's health to 10% when it enters the map ?
 

Troll-Brain

You can change this now in User CP.
Reaction score
85
I think you're onto something, troll. Problem is, systems like AIDS fire an event in the event boolexpr of unit enters region... So it is not really safe. :)

I did, do, and will do, lot of experiments about events.

About the problem you mentioned i'm quite surprised using a library and the keyword "requires" doesn't help here. (tested with AutoIndex not AIDS, GetUnitId(GetFilterUnit()) == 0)
So what ?!
It means if you use several TriggerRegister boolexpr, they are fired simultaneously ?!

I think i will try to use it though, because in case of structure built with an human, i have a use, it's long to explain.
I haven't played with PlayerUnitEvent boolexpr yet though, i will test them first.

EDIT :

How Surprising !

JASS:
//! runtextmacro t_filter("0")
//! runtextmacro t_filter("1")
//! runtextmacro t_filter("2")
//! runtextmacro t_filter("3")
//! runtextmacro t_filter("4")
//! runtextmacro t_filter("5")
//! runtextmacro t_filter("6")
//! runtextmacro t_filter("7")
//! runtextmacro t_filter("8")
//! runtextmacro t_filter("9")

//! textmacro t_filter takes INDEX
library EnterMap$INDEX$ initializer onInit requires AIDS

private function filter takes nothing returns boolean
    call BJDebugMsg(" ")
    call BJDebugMsg("filter$INDEX$ 1")
    call BJDebugMsg("filter$INDEX$ 2")
    call BJDebugMsg("filter$INDEX$ 3")
    call BJDebugMsg(GetUnitName(GetFilterUnit()) + " " + I2S(GetUnitId(GetFilterUnit())))
    return false
endfunction

private function onInit takes nothing returns nothing
    local trigger trig = CreateTrigger()
    local region reg = CreateRegion()
    
    call RegionAddRect(reg,GetWorldBounds())
    call TriggerRegisterEnterRegion(trig,reg,function filter)
    call BJDebugMsg("INIT$INDEX$")
endfunction

endlibrary
//! endtextmacro


It displays INIT0 to INIT9, but on an unit creation, filter9 to filter0 !!!
That's why "requires" doesn't work o_O (the unit indexer "enter region" filter fire the last)

Also that's not the fault of ExecuteFunc (library initializer), it's the same with scopes (without the "requires" keyword ofc).

I would bet the last created trigger fired the last and not the first :banghead:

EDIT 2 :

Aha, there is no rule for that, it depends the event, for example for the event EVENT_PLAYER_END_CINEMATIC, it display "0" to "9" .
Hmm ...
It could depend if the TriggerRegister functions has a boolexpr argument or not, but it's too much tests for today, maybe an other day ...
 

Troll-Brain

You can change this now in User CP.
Reaction score
85
@Jesus4Lyf

Huhh :confused:
I tried to destroy / recreate the indexer enter region trigger, create mine , recreate the indexer trigger but it still doesn't work, the indexer trigger fire the last (i tried that just to know).
I tried also to create my filter first, i mean using Filter(myFilter)).

JASS:
library WTF initializer onInit requires AutoIndex // or AIDS

globals
    boolean array IsIndexerEnterRegionHooked // can't use readonly with a global array
    private trigger Indexer
    private boolexpr EnterRegionFilter
    private region Reg
    private boolean array IgnoreHook
endglobals

private function HookEnterRegion takes trigger whichTrigger, region whichRegion, boolexpr filter returns event   
    if IgnoreHook[0] then
        return null
    endif
    
    if not IsIndexerEnterRegionHooked[0] then // if it wasn't an array it would crash the thread until the variable is setted to true
        
        set IsIndexerEnterRegionHooked[0] = true
        set Indexer = whichTrigger
        set Reg = whichRegion
        set EnterRegionFilter = filter
        return null
    endif
    
    call DestroyTrigger(Indexer)
    set Indexer = null
    set Indexer = CreateTrigger()
    set IgnoreHook[0] = true
    call TriggerRegisterEnterRegion(Indexer,Reg,EnterRegionFilter)
    set IgnoreHook[0] = false
    
    return null
endfunction

hook TriggerRegisterEnterRegion HookEnterRegion

endlibrary


Oh, and don't forget a module initializer fire before ALL struct initializers.
I mean someone enough silly to use a TriggerRegisterEnterRegion boolexpr inside a module initializer can break AIDS, in the sense that the unit won't be indexed when this such boolexpr will be evaluated.

So it would better if you use a dummy module inside your dummy struct.
 

Troll-Brain

You can change this now in User CP.
Reaction score
85
I wouldn't do anything based on this information. This is going to change eventually once Vex has the time to update how initialization works.
But it wouldn't fuck up library requires, right ?
I mean i just use it as a dummy initializer (instead of a library initializer) but use requires of library for god sake.
I just use to prevent these initializations madness, not as some hack feature.
 

Anachron

New Member
Reaction score
53
Hmm, I guess its warcraft III hardcoded, never worked it it though.
Also, I think it has something to do with the Warcraft 3 engine.
Maybe they first create all handles, and after that, they load all handle values and put it into the handles?
 

Troll-Brain

You can change this now in User CP.
Reaction score
85
Hmm, I guess its warcraft III hardcoded, never worked it it though.
Also, I think it has something to do with the Warcraft 3 engine.
Maybe they first create all handles, and after that, they load all handle values and put it into the handles?

I think (only a guess not tested at all) that these boolexpr (inside a TriggerRegister) are a sort of a reverse stack, the last trigger created fire the first, and the other (inside a condition) fire like a stack, the last created trigger fire the last. (hmm maybe it's confused xD)

At least it seems the case for TriggerRegisterEnterRegion.

Also forgot about my post with hooks, i didn't read the compiled code but it shouldn't change the order of the trigger creation anyway, since hooks are done before the native call.

Again, it's just a personal theory i could be totally wrong, i'm too lazy to really test it, and it wouldn't be useful to know it anyway, just "good to know" ^^
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Members online

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top