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

[Trigger] [Solved] Trigger malfunctions when an Integer variable is set to the HandleID of a unit

Status
Not open for further replies.
Level 6
Joined
Jul 12, 2021
Messages
95
Trigger malfunctions when an Integer variable is set to the HandleID of a unit.

Works:
  • IntegerOfRemovingUnitsValue
    • Events
      • Player - Player 1 (Red) types a chat message containing run as An exact match
    • Conditions
    • Actions
      • Set VariableSet Unit[1] = Paladin 0000 <gen>
      • Hashtable - Save Handle OfUnit[1] as 1 of 1 in (Last created hashtable).
      • Set VariableSet TestInteger_Copy = 1
      • Quest - Display to (All players) the Quest Update message: (String(TestInteger_Copy))
      • Set VariableSet IntegerOfRemovingUnits[TestInteger_Copy] = 4
      • Quest - Display to (All players) the Quest Update message: (String(IntegerOfRemovingUnits[TestInteger_Copy]))
Doesn't work, the last line of the trigger prints 0 instead of 4:
  • IntegerOfRemovingUnitsValue
    • Events
      • Player - Player 1 (Red) types a chat message containing run as An exact match
    • Conditions
    • Actions
      • Set VariableSet Unit[1] = Paladin 0000 <gen>
      • Hashtable - Save Handle OfUnit[1] as 1 of 1 in (Last created hashtable).
      • Set VariableSet TestInteger_Copy = (Key (Load 1 of 1 in (Last created hashtable).).)
      • Quest - Display to (All players) the Quest Update message: (String(TestInteger_Copy))
      • Set VariableSet IntegerOfRemovingUnits[TestInteger_Copy] = 4
      • Quest - Display to (All players) the Quest Update message: (String(IntegerOfRemovingUnits[TestInteger_Copy]))
Works:
  • IntegerOfRemovingUnitsValue
    • Events
      • Player - Player 1 (Red) types a chat message containing run as An exact match
    • Conditions
    • Actions
      • Set VariableSet Unit[1] = Paladin 0000 <gen>
      • Hashtable - Save Handle OfUnit[1] as 1 of 1 in (Last created hashtable).
      • Set VariableSet TestInteger_Copy = (Key (Load 1 of 1 in (Last created hashtable).).)
      • Set VariableSet TestInteger_Copy = (TestInteger_Copy / 1000)
      • Quest - Display to (All players) the Quest Update message: (String(TestInteger_Copy))
      • Set VariableSet IntegerOfRemovingUnits[TestInteger_Copy] = 4
      • Quest - Display to (All players) the Quest Update message: (String(IntegerOfRemovingUnits[TestInteger_Copy]))
Why doesn't it work when the TestInteger_Copy is set to the HandleId of the Unit[1]?
What can I do to solve this problem? Do I have to divide it by 1000 for it to work?
 

Attachments

  • Hiveworkshop Integer variable is set to the HandleID of a unit.w3m
    16.7 KB · Views: 22

Uncle

Warcraft Moderator
Level 65
Joined
Aug 10, 2018
Messages
6,693
The index limit is 32,768, which I guess you know on account of the division. Would that method really be necessary though? Why use an Array when you can use the Hashtable for everything?

Anyway, using Custom Script I got it to display the Paladin's handle id:
  • IntegerOfRemovingUnitsValue
    • Events
      • Player - Player 1 (Red) types a chat message containing run as An exact match
    • Conditions
    • Actions
      • Set VariableSet Unit = Paladin 0000 <gen>
      • Custom script: set udg_Handle = udg_Unit
      • Hashtable - Save (Key Handle.) as 1 of 1 in (Last created hashtable).
      • -------- --------
      • Set VariableSet Int = (Load 1 of 1 from (Last created hashtable).)
      • Quest - Display to (All players) the Quest Update message: (String(Int))
      • -------- --------
      • Set VariableSet Array[Int] = 4
      • Quest - Display to (All players) the Quest Update message: (String(Array[Int]))
Array[Int] won't display though since Int is set to a value larger than 32,768 (Index Limit). Instead, it displays Array[0] which has a default value of 0.
 
Last edited:
Status
Not open for further replies.
Top