• 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.

How to chage hero?

Status
Not open for further replies.
Level 9
Joined
Jan 7, 2010
Messages
642
So im making a map and I want to know how I can make the hero change, as in if you buy a different hero, it changes the heroes abilities, look, stats and stuff like that. Just like in battle tanks.
 
As far as I can see, it's not anything difficult or weird. Do this:
  • Trigger1
  • Events
    • Map Initialization
  • Conditions
  • Actions
    • Hashtable - Create a hashtable
    • Set Hashtable = (Last created hashtable)
    • Set Temp_Force = (All players matching (((Matching player) slot status) Equal to Is Playing) and (((Matching player) controller) Equal to User))
    • Player Group - Pick every player in (Temp_Force) and do (Actions)
      • Loop - Actions
        • Set Point = ((Picked Player)'s Start Location)
        • Unit - Create 1 Dummy Engineer for (Picked Player) at Point facing 45 degrees
        • Hashtable - Save (Last created unit) as (Key(hero)) of (Key(Picked Player)) in Hashtable
        • Custom script: call RemoveLocation (udg_Point)
    • Custom script: call DestroyForce (udg_Temp_Group) //if you use this player group again, don't destroy it with this line.
  • Trigger
  • Events
    • Unit - A unit sells a unit
  • Conditions
    • ((Sold unit) is a Hero) Equal to True)
  • Actions
    • Unit - Remove (Load (Key(hero)) of (Key(Owner of (Sold unit))) from Hashtable) from the game
    • Selection - Select (Sold unit) for (Owner of (Sold unit))
    • Hashtable - Save (Sold unit) as (Key(hero)) of (Key(Owner of (Sold unit))) in Hashtable
Temp_Force is a Player Group variable, Point is a Point variable and Hashtable a Hashtable variable.

References:
[•] http://www.hiveworkshop.com/forums/trigger-gui-editor-tutorials-279/hashtables-mui-133407/
[•] http://www.hiveworkshop.com/forums/trigger-gui-editor-tutorials-279/variables-5896/
[•] http://www.hiveworkshop.com/forums/triggers-scripts-269/things-leak-35124/
 
Status
Not open for further replies.
Top