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

Negative Attributes

Status
Not open for further replies.
Level 13
Joined
Oct 16, 2010
Messages
731
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 25
Joined
Sep 26, 2009
Messages
2,378
There's no way to do it as far as I know.
How do you imagine negative attribute really? A negative health amount? (strength) or negative mana amount? (intelligence). It doesn't make sense.
The minimum value for each attribute is 1.
 
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 63
Joined
Jan 18, 2005
Messages
27,197
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 63
Joined
Jan 18, 2005
Messages
27,197
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 13
Joined
Oct 16, 2010
Messages
731
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,017
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 63
Joined
Jan 18, 2005
Messages
27,197
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 63
Joined
Jan 18, 2005
Messages
27,197
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