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

[Trigger] Hashtable spell

Status
Not open for further replies.
Level 12
Joined
Aug 12, 2008
Messages
350
It's my first spell using hashtable that going to a spell in my spellpack and below are the triggers for the spell that I've made. It works perfectly fine with only a single caster but somehow it face a problem when two or more caster used it on the same time; not MUI.
Spell description
Active Ability
Spell Type : Instant/No Target
Tygore Powerhoof gets pump up with a charge mystical power at the axe that he hold. When Tygore attack a unit, the mystical will be release which it heals all nearby ally and damages all nearby enemies. Max up to 8 charges.
Level 1 : 50 heal; 75 damage
Level 2 : 100 heal; 150 damage
Level 3 : 150 heal; 225 damage
  • Charge Up setup
    • Events
      • Map initialization
    • Conditions
    • Actions
      • Hashtable - Create a hashtable
      • Set CU_hashtable = (Last created hashtable)
  • Charge Up cast
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Charge Up
    • Actions
      • Set CU_caster = (Triggering unit)
      • Set CU_key = (Custom value of CU_caster)
      • Hashtable - Save Handle OfCU_caster as 0 of CU_key in CU_hashtable
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Load 1 of CU_key from CU_hashtable) Equal to False
        • Then - Actions
          • Hashtable - Save True as 1 of CU_key in CU_hashtable
          • Unit - Add Charge Up_attachment to CU_caster
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Load 2 of CU_key from CU_hashtable) Less than 8
        • Then - Actions
          • Set CU_charges = ((Load 2 of CU_key from CU_hashtable) + 1)
          • Hashtable - Save CU_charges as 2 of CU_key in CU_hashtable
          • Floating Text - Create floating text that reads |cffffcc00+1|r above CU_caster with Z offset 0.00, using font size 10.00, color (100.00%, 100.00%, 100.00%), and 0.00% transparency
          • Set CU_floattext[CU_key] = (Last created floating text)
          • Floating Text - Change CU_floattext[CU_key]: Disable permanence
          • Floating Text - Set the velocity of CU_floattext[CU_key] to 64.00 towards 90.00 degrees
          • Floating Text - Change the lifespan of CU_floattext[CU_key] to 2.00 seconds
          • Floating Text - Change the fading age of CU_floattext[CU_key] to 0.75 seconds
          • Floating Text - Destroy CU_floattext[CU_key]
        • Else - Actions
          • Floating Text - Create floating text that reads |cffff0000+0|r above CU_caster with Z offset 0.00, using font size 10.00, color (100.00%, 100.00%, 100.00%), and 0.00% transparency
          • Set CU_floattext[CU_key] = (Last created floating text)
          • Floating Text - Change CU_floattext[CU_key]: Disable permanence
          • Floating Text - Set the velocity of CU_floattext[CU_key] to 64.00 towards 90.00 degrees
          • Floating Text - Change the lifespan of CU_floattext[CU_key] to 2.00 seconds
          • Floating Text - Change the fading age of CU_floattext[CU_key] to 0.75 seconds
          • Floating Text - Destroy CU_floattext[CU_key]
      • Hashtable - Save (50.00 x (Real((Level of Charge Up for CU_caster)))) as 3 of CU_key in CU_hashtable
      • Hashtable - Save (75.00 x (Real((Level of Charge Up for CU_caster)))) as 4 of CU_key in CU_hashtable
      • Hashtable - Save Abilities\Spells\Items\AIma\AImaTarget.mdl as 5 of CU_key in CU_hashtable
      • Hashtable - Save Abilities\Spells\Items\AIil\AIilTarget.mdl as 6 of CU_key in CU_hashtable
  • Charge Up release
    • Events
      • Unit - A unit Is attacked
    • Conditions
      • (Attacking unit) Equal to (Load 0 of (Custom value of (Attacking unit)) in CU_hashtable)
      • (Load 1 of (Custom value of (Attacking unit)) from CU_hashtable) Equal to True
    • Actions
      • Set CU_attacker = (Attacking unit)
      • Set CU_target = (Triggering unit)
      • Set CU_targetpoint = (Position of CU_target)
      • Set CU_charge_current = (Load 2 of (Custom value of CU_attacker) from CU_hashtable)
      • Custom script: set bj_wantDestroyGroup = true
      • Unit Group - Pick every unit in (Units within 400.00 of CU_targetpoint matching ((((Matching unit) is A structure) Equal to False) and ((((Matching unit) is Mechanical) Equal to False) and ((((Matching unit) is Magic Immune) Equal to False) and ((((Matching unit) is alive) Equal to True) an and do (Actions)
        • Loop - Actions
          • Unit - Set life of (Picked unit) to ((Life of (Picked unit)) + (Load 3 of (Custom value of CU_attacker) from CU_hashtable))
          • Set CU_random_heal_point = (Position of (Picked unit))
          • Special Effect - Create a special effect at CU_random_heal_point using (Load 5 of (Custom value of CU_attacker) from CU_hashtable)
          • Special Effect - Destroy (Last created special effect)
      • Custom script: set bj_wantDestroyGroup = true
      • Unit Group - Pick every unit in (Units within 400.00 of CU_targetpoint matching ((((Matching unit) is A structure) Equal to False) and ((((Matching unit) is Mechanical) Equal to False) and ((((Matching unit) is Magic Immune) Equal to False) and ((((Matching unit) is alive) Equal to True) an and do (Actions)
        • Loop - Actions
          • Unit - Set life of (Picked unit) to ((Life of (Picked unit)) - (Load 4 of (Custom value of CU_attacker) from CU_hashtable))
          • Set CU_random_damage_point = (Position of (Picked unit))
          • Special Effect - Create a special effect at CU_random_damage_point using (Load 6 of (Custom value of CU_attacker) from CU_hashtable)
          • Special Effect - Destroy (Last created special effect)
      • Set CU_charge_current = (CU_charge_current - 1)
      • Hashtable - Save CU_charge_current as 2 of (Custom value of CU_attacker) in CU_hashtable
      • Floating Text - Create floating text that reads |cffffcc00-1|r above CU_caster with Z offset 0.00, using font size 10.00, color (100.00%, 100.00%, 100.00%), and 0.00% transparency
      • Set CU_floattext[CU_key] = (Last created floating text)
      • Floating Text - Change CU_floattext[CU_key]: Disable permanence
      • Floating Text - Set the velocity of CU_floattext[CU_key] to 64.00 towards 90.00 degrees
      • Floating Text - Change the lifespan of CU_floattext[CU_key] to 2.00 seconds
      • Floating Text - Change the fading age of CU_floattext[CU_key] to 0.75 seconds
      • Floating Text - Destroy CU_floattext[CU_key]
      • Custom script: call RemoveLocation (udg_CU_random_heal_point)
      • Custom script: call RemoveLocation (udg_CU_random_damage_point)
      • Custom script: call RemoveLocation (udg_CU_targetpoint)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Load 2 of (Custom value of CU_attacker) from CU_hashtable) Equal to 0
        • Then - Actions
          • Unit - Remove Charge Up_attachment from CU_attacker
          • Hashtable - Save False as 2 of (Custom value of CU_attacker) in CU_hashtable
          • Hashtable - Clear all child hashtables of child (Custom value of CU_attacker) in CU_hashtable
        • Else - Actions
 
a) Use Damage Detection system, this event can be easily abused with the Stop command.
b) You are mixing indexing system with hashtables, no reason to do that.
c) Don't use custom values, a hashtable is far better than these pretentious MUIers.
d) Don't save the charges on the custom value, save them on the caster himself.
e) Don't save a boolean to check whether the caster has initiated the charges; use (Level of ChargeUp_attachment for CU_Caster Greater than 0).
f) You are manipulating the custom value as indexing and as charges at the same time; it obviously won't work like that.
g) There's no reason to save floating texts as array'd variables.
 
Level 12
Joined
Aug 12, 2008
Messages
350
Well of course I'm mixing it up because I used to create spell using index. This is my first spell in hashtable and that's why I'm posting it up at here to ask for help :D
Use Damage Detection system, this event can be easily abused with the Stop command.
Thanks hehe.. didn't realise it.
b) You are mixing indexing system with hashtables, no reason to do that.
c) Don't use custom values, a hashtable is far better than these pretentious MUIers.
d) Don't save the charges on the custom value, save them on the caster himself.
I don't know how to save on the caster himself because I observed that many of spells in hashtable in hiveworkshop seems to be "save bla bla of custom value of triggering unit or picked unit" I just followed :p
Don't save a boolean to check whether the caster has initiated the charges; use (Level of ChargeUp_attachment for CU_Caster Greater than 0).
Alright. Thanks hehe ><
You are manipulating the custom value as indexing and as charges at the same time; it obviously won't work like that.
ermm.. but it actually work well just that it doesn't work for multi unit..
There's no reason to save floating texts as array'd variables.
Ohhppss >< I'll fixed it.

[EDIT]: Oh I got your words :D Fixed. Hashtable removed. :p I hate hashtable. ><
 
  • Actions
    • Set CU_Charges = (Load (Key charges) of (Key (Triggering unit)) from CU_Hash)
    • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
      • If - Conditions
        • CU_Charges Less than 8
      • Then - Actions
        • Hashtable - Save (CU_Charges + 1) as (Key charges) of (Key (Triggering unit)) in CU_Hash
      • Else - Actions
Then, in the damage detection,
  • Actions
    • Set CU_ChargeLoad = (Load Key(charges) of (Key(Damage source)) in CU_Hash)
    • Hashtable - Save (CU_ChargeLoad - 1) as Key(charges) of (Key(Damage source)) in CU_Hash)
 
Status
Not open for further replies.
Top