# (GUI) Spell critical/miss chance demo

#### Palooo3

Level 10
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

Level 15
Set RandomNumber = Random Integer Number between 0 and 100
If then else :
If RandomNumber Superiour than 90
Then deal 100damages
Else if then else2
If RandomNumber Superiour than 10
then deal 200damages
else do nothing.

A trigger like this (here it's with 10% critical chances and 10% miss chance)

#### Bannar

Code Reviewer
Level 26
• 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

#### NeoFight

Level 5
if you want the spell to be passive, you need a Damage Detection system first. then It ain't hard to trigger

#### Palooo3

Level 10
and what if i want buff increasing critical strike chance? any idea?

#### Bannar

Code Reviewer
Level 26
@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