• 🏆 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!

[Solved] I have to convert this into handmade Custom Value and i want to learn how to

Status
Not open for further replies.
Level 17
Joined
Jun 2, 2009
Messages
1,141
Hello everyone. My map have a UnitIndexer and it looks like it conflicts with this system.
How can i create my own CustomValue system?

  • OrmanSetup2
    • Events
      • Unit - A unit enters NcAltCheck1 <gen>
      • Unit - A unit enters NcAltCheck2 <gen>
      • Unit - A unit enters NcAltCheck3 <gen>
      • Unit - A unit enters NcAltCheck4 <gen>
      • Unit - A unit enters NcAltCheck5 <gen>
      • Unit - A unit enters NcAltCheck6 <gen>
      • Unit - A unit enters NcUstCheck1 <gen>
      • Unit - A unit enters NcUstCheck2 <gen>
      • Unit - A unit enters NcUstCheck3 <gen>
      • Unit - A unit enters NcUstCheck4 <gen>
      • Unit - A unit enters NcUstCheck5 <gen>
      • Unit - A unit enters NcUstCheck6 <gen>
      • Unit - A unit enters GorevSagUstBolge <gen>
      • Unit - A unit enters GorevSagBolge <gen>
      • Unit - A unit enters GorevSolBolge <gen>
    • Conditions
      • (Owner of (Triggering unit)) Equal to Neutral Hostile
    • Actions
      • Set NcUnit = (Triggering unit)
      • For each (Integer NcLoop) from 1 to 15, do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (NcUnit is in (Units in NcRegion[NcLoop])) Equal to True
            • Then - Actions
              • Set NcUnitRegion[(Custom value of NcUnit)] = NcRegion[NcLoop]
              • Custom script: exitwhen true
            • Else - Actions
  • OrmanLeaves
    • Events
      • Unit - A unit leaves NcAltCheck1 <gen>
      • Unit - A unit leaves NcAltCheck2 <gen>
      • Unit - A unit leaves NcAltCheck3 <gen>
      • Unit - A unit leaves NcAltCheck4 <gen>
      • Unit - A unit leaves NcAltCheck5 <gen>
      • Unit - A unit leaves NcAltCheck6 <gen>
      • Unit - A unit leaves NcUstCheck1 <gen>
      • Unit - A unit leaves NcUstCheck2 <gen>
      • Unit - A unit leaves NcUstCheck3 <gen>
      • Unit - A unit leaves NcUstCheck4 <gen>
      • Unit - A unit leaves NcUstCheck5 <gen>
      • Unit - A unit leaves NcUstCheck6 <gen>
      • Unit - A unit leaves GorevSolBolge <gen>
      • Unit - A unit leaves GorevSagBolge <gen>
      • Unit - A unit leaves GorevSagUstBolge <gen>
    • Conditions
      • (Owner of (Triggering unit)) Equal to Neutral Hostile
    • Actions
      • Set NcUnit = (Triggering unit)
      • Set NcPoint = (Center of NcUnitRegion[(Custom value of NcUnit)])
      • Unit - Move NcUnit instantly to NcPoint
      • Unit - Create 1 DUMMY [JFA] for (Owner of (Triggering unit)) at (Position of (Triggering unit)) facing Default building facing degrees
      • Unit - Add a 2.00 second Generic expiration timer to (Last created unit)
      • Unit - Add Orman Heal to (Last created unit)
      • Unit - Order (Last created unit) to Night Elf Druid Of The Claw - Rejuvenation (Triggering unit)
I have to replace Custom Value of Unit with handmade Custom Value but i have failed. When i make it array, it asks for array. If i will not, i cannot create second part of trigger.

  • Set NcUnitRegion[(Custom value of NcUnit)] = NcRegion[NcLoop]
  • Set NcPoint = (Center of NcUnitRegion[(Custom value of NcUnit)])
 
Level 17
Joined
Jun 2, 2009
Messages
1,141
There is no conflict with Unit Indexer in this trigger. Custom value of unit is being used as it should.

What is the problem with these triggers?
Uhm. Are you sure? The creatures who tried to left the region teleporting center of the map. It happens when trigger couldn't find the region.

