HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Get Primary Attribute

12-20-2004, 11:37 PM#1
YellowSubmarine
I'm making a spell that will deal damage based on stats; I was wondering if there's a way for a trigger to get the primary attribute of a Hero without having to compare a crapload of unit types.

Thanks in advance!
12-21-2004, 01:40 AM#2
BBDino
If you arnt using the point value of the hero for anything you could use that.

Ie. Set all str heroes to have a PV of 1, int to 2 and agil to 3

Then in your trigger check the point value of the casting hero.
12-21-2004, 04:23 AM#3
YellowSubmarine
That's pretty much just what I didn't want to do. Other suggestions are still welcome, though.
12-21-2004, 05:56 AM#4
BBDino
lol, it would take like 20 seconds to assign the point values in the object editor. And then another 20 seconds to write a quick loop to check point values. How much faster do you expect!
12-21-2004, 09:27 AM#5
logik
you would have to make any spell you want to be based on an attribute to be triggered.

this has inspired me to make a attribute based spells demo map... (goes to work)


but you detect what spell is cast, then use dmg triggeres etc.
12-21-2004, 11:26 AM#6
Guest
If you make sure the primary attribute of your Heroes without bonuses is also their highest in value, like with all Heroes in normal game (as far as I know), you could write a function that returns their highest attribute.

Like

Code:
function GetHighestAttrHero takes unit hero returns integer
    local integer primattr = bj_HEROSTAT_STR
    if GetHeroStatBJ(bj_HEROSTAT_AGI, hero, false) > GetHeroStatBJ(bj_HEROSTAT_STR, hero, false) then
       set primattr = bj_HEROSTAT_AGI
    endif
    if GetHeroStatBJ(bj_HEROSTAT_INT, hero, false) > GetHeroStatBJ(bj_HEROSTAT_AGI, hero, false) then
       set primattr = bj_HEROSTAT_INT
    endif
    return primattr
endfunction

Code:
//REQUIREMENT: Primary attribute of Hero is their highest attribute without bonuses
function GetPrimAttrHero takes unit hero returns integer
    return GetHighestAttrHero(hero)
endfunction
12-21-2004, 04:45 PM#7
YellowSubmarine
@logik: Yes, I've made such triggered spells in the past.

@BBDino: Oh, the values in the Object Editor? That makes more sense that custom point value :P

@WorldWatcher: That's a clever idea, but the heroes of my map would have dynamic stats; they would choose them each time they level up. That's the whole purpose of this spell: to beat the crap out of those who whore their primary attribute up.

Custom point values sound nice, though; I'll look into it. Thanks, guys; I appreciate it.