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

[Trigger] Spell Crashed

Status
Not open for further replies.
Level 12
Joined
Aug 12, 2008
Messages
349
This is my first time creating spell using hashtable and I couldn't figure it out why it crash. Can anyone help? :D


Active Ability
Spell Type: Single Target
Cast Range: 650 range
Maiev blinks to the target enemy unit and strikes the unit, stunning the target for 0.5 seconds and Maiev gains Phantom for a short duration. Phantom causes Maiev to deals extra damage which doubles every hit. Level 1: 1.5x agi in dmg for bonus dmg; lasts for 3 secs
Level 2: 1.75x agi in dmg for bonus dmg; lasts for 3.5 secs
Level 3: 2x agi in dmg for bonus dmg; lasts for 4 secs
Mana Cost: 0
Cooldown: 0

[trigger=Map Initialization]Map Initialization
Events
Map initialization
Conditions
Actions
Hashtable - Create a hashtable
Set PS_Hashtable = (Last created hashtable)
Custom script: set udg_PS_CasterGroup = CreateGroup ()
-------- ============================ --------
-------- ----------------- Configurables ----------------- --------
Set PS_DamageType = Hero
Set PS_Transparency = 50.00
Set PS_SFX_Attach = Abilities\Spells\Other\HowlOfTerror\HowlTarget.mdl
Set PS_SFX_Attack = Objects\Spawnmodels\Human\HumanBlood\BloodElfSpellThiefBlood.mdl
Set PS_SFX_BlinkSource = Abilities\Spells\Undead\CarrionSwarm\CarrionSwarmDamage.mdl
Set PS_SFX_BlinkTarget = Abilities\Spells\Undead\DeathCoil\DeathCoilSpecialArt.mdl
-------- ------------- Configurable Ends ------------- --------
-------- ============================ --------
[/trigger]

[trigger=PS Cast]
PS Cast
Events
Unit - A unit Starts the effect of an ability
Conditions
(Ability being cast) Equal to Phantom Strike
Actions
Set tempUnit = (Triggering unit)
Set tempInteger = (Level of Phantom Strike for tempUnit)
Custom script: set udg_PS_Key = GetHandleId (udg_tempUnit)
-------- ============================ --------
-------- ----------------- Configurables ----------------- --------
Set PS_Duration = (2.50 + (0.50 x (Real(tempInteger))))
Set PS_BonusDamage = ((1.25 + (0.25 x (Real(tempInteger)))) x (Real((Agility of tempUnit (Include bonuses)))))
-------- ------------- Configurable Ends ------------- --------
-------- ============================ --------
Animation - Change tempUnit's vertex coloring to (100.00%, 100.00%, 100.00%) with PS_Transparency% transparency
-------- ------------ Moving the Caster ------------ --------
Set tempPoint = (Position of tempUnit)
Set tempUnit2 = (Target unit of ability being cast)
Set tempPoint2 = (Position of tempUnit2)
Special Effect - Create a special effect attached to the chest of tempUnit using PS_SFX_Attach
Set tempSFX = (Last created special effect)
Special Effect - Create a special effect at tempPoint using PS_SFX_BlinkSource
Special Effect - Destroy (Last created special effect)
Special Effect - Create a special effect at tempPoint2 using PS_SFX_BlinkTarget
Special Effect - Destroy (Last created special effect)
Unit - Move tempUnit instantly to tempPoint2, facing tempPoint2
Unit - Order tempUnit to Attack tempUnit2
Custom script: call RemoveLocation (udg_tempPoint)
Custom script: call RemoveLocation (udg_tempPoint2)
-------- ============================ --------
-------- ---------------- Saving Values ---------------- --------
Hashtable - Save PS_Duration as 1 of PS_Key in PS_Hashtable
Hashtable - Save PS_BonusDamage as 2 of PS_Key in PS_Hashtable
Hashtable - Save Handle OftempSFX as 3 of PS_Key in PS_Hashtable
-------- ============================ --------
Unit Group - Add tempUnit to PS_CasterGroup
Trigger - Turn on PS Loop <gen>
Trigger - Turn on PS Detection <gen>
[/trigger]