Is it not conflicts with this one?

  • Unit Indexer
    • Events
      • Map initialization
    • Conditions
    • Actions
      • Custom script: call ExecuteFunc("InitializeUnitIndexer")
      • Custom script: endfunction
      • Custom script:
      • Custom script: function ClearUnitIndex takes nothing returns nothing
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Custom value of UDexUnits[UDex]) Equal to 0
        • Then - Actions
          • Set UnitIndexLock[UDex] = (UnitIndexLock[UDex] - 1)
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • UnitIndexLock[UDex] Equal to 0
            • Then - Actions
              • Set UDexNext[UDexPrev[UDex]] = UDexNext[UDex]
              • Set UDexPrev[UDexNext[UDex]] = UDexPrev[UDex]
              • Set UDexPrev[UDex] = 0
              • Set UnitIndexEvent = 0.00
              • Set UnitIndexEvent = 2.00
              • Set UnitIndexEvent = 0.00
              • Set UDexUnits[UDex] = No unit
              • Set UDexNext[UDex] = UDexRecycle
              • Set UDexRecycle = UDex
            • Else - Actions
        • Else - Actions
      • Custom script: endfunction
      • Custom script:
      • Custom script: function IndexUnit takes nothing returns boolean
      • Custom script: local integer pdex = udg_UDex
      • Custom script: local integer ndex
      • -------- - --------
      • -------- You can customize the following block - if conditions are false the (Matching unit) won't be indexed. --------
      • -------- - --------
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • UnitIndexerEnabled Equal to True
          • (Custom value of (Matching unit)) Equal to 0
        • Then - Actions
          • Set UDexWasted = (UDexWasted + 1)
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • UDexWasted Equal to 32
            • Then - Actions
              • Set UDexWasted = 0
              • Set UDex = UDexNext[0]
              • Custom script: loop
              • Custom script: exitwhen udg_UDex == 0
              • Custom script: set ndex = udg_UDexNext[udg_UDex]
              • Custom script: call ClearUnitIndex()
              • Custom script: set udg_UDex = ndex
              • Custom script: endloop
            • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • UDexRecycle Equal to 0
            • Then - Actions
              • Set UDex = (UDexGen + 1)
              • Set UDexGen = UDex
            • Else - Actions
              • Set UDex = UDexRecycle
              • Set UDexRecycle = UDexNext[UDex]
          • Set UDexUnits[UDex] = (Matching unit)
          • Unit - Set the custom value of UDexUnits[UDex] to UDex
          • Set UDexPrev[UDexNext[0]] = UDex
          • Set UDexNext[UDex] = UDexNext[0]
          • Set UDexNext[0] = UDex
          • Set UnitIndexLock[UDex] = 1
          • Set UnitIndexEvent = 0.00
          • Set UnitIndexEvent = 1.00
          • Set UnitIndexEvent = 0.00
          • Custom script: set udg_UDex = pdex
        • Else - Actions
      • Custom script: return false
      • Custom script: endfunction
      • Custom script:
      • Custom script: function InitializeUnitIndexer takes nothing returns nothing
      • Custom script: local integer i = bj_MAX_PLAYER_SLOTS
      • Custom script: local boolexpr b = Filter(function IndexUnit)
      • Custom script: local region re = CreateRegion()
      • Custom script: local trigger t = GetTriggeringTrigger()
      • Custom script: local rect r = GetWorldBounds()
      • Custom script: call RegionAddRect(re, r)
      • Custom script: call TriggerRegisterEnterRegion(t, re, b)
      • Custom script: call TriggerClearActions(t)
      • Custom script: call TriggerAddAction(t, function ClearUnitIndex)
      • Set UnitIndexerEnabled = True
      • Custom script: loop
      • Custom script: set i = i - 1
      • Custom script: call GroupEnumUnitsOfPlayer(bj_lastCreatedGroup, Player(i), b)
      • Custom script: exitwhen i == 0
      • Custom script: endloop
      • Custom script: call RemoveRect(r)
      • Custom script: set re = null
      • Custom script: set r = null
      • Custom script: set t = null
      • Custom script: set b = null
      • Set UnitIndexEvent = 3.00
      • Set UnitIndexEvent = 0.00
 
Last edited:
Level 20
Joined
Feb 27, 2019
Messages
593
The custom value is being used not changed. If you manually change the custom value of a unit you break the Unit Indexer. The custom value of a unit is re-used after an old unit dies or is removed. In that case data from a variable can be inherited by a newly created unit. Thats not a problem with these triggers though.

Its as you say if the trigger cant find a point it will default that point to the center of the map. So what is causing this?
1The region is not initialized properly.
2The region is destroyed.
3The custom value of the unit is manually changed elsewhere.
4The condition "(NcUnit is in (Units in NcRegion[NcLoop])) Equal to True" fails when the unit enters the region which then doesnt assign a region to the variable.

You can use debug to find out why your trigger fails: Things You Should Know When Using Triggers / GUI
You can use more precise debug messages to display relevant information, for example NcLoop or Custom value of NcUnit.
 
Level 12
Joined
Jan 10, 2023
Messages
191
How can i create my own CustomValue system?

I see your title says, "...I want to learn how to". I was thinking this is more of a "what is a unit indexer" type question. So I'm basing my response off of that:

Just think of it as a big list.

If something dies, you would want to "erase it", but then you would eventually have a bunch if wasted space. So the easiest solution is, when you get a new thing to add to the list, check if you have any empty "list-slots" before making a new spot at the bottom.
 
Level 17
Joined
Jun 2, 2009
Messages
1,141
Wow wait. Is Custom Value does not conflict with UnitIndexer? If not, i can set this as solved. That means i can find and fix the problem if UnitIndexer does not conflicts.

@Uncle Probably looks fine because it was your system in here [Solved] - Any better solution for the detect leaving region? i am looking the trigger but i don't understand how it is bugged.

@Tristronic Yes and i don't know what it does. I am going to search for what is unitindexer.

Tagged as solved. I will find and solve the issue if UnitIndexer not interfere with this trigger.
 
