• 🏆 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!
  • 🏆 Hive's 6th HD Modeling Contest: Mechanical is now open! Design and model a mechanical creature, mechanized animal, a futuristic robotic being, or anything else your imagination can tinker with! 📅 Submissions close on June 30, 2024. Don't miss this opportunity to let your creativity shine! Enter now and show us your mechanical masterpiece! 🔗 Click here to enter!

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:
Level 19
Joined
Feb 4, 2009
Messages
1,313
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: 78
Status
Not open for further replies.
Top