[Solved] Ensure specific unit always has intelligence stat of 0.

Level 2
Joined
Nov 20, 2019
Messages
24
I have a hero unit that basically uses 'energy' instead of mana. It recovers very quickly and mana regen and total energy can be upgraded via triggers like this.

upload_2020-7-15_20-30-22.png


However if this unit is to acquire intellect via an item or a tome (power up) it increases its total mana breaking the overall system. I can get around general items by making a trigger to destroy them if the hero picks them up.

However my map also uses tomes and I basically just want to to make a trigger to ensure that this hero always has an intellect of 0.

I tried making a periodic event occurring every 0.3 seconds to set the units int to 0. Something like this

/i know this wont work this is just an example of what i want to achieve/

upload_2020-7-15_20-33-10.png


Anyone know a reliable way to make a hero always have 0 of a stat even after using power ups?

Sorry if this is simple, i'm still very noob. Thank you! Will +rep

EDIT: changing gameplay constants to not add mana with intellect is not an option as I have other heroes using a regular mana system.
 
Last edited:

Dr Super Good

Spell Reviewer
Level 59
Joined
Jan 18, 2005
Messages
26,619
You can probably detect when the unit uses a powerup via either item, ability or order events. One can then use a nominal 0 second delay from a timer (as the event might fire before the tome is applied) before undoing the effects of the tome and potentially refunding or replacing it.

Another solution would be to trigger the tomes. This way an exception could be made for that specific unit so that no intelligence modification occurs.
 
Level 17
Joined
Mar 29, 2020
Messages
978
I'm not sure I exactly understand the difference between mana and "energy" besides that you changed the name so my solution might be totally off -

it seems like the easiest way to do this would be to add the relevant amount of intelligence(=mana total+regen) to the unit for each level of the ability. that way it would interact correctly with the intelligence gained and not spaz out.

if you want to keep your system, I would try using - set max mana of unit to arithmetic(max mana of unit+ 100). and similarly with mana regen. if the regen doesn't work than just give it an altered brilliance aura that only targets "self".
 
Level 2
Joined
Nov 20, 2019
Messages
24
I'm not sure I exactly understand the difference between mana and "energy" besides that you changed the name so my solution might be totally off -

it seems like the easiest way to do this would be to add the relevant amount of intelligence(=mana total+regen) to the unit for each level of the ability. that way it would interact correctly with the intelligence gained and not spaz out.

if you want to keep your system, I would try using - set max mana of unit to arithmetic(max mana of unit+ 100). and similarly with mana regen. if the regen doesn't work than just give it an altered brilliance aura that only targets "self".

The system IS just a regular mana system, but it's supposed to immitate that of a rogue from WoW. Very quick resource spending/regeneration (Rather than a large mana pool) the 'energy' pool caps out at 100, 130, 140, 150, 160.

You're solution is basically what I've done as per the first screen shot.

Mana amount is 'set' to 130 for rank 1 and regen amount is set to 25. However If i was to go and tome up some Int after this It would increase the mana pool.
 
Level 2
Joined
Nov 20, 2019
Messages
24
You can probably detect when the unit uses a powerup via either item, ability or order events. One can then use a nominal 0 second delay from a timer (as the event might fire before the tome is applied) before undoing the effects of the tome and potentially refunding or replacing it.

Another solution would be to trigger the tomes. This way an exception could be made for that specific unit so that no intelligence modification occurs.

I did try a method similar to this, couldn't get it to work, I'll have another crack at this I think.
 
Level 17
Joined
Mar 29, 2020
Messages
978
You're solution is basically what I've done as per the first screen shot.

If I'm not mistaken, there is a key difference between your screenshot and "set max mana of unit to arithmetic(max mana of unit+ 100)" being that the latter just adds to the current mana pool, whereas your solution just sets a predetermined amount without taking the current mana pool into account. that could make all the difference.
 
Level 2
Joined
Nov 20, 2019
Messages
24
Zero and Minus Stat Use the native aka jass/custom script version of setting stats to have 0 and negatives. Should work until someone from the reforged 3 team decides to counter that too like they did with how you can't unally or unvision yourself anymore.

Not having issues with that really, you can just shift+enter and set to a 0 value.
 
