• 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 faction for Warcraft 3 and enter Hive's 19th Techtree Contest: Co-Op Commanders! Click here to enter!
  • Create a void inspired texture for Warcraft 3 and enter Hive's 34th Texturing Contest: Void! Click here to enter!
  • The Hive's 21st Texturing Contest: Upgrade is now concluded, time to vote for your favourite set of icons! Click here to vote!

Unit id and Spawning unit from id

Status
Not open for further replies.
like when i type in -unitid it will come up with a message saying A043 something like that on the selected unit then when i type -spawn A043 it will create that unit
so ye the selected units rawcode will be shown then it will spawn on the units rawcode
if the selected unit was a footman and the selected player types -unitid it will display hfoo then if the user types in -spawn hfoo it will spawn a foot man
 
Last edited:
actually unittypes are integers so there is no problem with it
note that unit ids are numbers like 12789234570 (rather long)
  • Ini
    • Events
      • Map initialization
    • Conditions
    • Actions
      • Player Group - Pick every player in (All players) and do (Actions)
        • Loop - Actions
          • Trigger - Add to UnitId <gen> the event (Player - (Picked player) types a chat message containing -unitid as An exact match)
          • Trigger - Add to Spawn <gen> the event (Player - (Picked player) types a chat message containing -spawn as A substring)
  • UnitId
    • Events
    • Conditions
    • Actions
      • Custom script: set bj_wantDestroyGroup = true
      • Unit Group - Pick every unit in (Units currently selected by (Triggering player)) and do (Actions)
        • Loop - Actions
          • Set UnitType = (Unit-type of (Picked unit))
          • Custom script: set udg_i = udg_UnitType
          • Game - Display to (All players) for 60.00 seconds the text: (String(i))
  • Spawn
    • Events
    • Conditions
      • (Substring((Entered chat string), 1, 7)) Equal to -spawn
    • Actions
      • Set i = (Integer((Substring((Entered chat string), 8, 20))))
      • Custom script: set udg_UnitType = udg_i
      • Game - Display to (All players) for 60.00 seconds the text: (String(UnitType))
      • Set loc = (Point(0.00, 0.00))
      • Unit - Create 1 UnitType for (Triggering player) at loc facing 0.00 degrees
      • Custom script: call RemoveLocation(udg_loc)
converting a string variable directly to unit type works, too
  • Set UnitType = (Unit-type(footman))
 

Attachments

  • SpawnUnitsId.w3x
    13.2 KB · Views: 81
Status
Not open for further replies.
Top