Level 17
Joined
Jun 2, 2009
Messages
1,141
Ah by the way here is the full system @Uncle

  • OrmanSetup
    • Events
      • Map initialization
    • Conditions
    • Actions
      • Set NcRegion[1] = NcUstCheck1 <gen>
      • Set NcRegion[2] = NcUstCheck2 <gen>
      • Set NcRegion[3] = NcUstCheck3 <gen>
      • Set NcRegion[4] = NcUstCheck4 <gen>
      • Set NcRegion[5] = NcUstCheck5 <gen>
      • Set NcRegion[6] = NcUstCheck6 <gen>
      • Set NcRegion[7] = NcAltCheck1 <gen>
      • Set NcRegion[8] = NcAltCheck2 <gen>
      • Set NcRegion[9] = NcAltCheck3 <gen>
      • Set NcRegion[10] = NcAltCheck4 <gen>
      • Set NcRegion[11] = NcAltCheck5 <gen>
      • Set NcRegion[12] = NcAltCheck6 <gen>
      • Set SpawnRegion[1] = NCGrupDevil1 <gen>
      • Set SpawnRegion[2] = NCGrupDevil2 <gen>
      • Set SpawnRegion[3] = NCGrupDevil3 <gen>
      • Set SpawnRegion[4] = NCGrupDevil3 <gen>
      • Set SpawnRegion[5] = NCGrupDevil4 <gen>
      • Set SpawnRegion[6] = NCGrupDevil5 <gen>
      • Set SpawnRegion[7] = NCGrupDevil6 <gen>
      • Set SpawnRegion[8] = NCGrupReaper1 <gen>
      • Set SpawnRegion[9] = NCGrupReaper2 <gen>
      • Set SpawnRegion[10] = NCGrupReaper3 <gen>
      • Set SpawnRegion[11] = NCGrupReaper3 <gen>
      • Set SpawnRegion[12] = NCGrupReaper4 <gen>
      • Set SpawnRegion[13] = NCGrupReaper5 <gen>
      • Set SpawnRegion[14] = NCGrupReaper6 <gen>
      • Set SpawnUnit[1] = Murloc Flesheater (level 1)
      • Set SpawnUnit[2] = Treant (level 2)
      • Set SpawnUnit[3] = Mud Golem (level 3)
      • Set SpawnUnit[4] = Satyr (level 3)
      • Set SpawnUnit[5] = Ghoul (level 5)
      • Set SpawnUnit[6] = Sasquatch (level 7)
      • Set SpawnUnit[7] = Ogre Lord (level 10)
      • Set SpawnUnit[8] = Murloc Flesheater (level 1 REAPER)
      • Set SpawnUnit[9] = Treant (level 2 REAPER)
      • Set SpawnUnit[10] = Mud Golem (level 3 REAPER)
      • Set SpawnUnit[11] = Satyr (level 3 REAPER)
      • Set SpawnUnit[12] = Ghoul (level 5 REAPER)
      • Set SpawnUnit[13] = Sasquatch (level 7 REAPER)
      • Set SpawnUnit[14] = Ogre Lord (level 10 REAPER)
      • Set SpawnLimit[1] = 3
      • Set SpawnLimit[2] = 3
      • Set SpawnLimit[3] = 1
      • Set SpawnLimit[4] = 2
      • Set SpawnLimit[5] = 3
      • Set SpawnLimit[6] = 1
      • Set SpawnLimit[7] = 1
      • Set SpawnLimit[8] = 3
      • Set SpawnLimit[9] = 3
      • Set SpawnLimit[10] = 1
      • Set SpawnLimit[11] = 2
      • Set SpawnLimit[12] = 3
      • Set SpawnLimit[13] = 1
      • Set SpawnLimit[14] = 1
  • OrmanSetup2
    • Events
      • Unit - A unit enters NcAltCheck1 <gen>
      • Unit - A unit enters NcAltCheck2 <gen>
      • Unit - A unit enters NcAltCheck3 <gen>
      • Unit - A unit enters NcAltCheck4 <gen>
      • Unit - A unit enters NcAltCheck5 <gen>
      • Unit - A unit enters NcAltCheck6 <gen>
      • Unit - A unit enters NcUstCheck1 <gen>
      • Unit - A unit enters NcUstCheck2 <gen>
      • Unit - A unit enters NcUstCheck3 <gen>
      • Unit - A unit enters NcUstCheck4 <gen>
      • Unit - A unit enters NcUstCheck5 <gen>
      • Unit - A unit enters NcUstCheck6 <gen>
      • Unit - A unit enters GorevSagUstBolge <gen>
      • Unit - A unit enters GorevSagBolge <gen>
      • Unit - A unit enters GorevSolBolge <gen>
    • Conditions
      • (Owner of (Triggering unit)) Equal to Neutral Hostile
    • Actions
      • Set NcUnit = (Triggering unit)
      • For each (Integer NcLoop) from 1 to 15, do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (NcUnit is in (Units in NcRegion[NcLoop])) Equal to True
            • Then - Actions
              • Set NcUnitRegion[(Custom value of NcUnit)] = NcRegion[NcLoop]
              • Custom script: exitwhen true
            • Else - Actions
  • OrmanLeaves
    • Events
      • Unit - A unit leaves NcAltCheck1 <gen>
      • Unit - A unit leaves NcAltCheck2 <gen>
      • Unit - A unit leaves NcAltCheck3 <gen>
      • Unit - A unit leaves NcAltCheck4 <gen>
      • Unit - A unit leaves NcAltCheck5 <gen>
      • Unit - A unit leaves NcAltCheck6 <gen>
      • Unit - A unit leaves NcUstCheck1 <gen>
      • Unit - A unit leaves NcUstCheck2 <gen>
      • Unit - A unit leaves NcUstCheck3 <gen>
      • Unit - A unit leaves NcUstCheck4 <gen>
      • Unit - A unit leaves NcUstCheck5 <gen>
      • Unit - A unit leaves NcUstCheck6 <gen>
      • Unit - A unit leaves GorevSolBolge <gen>
      • Unit - A unit leaves GorevSagBolge <gen>
      • Unit - A unit leaves GorevSagUstBolge <gen>
    • Conditions
      • (Owner of (Triggering unit)) Equal to Neutral Hostile
    • Actions
      • Set NcUnit = (Triggering unit)
      • Set NcPoint = (Center of NcUnitRegion[(Custom value of NcUnit)])
      • Unit - Order NcUnit to Move To NcPoint
      • Unit - Create 1 DUMMY [JFA] for (Owner of (Triggering unit)) at (Position of (Triggering unit)) facing Default building facing degrees
      • Unit - Add a 2.00 second Generic expiration timer to (Last created unit)
      • Unit - Add Orman Heal to (Last created unit)
      • Unit - Order (Last created unit) to Night Elf Druid Of The Claw - Rejuvenation (Triggering unit)
