• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

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