• 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.

Explanation of API, MUI, and GetHandleId

Status
Not open for further replies.
Level 14
Joined
Nov 18, 2007
Messages
1,084
  1. In the most basic sense, an API is what the user is allowed to use from a programming language or system. For instance, the Jass API provides for GetTriggerUnit which allows you to get the triggering unit from an event. You can look at this to get a better definition and this to look at the API for Jass.
  2. A spell is called MUI (Multi-Unit Instanceability) if multiple units can cast the spell simultaneously without any conflicts. This applies even if the multiple units are owned by the same player.
    MPI is similar to MUI but only one unit from each player can cast the spell without conflicts.
  3. I'm assuming you mean GetHandleId.
    It basically returns the unique integer id for a handle.
    Example: two units that are basically clones of each other (same unit type id, same mana, same life, etc.) would have different handle ids.

    Example usage:
    JASS:
    local integer id = GetHandleId(YourUnit) // Gets the handle id of YourUnit

    Even though my examples are only using units, you should know that the function can be used for any type that extends handle, like items and timers.
 
Level 5
Joined
Jan 4, 2009
Messages
118
Thanks for your help. And please help me on it. From what you've said, I feel that many do not know what's about jass.

- Can you explain me about do MUI Spell? Plz!!
- And Handle Value can use for what?
- Declaration globals variable is neccessary?
ex.
JASS:
globals
unit u = GetTriggerUnit()
integer i = 2
endglobals
 
Level 26
Joined
Aug 18, 2009
Messages
4,097
For a spell to be MUI, it has to store its data in different memory spaces.

Simple example: Everytime the spell is being cast, the caster shall be attached its current intelligence amount. This means that each caster needs its own designated variable. GetHandleId provides a different integer value for each unit, a unique marker. You can use this marker/index in a hashtable

SaveInteger(<table>, GetHandleId(<caster>), <key>, <intelligence>)

so the hashtable field is dependent on the caster, like we wanted it.

MPI is not necessarily easier but there was no hashtable in GUI before, nor the GetHandleId. That is why some mapmakers stored the data that should actually belong to the unit to the owner of the unit instead and used that player's player number as an index for arrays.

Do not grasp what your third point is about. There is no GetTriggerUnit() when variables are being declared. GetTriggerUnit() is an event response for unitevents, playerunitevents and some more. Global variables do not have to be initialized in declaration but they should have some value before you try to read something out of them.
 
Level 5
Joined
Jan 4, 2009
Messages
118
summary Handle and Hashtable is useful for make MUI spell? It'sright. Can you exmaple some MUI Spell for me plz. About Globals Declaration I wonder It's different from normal varibles creates on Crtl+B
 
Status
Not open for further replies.
Top