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

[Trigger Request - Not JASS/LUA] Set Unit Skin

Status
Not open for further replies.
Level 8
Joined
Aug 13, 2009
Messages
361
Hello,

I've been trying to figure out how to randomize the Unit Skin on trained units (for example, I am trying to make it where whenever you create the "Hero Paladin" it will randomly choose between all the "Paladin" unit skins when it's trained, much like how you can enable Jaina's Daughter of the Sea skin).

My knowledge of triggers is very limited so I've not had any luck, so after a few hours I am here to ask for help.

I would like if someone could possibly create or show my how to create this trigger, I would intend to use it for all races, not just Human and not just Paladin.

It needs to be in-game triggers, not Jass/vJass or LUA.

This is for Reforged.

I am requesting this system so that the Computer AI will still use the heroes, instead of just replacing them with Custom Heroes.

Thanks,
Hjorleif
 

Uncle

Warcraft Moderator
Level 65
Joined
Aug 10, 2018
Messages
6,714
This trigger creates the Hashtable and is also used to add Units to the system.
  • HS Setup
    • Events
      • Map initialization
    • Conditions
    • Actions
      • -------- Create the Hashtable --------
      • Hashtable - Create a hashtable
      • Set VariableSet HS_Hashtables = (Last created hashtable)
      • -------- --------
      • -------- Add a new Unit-Type to the system --------
      • -------- Set all of the possible Skins --- The first Unit [1] is the default Unit-Type (Like Paladin, Blood Mage, etc) --------
      • Set VariableSet HS_Skins_Total = 3
      • Set VariableSet HS_Skins[1] = Paladin
      • Set VariableSet HS_Skins[2] = Sir Gregory Edmunson
      • Set VariableSet HS_Skins[3] = Uther
      • Trigger - Run HS Add To System <gen> (ignoring conditions)
      • -------- --------
      • -------- Add a new Unit-Type to the system --------
      • -------- Set all of the possible Skins --- The first Unit [1] is the default Unit-Type (Like Paladin, Blood Mage, etc) --------
      • Set VariableSet HS_Skins_Total = 2
      • Set VariableSet HS_Skins[1] = Archmage
      • Set VariableSet HS_Skins[2] = Antonidas
      • Trigger - Run HS Add To System <gen> (ignoring conditions)
This adds the variables you just setup to the HS_Hashtable.
  • HS Add To System
    • Events
    • Conditions
    • Actions
      • Custom script: set udg_HS_Main_Id = udg_HS_Skins[1]
      • Hashtable - Save HS_Skins_Total as 0 of HS_Main_Id in HS_Hashtables.
      • For each (Integer HS_Loop) from 1 to HS_Skins_Total, do (Actions)
        • Loop - Actions
          • Custom script: set udg_HS_Id = udg_HS_Skins[udg_HS_Loop]
          • Hashtable - Save HS_Id as HS_Loop of HS_Main_Id in HS_Hashtables.
This applies the Skin to the Hero when it first enters the map. More conditions may be needed to filter out unwanted things.
  • HS Set Hero Skin
    • Events
      • Unit - A unit enters (Playable map area)
    • Conditions
      • ((Triggering unit) is A Hero) Equal to True
    • Actions
      • Set VariableSet HS_UnitType = (Unit-type of (Triggering unit))
      • Custom script: set udg_HS_Id = udg_HS_UnitType
      • Set VariableSet HS_Skins_Total = 0
      • Set VariableSet HS_Skins_Total = (Load 0 of HS_Id from HS_Hashtables.)
      • Set VariableSet HS_Id = (Load (Random integer number between 1 and HS_Skins_Total) of HS_Id from HS_Hashtables.)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • HS_Skins_Total Not equal to 0
        • Then - Actions
          • Unit - Set Unit Skin of (Triggering unit) to HS_Id
        • Else - Actions
How to use it:
- Click the HS Setup trigger
- Set Skins_Total = Total number of Skins the desired Unit-Type uses
- Set Skins[] = Each of the different Unit-Types (See trigger example)
- Run HS Add To System <gen> (ignoring conditions)
Finished!

You'll see that I have two examples already created in the HS Setup trigger for the Paladin and Archmage. Simply copy or replace what I did there and you'll be set.

You may want to modify the HS Set Hero Skin trigger to account for certain things that I might have overlooked. One thing that comes to mind is Illusions causing the trigger to go off.
 

Attachments

  • Hero Skin System v.1.w3m
    17.8 KB · Views: 42
Last edited:
Level 8
Joined
Aug 13, 2009
Messages
361
Hello,

That works perfectly. I wonder, is there a way to change the name? Say, if it randomly picks the Uther skin, is there a way to change it's name to "Uther" and/or anything I choose?

Thanks,
Hjorleif
 
Level 8
Joined
Aug 13, 2009
Messages
361
Hello,

Awesome! Thanks for the help so far, I really appreciate it.

I'm assuming they all use the default Hero Paladin's icon? If so, I can work with that by using like the Paladin Class Icon from WoW or something.

Thanks,
Hjorleif
 
Status
Not open for further replies.
Top