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

Questions about Unit

Level 1
Joined
Oct 10, 2024
Messages
2
I am using Equipment v2.5.2. But the system only generates equipment for 2 units that spawn in the middle of the map, "demon" and "test". I want to create equipment for all heroes, or a specific hero, but i don't know how?

private function Initialize takes nothing returns nothing
local unit demon = CreateUnit(Player(0), 'Edem', -14450, 13612, 0)
local unit test = CreateUnit(Player(0), 'H001', -14450, 13612, 0)
local unit orc = UnitTypeId('N000') ???


call CreateEquipment(test)
call CreateEquipment(demon)
call CreateEquipment(orc)
 

Uncle

Warcraft Moderator
Level 73
Joined
Aug 10, 2018
Messages
7,869
This is the function that creates Equipment for a given unit:
vJASS:
call CreateEquipment(demon)
demon in that example is a Unit variable referring to one of the previously created units -> demon = CreateUnit(Player(0), 'Edem', -14450, 13612, 0)

But demon can be literally any Unit variable you want. For example, here's how you could create Equipment for a Hero when it first comes into play:
  • Events
    • Unit - A unit Enters (playable map area)
  • Conditions
    • ((Triggering unit) is a Hero) Equal to True
  • Actions
    • Set Variable MyUnitVar = (Triggering unit)
    • Custom script: call CreateEquipment( udg_MyUnitVar )

The final trigger could look something like this:
  • Events
    • Unit - A unit Enters (playable map area)
  • Conditions
    • ((Triggering unit) is a Hero) Equal to True
    • ((Triggering unit) is an Illusion) Equal to False
    • ((Owner of (Triggering unit)) is in Active_Player_Group) Equal to True
  • Actions
    • Set Variable MyUnitVar = (Triggering unit)
    • Custom script: call CreateEquipment( udg_MyUnitVar )
^ This would ensure that only Heroes owned by "Active Players" that are NOT illusions (unsure if this is necessary) will be given Equipment.
 
Last edited:

Uncle

Warcraft Moderator
Level 73
Joined
Aug 10, 2018
Messages
7,869
Thanks for your help. Equipment v2.5.2 is an equipment system, use JASS Equipment v2.5.2
Do the above commands work?
What above commands?

If you mean this:
vJASS:
local unit orc = UnitTypeId('N000') ???
call CreateEquipment(orc)
No, that won't work.

Even if you did it properly it still wouldn't work:
vJASS:
local integer orc_id = 'N000'
call CreateEquipment(orc_id)
The system creates a single new "Equipment" for a specific Unit. But you can just check when a unit of that type comes into play and create it then.
 
Top