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

Need Help For Gui Coders(spells)

Status
Not open for further replies.

Spell(Kinetic Pulsar)

[trigger=]KP Config
Events
Map initialization
Conditions
Actions
-------- 0=0=0=0 --------
-------- Hashtable --------
-------- 0=0=0=0 --------
Custom script: call DestroyGroup(udg_KP_TempGroup)
Set KP_Hash = (Last created hashtable)
-------- 0=0=0=0=0 --------
-------- Objects used --------
-------- 0=0=0=0=0 --------
Set KP_Abilities[1] = Kinetic Pulsar
Set KP_Abilities[2] = KP STun
Set KP_Abilities[3] = KP Lightning
Set KP_Units[1] = KP Dummy[1]
Set KP_Units[2] = KP Dummy[3]
-------- 0=0=0=0=0=0=0=0 --------
-------- CONFIGURATION --------
-------- 0=0=0=0=0=0=0=0 --------
-------- Determines the AoE of Damage --------
Set KP_AoE = 250.00
-------- Determines the Damage --------
Set KP_Damage[1] = 100.00
Set KP_Damage[2] = 200.00
Set KP_Damage[3] = 300.00
-------- Determines how far the orbs go outwards. --------
Set KP_BaseAoE = 600.00
-------- Determines how height of the lightning --------
Set KP_Height = 75.00
-------- Determines the Lightning Effect --------
Set KP_LightningEffect = DRAM
-------- Determines the Max number of Pulses --------
Set KP_MaxPulses = 5.00
-------- Determines the number of orbs released per interval --------
Set KP_Orbs = 9
-------- Determines the angle per sides --------
Set KP_Sides = 45.00
-------- Determines the buff --------
Set KP_Buff = Stunned(Custom) (Pause)
-------- Determines the distance of orbs from the starting point --------
Set KP_StartDistance = 100.00
-------- Determines how long does each orbs last --------
Set KP_Duration = 5.00
[/trigger][trigger=]KP Cast
Events
Unit - A unit Starts the effect of an ability
Conditions
(Ability being cast) Equal to Kinetic Pulsar
Actions
-------- 0=0=0=0=0 --------
-------- VARIABLES --------
-------- 0=0=0=0=0 --------
Set KP_Caster = (Triggering unit)
Custom script: set udg_KP_CasterHandle = GetHandleId(udg_KP_Caster)
-------- Determines the number pulses currently released --------
Set KP_CurrentPulses = 0.00
-------- Saving Variable --------
Hashtable - Save KP_CurrentPulses as 5 of KP_CasterHandle in KP_Hash
-------- Starting Loop --------
Unit Group - Add KP_Caster to KP_CasterGroup
[/trigger][trigger=]KP Pulses
Events
Time - Every 2.00 seconds of game time
Conditions
Actions
Unit Group - Pick every unit in KP_CasterGroup and do (Actions)
Loop - Actions
-------- Loading Variables --------
Set KP_PickedCaster = (Picked unit)
Custom script: set udg_KP_PickedHandle = GetHandleId(udg_KP_PickedCaster)
Set KP_CurrentPulses = (Load 5 of KP_PickedHandle from KP_Hash)
Set KP_Levels = (Level of KP_Abilities[1] for KP_PickedCaster)
Set KP_MaxPulses = 5.00
-------- Checking --------
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
KP_CurrentPulses Less than KP_MaxPulses
Then - Actions
-------- Creating Orbs --------
Set KP_PickedLoc = (Position of KP_PickedCaster)
For each (Integer A) from 1 to KP_Orbs, do (Actions)
Loop - Actions
Set KP_Offset = (KP_PickedLoc offset by KP_StartDistance towards ((Real((Integer A))) x KP_Sides) degrees)
Unit - Create 1 KP_Units[1] for (Owner of KP_PickedCaster) at KP_Offset facing ((Real((Integer A))) x KP_Sides) degrees
Set KP_Loc = (Position of (Last created unit))
Set KP_DummyOffset = (KP_Loc offset by KP_BaseAoE towards (Facing of (Last created unit)) degrees)
Unit - Add KP_Abilities[3] to (Last created unit)
Unit - Set level of KP_Abilities[3] for (Last created unit) to KP_Levels
Unit - Order (Last created unit) to Move To KP_DummyOffset
Unit - Add a KP_Duration second Generic expiration timer to (Last created unit)
-------- Cleaning Leaks --------
Custom script: call RemoveLocation(udg_KP_Offset)
Custom script: call RemoveLocation(udg_KP_Loc)
Custom script: call RemoveLocation(udg_KP_DummyOffset)
-------- Saving Variable --------
Hashtable - Save (KP_CurrentPulses + 1.00) as 5 of KP_PickedHandle in KP_Hash
-------- Cleaning Leak --------
Custom script: call RemoveLocation(udg_KP_PickedLoc)
Else - Actions
-------- Clean Up --------
Hashtable - Clear all child hashtables of child KP_PickedHandle in KP_Hash
Unit Group - Remove KP_PickedCaster from KP_CasterGroup
[/trigger][trigger=]KP Lightning Check
Events
Time - Every 0.04 seconds of game time
Conditions
Actions
Set KP_DummyGroup = (Units in (Playable map area) matching (((((Matching unit) is in KP_LightningGroup) Equal to False) and (((Matching unit) is alive) Equal to True)) and ((Level of KP Lightning for (Matching unit)) Greater than 0)))
Unit Group - Pick every unit in KP_DummyGroup and do (Actions)
Loop - Actions
-------- Add units to lightning group --------
Unit Group - Add (Picked unit) to KP_LightningGroup
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(Number of units in KP_LightningGroup) Greater than 0
Then - Actions
Trigger - Turn on KP Lightning <gen>
Else - Actions
Custom script: call DestroyGroup(udg_KP_DummyGroup)
[/trigger][trigger=]KP Lightning
Events
Time - Every 0.04 seconds of game time
Conditions
Actions
Unit Group - Pick every unit in KP_LightningGroup and do (Actions)
Loop - Actions
Set KP_DummyP = (Picked unit)
Set KP_DummyLevels = (Level of KP_Abilities[3] for KP_DummyP)
Custom script: set udg_KP_UHandle = GetHandleId(udg_KP_DummyP)
-------- Checking if picked unit is alive --------
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(KP_DummyP is alive) Equal to True
Then - Actions
-------- Unit Setup --------
Set KP_DummyLoc = (Position of KP_DummyP)
-------- Lightning Clean up --------
For each (Integer KP_I) from 1 to KP_UHandle, do (Actions)
Loop - Actions
Lightning - Destroy (Load KP_I of KP_UHandle in KP_Hash)
Set KP_I = 0
Set KP_TempGroup = (Units within KP_AoE of KP_DummyLoc)
Unit Group - Pick every unit in KP_TempGroup and do (Actions)
Loop - Actions
-------- Target Acquiring --------
Set KP_TempUnit = (Picked unit)
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(KP_TempUnit belongs to an ally of (Owner of KP_DummyP)) Equal to True
(KP_TempUnit is in KP_LightningGroup) Equal to True
KP_TempUnit Equal to KP_DummyP
Then - Actions
-------- Effects --------
Set KP_I = (KP_I + 1)
Set KP_TempLoc = (Position of KP_TempUnit)
Custom script: set udg_KP_TempZ = GetLocationZ (udg_KP_DummyLoc) + udg_KP_Height
Custom script: set udg_KP_TempZ2= GetLocationZ (udg_KP_TempLoc) + udg_KP_Height
Custom script: set udg_KP_TempLightning = AddLightningEx(udg_KP_LightningEffect , true, GetLocationX(udg_KP_DummyLoc), GetLocationY(udg_KP_DummyLoc), udg_KP_TempZ, GetLocationX(udg_KP_TempLoc), GetLocationY(udg_KP_TempLoc), udg_KP_TempZ2)
Custom script: call RemoveLocation(udg_KP_TempLoc)
Hashtable - Save Handle OfKP_TempLightning as KP_I of KP_UHandle in KP_Hash
Else - Actions
Set KP_DamageGroup[1] = (Units within KP_AoE of KP_DummyLoc matching (((((Matching unit) is A structure) Not equal to True) and ((((Matching unit) is Magic Immune) Not equal to True) and (((Matching unit) is alive) Equal to True))) and (((Matching unit) belongs to an enemy of (Owner
Set KP_DamageGroup[2] = (Random 1 units from KP_DamageGroup[1])
-------- Starts Stun and Damage --------
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(Number of units in KP_DamageGroup[1]) Greater than 0
Then - Actions
Unit Group - Pick every unit in KP_DamageGroup[2] and do (Actions)
Loop - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
((Picked unit) has buff KP_Buff) Not equal to True
Then - Actions
Set KP_DamageP = (Picked unit)
Set KP_DamageLoc = (Position of KP_DamageP)
Unit - Create 1 KP_Units[2] for (Owner of KP_DummyP) at KP_DamageLoc facing Default building facing degrees
Unit - Add KP_Abilities[2] to (Last created unit)
Unit - Set level of KP_Abilities[2] for (Last created unit) to KP_DummyLevels
Unit - Order (Last created unit) to Human Mountain King - Storm Bolt KP_DamageP
Unit - Add a 1.00 second Generic expiration timer to (Last created unit)
-------- Cleans Leak --------
Custom script: call RemoveLocation(udg_KP_DamageLoc)
Else - Actions
Else - Actions
-------- Cleaning Leaks --------
Hashtable - Save KP_I as 0 of KP_UHandle in KP_Hash
Custom script: call RemoveLocation(udg_KP_DummyLoc)
Custom script: call DestroyGroup(udg_KP_DamageGroup[1])
Custom script: call DestroyGroup(udg_KP_DamageGroup[2])
Custom script: call DestroyGroup(udg_KP_TempGroup)
Else - Actions
-------- Clean up --------
For each (Integer KP_I) from 1 to KP_UHandle, do (Actions)
Loop - Actions
Lightning - Destroy (Load KP_I of KP_UHandle in KP_Hash)
Unit Group - Remove KP_DummyP from KP_LightningGroup
Hashtable - Clear all child hashtables of child KP_UHandle in KP_Hash
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(Number of units in KP_LightningGroup) Equal to 0
Then - Actions
Trigger - Turn off (This trigger)
Else - Actions
[/trigger]
Problem
-Pulses never end
-Lightning doesnt show
-Group Pick doesnt work
-Stun doesnt work
-doesnt pick units with the ability kp lightning

I really need your help

 
  • For each (Integer KP_I) from 1 to KP_UHandle, do (Actions)
That is why your lightning is never appearing - you don't load the correct integer to go "to" since you just go to the ID number of the unit as opposed to a saved value for how many lightning effects are attached to it
i forgot about it thanks.
ill just try it out
But what about the unlimited pulses??
 
i forgot about it thanks.
ill just try it out
But what about the unlimited pulses??
Doesnt Work
Screeny:
217293-albums5560-picture59023.jpg
 
Level 33
Joined
Mar 27, 2008
Messages
8,035
Maybe my test map could help you with something about handling Lightning and destroying them when necessary.

This is a spell request I did, and this is the information for the spell;

Originally Posted by mrVoid
Good day. I want to request a spell.
Target: friendly unit
Duration: unlimited
Effect: increase target's attack speed (+30%/+50%/+70%) and movement speed (+15%/+20%/+25%) but decrease caster's attack speed (-25%/-45%/-65%) and movement speed (-20%/-30%/-40%)
Additional:
- stop effect if distance between caster and target becomes more than 450
- caster can cancel the effect at any moment
- independ of ability's level, caster always casts lvl 1 effect
- caster can "charge" effect and increase effect level
- maximum of effect level by charges is ability's level
 

Attachments

  • Evil Bond - mrVoid.w3x
    19.6 KB · Views: 87
Last edited:
Maybe my test map could help you with something about handling Lightning and destroying them when necessary.

This is a spell request I did, and this is the information for the spell;
that looks like Wisp's Tether from DotA

Anyone can fix the unlimited pulses?


here is the link of my file:

http://www.4shared.com/file/fur4KDDc/Kinetic_Pulsar.html


Note:you need to have an account to open and download the file.
 
New Problem:
Screeny:
217293-albums5560-picture59024.jpg

This Happens when im near on a "Boundary"
This what did i do to the triggers:[trigger=]KP Lightning Check
Events
Time - Every 0.04 seconds of game time
Conditions
Actions
Set KP_DummyGroup = (Units in (Playable map area) matching (((((Matching unit) is in KP_LightningGroup) Equal to False) and (((Matching unit) is alive) Equal to True)) and ((Unit-type of (Matching unit)) Equal to KP Dummy[1])))
Unit Group - Pick every unit in KP_DummyGroup and do (Actions)
Loop - Actions
-------- Add units to lightning group --------
Unit Group - Add (Picked unit) to KP_LightningGroup
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(Number of units in KP_LightningGroup) Greater than 0
Then - Actions
Trigger - Turn on KP Lightning <gen>
Else - Actions
Custom script: call DestroyGroup(udg_KP_DummyGroup)
[/trigger][trigger=]KP Lightning
Events
Time - Every 0.04 seconds of game time
Conditions
Actions
Unit Group - Pick every unit in KP_LightningGroup and do (Actions)
Loop - Actions
Set KP_DummyP = (Picked unit)
Set KP_DummyLevels = (Level of KP_Abilities[3] for KP_DummyP)
Custom script: set udg_KP_UHandle = GetHandleId(udg_KP_DummyP)
-------- Checking if picked unit is alive --------
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(KP_DummyP is alive) Equal to True
Then - Actions
-------- Unit Setup --------
Set KP_DummyLoc = (Position of KP_DummyP)
-------- Lightning Clean up --------
For each (Integer KP_I) from 1 to (Load 0 of KP_UHandle from KP_Hash), do (Actions)
Loop - Actions
Lightning - Destroy (Load KP_I of KP_UHandle in KP_Hash)
Set KP_I = 0
Set KP_TempGroup = (Units within KP_AoE of KP_DummyLoc)
Unit Group - Pick every unit in KP_TempGroup and do (Actions)
Loop - Actions
-------- Target Acquiring --------
Set KP_TempUnit = (Picked unit)
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(KP_TempUnit belongs to an ally of (Owner of KP_DummyP)) Equal to True
(KP_TempUnit is in KP_LightningGroup) Equal to True
KP_TempUnit Not equal to KP_DummyP
(Unit-type of (Picked unit)) Equal to KP_Units[1]
Then - Actions
-------- Effects --------
Set KP_I = (KP_I + 1)
Set KP_TempLoc = (Position of KP_TempUnit)
Custom script: set udg_KP_TempZ = GetLocationZ (udg_KP_DummyLoc) + udg_KP_Height
Custom script: set udg_KP_TempZ2= GetLocationZ (udg_KP_TempLoc) + udg_KP_Height
Custom script: set udg_KP_TempLightning = AddLightningEx("DRAM" , true, GetLocationX(udg_KP_DummyLoc), GetLocationY(udg_KP_DummyLoc), udg_KP_TempZ, GetLocationX(udg_KP_TempLoc), GetLocationY(udg_KP_TempLoc), udg_KP_TempZ2)
Custom script: call RemoveLocation(udg_KP_TempLoc)
Hashtable - Save Handle OfKP_TempLightning as KP_I of KP_UHandle in KP_Hash
Else - Actions
Set KP_DamageGroup[1] = (Units within KP_AoE of KP_DummyLoc matching (((((Matching unit) is A structure) Not equal to True) and ((((Matching unit) is Magic Immune) Not equal to True) and (((Matching unit) is alive) Equal to True))) and (((Matching unit) belongs to an enemy of (Owner
Set KP_DamageGroup[2] = (Random 1 units from KP_DamageGroup[1])
-------- Starts Stun and Damage --------
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(Number of units in KP_DamageGroup[1]) Greater than 0
Then - Actions
Unit Group - Pick every unit in KP_DamageGroup[2] and do (Actions)
Loop - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
((Picked unit) has buff KP_Buff) Not equal to True
Then - Actions
Set KP_DamageP = (Picked unit)
Set KP_DamageLoc = (Position of KP_DamageP)
Unit - Create 1 KP_Units[2] for (Owner of KP_DummyP) at KP_DamageLoc facing Default building facing degrees
Unit - Add KP_Abilities[2] to (Last created unit)
Unit - Set level of KP_Abilities[2] for (Last created unit) to KP_DummyLevels
Unit - Order (Last created unit) to Human Mountain King - Storm Bolt KP_DamageP
Unit - Add a 1.00 second Generic expiration timer to (Last created unit)
-------- Cleans Leak --------
Custom script: call RemoveLocation(udg_KP_DamageLoc)
Else - Actions
Else - Actions
Hashtable - Save KP_I as 0 of KP_UHandle in KP_Hash
-------- Cleaning Leaks --------
Custom script: call RemoveLocation(udg_KP_DummyLoc)
Custom script: call DestroyGroup(udg_KP_DamageGroup[1])
Custom script: call DestroyGroup(udg_KP_DamageGroup[2])
Custom script: call DestroyGroup(udg_KP_TempGroup)
Else - Actions
-------- Clean up --------
For each (Integer KP_I) from 1 to (Load 0 of KP_UHandle from KP_Hash), do (Actions)
Loop - Actions
Lightning - Destroy (Load KP_I of KP_UHandle in KP_Hash)
Unit Group - Remove KP_DummyP from KP_LightningGroup
Hashtable - Clear all child hashtables of child KP_UHandle in KP_Hash
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(Number of units in KP_LightningGroup) Equal to 0
Then - Actions
Trigger - Turn off (This trigger)
Else - Actions
[/trigger]
 
Another Problem:
  • KP Lightning
    • Events
      • Time - Every 0.03 seconds of game time
    • Conditions
    • Actions
      • Unit Group - Pick every unit in KP_LightningGroup and do (Actions)
        • Loop - Actions
          • Set KP_DummyP = (Picked unit)
          • Set KP_DummyLevels = (Level of KP_Abilities[3] for KP_DummyP)
          • Custom script: set udg_KP_UHandle = GetHandleId(udg_KP_DummyP)
          • -------- Checking if picked unit is alive --------
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (KP_DummyP is alive) Equal to True
            • Then - Actions
              • -------- Unit Setup --------
              • Set KP_DummyLoc = (Position of KP_DummyP)
              • -------- Lightning Clean up --------
              • For each (Integer KP_I) from 1 to (Load 0 of KP_UHandle from KP_Hash), do (Actions)
                • Loop - Actions
                  • Lightning - Destroy (Load KP_I of KP_UHandle in KP_Hash)
              • Set KP_I = 0
              • Set KP_TempGroup = (Units within KP_AoE of KP_DummyLoc matching (((((Matching unit) belongs to an enemy of (Owner of KP_DummyP)) Not equal to True) and (((Matching unit) is in KP_LightningGroup) Equal to True)) and ((Matching unit) Not equal to KP_DummyP)))
              • Unit Group - Pick every unit in KP_TempGroup and do (Actions)
                • Loop - Actions
                  • -------- Target Acquiring --------
                  • Set KP_TempUnit = (Picked unit)
                  • -------- Effects --------
                  • Set KP_I = (KP_I + 1)
                  • Set KP_TempLoc = (Position of KP_TempUnit)
                  • Custom script: set udg_KP_TempZ = GetLocationZ (udg_KP_DummyLoc) + udg_KP_Height
                  • Custom script: set udg_KP_TempZ2= GetLocationZ (udg_KP_TempLoc) + udg_KP_Height
                  • Custom script: set udg_KP_TempLightning = AddLightningEx("DRAM" , true, GetLocationX(udg_KP_DummyLoc), GetLocationY(udg_KP_DummyLoc), udg_KP_TempZ, GetLocationX(udg_KP_TempLoc), GetLocationY(udg_KP_TempLoc), udg_KP_TempZ2)
                  • Custom script: call RemoveLocation(udg_KP_TempLoc)
                  • Hashtable - Save Handle OfKP_TempLightning as KP_I of KP_UHandle in KP_Hash
              • Set KP_DamageGroup[1] = (Units within KP_AoE of KP_DummyLoc matching (((((Matching unit) is A structure) Not equal to True) and ((((Matching unit) is Magic Immune) Not equal to True) and (((Matching unit) is alive) Equal to True))) and (((Matching unit) belongs to an enemy of (Owner
              • Set KP_DamageGroup[2] = (Random 1 units from KP_DamageGroup[1])
              • -------- Starts Stun and Damage --------
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (Number of units in KP_DamageGroup[1]) Greater than 0
                • Then - Actions
                  • Unit Group - Pick every unit in KP_DamageGroup[2] and do (Actions)
                    • Loop - Actions
                      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                        • If - Conditions
                          • ((Picked unit) has buff KP_Buff) Not equal to True
                        • Then - Actions
                          • Set KP_DamageP = (Picked unit)
                          • Set KP_DamageLoc = (Position of KP_DamageP)
                          • Unit - Create 1 KP_Units[2] for (Owner of KP_DummyP) at KP_DamageLoc facing Default building facing degrees
                          • Unit - Add KP_Abilities[2] to (Last created unit)
                          • Unit - Set level of KP_Abilities[2] for (Last created unit) to KP_DummyLevels
                          • Unit - Order (Last created unit) to Human Mountain King - Storm Bolt KP_DamageP
                          • Unit - Cause KP_DummyP to damage (Picked unit), dealing KP_Damage[KP_DummyLevels] damage of attack type Spells and damage type Magic
                          • Unit - Add a 1.00 second Generic expiration timer to (Last created unit)
                          • -------- Cleans Leak --------
                          • Custom script: call RemoveLocation(udg_KP_DamageLoc)
                        • Else - Actions
                • Else - Actions
              • Hashtable - Save KP_I as 0 of KP_UHandle in KP_Hash
              • -------- Cleaning Leaks --------
              • Custom script: call RemoveLocation(udg_KP_DummyLoc)
              • Custom script: call DestroyGroup(udg_KP_DamageGroup[1])
              • Custom script: call DestroyGroup(udg_KP_DamageGroup[2])
              • Custom script: call DestroyGroup(udg_KP_TempGroup)
            • Else - Actions
              • -------- Clean up --------
              • For each (Integer KP_I) from 1 to (Load 0 of KP_UHandle from KP_Hash), do (Actions)
                • Loop - Actions
                  • Lightning - Destroy (Load KP_I of KP_UHandle in KP_Hash)
              • Unit Group - Remove KP_DummyP from KP_LightningGroup
              • Hashtable - Clear all child hashtables of child KP_UHandle in KP_Hash
Now doesnt save lightnings and create lightnings every 2 seconds.
 
Level 33
Joined
Mar 27, 2008
Messages
8,035
You are creating a Lightning once every 0.04 seconds, that's bad.

I said to look up my test map, I create 1 (ONE) Lightning per spell cast and that will save performance.

Once the Lightning has been created, you just need to move it by using MoveLightningEx (Custom script function too).

Also, if you use AddLightningEx function, that lightning created can't be referred as (Last created lightning).

You must set it via Variable (Custom script).

  • Custom script: udg_LightningVariable = AddLightingEx("NameOfLighting", true, x1, y1, z1, x2, y2, z2)
 
Status
Not open for further replies.
Top