These creatures we're leaving their locations They are neutral creatures just like the others in the list. But they are not respawns. They are quest creatures that spawns in 3 different locations.

  • QuestYaratma
    • Events
      • Time - Elapsed game time is 60.00 seconds
    • Conditions
    • Actions
      • Set Zar = (Random integer number between 1 and 3)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • Zar Equal to 1
        • Then - Actions
          • Unit - Create 1 Baratrum the Teabringer (neutral) for Neutral Hostile at (Center of BaratSolCenter <gen>) facing Default building facing degrees
          • Set QuestYaratik[1] = (Last created unit)
        • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • Zar Equal to 2
            • Then - Actions
              • Unit - Create 1 Dragon Turtle (neutral) for Neutral Hostile at (Center of BaratSolCenter <gen>) facing Default building facing degrees
              • Unit - Add spell reduce -4.00 YES to (Last created unit)
              • Set QuestYaratik[1] = (Last created unit)
            • Else - Actions
              • Unit - Create 1 Ancient Hydra (neutral) for Neutral Hostile at (Center of BaratSolCenter <gen>) facing Default building facing degrees
              • Set QuestYaratik[1] = (Last created unit)
      • Set Zar = 0
      • Set Zar = (Random integer number between 1 and 3)
      • Wait 1.00 seconds
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • Zar Equal to 1
        • Then - Actions
          • Unit - Create 1 Baratrum the Teabringer (neutral) for Neutral Hostile at (Center of BaratSagCenter <gen>) facing Default building facing degrees
          • Set QuestYaratik[2] = (Last created unit)
        • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • Zar Equal to 2
            • Then - Actions
              • Unit - Create 1 Dragon Turtle (neutral) for Neutral Hostile at (Center of BaratSagCenter <gen>) facing Default building facing degrees
              • Unit - Add spell reduce -4.00 YES to (Last created unit)
              • Set QuestYaratik[2] = (Last created unit)
            • Else - Actions
              • Unit - Create 1 Ancient Hydra (neutral) for Neutral Hostile at (Center of BaratSagCenter <gen>) facing Default building facing degrees
              • Set QuestYaratik[2] = (Last created unit)
      • Wait 1.00 seconds
      • Set Zar = 0
      • Set Zar = (Random integer number between 1 and 3)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • Zar Equal to 1
        • Then - Actions
          • Unit - Create 1 Baratrum the Teabringer (neutral) for Neutral Hostile at (Center of Region 133 <gen>) facing Default building facing degrees
          • Set QuestYaratik[3] = (Last created unit)
        • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • Zar Equal to 2
            • Then - Actions
              • Unit - Create 1 Dragon Turtle (neutral) for Neutral Hostile at (Center of Region 133 <gen>) facing Default building facing degrees
              • Unit - Add spell reduce -4.00 YES to (Last created unit)
              • Set QuestYaratik[3] = (Last created unit)
            • Else - Actions
              • Unit - Create 1 Ancient Hydra (neutral) for Neutral Hostile at (Center of Region 133 <gen>) facing Default building facing degrees
              • Set QuestYaratik[3] = (Last created unit)
 
Level 17
Joined
Jun 2, 2009
Messages
1,141
Again, this Condition isn't going to work:
  • (NcUnit is in (Units in NcRegion[NcLoop])) Equal to True
The unit isn't considered in the Region yet. Reread my last post.

If you refer the first trigger, i have just added this one. It was between 1 to 12. Now it will going to work?

  • OrmanSetup
    • Events
      • Map initialization
    • Conditions
    • Actions
      • Set NcRegion[13] = GorevSolBolge <gen>
      • Set NcRegion[14] = GorevSagBolge <gen>
      • Set NcRegion[15] = GorevSagUstBolge <gen>
 
Level 20
Joined
Feb 27, 2019
Messages
593
The condition can fail if a unit WALKS into a region. If they spawn inside a region it probably wont fail unless maybe its literally an edge case scenario.
 

Uncle

Warcraft Moderator
Level 64
Joined
Aug 10, 2018
Messages
6,569
It was working since today for the rest of creeps? It just wasn't worked for my new 3 regions?
Ok then making it Equal to False gonna solve my problem?
Break it down logically:

Did a unit enter one of those 12 regions?

If yes, did the trigger work or not when this happened?

If it did NOT work, then it's not going to work even with the 3 new regions. The regions are all using the same exact logic so either everything works or nothing works.

The solution I suggested is to fix the regions because they have a bug most people are unaware of.

Click the link in my first post, scroll down and find Uncle, read what I said, recreate my solution, and test your map again and tell us if it fixed the issue or not. If it doesn't fix the issue then you either failed to recreate the solution properly or there's another issue we aren't aware of.

I realize you may not understand what I'm saying so here is the "region fix" trigger you need to create:
  • Events
    • Map initialization
  • Conditions
  • Actions
    • Custom script: local rect r
    • Set FixRegion[1] = NcAltCheck1
    • Set FixRegion[2] = NcAltCheck2
    • Set FixRegion[3] = NcAltCheck3
    • // do this for every Region you want to fix
    • For each (Integer A) from 1 to 100, do (Actions)
      • Loop - Actions
        • Custom script: set r = udg_FixRegion[bj_forLoopAIndex]
        • Custom script: call SetRect(r, GetRectMinX(r) - 32., GetRectMinY(r) - 32., GetRectMaxX(r) + 32., GetRectMaxY(r) + 32.)
        • Custom script: set r = null
FixRegion is a Region array variable you need to create yourself.
 
Last edited:
Level 17
Joined
Jun 2, 2009
Messages
1,141
@[db]east But somehow this system was works well until i have created 3 new regions and put boss creatures within the regions.
Units we're trying to leave was ordering back to their locations since today. But it wasn't worked with new 3 regions and you realized i was forgot add new 3 regions
@Uncle I have already checked but this doesn't make any sense to me.

  • page.gif
    Custom script: local rect r
  • if.gif
    For each (Integer A) from 1 to TotalRegions, do (Actions)
    • joinbottomminus.gif
      actions.gif
      Loop - Actions
      • empty.gif
        join.gif
        page.gif
        Custom script: set r = udg_Region[bj_forLoopAIndex]
      • empty.gif
        join.gif
        page.gif
        Custom script: call SetRect(r, GetRectMinX(r) - 32., GetRectMinY(r) - 32., GetRectMaxX(r) + 32., GetRectMaxY(r) + 32.)
      • empty.gif
        joinbottom.gif
        page.gif
        Custom script: set r = null
But if you will say "just copy this into your map" yes i will.

