• 🏆 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!

Spirit protection 1.06

Being attacked, there is a chance to cast random spell to an opponent.
Level 1 - 20% chance
Level 2 - 40% chance
Level 3 - 60% chance

The power of the spells increases with level of ability.


version 1.06
In version 1.06 user can select any chance to cast a random spell, instead of using Max and min factors. Also I have imroved some description.




Credits:
Anachron (good icon for the spell)

Keywords:
attack, random,spell,cast,chance, passive,aura,lightning
Contents

Spirit protection 1.06 (Map)

Reviews
19th Jul 2011 Maker: Simple but could be useful. Change GetLastCreatedUnit() to bj_lastCreatedUnit

Moderator

M

Moderator

19th Jul 2011
Maker:
Simple but could be useful.
Change GetLastCreatedUnit() to bj_lastCreatedUnit
 
Level 8
Joined
May 9, 2010
Messages
266
I know, that this spell is very simple.Nevertheless, I uploaded the spell for check.


  • spirit protection ini
    • События
      • Map initialization
    • Условия
    • Действия
      • -------- Choose the number of your dummy spells --------
      • -------- In this test map I have 5 dummy spells --------
      • Set Random_spell_Count = 5
      • -------- This is value - the max number for the chance --------
      • -------- For example: --------
      • -------- if [1] value = 8 and [2] value = 1 --------
      • -------- then the change to cast random spell is --------
      • -------- 1/(8-1*lvl) * 100% --------
      • -------- 1 lvl - 14.28% --------
      • -------- 2 lvl - 16.66% --------
      • -------- 3 lvl - 20.00% --------
      • Set Integer_DATA[1] = 8
      • -------- This is value - factor of descreasing change --------
      • Set Integer_DATA[2] = 1
      • -------- --------
      • -------- --------
      • -------- choose your dummy spells --------
      • Set Random_Spell[1] = Отравленный РЅРѕР¶ random spell
      • Set Random_Spell[2] = Полиморф random spell
      • Set Random_Spell[3] = Цепь молний random spell
      • Set Random_Spell[4] = Очищение random spell
      • Set Random_Spell[5] = Ледяная звезда random spell
      • -------- --------
      • -------- --------
      • -------- choose ordercodes of your spells --------
      • -------- In the same procedure --------
      • Set Order[1] = Тюремщица (Ночные эльфы) - Отравленный РЅРѕР¶
      • Set Order[2] = Волшебница (Альянс) - Полиморф
      • Set Order[3] = Говорящий СЃ Духами (РћСЂРґР°) - Цепь молний
      • Set Order[4] = Шаман (РћСЂРґР°) - Очищение
      • Set Order[5] = Король Мертвых (Нежить) - Ледяной взрыв
  • spirit protection effect
    • События
      • Боевая единица - A unit Атакован
    • Условия
      • (Level of Spirit protection for (Triggering unit)) РЅРµ равно (!=) 0
    • Действия
      • Multiple FunctionsIf (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • Если - Условия
          • (Random integer number between 1 and (Integer_DATA[1] - (Integer_DATA[2] x (Level of Spirit protection for (Triggering unit))))) равно (==) 1
        • РўРѕ - Действия
          • -------- This is a random value beetween 1 and the count of your random spells --------
          • Set Random_Value = (Random integer number between 1 and Random_spell_Count)
          • Set TempPoint = (Position of (Triggering unit))
          • Боевая единица - Create 1 dummy for (Owner of (Triggering unit)) at TempPoint facing Стандартная ориентация зданий (270.0) degrees
          • Боевая единица - Add a 2.00 second Общий expiration timer to (Last created unit)
          • -------- order to cast your chose spell with the correspond orders --------
          • Set Random_Value2 = (Random integer number between 1 and Random_spell_Count)
          • Боевая единица - Add Random_Spell[Random_Value2] to (Last created unit)
          • Боевая единица - Order (Last created unit) to Order[Random_Value2] (Attacking unit)
          • Custom script: call RemoveLocation(udg_TempPoint)
        • Р˜РЅР°С‡Рµ - Действия
 
Last edited by a moderator:
Level 7
Joined
Jul 29, 2010
Messages
259
We'll I think the spell is hard to see from the tiny pic. So I tried using it in-game and for some reason it dident work. So than I downloaded it again, redid it again, and it dident work.. so yea.. I dont know what exactly you did or maybe if its my fault.. but by other peoples comments I would try working on somthing else or fixing this one. Dont give up though!
 
Level 8
Joined
May 9, 2010
Messages
266
When i put your custom script, it is not get an error, but spell is not works.
So, I edit script:
  • Custom script: call IssueTargetOrderById( GetLastCreatedUnit(), udg_Order[udg_Random_Value], GetAttacker() )
And it works.
If I put this script, it will be openable in normal WE?
 

Bribe

Code Moderator
Level 50
Joined
Sep 26, 2009
Messages
9,456
I hadn't realized Order was an array due to UMSWE's obscurity. In that case, use
JASS:
call IssueTargetOrderById(bj_lastCreatedUnit, udg_Order[udg_Random_Value], GetAttacker())
because GetLastCreatedUnit() is avoidable in JASS in favor of the inlined "bj_lastCreatedUnit".

It should be openable in normal WE after that change.
 

Bribe

Code Moderator
Level 50
Joined
Sep 26, 2009
Messages
9,456
Alright, here are your triggers in English:

  • spirit protection ini
    • Events
      • Map initialization
    • Conditions
    • Actions
      • -------- Choose the number of your dummy spells --------
      • -------- In this test map I have 5 dummy spells --------
      • Set Random_spell_Count = 5
      • -------- This is value - the max number for the chance --------
      • -------- For example: --------
      • -------- if [1] value = 8 and [2] value = 1 --------
      • -------- then the change to cast random spell is --------
      • -------- 1/(8-1*lvl) * 100% --------
      • -------- 1 lvl - 14.28% --------
      • -------- 2 lvl - 16.66% --------
      • -------- 3 lvl - 20.00% --------
      • Set Integer_DATA[1] = 8
      • -------- This is value - factor of descreasing change --------
      • Set Integer_DATA[2] = 1
      • -------- --------
      • -------- --------
      • -------- choose your dummy spells --------
      • Set Random_Spell[1] = Shadow Strike random spell
      • Set Random_Spell[2] = Polymorph random spell
      • Set Random_Spell[3] = Chain Lightning random spell
      • Set Random_Spell[4] = Purge random spell
      • Set Random_Spell[5] = Frost Nova random spell
      • -------- --------
      • -------- --------
      • -------- choose ordercodes of your spells --------
      • -------- In the same procedure --------
      • Set Order[1] = Unknown
      • Set Order[2] = Unknown
      • Set Order[3] = Unknown
      • Set Order[4] = Unknown
      • Set Order[5] = Unknown
  • spirit protection effect
    • Events
      • Unit - A unit Is attacked
    • Conditions
      • (Level of Spirit protection for (Triggering unit)) Not equal to 0
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Random integer number between 1 and (Integer_DATA[1] - (Integer_DATA[2] x (Level of Spirit protection for (Triggering unit))))) Equal to 1
        • Then - Actions
          • -------- This is a random value beetween 1 and the count of your random spells --------
          • Set Random_Value = (Random integer number between 1 and Random_spell_Count)
          • Set TempPoint = (Position of (Triggering unit))
          • Unit - Create 1 dummy for (Owner of (Triggering unit)) at TempPoint facing Default building facing degrees
          • Unit - Add a 2.00 second Generic expiration timer to (Last created unit)
          • -------- order to cast your chose spell with the correspond orders --------
          • Unit - Add Random_Spell[Random_Value] to (Last created unit)
          • Custom script: call IssueTargetOrderById(bj_lastCreatedUnit, udg_Order[udg_Random_Value], GetAttacker())
          • Custom script: call RemoveLocation(udg_TempPoint)
        • Else - Actions
