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

Zero and Minus Stat

Status
Not open for further replies.
As most likely know, it is difficult to obtain zero or minus white stats however apparently the GUI function fails and the jass/custom script one works quite well. :thumbs_up:

[trigger=Zero Stat]
Untitled Trigger 003
Events
Player - Player 1 (Red) skips a cinematic sequence
Conditions
Actions
Unit Group - Pick every unit in (Units currently selected by Player 1 (Red)) and do (Actions)
Loop - Actions
Set i = 0
Set u = (Picked unit)
Custom script: call SetHeroAgi(udg_u,udg_i,true)
[/trigger]

[trigger=Minus Stat]
Untitled Trigger 003
Events
Player - Player 1 (Red) skips a cinematic sequence
Conditions
Actions
Unit Group - Pick every unit in (Units currently selected by Player 1 (Red)) and do (Actions)
Loop - Actions
Set i = -99
Set u = (Picked unit)
Custom script: call SetHeroAgi(udg_u,udg_i,true)
[/trigger]

It might seem and look simple, but I was sure surprised by the number of mapmakers who didn't know this. Hope this'll help people who want zero and minus white stats outside of shift + enter in object editor.


Edit: If you set the strength in object editor too high as a minus that health goes below zero/0, it will crash the game before being able to finish loading the map.
 
Last edited:

Dr Super Good

Spell Reviewer
Level 64
Joined
Jan 18, 2005
Messages
27,286
If you looked at the BJ it is kind of obvious...
JASS:
function SetHeroStat takes unit whichHero,integer whichStat,integer value returns nothing
    if (value <= 0) then
        return
    endif
    if (whichStat == bj_HEROSTAT_STR) then
        call SetHeroStr(whichHero, value, true)
    elseif (whichStat == bj_HEROSTAT_AGI) then
        call SetHeroAgi(whichHero, value, true)
    elseif (whichStat == bj_HEROSTAT_INT) then
        call SetHeroInt(whichHero, value, true)
    else
    endif
endfunction
Specifically...
JASS:
    if (value <= 0) then
        return
    endif
 
Status
Not open for further replies.
Top