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

[Solved] Undeclared Variable

Status
Not open for further replies.
Level 5
Joined
Apr 29, 2015
Messages
143
So I was trying to get a trigger that gets unit's attack damage value, I copied the trigger and the variable but somehow got this issue...

Error: "Undeclared variable udg_i1"
Line 1: "set udg_i1=GetHandleId(udg_u1)"
Line 2:"set udg_i1=GetHandleId(LoadUnitHandle(udg_DD_Hash, GetHandleId(GetTriggerUnit()), StringHash("owner")))"

And these are the triggers.

  • Detect Damage
    • Events
    • Conditions
    • Actions
      • Set r1 = (Damage taken)
      • Unit - Set life of (Triggering unit) to 100.00%
      • Custom script: set udg_i1 = GetHandleId( LoadUnitHandle( udg_DD_Hash , GetHandleId( GetTriggerUnit() ) , StringHash ("owner") ) )
      • Custom script: set udg_i2 = LoadInteger( udg_DD_Hash , udg_i1 , StringHash ("hits") )
      • Custom script: set udg_r2 = LoadReal(udg_DD_Hash , udg_i1 , StringHash("TempMax") )
      • Custom script: set udg_r3 = LoadReal( udg_DD_Hash , udg_i1 , StringHash("TempMin") )
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • r1 Greater than r2
        • Then - Actions
          • Custom script: call SaveReal(udg_DD_Hash, udg_i1 , StringHash("TempMax") , udg_r1 )
        • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • r1 Less than r3
            • Then - Actions
              • Custom script: call SaveReal(udg_DD_Hash , udg_i1 , StringHash("TempMin") , udg_r1 )
            • Else - Actions
      • Set i2 = (i2 + 1)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • i2 Equal to DamageHits
        • Then - Actions
          • For each (Integer loopA) from 1 to SpawnAmount, do (Actions)
            • Loop - Actions
              • Custom script: call ShowUnit( LoadUnitHandle( udg_DD_Hash , udg_i1 , udg_loopA ) , false )
          • Unit - Hide (Triggering unit)
          • Custom script: call SaveReal(udg_DD_Hash , udg_i1 , StringHash("Max") , LoadReal( udg_DD_Hash , udg_i1 , StringHash("TempMax") ) )
          • Custom script: call SaveReal(udg_DD_Hash , udg_i1 , StringHash("Min") , LoadReal( udg_DD_Hash , udg_i1 , StringHash("TempMin") ) )
        • Else - Actions
          • Custom script: call SaveInteger( udg_DD_Hash , udg_i1 , StringHash("hits") , udg_i2 )
  • Update Damage
    • Events
      • Unit - A unit Uses an item
      • Unit - A unit Gains a level
      • Unit - A unit Loses an item
      • Unit - A unit Acquires an item
    • Conditions
      • (Unit-type of (Triggering unit)) Not equal to Paladin - (str)
      • (Unit-type of (Triggering unit)) Not equal to Blademaster - (agi)
      • (Unit-type of (Triggering unit)) Not equal to Blood Mage - (int)
    • Actions
      • -------- -------------------------------------------------- --------
      • Wait 0.00 seconds
      • -------- -------------------------------------------------- --------
      • Set u1 = (Triggering unit)
      • Custom script: set udg_i1 = GetHandleId(udg_u1)
      • -------- -------------------------------------------------- --------
      • Custom script: set udg_u2 = LoadUnitHandle(udg_DD_Hash , udg_i1 , StringHash("dummy") )
      • -------- -------------------------------------------------- --------
      • Custom script: call SaveInteger(udg_DD_Hash , udg_i1 , StringHash("hits") , 0 )
      • Custom script: call SaveReal(udg_DD_Hash , udg_i1 , StringHash("TempMax") , 0 )
      • Custom script: call SaveReal(udg_DD_Hash , udg_i1 , StringHash("TempMin") , 100000 )
      • -------- -------------------------------------------------- --------
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • u2 Equal to No unit
        • Then - Actions
          • Set DD_boolean = False
          • Custom script: set udg_u2 = CreateUnit( Player(15) , udg_Dummies[100] , udg_SpawnCoordinates[0] , udg_SpawnCoordinates[1] , 0 )
          • Custom script: call SaveUnitHandle( udg_DD_Hash , GetHandleId(udg_u2) , StringHash("owner") , udg_u1 )
          • Custom script: call SaveUnitHandle( udg_DD_Hash , udg_i1 , StringHash("dummy") , udg_u2 )
          • Custom script: call TriggerRegisterUnitEvent( gg_trg_Detect_Damage, udg_u2, EVENT_UNIT_DAMAGED )
        • Else - Actions
          • Set DD_boolean = True
          • Unit - Unhide u2
      • -------- -------------------------------------------------- --------
      • For each (Integer loopC) from 0 to DamageUnitTypes, do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Unit-type of u1) Equal to DamageAttackers[loopC]
            • Then - Actions
              • Set UnitType = Dummies[DummyIndex[loopC]]
              • For each (Integer loopA) from 1 to SpawnAmount, do (Actions)
                • Loop - Actions
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • DD_boolean Equal to False
                    • Then - Actions
                      • Custom script: set udg_u3 = CreateUnit( Player(15) , udg_UnitType , udg_SpawnCoordinates[0] , udg_SpawnCoordinates[1] , 0 )
                      • Custom script: call SaveUnitHandle( udg_DD_Hash , udg_i1 , udg_loopA , udg_u3 )
                    • Else - Actions
                      • Custom script: set udg_u3 = LoadUnitHandle( udg_DD_Hash , udg_i1 , udg_loopA )
                      • Unit - Remove Inventory (Hero) from u3
                      • Unit - Add Inventory (Hero) to u3
                      • Unit - Unhide u3
                  • Hero - Set u3 Hero-level to (Level of u1), Hide level-up graphics
                  • Hero - Modify Strength of u3: Set to (Strength of u1 (Exclude bonuses))
                  • Hero - Modify Agility of u3: Set to (Agility of u1 (Exclude bonuses))
                  • Hero - Modify Intelligence of u3: Set to (Intelligence of u1 (Exclude bonuses))
                  • For each (Integer loopB) from 1 to 6, do (Actions)
                    • Loop - Actions
                      • Hero - Create (Item-type of (Item carried by u1 in slot loopB)) and give it to u3
                  • Animation - Change u3's animation speed to 2000.00% of its original speed
                  • Unit - Order u3 to Attack u2
              • Item - Pick every item in DD_Region and do (Item - Remove (Picked item))
              • Skip remaining actions
            • Else - Actions
Any helps would be appreciated. :)
 
Level 5
Joined
Apr 29, 2015
Messages
143
Ok, after adding i1 integer variable, it is now fixed, thanks. :)
Though they should have tell to add integer variable i1 beforehand. :I
 
Status
Not open for further replies.
Top