Update. I have created but i don't know where should i put this.

  • Untitled Trigger 004
    • Events
    • Conditions
    • Actions
      • Custom script: local rect r
      • For each (Integer A) from 1 to TotalRegions, do (Actions)
        • Loop - Actions
          • Custom script: set r = udg_Region[bj_forLoopAIndex]
          • Custom script: call SetRect(r, GetRectMinX(r) - 32., GetRectMinY(r) - 32., GetRectMaxX(r) + 32., GetRectMaxY(r) + 32.)
          • Custom script: set r = null
TotalRegions: Integer. Not set yet.
 
Last edited:
Level 17
Joined
Jun 2, 2009
Messages
1,141
Ok i made changes. I hope i did this correctly.

  • OrmanSetup
    • Events
      • Map initialization
    • Conditions
    • Actions
      • Custom script: local rect r
      • Set NcRegion[1] = NcUstCheck1 <gen>
      • Set NcRegion[2] = NcUstCheck2 <gen>
      • Set NcRegion[3] = NcUstCheck3 <gen>
      • Set NcRegion[4] = NcUstCheck4 <gen>
      • Set NcRegion[5] = NcUstCheck5 <gen>
      • Set NcRegion[6] = NcUstCheck6 <gen>
      • Set NcRegion[7] = NcAltCheck1 <gen>
      • Set NcRegion[8] = NcAltCheck2 <gen>
      • Set NcRegion[9] = NcAltCheck3 <gen>
      • Set NcRegion[10] = NcAltCheck4 <gen>
      • Set NcRegion[11] = NcAltCheck5 <gen>
      • Set NcRegion[12] = NcAltCheck6 <gen>
      • Set NcRegion[13] = GorevSolBolge <gen>
      • Set NcRegion[14] = GorevSagBolge <gen>
      • Set NcRegion[15] = GorevSagUstBolge <gen>
      • Set SpawnRegion[1] = NCGrupDevil1 <gen>
      • Set SpawnRegion[2] = NCGrupDevil2 <gen>
      • Set SpawnRegion[3] = NCGrupDevil3 <gen>
      • Set SpawnRegion[4] = NCGrupDevil3 <gen>
      • Set SpawnRegion[5] = NCGrupDevil4 <gen>
      • Set SpawnRegion[6] = NCGrupDevil5 <gen>
      • Set SpawnRegion[7] = NCGrupDevil6 <gen>
      • Set SpawnRegion[8] = NCGrupReaper1 <gen>
      • Set SpawnRegion[9] = NCGrupReaper2 <gen>
      • Set SpawnRegion[10] = NCGrupReaper3 <gen>
      • Set SpawnRegion[11] = NCGrupReaper3 <gen>
      • Set SpawnRegion[12] = NCGrupReaper4 <gen>
      • Set SpawnRegion[13] = NCGrupReaper5 <gen>
      • Set SpawnRegion[14] = NCGrupReaper6 <gen>
      • Set SpawnUnit[1] = Murloc Flesheater (level 1)
      • Set SpawnUnit[2] = Treant (level 2)
      • Set SpawnUnit[3] = Mud Golem (level 3)
      • Set SpawnUnit[4] = Satyr (level 3)
      • Set SpawnUnit[5] = Ghoul (level 5)
      • Set SpawnUnit[6] = Sasquatch (level 7)
      • Set SpawnUnit[7] = Ogre Lord (level 10)
      • Set SpawnUnit[8] = Murloc Flesheater (level 1 REAPER)
      • Set SpawnUnit[9] = Treant (level 2 REAPER)
      • Set SpawnUnit[10] = Mud Golem (level 3 REAPER)
      • Set SpawnUnit[11] = Satyr (level 3 REAPER)
      • Set SpawnUnit[12] = Ghoul (level 5 REAPER)
      • Set SpawnUnit[13] = Sasquatch (level 7 REAPER)
      • Set SpawnUnit[14] = Ogre Lord (level 10 REAPER)
      • Set SpawnLimit[1] = 3
      • Set SpawnLimit[2] = 3
      • Set SpawnLimit[3] = 1
      • Set SpawnLimit[4] = 2
      • Set SpawnLimit[5] = 3
      • Set SpawnLimit[6] = 1
      • Set SpawnLimit[7] = 1
      • Set SpawnLimit[8] = 3
      • Set SpawnLimit[9] = 3
      • Set SpawnLimit[10] = 1
      • Set SpawnLimit[11] = 2
      • Set SpawnLimit[12] = 3
      • Set SpawnLimit[13] = 1
      • Set SpawnLimit[14] = 1
      • Set FixRegion[1] = NcAltCheck1 <gen>
      • Set FixRegion[2] = NcAltCheck2 <gen>
      • Set FixRegion[3] = NcAltCheck3 <gen>
      • Set FixRegion[4] = NcAltCheck4 <gen>
      • Set FixRegion[5] = NcAltCheck5 <gen>
      • Set FixRegion[6] = NcAltCheck6 <gen>
      • Set FixRegion[7] = NcUstCheck1 <gen>
      • Set FixRegion[8] = NcUstCheck2 <gen>
      • Set FixRegion[9] = NcUstCheck3 <gen>
      • Set FixRegion[10] = NcUstCheck4 <gen>
      • Set FixRegion[11] = NcUstCheck5 <gen>
      • Set FixRegion[12] = NcUstCheck6 <gen>
      • Set FixRegion[13] = GorevSolBolge <gen>
      • Set FixRegion[14] = GorevSagBolge <gen>
      • Set FixRegion[15] = GorevSagUstBolge <gen>
      • For each (Integer A) from 1 to 15, do (Actions)
        • Loop - Actions
          • Custom script: set r = udg_FixRegion[bj_forLoopAIndex]
          • Custom script: call SetRect(r, GetRectMinX(r) - 32., GetRectMinY(r) - 32., GetRectMaxX(r) + 32., GetRectMaxY(r) + 32.)
          • Custom script: set r = null

