I'm trying to create a channeled spell which requires creating a lightning effect from point a to b. I can't understand why it works properly only on first cast (when 2 simultaneous instances are active).
it would be better to post the triggers here directly i guess. i for example do not have access to the world editor right now and maybe others havent as well.
triggering problems like the ones you mentioned are most of the time found by attentively looking at the code.
-------- Refreshing the location of the target. --------
Hashtable - Save Handle Of(Position of (Load (Key target) of (Key (Picked unit)) in Surge_Hash)) as (Key targetloc) of (Key (Picked unit)) in Surge_Hash
-------- Then checking that spell channeling can still continue, and making everything happen if it can. --------
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(Load (Key duration) of (Key (Picked unit)) from Surge_Hash) Greater than 0.00
((Picked unit) is alive) Equal to True
((Load (Key target) of (Key (Picked unit)) in Surge_Hash) is alive) Equal to True
(Distance between (Load (Key casterloc) of (Key (Picked unit)) in Surge_Hash) and (Load (Key targetloc) of (Key (Picked unit)) in Surge_Hash)) Less than (Load (Key radius) of (Key (Picked unit)) from Surge_Hash)
Then - Actions
-------- Stage 1 of channeled beam --------
-------- IF NEEDED, MODIFY THE LIGHTNING EFFECT HERE! --------
Lightning - Create a Chain Lightning - Secondary lightning effect from source (Load (Key casterloc) of (Key (Picked unit)) in Surge_Hash) to target (Load (Key targetloc) of (Key (Picked unit)) in Surge_Hash)
Hashtable - Save Handle Of(Last created lightning effect) as (Key low) of (Key (Picked unit)) in Surge_Hash
Hashtable - Save (Load (Key damage low) of (Key (Picked unit)) from Surge_Hash) as (Key damage) of (Key (Picked unit)) in Surge_Hash
-------- Stage 2 of channeled beam --------
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(Load (Key duration) of (Key (Picked unit)) from Surge_Hash) Less than ((Surge_Duration / 3.00) x 2.00)
Then - Actions
-------- IF NEEDED, MODIFY THE LIGHTNING EFFECT HERE! --------
Lightning - Create a Chain Lightning - Primary lightning effect from source (Load (Key casterloc) of (Key (Picked unit)) in Surge_Hash) to target (Load (Key targetloc) of (Key (Picked unit)) in Surge_Hash)
Hashtable - Save Handle Of(Last created lightning effect) as (Key med) of (Key (Picked unit)) in Surge_Hash
Hashtable - Save (Load (Key damage med) of (Key (Picked unit)) from Surge_Hash) as (Key damage) of (Key (Picked unit)) in Surge_Hash
-------- Stage 3 of channeled beam --------
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(Load (Key duration) of (Key (Picked unit)) from Surge_Hash) Less than (Surge_Duration / 3.00)
Then - Actions
-------- IF NEEDED, MODIFY THE LIGHTNING EFFECT HERE! --------
Lightning - Create a Forked Lightning lightning effect from source (Load (Key casterloc) of (Key (Picked unit)) in Surge_Hash) to target (Load (Key targetloc) of (Key (Picked unit)) in Surge_Hash)
Hashtable - Save Handle Of(Last created lightning effect) as (Key high) of (Key (Picked unit)) in Surge_Hash
Hashtable - Save (Load (Key damage high) of (Key (Picked unit)) from Surge_Hash) as (Key damage) of (Key (Picked unit)) in Surge_Hash
Else - Actions
Else - Actions
-------- Actually damaging the target --------
Unit - Cause (Picked unit) to damage (Load (Key target) of (Key (Picked unit)) in Surge_Hash), dealing (Load (Key damage) of (Key (Picked unit)) from Surge_Hash) damage of attack type Spells and damage type Normal
-------- Optional, additional eye-candy. --------
Special Effect - Create a special effect attached to the origin of (Picked unit) using Surge_Effect
Special Effect - Destroy (Last created special effect)
Special Effect - Create a special effect attached to the origin of (Load (Key target) of (Key (Picked unit)) in Surge_Hash) using Surge_Effect
Special Effect - Destroy (Last created special effect)
Else - Actions
-------- When channeling cannot continue, it won't. Clearing data from cast. --------
Unit - Order (Picked unit) to Stop
Hashtable - Clear all child hashtables of child (Key (Picked unit)) in Surge_Hash
Unit Group - Remove (Picked unit) from Surge_Group
In greater detail, it works perfectly when used once at a time. While used multiple times simultaneously, it works properly once. After that, the lightning effects are created at the caster which casted previously.
No it shouldn't although the key picked unit will make it only one instance per unit. I haven't done this in GUI. I can recommend you to start with JASS or indexing
Can they? There's a trigger in the map which stops the loop if the casters stops channeling. Plus, that's not my problem anyways. It is that the first stage (the first lightning effect) works as it should on as many simultaneous casters as needed. The second and third stages (read: lightning effects) do not work as intended (except for the first time casting multiple instances simultaneously). How would I go about fixing it? Have you really even checked the map in the first post?
Yes I have and now when I open it again I got it. It leaks alot as you never set any locations, you just stores the position which also creates a leak. Forgot about the last trigger totally btw.
Trigger:
Hashtable - Save Handle Of(Position of (Triggering unit)) as (Key casterloc) of (Key (Triggering unit)) in Surge_Hash
Hashtable - Save Handle Of(Position of (Target unit of ability being cast)) as (Key targetloc) of (Key (Triggering unit)) in Surge_Hash
And
Trigger:
Hashtable - Save Handle Of(Position of (Load (Key target) of (Key (Picked unit)) in Surge_Hash)) as (Key targetloc) of (Key (Picked unit)) in Surge_Hash
Also this is very inefficient as it destroys and creates new lightning effect every 0.05. Maybe you should try to use "Move Lightning"?
You maybe should use booleans instead of calculating each stage? So when the duration is set you check an if "your calc" + "your boolean == false" and if so you set the boolean to true.
EDIT: Dag nabbit, I set them to another hashtable I didn't use in the map -- now it works like a charm. I don't know, maybe destroying the effects all the time made it off-sync or something. Thanks, baassee, and +rep for your efforts.
EDIT 2: Can't give rep again, but you have my thanks
Finally finding about some of the bots that are flooding the users online - bytespider apparently is a huge offender here - ignores robots.txt and comes in from a ton of different IPs
Ghan has said he has fixed this. Monovertex please confirm this fix. This was only a problem with people that had signatures in the upper levels like not the special members but the respected members.