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

Making Spells

Status
Not open for further replies.

hdm

hdm

Level 9
Joined
Nov 19, 2011
Messages
384
1 - Hey,huh,does anyone know how to make a passive spell that,when the life of the Caster is lesser than x% it backs for n% and it just happens x seconds (50 for exemple)after used the first time ?

2 - Also,if there is a way that the Item gives to Hero +x of his primary atributte,for example - If a hero has the agility as primary atribute,it adds +X to ability.And if the Hero has the Strenght as primary,it adds +X to strenght.

If there is a way,tell me,I'm needing it
 
Level 17
Joined
Nov 13, 2006
Messages
1,814
1 - Hey,huh,does anyone know how to make a passive spell that,when the life of the Caster is lesser than x% it backs for n% and it just happens x seconds (50 for exemple)after used the first time ?

2 - Also,if there is a way that the Item gives to Hero +x of his primary atributte,for example - If a hero has the agility as primary atribute,it adds +X to ability.And if the Hero has the Strenght as primary,it adds +X to strenght.

If there is a way,tell me,I'm needing it

1. used passive ability then what u mean under this?
after used the first time

something like this?
  • Life
    • Events
      • Unit - A unit Is attacked
    • Conditions
      • (Level of *Your passive* for (Attacked unit)) Greater than 0
      • (Percentage life of (Attacked unit)) Less than 20.00
    • Actions
      • Unit - Set life of (Attacked unit) to ((Life of (Attacked unit)) + 100.00)
      • ----this is fixed amount ^-----
      • Unit - Set life of (Attacked unit) to 30.00%
      • ----percentage ^------
  • Unit - Set life of (Attacked unit) to ((Percentage life of (Attacked unit)) + ((Real((Level of *Your passive* for (Attacked unit)))) x 5.00))%
    • ---percentage what depend from ability level=>curent percentage+ability level*5----

2. u cant detect what is the primary attribute but u can check what attribute is higher, example if strength > agility and intellligence then put to strength or just store in variable every hero and later compare with if and add str to hero[x] hero, agility to hero[y]
 

Chaosy

Tutorial Reviewer
Level 40
Joined
Jun 9, 2011
Messages
13,220
2. you can detect this.
  • Actions
    • Set stats[1] = (Strength of (Triggering unit) (Exclude bonuses))
    • Set stats[2] = (Agility of (Triggering unit) (Exclude bonuses))
    • Set stats[3] = (Intelligence of (Triggering unit) (Exclude bonuses))
    • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
      • If - Conditions
        • stats[1] Greater than stats[2]
        • stats[1] Greater than stats[3]
      • Then - Actions
        • Hero - Modify Strength of (Triggering unit): Add 5
      • Else - Actions
    • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
      • If - Conditions
        • stats[2] Greater than stats[1]
        • stats[2] Greater than stats[3]
      • Then - Actions
        • Hero - Modify Agility of (Triggering unit): Add 5
      • Else - Actions
    • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
      • If - Conditions
        • stats[3] Greater than stats[1]
        • stats[3] Greater than stats[2]
      • Then - Actions
        • Hero - Modify Intelligence of (Triggering unit): Add 5
      • Else - Actions
 
2. you can detect this.
  • Actions
    • Set stats[1] = (Strength of (Triggering unit) (Exclude bonuses))
    • Set stats[2] = (Agility of (Triggering unit) (Exclude bonuses))
    • Set stats[3] = (Intelligence of (Triggering unit) (Exclude bonuses))
    • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
      • If - Conditions
        • stats[1] Greater than stats[2]
        • stats[1] Greater than stats[3]
      • Then - Actions
        • Hero - Modify Strength of (Triggering unit): Add 5
      • Else - Actions
    • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
      • If - Conditions
        • stats[2] Greater than stats[1]
        • stats[2] Greater than stats[3]
      • Then - Actions
        • Hero - Modify Agility of (Triggering unit): Add 5
      • Else - Actions
    • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
      • If - Conditions
        • stats[3] Greater than stats[1]
        • stats[3] Greater than stats[2]
      • Then - Actions
        • Hero - Modify Intelligence of (Triggering unit): Add 5
      • Else - Actions
This is simple bad, sometimes you can upgrade int for agi hero at same start so you can cast more spells earlier ingame, at some point your int can be greater than main attribute.

Anyway here is my suggestion.

  • Setup
    • Events
      • Map initialization
    • Conditions
    • Actions
      • Hashtable - Create a hashtable
      • Set Hash = (Last created hashtable)
      • -------- Hashtable + Unit Raw Code + any number (but must be same for all) + 1(agility)/2(Intelligence)/3(Strength) --------
      • Custom script: call SaveInteger( udg_Hash, 'Hpal', 0 , 3) // Paladin
      • Custom script: call SaveInteger( udg_Hash, 'Hmkg', 0 , 3) // Mountain King
      • Custom script: call SaveInteger( udg_Hash, 'Hamg', 0 , 2) // Archmage
      • Custom script: call SaveInteger( udg_Hash, 'Hblm', 0 , 2) // Blood Mage
      • Custom script: call SaveInteger( udg_Hash, 'Obla', 0 , 1) // Blademaster
  • Test 1
    • Events
      • Unit - A unit Acquires an item
    • Conditions
      • (Item-type of (Item being manipulated)) Equal to Claws of Attack +15
    • Actions
      • -------- Hashtable + Unit Raw Code + number set above --------
      • Custom script: set udg_i = LoadInteger( udg_Hash, GetUnitTypeId(GetTriggerUnit()), 0 )
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • i Equal to 1
        • Then - Actions
          • Hero - Modify Agility of (Triggering unit): Add 5
        • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • i Equal to 2
            • Then - Actions
              • Hero - Modify Intelligence of (Triggering unit): Add 5
            • Else - Actions
              • Hero - Modify Strength of (Triggering unit): Add 5
  • Test 2
    • Events
      • Unit - A unit Loses an item
    • Conditions
      • (Item-type of (Item being manipulated)) Equal to Claws of Attack +15
    • Actions
      • Custom script: set udg_i = LoadInteger( udg_Hash, GetUnitTypeId(GetTriggerUnit()), 0 )
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • i Equal to 1
        • Then - Actions
          • Hero - Modify Agility of (Triggering unit): Subtract 5
        • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • i Equal to 2
            • Then - Actions
              • Hero - Modify Intelligence of (Triggering unit): Subtract 5
            • Else - Actions
              • Hero - Modify Strength of (Triggering unit): Subtract 5
 
Status
Not open for further replies.
Top