• 🏆 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!

[Trigger] How to Make a Trigger Find Name of Unit?

Status
Not open for further replies.
I am making a map that requires the creation of thousands of triggers if I were to make it for the individual units...
If there is any way to make it find the NAME of a unit, in oppose to the Unit-Type, I could simply make it find the name of the unit, and if the targeted unit and casting unit have the same name and level and are in a specific category, then to do blah blah. Because what I am doing is having units of like 20 different levels for every unit. If I could make the trigger this way, then I could make only ONE trigger to do the work.
Again, anyone who knows how to make a trigger find the name of a unit, please tell me. This would probably be in JASS, which I have limited knowledge of.
 
Level 12
Joined
Aug 22, 2008
Messages
911
The String value of the Name of the unti is found in the String values section, as the last if I'm not mistaken.
Now your comparison would look like this:
  • If (All conditions are True) do (Then - Actions) else do (Else - Actions)
    • If - Conditions
      • (Name of (Target Unit of ...) equals (Name of (Casting Unit)))
    • Then - Actions
    • Else - Actions
 
  • Trigger1
  • Events
    • Unit - A unit start the effect of an ability
  • Conditions
    • (Ability being cast) Equal to X
  • Actions
    • Set Point1 = (Position of (Target unit of ability being cast))
    • Unit - Create 1 (Unit-type of (Target unit of ability being cast)) for (Owner of (Triggering unit)) at Point facing default building degrees
    • Hero - Set level of (Last created unit) to (Level of (Target unit of ability being cast)) + 1)
    • Custom script: call RemoveLocation (udg_Point1)
 
thats not quite what i meant. im talking about units, not heroes. as in, i make 10 units, from levels 1-10. and if a 1 casts it on a 1, then you get a 2. i could do this unit by unit, but it would b much easier if i could use strings, and have it make a unit with the name of the unit, but one level higher. this may take JASS, which i am not talented with
 
Level 37
Joined
Mar 6, 2006
Messages
9,240
Set the units to an array:

  • Footman_Array[1] = Level 1 Footman
  • Footman_Array[2] = Level 2 Footman
  • ...
  • Rifleman_Array[1] = Level 1 Rifleman
  • Rifleman_Array[2] = Level 2 Rifleman
Then detect the unit type and level of unit, replace the old unit with level + 1 unit.
 
lol i guess there is no shortcut. i know about arrays. i meant i was hoping there was a way to do it without triggering for each individual unit. guess ill do it the way i was originally going to do it...unless.. i guess i dont actualy have to use new units, i could just have them be powered up and given an ability describing their level and giving them a buff, which would change to say each level. guess ill do it like this, would save the time of triggering for every level of every unit (i was originally going to have 20 levels for like hundreds of units)
 
Status
Not open for further replies.
Top