FixRegion: RegionArray[15]
 
Level 20
Joined
Feb 27, 2019
Messages
593
To my understanding: Uncle is highlighting a bug that exists in the game. There is probably really no drawback to apply the fix. The bug occurs for a certain reason and that reason may not apply to these triggers per se, all depending on how your units can enter those regions. That reason is that the size of the region makes it so that a unit can enter the region but still not be considered being inside the region. With Uncles fix that bug probably cant happen. The bug happens but may not be limited to when a unit walks into a region. If a unit doesnt walk into a region but lets say is spawned in the middle of it, the tiny offset probably wont matter since the unit is basically in the center of it and far from being affected by a tiny offset.

To apply Uncles fix for this trigger is easy. Since the regions are already set to NcRegion you can use those here since those are the regions you want to fix: set r = udg_NcRegion[bj_forLoopAIndex]

In the future youd want to apply the fix to any regions that use the event a unit enters region combined with the condition unit is in region.
 
Last edited:
Level 17
Joined
Jun 2, 2009
Messages
1,141
Hello again. Sadly it is totally broken now. Neutral Creeps are able to leave their regions now. Let me tell you step by step how it is works.
I am not familiar with this system, please let me know if somethings not right. I was created 30 triggers for the enter and leave, dear Uncle suggested me to this system.

--- Trigger 1/3 Setup ---

  • OrmanSetup
    • Events
      • Map initialization
    • Conditions
    • Actions
      • Custom script: local rect r
      • Set NcRegion[1] = NcUstCheck1 <gen>
      • Set NcRegion[2] = NcUstCheck2 <gen>
      • Set NcRegion[3] = NcUstCheck3 <gen>
      • Set NcRegion[4] = NcUstCheck4 <gen>
      • Set NcRegion[5] = NcUstCheck5 <gen>
      • Set NcRegion[6] = NcUstCheck6 <gen>
      • Set NcRegion[7] = NcAltCheck1 <gen>
      • Set NcRegion[8] = NcAltCheck2 <gen>
      • Set NcRegion[9] = NcAltCheck3 <gen>
      • Set NcRegion[10] = NcAltCheck4 <gen>
      • Set NcRegion[11] = NcAltCheck5 <gen>
      • Set NcRegion[12] = NcAltCheck6 <gen>
      • Set NcRegion[13] = GorevSolBolge <gen>
      • Set NcRegion[14] = GorevSagBolge <gen>
      • Set NcRegion[15] = GorevSagUstBolge <gen>
      • Set SpawnRegion[1] = NCGrupDevil1 <gen>
      • Set SpawnRegion[2] = NCGrupDevil2 <gen>
      • Set SpawnRegion[3] = NCGrupDevil3 <gen>
      • Set SpawnRegion[4] = NCGrupDevil3 <gen>
      • Set SpawnRegion[5] = NCGrupDevil4 <gen>
      • Set SpawnRegion[6] = NCGrupDevil5 <gen>
      • Set SpawnRegion[7] = NCGrupDevil6 <gen>
      • Set SpawnRegion[8] = NCGrupReaper1 <gen>
      • Set SpawnRegion[9] = NCGrupReaper2 <gen>
      • Set SpawnRegion[10] = NCGrupReaper3 <gen>
      • Set SpawnRegion[11] = NCGrupReaper3 <gen>
      • Set SpawnRegion[12] = NCGrupReaper4 <gen>
      • Set SpawnRegion[13] = NCGrupReaper5 <gen>
      • Set SpawnRegion[14] = NCGrupReaper6 <gen>
      • Set SpawnUnit[1] = Murloc Flesheater (level 1)
      • Set SpawnUnit[2] = Treant (level 2)
      • Set SpawnUnit[3] = Mud Golem (level 3)
      • Set SpawnUnit[4] = Satyr (level 3)
      • Set SpawnUnit[5] = Ghoul (level 5)
      • Set SpawnUnit[6] = Sasquatch (level 7)
      • Set SpawnUnit[7] = Ogre Lord (level 10)
      • Set SpawnUnit[8] = Murloc Flesheater (level 1 REAPER)
      • Set SpawnUnit[9] = Treant (level 2 REAPER)
      • Set SpawnUnit[10] = Mud Golem (level 3 REAPER)
      • Set SpawnUnit[11] = Satyr (level 3 REAPER)
      • Set SpawnUnit[12] = Ghoul (level 5 REAPER)
      • Set SpawnUnit[13] = Sasquatch (level 7 REAPER)
      • Set SpawnUnit[14] = Ogre Lord (level 10 REAPER)
      • Set SpawnLimit[1] = 3
      • Set SpawnLimit[2] = 3
      • Set SpawnLimit[3] = 1
      • Set SpawnLimit[4] = 2
      • Set SpawnLimit[5] = 3
      • Set SpawnLimit[6] = 1
      • Set SpawnLimit[7] = 1
      • Set SpawnLimit[8] = 3
      • Set SpawnLimit[9] = 3
      • Set SpawnLimit[10] = 1
      • Set SpawnLimit[11] = 2
      • Set SpawnLimit[12] = 3
      • Set SpawnLimit[13] = 1
      • Set SpawnLimit[14] = 1
      • Set FixRegion[1] = NcAltCheck1 <gen>
      • Set FixRegion[2] = NcAltCheck2 <gen>
      • Set FixRegion[3] = NcAltCheck3 <gen>
      • Set FixRegion[4] = NcAltCheck4 <gen>
      • Set FixRegion[5] = NcAltCheck5 <gen>
      • Set FixRegion[6] = NcAltCheck6 <gen>
      • Set FixRegion[7] = NcUstCheck1 <gen>
      • Set FixRegion[8] = NcUstCheck2 <gen>
      • Set FixRegion[9] = NcUstCheck3 <gen>
      • Set FixRegion[10] = NcUstCheck4 <gen>
      • Set FixRegion[11] = NcUstCheck5 <gen>
      • Set FixRegion[12] = NcUstCheck6 <gen>
      • Set FixRegion[13] = GorevSolBolge <gen>
      • Set FixRegion[14] = GorevSagBolge <gen>
      • Set FixRegion[15] = GorevSagUstBolge <gen>
      • For each (Integer A) from 1 to 15, do (Actions)
        • Loop - Actions
          • Custom script: set r = udg_FixRegion[bj_forLoopAIndex]
          • Custom script: call SetRect(r, GetRectMinX(r) - 32., GetRectMinY(r) - 32., GetRectMaxX(r) + 32., GetRectMaxY(r) + 32.)
          • Custom script: set r = null
