• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

(GUI) Spell critical/miss chance demo

Status
Not open for further replies.
Level 10
Joined
Nov 24, 2010
Messages
546
Hey guys,
anyone can show me how to make spell having critical strike chance/miss chance?

Example, let's say we have damagive spell, dealing 100 damage.
Whenever it is casted it has X chance (chance is set in variable)
to deal 2x damage = 200, But it also has Y chance to miss, dealing 0 damage.

+ Rep and credits to creator ;P
Palooo3
 

Bannar

Code Reviewer
Level 26
Joined
Mar 19, 2008
Messages
3,140
  • setup
    • Events
      • Map Initialization
    • Conditions
    • Actions
      • Set BaseDamage = 100.00
      • Set MissChance = 15
      • Set BonusChance = 25
  • init
    • Events
      • Unit - A unit Starts effect of ability
    • Conditions
      • (Ability being cast) Equal to SpellX
    • Actions
      • Set MissChance = 100 - MissChance
      • Set Factor = 1
      • Set i = (Random integer from 1 to 100)
      • If (All conditions are true) then do (Then - Actions) else do (Else - Actions)
        • If - Conditions
          • i Less or equal to BonusChance
        • Then - Actions
          • Set Factor = 2
        • Else - Actions
          • If (All conditions are true) then do (Then - Actions) else do (Else - Actions)
            • If - Conditions
              • i Greater or equal to MissChance
            • Then - Actions
              • Set Factor = 0
            • Else - Actions
      • Unit - Order (Triggering unit) to damage (Target unit of ability being cast) dealing (BaseDamage x Factor) of damage type Spell and attack type Normal
 

Bannar

Code Reviewer
Level 26
Joined
Mar 19, 2008
Messages
3,140
@Palooo3, please be more precise next time. It's pointless to request a resource and add something after the requested stuff has been finished. Tell everything immidiately, in case it's not kind for those who are trying to help you.

Conditions for 'buffs' can be found in first section of condition filter 'booleans' (enter the window and look for thiso one).
  • init
    • Events
      • Unit - A unit Starts effect of ability
    • Conditions
      • (Ability being cast) Equal to SpellX
    • Actions
      • Set MissChance = 100 - MissChance
      • If (All conditions are true) then do (Then - Actions) else do (Else - Actions)
        • If - Conditions
          • ((Triggering unit) has <specific buff>) Equal to True
        • Then - Actions
          • Set BonusChance = BonusChance + 5
        • Else - Actions
      • Set Factor = 1
      • Set i = (Random integer from 1 to 100)
      • If (All conditions are true) then do (Then - Actions) else do (Else - Actions)
        • If - Conditions
          • i Less or equal to BonusChance
        • Then - Actions
          • Set Factor = 2
        • Else - Actions
          • If (All conditions are true) then do (Then - Actions) else do (Else - Actions)
            • If - Conditions
              • i Greater or equal to MissChance
            • Then - Actions
              • Set Factor = 0
            • Else - Actions
      • Unit - Order (Triggering unit) to damage (Target unit of ability being cast) dealing (BaseDamage x Factor) of damage type Spell and attack type Normal
 
Status
Not open for further replies.
Top