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

Hero Tavern (Random Hero Pick) Help!

Status
Not open for further replies.
Level 11
Joined
Nov 1, 2008
Messages
828
How would i make this trigger work?
  • Unit Group - Pick every unit in (Units of type |caabb3000Ancient Beast|r) and do (Unit Group - Add (Picked unit) to randomherogrouplight)
I'm trying to put random units in the group that arn't even on the map but they are in the hero tavern! And how would i be able to remove that unit once picked from the hero tavern? Thankyou!
+rep
 
Last edited:
Level 37
Joined
Mar 6, 2006
Messages
9,240
You can use unit pools. It only requires some custom scripts:


  • Untitled Trigger 080
    • Events
      • Map initialization
    • Conditions
    • Actions
      • Custom script: local unitpool up = CreateUnitPool()
      • Custom script: call UnitPoolAddUnitType(up, 'Hpal', 1)
      • Custom script: call UnitPoolAddUnitType(up, 'Hmkg', 1)
      • Custom script: call UnitPoolAddUnitType(up, 'Hamg', 1)
      • Custom script: call UnitPoolAddUnitType(up, 'Hblm', 1)
      • Custom script: call SaveUnitPoolHandle(udg_hash, 0, StringHash("unitpool"), up)
  • Untitled Trigger 082
    • Events
      • Player - Player 1 (Red) skips a cinematic sequence
    • Conditions
    • Actions
      • Custom script: local unitpool up = LoadUnitPoolHandle(udg_hash, 0, StringHash("unitpool"))
      • Custom script: set bj_lastCreatedUnit = PlaceRandomUnit(up, GetTriggerPlayer(), 0, 0, 0)
      • Custom script: call UnitPoolRemoveUnitType(up, GetUnitTypeId(bj_lastCreatedUnit))
      • Custom script: set up = null


Add the raw codes of unit types in the first trigger. You also need to create a hashtable variable called hash in the variable editor.

EDIT: Ok, you propably meant this:
  • Untitled Trigger 015
    • Events
      • Unit - A unit Sells a unit
    • Conditions
    • Actions
      • Player Group - Pick every player in (All players) and do (Actions)
        • Loop - Actions
          • Player - Limit training of (Unit-type of (Sold unit)) to 0 for (Picked player)
 
Level 11
Joined
Nov 1, 2008
Messages
828
I have never used unit pools before =o
Here is my triggers:




  • Hero Random Chosen Light
    • Events
      • Unit - A unit enters Rect 183 <gen>
    • Conditions
      • ((Triggering unit) is A Hero) Equal to True
      • (Unit-type of (Triggering unit)) Equal to Random Hero
    • Actions
      • Unit Group - Pick every unit in (Units of type |caabb3000Ancient Beast|r) and do (Unit Group - Add (Picked unit) to randomherogrouplight)
      • Unit Group - Pick every unit in (Random 1 units from randomherogrouplight) and do (Actions)
        • Loop - Actions
          • Unit - Create 1 (Unit-type of (Picked unit)) for (Owner of (Triggering unit)) at (Center of Region 177 <gen>) facing (Position of (Triggering unit))
          • Unit Group - Remove (Picked unit) from randomherogrouplight
      • Unit Group - Pick every unit in (Units owned by (Owner of (Triggering unit)) of type Hero Picker) and do (Actions)
        • Loop - Actions
          • Unit - Kill (Picked unit)
      • Unit - Remove (Triggering unit) from the game
      • Player - Set (Owner of (Triggering unit)) Current lumber to 1
      • Player - Set (Owner of (Triggering unit)) Current gold to 500
      • Player Group - Add (Owner of (Triggering unit)) to LightSide_Players
      • Special Effect - Create a special effect at (Position of (Triggering unit)) using Abilities\Spells\Other\Awaken\Awaken.mdl
      • Camera - Pan camera for (Owner of (Triggering unit)) to (Center of Rect 182 <gen>) over 1.00 seconds
      • Game - Display to (Player group((Owner of (Triggering unit)))) for 15.00 seconds the text: |cffffcc00Choose yo...
 
Status
Not open for further replies.
Top