Review:

The result is quite nice from what I can see. Normally, the event "unit is attacked" is a problem because it can be abused, but seeing as how the only person who could abuse it is the enemy (the one that gets damaged) this isn't a problem.

While it is simple, I think that's something that actually works for this thing's benefit.

Changes you should make:

On the dummy unit, change Art - Death time to 0 and change its status to "can't raise, does not decay". This way, the dummy unit will be removed instantly after its expiration timer.

On the test map, increase the odds for the random spell to be cast. This will help show off your system a bit better.

Use (Triggering player) instead of (Owner of (Triggering unit))

Integer_DATA should not be an array, just split into two normal variables with proper names instead of a generic name.
 
Level 8
Joined
May 9, 2010
Messages
266
Lol double post,just edit ur old post next time,I can't open and test the spell either
I don`t know why...

  • Set Order[1] = Unknown
    • Set Order[2] = Unknown
    • Set Order[3] = Unknown
    • Set Order[4] = Unknown
    • Set Order[5] = Unknown
Normal WE has not this function too?

This function close We when I click on button 'unknown'.
 
Last edited by a moderator:

Bribe

Code Moderator
Level 50
Joined
Sep 26, 2009
Messages
9,456
What I meant by increasing the odds is, instead of 14/17/20 make it 40/60/80 for the test map, so users can see it proc more often and see how well it works.

The last change I can see now is to change the icon. Currently, you have a "clickable icon" but it is not clickable - it's passive. So you should choose an icon for the spell that's a passive icon (like an aura).
 
Level 8
Joined
May 9, 2010
Messages
266
I`m sorry, I just have bad knowledge of English. However, it is not bad, that I have added new dummy spells?:D
Spell updated to version 1.03
-changed icon to passive
-increased chance of casting spell
 

Bribe