--- Trigger 2/3 Enters ---

  • OrmanEnters
    • Events
      • Unit - A unit enters NcAltCheck1 <gen>
      • Unit - A unit enters NcAltCheck2 <gen>
      • Unit - A unit enters NcAltCheck3 <gen>
      • Unit - A unit enters NcAltCheck4 <gen>
      • Unit - A unit enters NcAltCheck5 <gen>
      • Unit - A unit enters NcAltCheck6 <gen>
      • Unit - A unit enters NcUstCheck1 <gen>
      • Unit - A unit enters NcUstCheck2 <gen>
      • Unit - A unit enters NcUstCheck3 <gen>
      • Unit - A unit enters NcUstCheck4 <gen>
      • Unit - A unit enters NcUstCheck5 <gen>
      • Unit - A unit enters NcUstCheck6 <gen>
      • Unit - A unit enters GorevSagUstBolge <gen>
      • Unit - A unit enters GorevSagBolge <gen>
      • Unit - A unit enters GorevSolBolge <gen>
    • Conditions
      • (Owner of (Triggering unit)) Equal to Neutral Hostile
    • Actions
      • Set NcUnit = (Triggering unit)
      • For each (Integer NcLoop) from 1 to 15, do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (NcUnit is in (Units in NcRegion[NcLoop])) Equal to False
            • Then - Actions
              • Set NcUnitRegion[(Custom value of NcUnit)] = NcRegion[NcLoop]
              • Custom script: exitwhen true
            • Else - Actions
--- Trigger 3/3 Leaves ---

  • OrmanLeaves
    • Events
      • Unit - A unit leaves NcAltCheck1 <gen>
      • Unit - A unit leaves NcAltCheck2 <gen>
      • Unit - A unit leaves NcAltCheck3 <gen>
      • Unit - A unit leaves NcAltCheck4 <gen>
      • Unit - A unit leaves NcAltCheck5 <gen>
      • Unit - A unit leaves NcAltCheck6 <gen>
      • Unit - A unit leaves NcUstCheck1 <gen>
      • Unit - A unit leaves NcUstCheck2 <gen>
      • Unit - A unit leaves NcUstCheck3 <gen>
      • Unit - A unit leaves NcUstCheck4 <gen>
      • Unit - A unit leaves NcUstCheck5 <gen>
      • Unit - A unit leaves NcUstCheck6 <gen>
      • Unit - A unit leaves GorevSolBolge <gen>
      • Unit - A unit leaves GorevSagBolge <gen>
      • Unit - A unit leaves GorevSagUstBolge <gen>
    • Conditions
      • (Owner of (Triggering unit)) Equal to Neutral Hostile
    • Actions
      • Set NcUnit = (Triggering unit)
      • Set NcPoint = (Center of NcUnitRegion[(Custom value of NcUnit)])
      • Unit - Order NcUnit to Move To NcPoint
      • Unit - Create 1 DUMMY [JFA] for (Owner of (Triggering unit)) at (Position of (Triggering unit)) facing Default building facing degrees
      • Unit - Add a 2.00 second Generic expiration timer to (Last created unit)
      • Unit - Add Orman Heal to (Last created unit)
      • Unit - Order (Last created unit) to Night Elf Druid Of The Claw - Rejuvenation (Triggering unit)
 
Level 17
Joined
Jun 2, 2009
Messages
1,141
Why is this false?
  • (NcUnit is in (Units in NcRegion[NcLoop])) Equal to False
Think about the logic there, you're checking if it's NOT in any of the regions?

Isn't the whole goal of the trigger to find out if it IS in one of those regions?

It was True since it's creation until this message.

A unit walked into a region and the condition "(NcUnit is in (Units in NcRegion[NcLoop])) Equal to True" failed. Ba dum tish.
I thought it must be False, then i made it False. Because i don't understand how this trigger works.
Yes it looks good for now. I will let you know the final result after we play today.
 
Level 20
Joined
Feb 27, 2019
Messages
593
I just noticed.

You should use "Unit - Unit In Region":
  • (NcRegion[NcLoop] contains NcUnit) Equal to True
Instead of "Unit - Unit In Unit Group":
  • (NcUnit is in (Units in NcRegion[NcLoop])) Equal to True
That is because the later creates and leaks a unit group.
 
