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

Set unit level with triggers

Status
Not open for further replies.
Hello guys, how do you change the unit level with triggers? Or is there a JASS code that can do this?

• I cannot use Custom Value because indexer already uses it, and I already used Point Value to store the range of the unit (since triggers can't get the range of the unit).
• Unit level, not hero level.
 
Last edited:
Never tried myself, but if you use Warcraft III version 1.31 (latest), "Unit - Set Unit Integer Field" and choose "ulev"

upload_2019-9-13_19-50-42.png
 

Uncle

Warcraft Moderator
Level 64
Joined
Aug 10, 2018
Messages
6,583
Just adding this as a note. A unit indexer allows you to store information like this.

You could create an Integer variable with an Array named UnitLevel. Then set it upon creating the unit:
  • Set Level
    • Events
      • Unit - A unit enters (Entire map)
    • Conditions
    • Actions
      • Set TempUnit = (Triggering unit)
      • Set CustomValue = (Custom value of TempUnit)
      • Set UnitLevel[CustomValue] = (Level of TempUnit)
  • Increase Level
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Level Up
    • Actions
      • Set TempUnit = (Triggering unit)
      • Set CustomValue = (Custom value of TempUnit)
      • Set UnitLevel[CustomValue] = (UnitLevel[CustomValue] + 1)
Obviously you would have to trigger everything around this variable. For example, an ability like Charm that can only target a certain level of units would have to be triggered.
 
Last edited:
Level 3
Joined
Nov 8, 2021
Messages
11
Never tried myself, but if you use Warcraft III version 1.31 (latest), "Unit - Set Unit Integer Field" and choose "ulev"
just tried - works perfectly, you can also track current level with BlzGetUnitIntegerField with a param UNIT_IF_LEVEL

JASS:
native BlzGetUnitIntegerField                      takes unit whichUnit, unitintegerfield whichField returns integer
 
Status
Not open for further replies.
Top