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

[Solved] Hero Modify Attribute (SUBTRACT) Busted?

Status
Not open for further replies.
Level 4
Joined
Sep 14, 2011
Messages
47
Hey guys - just wondering if you can think of what the problem might be here. I have a ROAR ability that triggers a STR stat buff in an AOE and affects any allied heroes nearby. For MY hero everything works great. But for allied heroes, the ADD part works but not the SUBTRACT part doesn't! Weird bug.

  • Treant Fervor
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Fervor of the Ents (Treant)
    • Actions
      • Set ttPoint[0] = (Position of (Triggering unit))
      • Set ABTreant_tSTR = ABTreant_FervorSTRBonus[(Level of (Ability being cast) for (Triggering unit))]
      • Set ABTreant_FervorGroup = (Units within 500.00 of ttPoint[0] matching ((((Matching unit) belongs to an ally of Player 7 (Green)) Equal to True) and ((((Matching unit) is A Hero) Equal to True) and (((Matching unit) is alive) Equal to True))))
      • Custom script: call RemoveLocation(udg_ttPoint[0])
      • Unit Group - Pick every unit in ABTreant_FervorGroup and do (Actions)
        • Loop - Actions
          • Hero - Modify Strength of (Picked unit): Add ABTreant_tSTR
      • Wait 10.00 seconds
      • Unit Group - Pick every unit in ABTreant_FervorGroup and do (Actions)
        • Loop - Actions
          • Hero - Modify Strength of (Picked unit): Subtract ABTreant_tSTR
 
Level 19
Joined
Aug 8, 2007
Messages
2,765
First of all, why is ttpoint an array
Second of all, your spell isnt MUI. If two units cast it within 10 seconds of eachother, one group will get perma + strength and the other will actually get 0 + strength than get negative strength once the time is up.
Third, why not just make an ability like the passive +3 all stat item bonuses, set it to the level of the ability (3 to every stat per level) and add it to the units in the unit group than remove the item from the unit group
 
Level 4
Joined
Sep 14, 2011
Messages
47
Thanks for your help!

1. ttPoint shouldn't be an array but I've been using temp variables with arrays the whole map so far. How much do they slow things down?

2. MUI doesn't matter for this ability because only 1 hero has the ability and the cooldown is longer than the duration.

3. I would LOVE to do that. But passive abilities based off items like that one and others (like health) DO NOT work. I've tried this many times before. It works fine for the first level but you can't increment the levels (they always stay at level 1). This is the reason we have MAX HP/MANA systems, etc.

+REP for your help. Thanks.
 
Level 4
Joined
Sep 14, 2011
Messages
47
SOLVED - For some reason you can't subtract hero attributes from LEVEL 1 allied units with low ability scores via this trigger. When I increased their levels or ability scores it worked fine though. I was able to do this using another trigger no problem.
 
Level 19
Joined
Aug 8, 2007
Messages
2,765
If you want it to look more professional (green text and a +, able to use on level1 heroes)

  • Untitled Trigger 003
    • Events
      • Player - Player 1 (Red) types a chat message containing 1 as An exact match
    • Conditions
    • Actions
      • Unit - Remove Attribute Bonus from PlayerUnit[(Player number of (Triggering player))]
      • Unit - Add Attribute Bonus to PlayerUnit[(Player number of (Triggering player))]
      • Unit - Set level of Attribute Bonus for PlayerUnit[(Player number of (Triggering player))] to 1
      • Player - Disable Attribute Bonus for (Triggering player)
This worked fine for me. Essentially you would just make an attribute bonus with the stats you wanted per level and use the actions of this trigger to apply it than wait and remove it
 
Level 4
Joined
Sep 14, 2011
Messages
47
just one last thing, the group leaks...

Are you sure the group leaks? Each time the trigger runs, the group variable gets reassigned to a new group. Does the old group leak? If I run Call DestroyGroup on the variable, I'll have to use set variable = CreateGroup () which is a pain. Can I get someone to confirm this?
 
Level 4
Joined
Sep 14, 2011
Messages
47
Ok awesome thanks guys! I am learning about how unit groups leak. Does the unit group in this trigger leak too?

  • Lunar Frost Blade Spell
    • Events
      • Unit - A unit Begins casting an ability
    • Conditions
      • (Ability being cast) Equal to Lunar Frost Blade Spell
    • Actions
      • Set ttUnit[4] = (Target unit of ability being cast)
      • Set ttPoint[8] = (Position of (Triggering unit))
      • Unit - Create 1 Dummy (Lunar Frost Blade) for (Owner of (Triggering unit)) at ttPoint[8] facing Default building facing degrees
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (ttUnit[4] belongs to an ally of (Owner of (Triggering unit))) Equal to True
        • Then - Actions
          • Unit - Order (Last created unit) to Undead Lich - Frost Armor ttUnit[4]
        • Else - Actions
          • Unit - Order (Last created unit) to Human Mountain King - Storm Bolt ttUnit[4]
      • Unit - Remove (Last created unit) from the game
      • Custom script: call RemoveLocation(udg_ttPoint[8])
 
Status
Not open for further replies.
Top