Level 17
Joined
Jun 2, 2009
Messages
1,141
Yes it looks fine. We played without issue. Actually still we have a little problem.
You can move this unit out of their zones (they couldn't find time to get the order) and i have solved this issue for 3 of my creeps (quest creatures)

  • TurnBack
    • Events
      • Unit - A unit Is attacked
    • Conditions
      • (Owner of (Triggering unit)) Equal to Neutral Hostile
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Attacked unit) Equal to QuestYaratik[1]
          • And - All (Conditions) are true
            • Conditions
              • Or - Any (Conditions) are true
                • Conditions
                  • (Owner of (Attacking unit)) Equal to Player 1 (Red)
                  • (Owner of (Attacking unit)) Equal to Player 7 (Green)
        • Then - Actions
          • Unit - Move (Attacked unit) instantly to (Center of BaratSolCenter <gen>
They can be moved from their region. But if they've attacked by any of the units from team 1 or 7, i am simply moving them to their own regions.
Question is: I have duplicated this for 3 different creeps. But what about the other units? I have a lot of creatures within the list. Is there a way to do that easily?
 
Level 17
Joined
Jun 2, 2009
Messages
1,141
I just noticed.

You should use "Unit - Unit In Region":
  • (NcRegion[NcLoop] contains NcUnit) Equal to True
Instead of "Unit - Unit In Unit Group":
  • (NcUnit is in (Units in NcRegion[NcLoop])) Equal to True
That is because the later creates and leaks a unit group.
Uhm ok. It was Uncle's system and i don't know how it works. Now i am changing it like this.
Changed this with this one and i will test it tomorrow probably with people.

  • (NcUnit is in (Units in NcRegion[NcLoop])) Equal to True
    • /// changed with ///
  • (NcRegion[NcLoop] contains NcUnit) Equal to True
 
Level 20
Joined
Feb 27, 2019
Messages
593
They can be moved from their region. But if they've attacked by any of the units from team 1 or 7, i am simply moving them to their own regions.
Question is: I have duplicated this for 3 different creeps. But what about the other units? I have a lot of creatures within the list. Is there a way to do that easily?
Thats though to know without additional information. Are all neutral hostile units bound to those 15 specific regions you are using in this system?
 
Last edited:

Uncle

Warcraft Moderator
Level 64
Joined
Aug 10, 2018
Messages
6,569
Uhm ok. It was Uncle's system and i don't know how it works. Now i am changing it like this.
Changed this with this one and i will test it tomorrow probably with people.

  • (NcUnit is in (Units in NcRegion[NcLoop])) Equal to True
    • /// changed with ///
  • (NcRegion[NcLoop] contains NcUnit) Equal to True
I doubt I told you to use that function but maybe it was my mistake, apologies if so.

Again, just try to actually understand what's happening.

A unit enters one of X regions.

There is no Event Response that returns "Entered region" because Blizzard is dumb.

So we came up with this workaround that uses the For Loop to find which of the X regions the unit is in.
 
Level 39
Joined
Feb 27, 2007
Messages
5,024
A unit enters one of X regions.

There is no Event Response that returns "Entered region" because Blizzard is dumb.

So we came up with this workaround that uses the For Loop to find which of the X regions the unit is in.
I have not followed the discussion in this thread closely, but I have seen enough to notice that: this is exactly the same issue Uncle was talking about in another thread of yours. When a unit 'enters' a region and triggers events that run "when a unit enters [that region]", the unit will not be considered to be inside that region immediately, and checking if it is can fail even when it 'should' be true that the unit is in the region (since it fired the event).

Uncle has suggested solutions for fixing this in his other replies to you.
 
Level 17
Joined
Jun 2, 2009
Messages
1,141
Thats though to know without additional information. Are all neutral hostile units bound to those 15 specific regions you are using in this system?

Yes they are. Everything in here. But let me know if you need additional information [Solved] - I have to convert this into handmade Custom Value and i want to learn how to

I doubt I told you to use that function but maybe it was my mistake, apologies if so.

Again, just try to actually understand what's happening.

A unit enters one of X regions.

There is no Event Response that returns "Entered region" because Blizzard is dumb.

So we came up with this workaround that uses the For Loop to find which of the X regions the unit is in.

No problem. I am trying but it is difficult for me. I have a map 21 years old, still updating and there are too many triggers still i don't understand it yet.

I have not followed the discussion in this thread closely, but I have seen enough to notice that: this is exactly the same issue Uncle was talking about in another thread of yours. When a unit 'enters' a region and triggers events that run "when a unit enters [that region]", the unit will not be considered to be inside that region immediately, and checking if it is can fail even when it 'should' be true that the unit is in the region (since it fired the event).

Uncle has suggested solutions for fixing this in his other replies to you.
I have a 2 huge problems
1-) I am stupid person. My IQ is not like yours. I cannot think, read and understand as you. It is about my capabilities. I would like to be clever as yours.
2-) English is sometimes my enemy. I don't understand everything well. I am reading and i don't understand it completely. This is why sometimes i am asking and requesting for "exact" answer. Otherwise i don't understand long messages even if it includes the answer.
 
Level 20
Joined
Feb 27, 2019
Messages
593
If you want the same system as for the Quest creeps for all neutral hostile units then all you need to do is remove the specific quest unit from the condition and make use of NcUnitRegion that can be accessed through the units custom value. This trigger should be enough for the Quest creeps as well.
  • TurnBack
    • Events
      • Unit - A unit Is attacked
    • Conditions
      • (Owner of (Triggering unit)) Equal to Neutral Hostile
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • Or - Any (Conditions) are true
            • Conditions
              • (Owner of (Attacking unit)) Equal to Player 1 (Red)
              • (Owner of (Attacking unit)) Equal to Player 7 (Green)
        • Then - Actions
          • Unit - Move (Attacked unit) instantly to (Center of NcUnitRegion[(Custom value of (Attacked unit))]
 
Level 17
Joined
Jun 2, 2009
Messages
1,141
If you want the same system as for the Quest creeps for all neutral hostile units then all you need to do is remove the specific quest unit from the condition and make use of NcUnitRegion that can be accessed through the units custom value. This trigger should be enough for the Quest creeps as well.
  • TurnBack
    • Events
      • Unit - A unit Is attacked
    • Conditions
      • (Owner of (Triggering unit)) Equal to Neutral Hostile
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • Or - Any (Conditions) are true
            • Conditions
              • (Owner of (Attacking unit)) Equal to Player 1 (Red)
              • (Owner of (Attacking unit)) Equal to Player 7 (Green)
        • Then - Actions
          • Unit - Move (Attacked unit) instantly to (Center of NcUnitRegion[(Custom value of (Attacked unit))]
Wow is that all? Thank you so much again. I really appreciate people like you, @Pyrogasm and @Uncle because helping each other is a kind act.
Have a nice day all of you.
 
Status
Not open for further replies.
Top