[trigger=PS Loop]
PS Loop
Events
Time - Every 0.03 seconds of game time
Conditions
Actions
Unit Group - Pick every unit in PS_CasterGroup and do (Actions)
Loop - Actions
Set tempUnit = (Picked unit)
Custom script: set udg_PS_Key = GetHandleId (udg_tempUnit)
-------- ============================ --------
-------- --------- Checking the Duration --------- --------
Set PS_Duration = (Load 2 of PS_Key from PS_Hashtable)
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
PS_Duration Greater than 0.00
Then - Actions
Set PS_Duration = (PS_Duration - 0.03)
Hashtable - Save PS_Duration as 1 of PS_Key in PS_Hashtable
Else - Actions
Special Effect - Destroy (Load 3 of PS_Key in PS_Hashtable)
Unit Group - Remove tempUnit from PS_CasterGroup
Set tempInteger = (Number of units in PS_CasterGroup)
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
tempInteger Equal to 0
Then - Actions
Trigger - Turn off PS Loop <gen>
Trigger - Turn off PS Detection <gen>
Else - Actions
[/trigger]

[trigger=PS Detection]
PS Detection
Events
Game - GDD_Event becomes Equal to 0.00
Conditions
(GDD_DamageSource is in PS_CasterGroup) Equal to True
Actions
Set tempUnit = GDD_DamageSource
Set tempUnit2 = GDD_DamagedUnit
Custom script: set udg_PS_Key = GetHandleId (udg_tempUnit)
-------- ============================ --------
-------- ------------- Deals the Damage ------------ --------
Set PS_BonusDamage = (Load 2 of PS_Key from PS_Hashtable)
Unit - Cause tempUnit to damage tempUnit2, dealing PS_BonusDamage damage of attack type PS_DamageType and damage type Normal
-------- ----------- Increases the Damage ---------- --------
Set PS_BonusDamage = (2.00 x PS_BonusDamage)
Hashtable - Save PS_BonusDamage as 2 of PS_Key in PS_Hashtable
-------- ------------------------ SFX ------------------------ --------
Set tempPoint = (Position of tempUnit)
Special Effect - Create a special effect at tempPoint using PS_SFX_Attack
Special Effect - Destroy (Last created special effect)
Custom script: call RemoveLocation (udg_tempPoint)
-------- ============================ --------
-------- ----------- Create Floating Text ----------- --------
Set tempReal = (PS_BonusDamage / 2.00)
Set tempString = (String(tempReal))
Floating Text - Create floating text that reads (+|cffff0000 + (Substring(tempString, (Length of tempString), ((Length of tempString) - 1)))) above tempUnit with Z offset 0.00, using font size 8.50, color (100.00%, 100.00%, 100.00%), and 0.00% transparency
Floating Text - Change (Last created floating text): Disable permanence
Floating Text - Set the velocity of (Last created floating text) to 64.00 towards 90.00 degrees
Floating Text - Change the fading age of (Last created floating text) to 0.75 seconds
Floating Text - Change the lifespan of (Last created floating text) to 2.00 seconds
[/trigger]

The PS Detection uses Weep's GUI-Friendly Damage Detection System and I don't think there's problem importing the system.


Here's the demo-map

Sorry for double post.
 

Attachments

  • Phantom Strike.w3x
    22 KB · Views: 39
Last edited by a moderator:
Level 12
Joined
Mar 24, 2011
Messages
1,082
The problem is in this trigger
  • PS Detection
  • Events
  • Game - GDD_Event becomes Equal to 0.00
  • Conditions
  • (GDD_DamageSource is in PS_CasterGroup) Equal to True
  • Actions
  • Set tempUnit = GDD_DamageSource
  • Set tempUnit2 = GDD_DamagedUnit
  • Custom script: set udg_PS_Key = GetHandleId (udg_tempUnit)
  • -------- ============================ --------
  • -------- ------------- Deals the Damage ------------ --------
  • Set PS_BonusDamage = (Load 2 of PS_Key from PS_Hashtable)
  • Unit - Cause tempUnit to damage tempUnit2, dealing PS_BonusDamage damage of attack type PS_DamageType and damage type Normal
  • -------- ----------- Increases the Damage ---------- --------
  • Set PS_BonusDamage = (2.00 x PS_BonusDamage)
  • Hashtable - Save PS_BonusDamage as 2 of PS_Key in PS_Hashtable
  • -------- ------------------------ SFX ------------------------ --------
  • Set tempPoint = (Position of tempUnit)
  • Special Effect - Create a special effect at tempPoint using PS_SFX_Attack
  • Special Effect - Destroy (Last created special effect)
  • Custom script: call RemoveLocation (udg_tempPoint)
  • -------- ============================ --------
  • -------- ----------- Create Floating Text ----------- --------
  • Set tempReal = (PS_BonusDamage / 2.00)
  • Set tempString = (String(tempReal))
  • Floating Text - Create floating text that reads (+|cffff0000 + (Substring(tempString, (Length of tempString), ((Length of tempString) - 1)))) above tempUnit with Z offset 0.00, using font size 8.50, color (100.00%, 100.00%, 100.00%), and 0.00% transparency
  • Floating Text - Change (Last created floating text): Disable permanence
  • Floating Text - Set the velocity of (Last created floating text) to 64.00 towards 90.00 degrees
  • Floating Text - Change the fading age of (Last created floating text) to 0.75 seconds
  • Floating Text - Change the lifespan of (Last created floating text) to 2.00 seconds
