HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Variables

11-11-2005, 02:07 AM#1
Sir Xavior
Does any one have a variable tutorial that I can use. Or perhaps someone could help with my problem.

The problem is: How do I set a unit variable to specfic unit-tyoe
11-11-2005, 02:33 AM#2
TaintedReality
Eh? I don't understand what you mean. There is a unit-type variable, which will store a unit type(duh ;)), but the unit variable is meant for storing individual units. For example, you could store player 1's town hall in a unit variable, or you can store town halls in general as a unit-type variable. Dunno if that makes sense, but if that doesn't answer your question try to rephrase it so I can understand what your asking =O.
11-11-2005, 03:06 AM#3
Sir Xavior
Well the Unit comparison Conidtion you can use a unit variable.

Lets say i want a certain player to have a special unit only if the player has a certain hero. How can get that certain hero into a variable?

Is this better?
11-11-2005, 07:27 AM#4
TaintedReality
Ok, is the hero going to be made from a building, made through triggers, or pre-placed on the map?
Edit: I'm goin to sleep so let me know which it is and I'll answer tommorow ^^.
11-11-2005, 06:27 PM#5
Tim.
If the player only owns one of that type of unit, you can just use this. I supose you would prefer GUI.

Code:
Set tempUnit = (Random unit from (Units owned by (Player(1)) of type Footman))
11-13-2005, 03:45 AM#6
tassadar920
Quote:
Originally Posted by Tim.
If the player only owns one of that type of unit, you can just use this. I supose you would prefer GUI.

Code:
Set tempUnit = (Random unit from (Units owned by (Player(1)) of type Footman))

A "unit" variable is equal to a specific unit in existance... a unit-type is a generic term for a unit's object, not a specific instance of the unit.

If your checking for a hero for example, use a condition that checks for unit-type and then use the casting (Unit-Type of Unit) where "Unit" refers to the hero (regardless of what the hero himself is), then you can go from there.

That probably made no sense.
11-13-2005, 12:05 PM#7
Tim.
Quote:
Originally Posted by tassadar920
A "unit" variable is equal to a specific unit in existance... a unit-type is a generic term for a unit's object, not a specific instance of the unit.

Yes, and my small function took the only unit of the type and gave it the desired variable. Note the original issue:

Quote:
Originally Posted by Sir Xavior
The problem is: How do I set a unit variable to a specfic unit-tyoe
11-13-2005, 04:24 PM#8
tassadar920
I'm having trouble understand why you would need this though...

I think the original poster might have been confused trying to compare a specific Unit (the hero) to a generic Unit-Type to see if it's that type of unit. But there's a Unit-Type Comparison which does that without needing to make that conversion.
11-13-2005, 04:39 PM#9
TaintedReality
I think the poster abandoned this site or something =P. He posted a couple threads and recieved help in most of em, but hasn't replied to answer any of the questions.
11-15-2005, 02:09 AM#10
Sir Xavior
Well maybe I do not know as much as i thought I did, but this should help me greatly.