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

Attribute Caps

Status
Not open for further replies.
Level 2
Joined
Jul 9, 2007
Messages
7
How would I go about putting a cap on attributes? There is nothing about it in the constants, so I tried making a trigger. however, there is no Event - Hero Gains Attribute Points :( How would I go about limiting how high these numbers can go?
 
Level 2
Joined
Jul 9, 2007
Messages
7
In my map, The heros don't gain attributes from leveling up... They gain it from doing different things (reading, gym, etc), which are trigger based... I just need to detect when they reach a certain attribute... I think i have to check every x seconds, then if the attributes are passed the cap, it sets it back down.
 
Level 6
Joined
Aug 13, 2009
Messages
197
Lets assume that when your hero enters "strength" (Region) it checks the hero's Strength and if it is bellow the maximum Strength then it'll add if not it wont add more Strength.

  • Try this way
    • Events
      • Unit - A unit enters (Strength)
    • Conditions
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Strength of (Entering Unit) (Exclude bonuses)) Equal to X
        • Then - Actions
          • Hero - Modify Strength of (Entering Unit): Add X
        • Else - Actions
          • Game - Display to (All players) the text: You can't add more Strength
Good Luck with your map!

Edit: You can modify the attributes caps using Variables instead of fixed numbers...

Like:

  • Try this way
    • Events
      • Unit - A unit enters (Strength)
    • Conditions
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Strength of (Entering Unit) (Exclude bonuses)) Equal to YourVariableOfTheAttributesCaps
        • Then - Actions
          • Hero - Modify Strength of (Entering Unit): Add YourVariableOfTheAttributesItWillAdd
        • Else - Actions
          • Game - Display to (All players) the text: You can't add more Strength
 
Level 16
Joined
Mar 3, 2006
Messages
1,564
In my map, The heros don't gain attributes from leveling up... They gain it from doing different things (reading, gym, etc), which are trigger based... I just need to detect when they reach a certain attribute... I think i have to check every x seconds, then if the attributes are passed the cap, it sets it back down.

There is no need at all to detect the strength every second, just detect it in the triggers that cause the attributes to change.
 
Level 2
Joined
Jul 9, 2007
Messages
7
hmm... Well, I understand how I'm going to make the cap now, however, I am having another problem... Some buildings/structures are able to carry items, and when they use an item with attribute upgrades, or even ones that don't but are based off it, it crashes the game... Any way to fix this, or am I going to have to write a trigger for each item?
 
Level 6
Joined
Aug 13, 2009
Messages
197
There is no need at all to detect the strength every second, just detect it in the triggers that cause the attributes to change.

Yes you're right... Mistake (Not that problematic but still may cause leaks) :D

You add the cap to the triggers which add the stats.
If you use tomes, make them trigger based.

Well yeh, it's a good way to cap the attributes, the trigger I used was just an example because I don't know how he did the tome system on his map.

hmm... Well, I understand how I'm going to make the cap now, however, I am having another problem... Some buildings/structures are able to carry items, and when they use an item with attribute upgrades, or even ones that don't but are based off it, it crashes the game... Any way to fix this, or am I going to have to write a trigger for each item?

About that... structures aren't supposed to pick tomes, are they? You gotta remake the whole tome system or add a condition that checks if the picking unit is an Hero or an unit with attributes... or... check if the picking unit is an structure and disable the attribute for it... unless... unlessssss.... you want to make your structures like heroes, that receive HP and Damage from tomes? You add a condition like above checking if picking unit is structure, if its not give the attributes normally, if it is you've to increase the structure hp and damage with a trigger.
 
Status
Not open for further replies.
Top