• 🏆 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!
  • ✅ The POLL for Hive's Texturing Contest #33 is OPEN! Vote for the TOP 3 SKINS! 🔗Click here to cast your vote!

[Trigger] Error with Creep Respawn

Status
Not open for further replies.
Level 7
Joined
Aug 15, 2012
Messages
318
hey I get quite a few errors when saving after adding this trigger to my map there are 9 errors
Line 392: Undefined type VarAsString_Real
Line 13949, 13950, 13951, 13993, 13994, 13995, 13023, 14024: Cannot convert real to null
heres the triggers that I added to my map

  • Respawn
    • Events
      • Unit - A unit owned by Neutral Hostile Dies
    • Conditions
      • (((Dying unit) is A Hero) Equal to False) and (((Dying unit) is Summoned) Equal to False)
    • Actions
      • Custom script: local unit u = GetDyingUnit()
      • Custom script: local integer id = GetUnitTypeId(u)
      • Custom script: local integer lv = GetHeroLevel(u)
      • Custom script: local integer cv = GetUnitUserData(u)
      • Custom script: local real x = LoadReal(udg_CreepTable, cv, 1)
      • Custom script: local real y = LoadReal(udg_CreepTable, cv, 2)
      • Custom script: local real ang = LoadReal(udg_CreepTable, cv, 3)
      • Wait 85.00 seconds
      • Custom script: call RemoveUnit( u )
      • Custom script: set u = CreateUnit(GetTriggerPlayer(),id,x,y,ang)
      • Custom script: if lv > 1 then
      • Custom script: call SetHeroLevel(u,lv,false)
      • Custom script: endif
      • Custom script: set u = null
  • Set the unit coordinate
    • Events
      • Game - UnitIndexEvent becomes Equal to 1.00
    • Conditions
    • Actions
      • Custom script: local unit u = udg_UDexUnits[udg_UDex]
      • Custom script: call SaveReal(udg_CreepTable, udg_UDex, 1, GetUnitX(u))
      • Custom script: call SaveReal(udg_CreepTable, udg_UDex, 2, GetUnitY(u))
      • Custom script: call SaveReal(udg_CreepTable, udg_UDex, 3, GetUnitFacing(u))
      • Custom script: set u = null
  • Unit Indexer
    • Events
    • 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 15
            • 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 = 16
      • 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 7
Joined
Aug 15, 2012
Messages
318
which lines r what ? for example we cant tell what line 392 is lol ...
TBH I have searched through all my triggers like 5 times and can not find link 392 anywhere idk wtf.
Line 392: Undefined type VarAsString_Real
VarAsString_Real udg_UnitIndexEvent= null

Line 13949, 13950, 13951, 13993, 13994, 13995, 13023, 14024: Cannot convert real to null
set udg_UnitIndexEvent="0.00"
set udg_UnitIndexEvent="2.00"
set udg_UnitIndexEvent="0.00"
set udg_UnitIndexEvent="0.00"
set udg_UnitIndexEvent="1.00"
set udg_UnitIndexEvent="0.00"
set udg_UnitIndexEvent="3.00"
set udg_UnitIndexEvent="0.00"

all the cannot convert real to null are in order in the trigger as here
 

Wrda

Spell Reviewer
Level 26
Joined
Nov 18, 2012
Messages
1,900
make sure UnitIndexEvent is a (real) variable in ur variable editor.

the reals tht are 0.00 are fine wrda. it does not create error try it in ur editor
I didn't say the reals that are 0.00 is a problem, I'm saying you can't null reals like "set real = null", because its default value is 0.00, it's the same as trying to null a unit variable like "set unit = 0.00", doesn't make sense.
 
Status
Not open for further replies.
Top