• 🏆 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!
  • 🏆 Hive's 6th HD Modeling Contest: Mechanical is now open! Design and model a mechanical creature, mechanized animal, a futuristic robotic being, or anything else your imagination can tinker with! 📅 Submissions close on June 30, 2024. Don't miss this opportunity to let your creativity shine! Enter now and show us your mechanical masterpiece!🔗 Click here to enter!

Problem with Item Ability Spell

Status
Not open for further replies.
Level 12
Joined
Aug 22, 2008
Messages
911
Greetings Hive,

A problem, I have.
My spell is supposed to increase the max mana of the spell-owning unit after it kills an enemy unit. The effect increases with level (longer duration, more max mana). The dummy ability itself is passive.
The following three triggers were supposed to do the job, but for some reason it doesn't remove the ability after it gives it and there's no floating text.
Can someone please help me find what did I do wrong?
  • Init
    • Events
      • Map initialization
    • Conditions
    • Actions
      • Hashtable - Create a hashtable
      • Set Hunger_Table = (Last created hashtable)
  • Kill
    • Events
      • Unit - A unit Dies
    • Conditions
      • (Level of Vengeful Hunger for (Killing unit)) Greater than or equal to 1
    • Actions
      • Unit - Set mana of (Killing unit) to ((Mana of (Killing unit)) + (50.00 x (Real((Level of Vengeful Hunger for (Killing unit))))))
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • ((Killing unit) is in Hunger_Group) Equal to False
        • Then - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Level of Vengeful Hunger for (Killing unit)) Equal to 1
            • Then - Actions
              • Unit - Add Increase Mana (100) to (Killing unit)
              • Hashtable - Save 10 as 1 of (Key (Killing unit)) in Hunger_Table
              • Hashtable - Save Handle Of(Killing unit) as 0 of (Key (Killing unit)) in Hunger_Table
            • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Level of Vengeful Hunger for (Killing unit)) Equal to 2
            • Then - Actions
              • Unit - Add Increase Mana (150) to (Killing unit)
              • Hashtable - Save 15 as 2 of (Key (Killing unit)) in Hunger_Table
              • Hashtable - Save Handle Of(Killing unit) as 0 of (Key (Killing unit)) in Hunger_Table
            • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Level of Vengeful Hunger for (Killing unit)) Equal to 3
            • Then - Actions
              • Unit - Add Increase Mana (200) to (Killing unit)
              • Hashtable - Save 20 as 3 of (Key (Killing unit)) in Hunger_Table
              • Hashtable - Save Handle Of(Killing unit) as 0 of (Key (Killing unit)) in Hunger_Table
            • Else - Actions
          • Unit Group - Add (Killing unit) to Hunger_Group
        • Else - Actions
  • Interval
    • Events
      • Time - Every 1.00 seconds of game time
    • Conditions
    • Actions
      • Unit Group - Pick every unit in Hunger_Group and do (Actions)
        • Loop - Actions
          • For each (Integer A) from 1 to 3, do (Actions)
            • Loop - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (Load (Integer A) of (Key (Picked unit)) from Hunger_Table) Equal to 0
                • Then - Actions
                  • If ((Integer A) Equal to 1) then do (Unit - Remove Increase Mana (100) from (Picked unit)) else do (Do nothing)
                  • If ((Integer A) Equal to 2) then do (Unit - Remove Increase Mana (150) from (Picked unit)) else do (Do nothing)
                  • If ((Integer A) Equal to 3) then do (Unit - Remove Increase Mana (200) from (Picked unit)) else do (Do nothing)
                  • Hashtable - Save -1 as (Integer A) of (Key (Picked unit)) in (Last created hashtable)
                  • If (((Load 1 of (Key (Picked unit)) from Hunger_Table) Less than or equal to 0) and (((Load 2 of (Key (Picked unit)) from Hunger_Table) Less than or equal to 0) and ((Load 3 of (Key (Picked unit)) from Hunger_Table) Less than or equal to 0))) then do (Unit Group - Remove (Picked unit) from Hunger_Group) else do (Do nothing)
                • Else - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (Load (Integer A) of (Key (Picked unit)) from Hunger_Table) Greater than or equal to 1
                • Then - Actions
                  • Hashtable - Save ((Load (Integer A) of (Key (Picked unit)) from Hunger_Table) - 1) as (Integer A) of (Key (Picked unit)) in Hunger_Table
                  • Floating Text - Create floating text that reads (Load (Integer A) of (Key (Picked unit)) from Hunger_Table) above (Picked unit) with Z offset 0.00, using font size 10.00, color (100.00%, 100.00%, 100.00%), and 0.00% transparency
                  • Floating Text - Change (Last created floating text): Disable permanence
                  • Floating Text - Change the lifespan of (Last created floating text) to 2.00 seconds
                  • Floating Text - Set the velocity of (Last created floating text) to 64.00 towards 90.00 degrees
                • Else - Actions
I apologise if this takes time to read.
 
Level 4
Joined
Apr 16, 2009
Messages
85
it doesn't show the floating text because you try to load a string but you save a integer (you need to load the integer and convert it into a string)

and why would you want to remove the ability? :eekani:
 
Level 12
Joined
Aug 22, 2008
Messages
911
The point of the ability is to grant inceased max mana for a limited amount of time, using Item Ability Grant Bonus Max Mana. It eventually has to be removed.
About the floating text, sounds decent - I'll try converting (String(value)) and I'll tell you if this works.
Does anyone else have any ideas? Please?
 
Level 22
Joined
Nov 14, 2008
Messages
3,256
Skip the integer A function, use a normal integer. I dont really see the problem here but as it is "hashtable" shit I will suggest to store the ability into variables at ini and also I dont like that you store number each and every one, better use an integer variable?
 
Level 12
Joined
Aug 22, 2008
Messages
911
baassee said:
Skip the integer A function, use a normal integer. I dont really see the problem here but as it is "hashtable" shit I will suggest to store the ability into variables at ini and also I dont like that you store number each and every one, better use an integer variable?
Hashtable is more efficient because it can be sorted by Handle IDs, if I use arrays I'll need to find another way of sorting which will probably have much more vices. As for the Integer A function - it works precisely as I want it to so there's no reason to replace it with an integer array.

Maker said:
  • Hashtable - Save -1 as (Integer A) of (Key (Picked unit)) in (Last created hashtable)
^You should at least change that to Hunger_Table
Fixed, still no working.

EDIT: Looks like I was wrong Maker, you found the glitch! Thanks +rep /SOLVED\
 
Status
Not open for further replies.
Top