• 🏆 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!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

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 63
Joined
Jan 18, 2005
Messages
27,191
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