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

Stat Trouble when switching forms

Status
Not open for further replies.
Level 4
Joined
Sep 27, 2009
Messages
119
In my map the hero gains the ability to shapeshift, however for some reason only health, damage and armor are affected by this switch. Each form affects attributes when used but for some reason I cannot make the attributes change, I have the hero units made and everything. The ability I'm currently using for the first switch is Druid of the Claw bear form.
 
Last edited:
Level 4
Joined
Sep 27, 2009
Messages
119
Indeed it is, I copied and pasted the hero in the object editor and modified values and made sure the form is the hero and alternate (morphed form) is the modified version of the hero.
 
Level 4
Joined
Sep 27, 2009
Messages
119
Well the point is to morph into a form which alters your stats a little bit - each increasing with level to scale it up with your hero so you don't stay with the small bonus forever. I will try the tinker ultimate.

Edit: The tinker ability will only work for the first form I want, it only gives you the option to add strength.
 
Last edited:
Level 4
Joined
Sep 27, 2009
Messages
119
yeah I did that, but since I'm also using the hero attributes picker from level gains I made it using a variable, looks a little like:
  • Attribute Tracker:
  • Events:
  • Unit - A unit starts the effect of an ability
  • Conditions:
  • (Ability being cast) equal to (form 1)
  • Actions:
  • Set Strength = Strength of (Casting Unit)
  • Hero - Modify Strength of the (Casting Unit): Set to (Desired Number)
And then of course I have it to where if they get the ability to increase the stat while in form it adds it to the varriable and sets it to that number when they morph back.
 

Dr Super Good

Spell Reviewer
Level 64
Joined
Jan 18, 2005
Messages
27,285
Remember to check all integer opperations, especially if fractions are involved (called reals in maths) to make sure no attributes go missing due to truncation (which occurs in integer division where fractions can not be represented) and that they all total up correctly.
Many maps have become badly broken from moves like this due to such errors resulting in permant loss or gain in stats.

If nescescary use reals to store the ammounts added and totals but convert them to integers when changing the hero stats. It is important no stats permantly go missing.
 
Level 4
Joined
Sep 27, 2009
Messages
119
As far as I know nothing has gone missing yet, even when spamming the switch, which more than likely won't be possible to spam, ever, unless someone cheats. But I'll run over these things, the only fraction I use is when the form is switched:
  • Form 1:
  • Events:
    • Unit - A unit Starts the effect of an ability
  • Conditions:
    • (Ability being cast) Equal to First Form
  • Actions:
    • If (All Conditions are True) then do (Then Actions) else do (Else actions)
      • If - Conditions:
        • (Unit-type of (Triggering unit)) Equal to My Hero
      • Then - Actions:
        • Set Strength = (Strength of (Casting unit) (Exclude bonuses))
        • Set Form 1 = True
        • Hero - Modify Strength of (Casting unit): Add (3 + (Integer((0.50 x (Real((Hero level of Triggering unit)))))))
      • Else - Actions:
        • Do nothing
    • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
      • If - Conditions:
        • (Unit-type of (Triggering unit)) Equal to Hero First Form
      • Then - Actions:
        • Set FirstForm = False
        • Hero - Modify Strength of (Casting unit): Set to Strength
      • Else - Actions:
        • Do nothing
 
Last edited:
Level 4
Joined
Sep 27, 2009
Messages
119
I did think ahead of that, since strength is the only attribute being modified in the first form, however I do have both Druid form and Bear Form with the same stats and gains, which I hope isn't going to cause a problem, just when you add a point to strength, while in bear form (hence the Form = True/False), this trigger fires off.
  • Strength:
    • Events:
      • Unit - A unit Learns a skill
    • Conditions:
      • (Learned Hero Skill) Equal to Strength
    • Actions:
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions:
          • (BearForm Equal to True) or (DireBearForm Equal to True)
        • Then - Actions
          • Hero - Modify Strength of (Learning Hero): Add 1
          • Unit - Remove Strength from (Learning Hero)
          • Set Strength = (Strength + 1)
        • Else - Actions
          • Hero - Modify Strength of (Learning Hero): Add 1
          • Unit - Remove Strength from (Learning Hero)
As I have stated, I haven't noticed any problems, the add .5*HL has worked every time I have tested it.
 
Status
Not open for further replies.
Top