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

Check unit type (Unit typeID) in hashtables. How?

Status
Not open for further replies.
Level 9
Joined
Aug 7, 2009
Messages
380
Hey
Guess the title can explain you clearly enough, but i will still give a small explaination:
This is how my system work and what my question:
  1. Add X unit type ID into the Y hashtable
  2. Add and add over again... with new unit type ID
  3. Spell casting... on a unit
  4. Unit type ID of target unit being cast is equal to unit type ID of X unit which added before?
Yep, that's all. Don't be shy asking for clearer explaination ^^!
thanks
 
Level 9
Joined
Jul 10, 2011
Messages
562
everything you explain is that you wanna save unit-types and later you wanna check whether the unit-type of a spell target is equal to one of the saved unit-types.

so i recommend to use an unit-type array because its faster and much easier than saving unit-types in a hash.

if you really wanna save the unit-types in a hash you have to do the following :

1. get the unit-type ID of the unit-type you wanna save
JASS:
GetUnitTypeId(whichUnit)
2. save the ID as integer in the hash
3. when you wanna compare the unit-types you have to compare the IDs
 
Level 9
Joined
Jul 10, 2011
Messages
562
you can do it in custom script and set the integer before saving it or you choose 'JASS code' under functions when you save it in the hash so you can enter that line directly.
 
Level 28
Joined
Jan 26, 2007
Messages
4,789
you can do it in custom script and set the integer before saving it or you choose 'JASS code' under functions when you save it in the hash so you can enter that line directly.
What? "Jass Code"? Never heard of that function. Is it something UMSWE-related?

Striker21: You don't exactly need to call it with the call-function: you need to set it to a variable (probably).
I will use the integer variable "unitId" for this example.
Something like set udg_unitId = GetUnitTypeId( unit ).

If the 'unit' is the triggering unit, then it will be: set udg_unitId = GetUnitTypeId( GetTriggerUnit() ).
If it is the last created unit, then: set udg_unitId = GetUnitTypeId( bj_lastCreatedUnit ).

Then you can store the variable unitId in the hashtable (Save Integer).
 
Status
Not open for further replies.
Top