You have to turn off the dds before dealing damage and turn off the trigger or you will create an infinite loop dds event.

You see damage is dealt >> GddEvent becomes 0 >> Trigger fires >> trigger deals damage >> GddEvent becomes 0 >> Trigger is fired >> Trigger deals damage >> GddEvent becomes 0 >> Trigger is fired >> Trigger deals damage >>GddEvent becomes 0 >> Trigger is fired >> Trigger deals damage >> ...

  • PS Detection
    • Events
      • Game - GDD_Event becomes Equal to 0.00
    • Conditions
      • (GDD_DamageSource is in PS_CasterGroup) Equal to True
    • Actions
      • -------- ============================ --------
      • -------- ============================ --------
      • Trigger - Turn off (This trigger)//add this
      • Trigger - Turn off GUI Friendly Damage Detection <gen> //and this
      • -------- ============================ --------
      • -------- ============================ --------
      • Set tempUnit = GDD_DamageSource
      • Set tempUnit2 = GDD_DamagedUnit
      • Custom script: set udg_PS_Key = GetHandleId (udg_tempUnit)
      • -------- ============================ --------
      • -------- ------------- Deals the Damage ------------ --------
      • Set PS_BonusDamage = (Load 2 of PS_Key from PS_Hashtable)
      • Unit - Cause tempUnit to damage tempUnit2, dealing PS_BonusDamage damage of attack type PS_DamageType and damage type Normal
      • -------- ============================ --------
      • -------- ============================ --------
      • Trigger - Turn on (This trigger)//add this
      • Trigger - Turn on GUI Friendly Damage Detection <gen> //and this
      • -------- ============================ --------
      • -------- ============================ --------
      • -------- ----------- Increases the Damage ---------- --------
      • Set PS_BonusDamage = (2.00 x PS_BonusDamage)
      • Hashtable - Save PS_BonusDamage as 2 of PS_Key in PS_Hashtable
      • -------- ------------------------ SFX ------------------------ --------
      • Set tempPoint = (Position of tempUnit)
      • Special Effect - Create a special effect at tempPoint using PS_SFX_Attack
      • Special Effect - Destroy (Last created special effect)
      • Custom script: call RemoveLocation (udg_tempPoint)
      • -------- ============================ --------
      • -------- ----------- Create Floating Text ----------- --------
      • Set tempReal = (PS_BonusDamage / 2.00)
      • Set tempString = (String(tempReal))
      • Floating Text - Create floating text that reads (+|cffff0000 + (Substring(tempString, (Length of tempString), ((Length of tempString) - 1)))) above tempUnit with Z offset 0.00, using font size 8.50, color (100.00%, 100.00%, 100.00%), and 0.00% transparency
      • Floating Text - Change (Last created floating text): Disable permanence
      • Floating Text - Set the velocity of (Last created floating text) to 64.00 towards 90.00 degrees
      • Floating Text - Change the fading age of (Last created floating text) to 0.75 seconds
      • Floating Text - Change the lifespan of (Last created floating text) to 2.00 seconds
Edit//Note: Can't test now that's why there are both lines but you'll find yourself if any of them is unneeded.
  • Trigger - Turn off (This trigger)
  • Trigger - Turn off GUI Friendly Damage Detection <gen>
 
Last edited:
Status
Not open for further replies.
Top