• Check out the results of the Techtree Contest #19!
  • 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.
  • Create a void inspired texture for Warcraft 3 and enter Hive's 34th Texturing Contest: Void! Click here to enter!
  • The Hive's 22nd Icon Contest: Creep Abilities is now concluded, time to vote for your favourite set of icons! Click here to vote!

[Trigger] Help with independent magics for multiplayer

Status
Not open for further replies.
Level 1
Joined
Dec 12, 2017
Messages
4
Hello, I have been dragging a very frequent problem when passing a map to multiplayer, the problem comes in the overwriting of the variables ... My solution was to use arrays with the ID of each unit, for example a dummy or the caster unit or the objectives, etc. like in the image
Screenshot
Now I do not know how to call that ID and use the functions based on the events, in this new trigger I do not have that event so it is difficult for me to call that ID ... please help
Screenshot
 
Well, you are trying to use multiple Unit Groups; one for each dummy. In fact, you need only one group in order to reference all existing dummy units. Also, the function "Key(object)" or
GetHandleId(object) might return a value that isn't supported by arrays. For example, the very first unit in game might get the number 1048672(+) as its id while arrays can only use numbers from 0 to 8191. Athur12A2 suggested what can be done to overcome the id problem, or you can also use a Hash Table, which supports large numbers such as the ones retrieved by the "Key(object)" function.
 
Thank you very much, I was learning from the spell that others raised: D effectively use the hash tables and the ID of either the caster, dummy or target ... I made the mistake of using arrays that only support 9999 units, the IDs use more than 5 digits :o thanks for the help
 
I made the mistake of using arrays that only support 9999 units
Arrays only support 8192. Even less if one does not included the bugged, not saved, indices. One can chain arrays together in series, but one might as well use a hashtable in this case.

People of old (before hashtable) got around the problem by subtracting a large constant from the handle ID before mapping to an array index. Even still if there is even a single handle ID leak it can eventually break the system. Hence I would recommend using a hashtable.
 
The frequently suggested MPI (multi-player instantiability) or MUI (multi-unit instantiability) is but a stopgap. When you decide the spell should not be per unit anymore, you can redo all the indexing, at least the entry points. The spell should manage the indexing itself, as is conducted in object oriented paradigm. So casting the ability allocates a new instance, you store the data including the unit therein and dismantle when the spell is finished. This also requires you to correctly define/track the life cycle. If you need access from other objects such like the unit, you should construct this link explicitely, from unit to spell (index). This is a much cleaner approach but, of course, GUI is not suited for it, which does not even provide local variables.
 
Status
Not open for further replies.
Back
Top