Level 2
Joined
Nov 20, 2019
Messages
24
Can anyone tell me where I am going wrong with this? I have tried various combinations of matching unit, triggering unit, unit manipulating item, etc... Maybe I'm doing the wait wrong?

upload_2020-7-17_21-30-12.png


EDIT: also tried using 'greater than or equal to' 1
 
Level 10
Joined
Feb 5, 2018
Messages
454
Can anyone tell me where I am going wrong with this? I have tried various combinations of matching unit, triggering unit, unit manipulating item, etc... Maybe I'm doing the wait wrong?

View attachment 359590

EDIT: also tried using 'greater than or equal to' 1

Just add wait 0.00 seconds. :) Then it should work.

Oh and also I think it should be "unit acquires an item". Since the tome is used automatically.
 
Level 10
Joined
Feb 5, 2018
Messages
454
  • Blaa
    • Events
      • Unit - A unit Acquires an item
    • Conditions
      • (Unit-type of (Triggering unit)) Equal to Archmage
      • (Item-type of (Item being manipulated)) Equal to Tome
    • Actions
      • Set VariableSet Temp = (Triggering unit)
      • Wait 0.01 seconds
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Intelligence of Temp (Exclude bonuses)) Greater than or equal to 1
        • Then - Actions
          • Hero - Modify Intelligence of Temp: Set to 1.
        • Else - Actions
This works. I tried with set to 0 and the trigger didn't want to change it to 0. This anyways gives an idea how it could be done. Or use the unit with 1 intelligence point.
 
Level 13
Joined
May 10, 2009
Messages
868
This works. I tried with set to 0 and the trigger didn't want to change it to 0. This anyways gives an idea how it could be done. Or use the unit with 1 intelligence point.
JASS:
function SetHeroStat takes unit whichHero, integer whichStat, integer value returns nothing
    // Ignore requests for negative hero stats.
    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
        // Unrecognized hero stat - ignore the request.
    endif
endfunction
custom script: call SetHeroInt(udg_Temp, 0, true) should do it.
 
Level 28
Joined
Aug 10, 2018
Messages
3,154
  • Blaa
    • Events
      • Unit - A unit Acquires an item
    • Conditions
      • (Unit-type of (Triggering unit)) Equal to Archmage
      • (Item-type of (Item being manipulated)) Equal to Tome
    • Actions
      • Set VariableSet Temp = (Triggering unit)
      • Wait 0.01 seconds
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Intelligence of Temp (Exclude bonuses)) Greater than or equal to 1
        • Then - Actions
          • Hero - Modify Intelligence of Temp: Set to 1.
        • Else - Actions
This works. I tried with set to 0 and the trigger didn't want to change it to 0. This anyways gives an idea how it could be done. Or use the unit with 1 intelligence point.
Triggering unit isn't lost between Waits, so no need for the variable Temp. Also, you wouldn't want to use a global variable like that, as it can be changed to something else during the Wait.
 
Level 2
Joined
Nov 20, 2019
Messages
24
  • Blaa
    • Events
      • Unit - A unit Acquires an item
    • Conditions
      • (Unit-type of (Triggering unit)) Equal to Archmage
      • (Item-type of (Item being manipulated)) Equal to Tome
    • Actions
      • Set VariableSet Temp = (Triggering unit)
      • Wait 0.01 seconds
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Intelligence of Temp (Exclude bonuses)) Greater than or equal to 1
        • Then - Actions
          • Hero - Modify Intelligence of Temp: Set to 1.
        • Else - Actions
This works. I tried with set to 0 and the trigger didn't want to change it to 0. This anyways gives an idea how it could be done. Or use the unit with 1 intelligence point.

I can not thank you enough for this! Works an absolute treat. Per your suggestion I will go ahead and use the hero with 1 intelligence. Absolute legend, will rep!

Thanks everybody else for your input/advice, it is much appreciated. This has been driving me crazy.

SOLVED!
 
Level 2
Joined
Nov 20, 2019
Messages
24
Triggering unit isn't lost between Waits, so no need for the variable Temp. Also, you wouldn't want to use a global variable like that, as it can be changed to something else during the Wait.

Thanks for informing me of that. That is definitely useful to know for the future!
 
Top