• 🏆 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!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

Question about arrays

Status
Not open for further replies.
Level 11
Joined
Mar 8, 2006
Messages
277
Hey man if i use this Test= unit with array

If i put
Test(Unit1)=Footman 005
Test(UNit2)=Footman 006

Kill Test(Unit1)
Kill Test(Unit2)

It doesnt work, only one unit gets killed, i mean the game thinks that Test(Unit1) and Test(Unit2) is the same unit and is not.


The array has to be alywas a number?
I want the array to be a word that i choose.
 
Level 2
Joined
Jun 6, 2010
Messages
9
Yeah, the array index is always a number, you can just name the variable something so you can remember what it is for
 
Level 28
Joined
Jan 26, 2007
Messages
4,789
The array has to be alywas a number?
I want the array to be a word that i choose.
Arrays are used for looping actions (like in Pharao's example), so letting them be words is just not smart.
It also isn't possible because strings that have been converted to an integer return 0.

Oh yeah, and arrays can't go over 2^13 (8192).

However, it is possible with hashtables (a double array).
 
Level 28
Joined
Jan 26, 2007
Messages
4,789
Dude what are u doing, dont give me exaple like that, coz i know how to use editor wtf.
Humm, he was trying to help, the least you can do is be a bit more grateful.
It really doesn't show that you know how to use the editor since.
Test(Unit1)=Footman 005
Test(UNit2)=Footman 006

Kill Test(Unit1)
Kill Test(Unit2)
This seems impossible to do in the editor and also completely not useful if it was possible.
 
Level 28
Joined
Jan 26, 2007
Messages
4,789
My question was if an array can be word not a number, i needed it for other resons obiosly not for killing a footman, but i thought u ppl will understand that by default.
Sorry, if PC's can't understand a question that's not correctly formulated, neither can we.

If you want to use words as arrays, the best option would be to use hashtables.
  • Hashtable - Save 100.00 as (Key Real1) of 0 in HashTable
  • 100.00 is the value saved.
  • Real1 is the word used to store the real.
  • 0 is another value used to store the real (since it's a double array).
  • HashTable is obviously the hashtable (created at map init).
 
Status
Not open for further replies.
Top