Code Moderator
Level 50
Joined
Sep 26, 2009
Messages
9,456
It does look good. "Doom" is a bit overkill ;)

The "Learn ability" icon should be an active one (with the border).

Something else I suggest is scaling the power of the abilities cast when he's attacked. For example, the random spell could be "dispel magic" at level 1, "purge" at level 2, "disenchant" at level 3, etc.

While I don't care what abilities they are the functionality to set level 1, level 2, level 3 sets of abilities should definitely be there so that people can more easily use this in their maps.
 
Level 8
Joined
May 9, 2010
Messages
266
Can I just import icon and give credits?
  • Unit - Set level of Random_Spell[Random_Value] for (Last created unit) to (Level of Spirit protection for (Triggering unit))
So, I am increasing power of spells with increasing level of ability.
 
Last edited:
Level 9
Joined
May 14, 2011
Messages
524
Can I just import icon and give credits?
  • Unit - Set level of Random_Spell[Random_Value] for (Last created unit) to (Level of Spirit protection for (Triggering unit))
So, I am increasing power of spells with increasing level of ability.
Ask bribe,he might let you,but I suggest not
 
Level 3
Joined
Jul 31, 2011
Messages
39
Excuse me... how do you change the percentage or chances it will cast in triggers? I guess 50% is overkill... I just made the spell to be 4 levels that's why... How can I make it:
Level 1 - 10%
Level 2 - 20%
Level 3 - 30%
Level 4 - 40%

Sorry, I do not understand what it means by the Factor_max and Factor_min in the triggers... help pls...


*Solved... Tnx .OmG.
 
Last edited:
Level 16
Joined
Jul 4, 2008
Messages
1,106

Short Review


For now this spell is too simple to be approved, as well as it is way too easy to abuse in game because it is using
  • Unit - A unit Is attacked
which makes the spell extremely abusable.

I will rate this spell.. 1/5.
That is enough for a vote of rejection.

HELP FOR FUTURE;
Go learn some tutorials at this place, go for either indexing or hashtables.

TRIGGERS;
  • spirit protection ini
    • Events
      • Map initialization
    • Conditions
    • Actions
      • -------- Choose the number of your dummy spells --------
      • Set Random_spell_Count = 8
      • -------- This is value - the max number for the chance --------
      • -------- For example: --------
      • -------- if [1] value = 8 and [2] value = 1 --------
      • -------- then the change to cast random spell is --------
      • -------- 1/(8-1*lvl) * 100% --------
      • -------- 1 lvl - 14.28% --------
      • -------- 2 lvl - 16.66% --------
      • -------- 3 lvl - 20.00% --------
      • Set Factor_max = 5
      • -------- This is value - factor of descreasing change --------
      • Set Factor_min = 1
      • -------- --------
      • -------- --------
      • -------- choose your dummy spells --------
      • Set Random_Spell[1] = Shadow Strike random spell
      • Set Random_Spell[2] = Polymorph random spell
      • Set Random_Spell[3] = Chain Lightning random spell
      • Set Random_Spell[4] = Purge random spell
      • Set Random_Spell[5] = Frost Nova random spell
      • Set Random_Spell[6] = Entangling Roots random spell
      • Set Random_Spell[7] = Curse random spell
      • Set Random_Spell[8] = Mana Burn random spell
      • -------- --------
      • -------- --------
      • -------- choose ordercodes of your spells --------
      • -------- In the same procedure --------
      • Set Order[1] = shadowstrike
      • Set Order[2] = polymorph
      • Set Order[3] = chainlightning
      • Set Order[4] = purge
      • Set Order[5] = frostnova
      • Set Order[6] = entanglingroots
      • Set Order[7] = curse
      • Set Order[8] = manaburn
  • spirit protection effect
    • Events
      • Unit - A unit Is attacked
    • Conditions
      • (Level of Spirit protection for (Triggering unit)) Not equal to 0
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Random integer number between 1 and (Factor_max - (Factor_min x (Level of Spirit protection for (Triggering unit))))) Equal to 1
        • Then - Actions
          • -------- This is a random value beetween 1 and the count of your random spells --------
          • Set Random_Value = (Random integer number between 1 and Random_spell_Count)
          • Set TempPoint = (Position of (Triggering unit))
          • Unit - Create 1 dummy for (Owner of (Triggering unit)) at TempPoint facing Default building facing degrees
          • Unit - Add a 2.00 second Generic expiration timer to (Last created unit)
          • -------- order to cast your chose spell with the correspond orders --------
          • Unit - Add Random_Spell[Random_Value] to (Last created unit)
          • Unit - Set level of Random_Spell[Random_Value] for (Last created unit) to (Level of Spirit protection for (Triggering unit))
          • Custom script: call IssueTargetOrder( bj_lastCreatedUnit, udg_Order[udg_Random_Value], GetAttacker() )
          • Custom script: call RemoveLocation(udg_TempPoint)
        • Else - Actions
 
Top