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

give costum value to units all around the map

Status
Not open for further replies.
Hellow friends ^.^ I would like to give a different value to any unit on the map.
I used this but it gives the same value to all units:
  • gives value
    • Events
      • Map initialization
    • Conditions
    • Actions
      • Set unitgroupsystem = (Units in (Playable map area))
      • Unit Group - Pick every unit in unitgroupsystem and do (Actions)
        • Loop - Actions
          • For each (Integer A) from 1 to (Number of units in unitgroupsystem), do (Actions)
            • Loop - Actions
              • Unit - Set the custom value of (Picked unit) to (Integer A)
      • Custom script: call DestroyGroup (udg_unitgroupsystem)
      • Trigger - Remove (This trigger) from the trigger queue
There are 12 units and i want unit 1 to be value 1 and unit 2 to be 2.
The current trigger above give all units value 12.
"units on the map" has 1000 slots [1000]
 
Level 4
Joined
Jul 18, 2009
Messages
85
If your look at your trigger you have it so it gives every picked unit the value of integer A which is 12.

I'm not sure if this will work for you but,
  • Event
  • Map Initialization
  • Actions
  • Set unitgroupsystem = (Units in (Playable map area))
  • Unit Group - Pick every unit in (units in (unitgroupsystem), and do (Actions)
  • Loop - Actions
  • For Each (Integer A) from 1 to (Number of unit sin unitgroupsystem, do (Actions)
  • Loop - Actions
  • Unit - Set the custom value of (Picked unit) to (0 + (Player number of (Owner of (Picked unit))))
  • Custom script: call DestroyGroup (udg_unitgroupsystem)
  • Trigger - Remove (This trigger) from the trigger queue
So basically if one unit belongs to red he will be 0 + 1. or 1
If blue 0 + 2. or 2
and so on. If you want a number 12 however that must mean that you have players 1-12 and each one has one of these units. I have no clue what your map is about/who controls units etc so if this wont work for you please explain the circumstances of your units.
 
So basically if one unit belongs to red he will be 0 + 1. or 1
If blue 0 + 2. or 2
and so on. If you want a number 12 however that must mean that you have players 1-12 and each one has one of these units. I have no clue what your map is about/who controls units etc so if this wont work for you please explain the circumstances of your units.

this unit number was random number that was in my map, i want it to work for 100 units,
so when I input the string -show 1 it will show the name of unit 1 of that 100 and -show 2 will show another name of unit that in the group.
 
Level 4
Joined
Jul 18, 2009
Messages
85
  • Events
  • Unit - A Enters Region (playable map area)
  • Actions
  • Unit - Set the custom value of (Triggering unit) to (0 + (Number of units in unitgroupsystem))
Would that work for you?
 
Status
Not open for further replies.
Top