• 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.
  • 💡 We're thrilled to announce that our upcoming texturing contest is in the works, and we're eager to hear your suggestions! Please take this opportunity to share your ideas in this theme discussion thread for the Texturing Contest #34!
  • 🏆 Hive's 7th HD Modeling Contest: Icecrown Creature is now open! The frozen wastes of Icecrown are home to some of Azeroth’s most terrifying and resilient creatures. For this contest, your challenge is to design and model a HD 3D monster that embodies the cold, undead, and sinister essence of Icecrown! 📅 Submissions close on April 13, 2025. Don't miss this opportunity to let your creativity shine! Enter now and show us your frozen masterpiece! 🔗 Click here to enter!

Negative Attributes

Status
Not open for further replies.
Level 14
Joined
Oct 16, 2010
Messages
748
Hi,

I had a spell idea running around in my head for a while and I just created it. Basically it's a passive that increase strength on kill, but reduces agility. However what I've just learnt is that you can't have negative attributes.

I tried the "subtract" function and it didn't work so I tried using the "set to" and that didn't work either. Is there any real work around for this?

Thanks!!!
 
Level 23
Joined
Apr 16, 2012
Messages
4,041
you can however set these values inside editor as defaults to <0(shift clicking). The effects, if I remember correctly:
strength - 0 hp, you die at first sight from anything
agility - no idea
inteligence - 0 mana

Just a drop off, as Nichilus said, there is no way to change stat to <1 with scripts
 
Level 12
Joined
Mar 13, 2012
Messages
1,121
What you want can be done by trigger with

SetHeroInt
SetHeroStr
SetHeroAgi

Use 'true' for the boolean argument when not sure what to choose.
 
Level 12
Joined
Mar 13, 2012
Messages
1,121
Would that be a custom script? I've only used them for cleaning leaks...
There is no GUI for this, so custom script is your choice if you use GUI, yes.

This is the signature of the function(s):
JASS:
native SetHeroInt     takes unit whichHero, integer newInt, boolean permanent returns nothing
This is an example:
  • Custom script: call SetHeroInt( hero, -10, true)
 

Dr Super Good

Spell Reviewer
Level 64
Joined
Jan 18, 2005
Messages
27,277
There is no GUI for this, so custom script is your choice if you use GUI, yes.
Here is the GUI.
  • Hero - Modify Strength of (Triggering unit): Subtract 10
  • Hero - Modify Agility of (Triggering unit): Subtract 10
  • Hero - Modify Intelligence of (Triggering unit): Subtract 10
Less efficient? Almost certain. Does it matter? Probably not.
 
Last edited:
Level 12
Joined
Mar 13, 2012
Messages
1,121
That is not what he wants. That GUI uses the SetHeroStat(...) function, which has a condition to exit for values <1.
 

Dr Super Good

Spell Reviewer
Level 64
Joined
Jan 18, 2005
Messages
27,277
That is not what he wants. That GUI uses the SetHeroStat(...) function, which has a condition to exit for values <1.

JASS:
function ModifyHeroStat takes integer whichStat,unit whichHero,integer modifyMethod,integer value returns nothing
    if (modifyMethod == bj_MODIFYMETHOD_ADD) then
        call SetHeroStat(whichHero, whichStat, GetHeroStatBJ(whichStat, whichHero, false) + value)
    elseif (modifyMethod == bj_MODIFYMETHOD_SUB) then
        call SetHeroStat(whichHero, whichStat, GetHeroStatBJ(whichStat, whichHero, false) - value)
    elseif (modifyMethod == bj_MODIFYMETHOD_SET) then
        call SetHeroStat(whichHero, whichStat, value)
    else
    endif
endfunction
It works fine as long as it is set to negative mode. Or set mode would also work (unless he wants negative hero stats, which is kind of unusual).
 
Level 14
Joined
Oct 16, 2010
Messages
748
The point of the ability was to gain infinite scaling of Strength but have a downside of infinite downscaling Agility. So you'd end up having loads of Strength but negative Agility. However I could only get to 1 Agility, which isn't what I wanted.
 
Level 21
Joined
Nov 4, 2013
Messages
2,016
The only way to do it is to add tomes which give negative attributes. For example, for -1 strength, choose the "Tome of Strength", modify its ability "Item Strength Gain", shift-click on Data - Strength Bonus, type -1 then add this tome to the hero when you want by triggers.
 

Dr Super Good

Spell Reviewer
Level 64
Joined
Jan 18, 2005
Messages
27,277
you MUST be fucking kidding me right now
Are you being serious?

JASS:
function GetHeroStatBJ takes integer whichStat,unit whichHero,boolean includeBonuses returns integer
    if (whichStat == bj_HEROSTAT_STR) then
        return GetHeroStr(whichHero, includeBonuses)
    elseif (whichStat == bj_HEROSTAT_AGI) then
        return GetHeroAgi(whichHero, includeBonuses)
    elseif (whichStat == bj_HEROSTAT_INT) then
        return GetHeroInt(whichHero, includeBonuses)
    else
        return 0
    endif
endfunction

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

function ModifyHeroStat takes integer whichStat,unit whichHero,integer modifyMethod,integer value returns nothing
    if (modifyMethod == bj_MODIFYMETHOD_ADD) then
        call SetHeroStat(whichHero, whichStat, GetHeroStatBJ(whichStat, whichHero, false) + value)
    elseif (modifyMethod == bj_MODIFYMETHOD_SUB) then
        call SetHeroStat(whichHero, whichStat, GetHeroStatBJ(whichStat, whichHero, false) - value)
    elseif (modifyMethod == bj_MODIFYMETHOD_SET) then
        call SetHeroStat(whichHero, whichStat, value)
    else
    endif
endfunction

Hence the above will limit to 1, a sensible limit. Anything less than 1 is not usually sensible.

The point of the ability was to gain infinite scaling of Strength but have a downside of infinite downscaling Agility. So you'd end up having loads of Strength but negative Agility. However I could only get to 1 Agility, which isn't what I wanted.
WC3 was not really designed to have negative hero attributes. The main reason for this I would imagine is the tendency to result in negative health and health regeneration which usually have fatal consequences for logical reasons. You can try using the direct calls as suggested earlier however the results may or may not be useful.
 

Dr Super Good

Spell Reviewer
Level 64
Joined
Jan 18, 2005
Messages
27,277
What he asked was not well defined so not clear. By negative attributes I thought of standard WC3 negative bonus attributes.
As opposed to positive bonus attributes.

As such the answer to his question was "it is possible to remove attribute points with triggers". With or without bonus text does not really matter as long as totals add up. He later clarified that he wanted the sum of the attribute to drop below 1.

What I do not understand is why you are going so off-topic. Surely if your solution worked he would not be still asking for help?
 
Status
Not open for further replies.
Top