I'm trying to make a channel system for an ORPG i'm developing but its not working quite right.
Basically, a unit casts a spell and saves the casting time of the ability and the trigger that is to be run when the channel is finished to the casting unit. I then run through a periodic to check if the channel is interrupted for some reason (if the unit moves or is stunned). Once the casting time is reached, the channel is stopped and the saved trigger is run.
I made a test ability that should have a 2.5 second casting time. My problem is for some reason the channel is almost instantanious instead of taking 2.5 seconds.
Here are the triggers, any help would be appreciated!
Channel System
Test Ability (2.5 sec. cast)
EDIT - btw, I ran a test and when the channel finishes the casting count and casting time are both -1590.22 instead of 2.5 like they should be.
Basically, a unit casts a spell and saves the casting time of the ability and the trigger that is to be run when the channel is finished to the casting unit. I then run through a periodic to check if the channel is interrupted for some reason (if the unit moves or is stunned). Once the casting time is reached, the channel is stopped and the saved trigger is run.
I made a test ability that should have a 2.5 second casting time. My problem is for some reason the channel is almost instantanious instead of taking 2.5 seconds.
Here are the triggers, any help would be appreciated!
Channel System
-
Channel Hashtable
-
Events
-
Time - Elapsed game time is 0.50 seconds
-
-
Conditions
-
Actions
-
Hashtable - Create a hashtable
-
Set HASHTABLE_channel = (Last created hashtable)
-
Trigger - Turn on Channel Periodic <gen>
-
-
-
Channel Periodic
-
Events
-
Time - Every 0.05 seconds of game time
-
-
Conditions
-
Actions
-
Unit Group - Pick every unit in CHANNEL_unitgroup and do (Actions)
-
Loop - Actions
-
-------- ---------------------------------------------------------------- --------
-
-------- Checks to see if the unit has moved from the last periodic proc --------
-
-------- ---------------------------------------------------------------- --------
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
-
(Load (Integer(casting count)) of (Custom value of (Picked unit)) from HASHTABLE_channel) Greater than 0.00
-
-
Then - Actions
-
Hashtable - Save (X of (Position of (Picked unit))) as (Integer(pos1x)) of (Custom value of (Picked unit)) in HASHTABLE_channel
-
Hashtable - Save (Y of (Position of (Picked unit))) as (Integer(pos1y)) of (Custom value of (Picked unit)) in HASHTABLE_channel
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
-
Or - Any (Conditions) are true
-
Conditions
-
(Load (Integer(pos1x)) of (Custom value of (Picked unit)) from HASHTABLE_channel) Not equal to (Load (Integer(pos2x)) of (Custom value of (Picked unit)) from HASHTABLE_channel)
-
(Load (Integer(pos1y)) of (Custom value of (Picked unit)) from HASHTABLE_channel) Not equal to (Load (Integer(pos2y)) of (Custom value of (Picked unit)) from HASHTABLE_channel)
-
-
-
-
Then - Actions
-
Set BOOLEAN_temp = True
-
-
Else - Actions
-
-
Hashtable - Save (X of (Position of (Picked unit))) as (Integer(pos2x)) of (Custom value of (Picked unit)) in HASHTABLE_channel
-
Hashtable - Save (Y of (Position of (Picked unit))) as (Integer(pos2y)) of (Custom value of (Picked unit)) in HASHTABLE_channel
-
-
Else - Actions
-
Hashtable - Save (X of (Position of (Picked unit))) as (Integer(pos2x)) of (Custom value of (Picked unit)) in HASHTABLE_channel
-
Hashtable - Save (Y of (Position of (Picked unit))) as (Integer(pos2y)) of (Custom value of (Picked unit)) in HASHTABLE_channel
-
-
-
-------- ------------------------------------------------------------------------------------------------ --------
-
-------- If the unit has moved, or if it has been stunned, then the channel is exited --------
-
-------- ------------------------------------------------------------------------------------------------ --------
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
-
Or - Any (Conditions) are true
-
Conditions
-
((Picked unit) has buff Stunned (Pause)) Equal to True
-
BOOLEAN_temp Equal to True
-
-
-
-
Then - Actions
-
Set BOOLEAN_temp = False
-
Hashtable - Save 0.00 as (Integer(casting time)) of (Custom value of (Picked unit)) in HASHTABLE_channel
-
Unit Group - Remove (Picked unit) from CHANNEL_unitgroup
-
-
Else - Actions
-
-------- ---------------------------------------------------------------- --------
-
-------- Adds the .05 seconds that have passed since the last periodic proc to the casting count --------
-
-------- ---------------------------------------------------------------- --------
-
Hashtable - Save ((Load (Integer(casting count)) of (Custom value of (Picked unit)) from HASHTABLE_channel) + 0.05) as (Integer(casting count)) of (Custom value of (Picked unit)) in HASHTABLE_channel
-
-------- ---------------------------------------------------------------- --------
-
-------- If the casting count is equal to the casting time then the channel is exited and the saved trigger is run --------
-
-------- ---------------------------------------------------------------- --------
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
-
(Load (Integer(casting count)) of (Custom value of (Picked unit)) from HASHTABLE_channel) Greater than or equal to (Load (Integer(casting time)) of (Custom value of (Picked unit)) from HASHTABLE_channel)
-
-
Then - Actions
-
Hashtable - Save 0.00 as (Integer(casting count)) of (Custom value of (Picked unit)) in HASHTABLE_channel
-
Unit Group - Remove (Picked unit) from CHANNEL_unitgroup
-
Trigger - Run (Load (Integer(trigger)) of (Custom value of (Picked unit)) in HASHTABLE_channel) (ignoring conditions)
-
-
Else - Actions
-
-
-
-
-
-
-
Test Ability (2.5 sec. cast)
-
Judgement Cast
-
Events
-
Unit - A unit Starts the effect of an ability
-
-
Conditions
-
(Ability being cast) Equal to Judgement
-
-
Actions
-
-------- ---------------------------------------------------------------- --------
-
-------- TEST ABILITY - saves the casting time and the trigger to run when the channel is complete to the unit --------
-
-------- ---------------------------------------------------------------- --------
-
Hashtable - Save 2.50 as (Integer(casting time)) of (Custom value of (Triggering unit)) in HASHTABLE_channel
-
Hashtable - Save Handle OfJudgement Finish <gen> as (Integer(trigger)) of (Custom value of (Triggering unit)) in HASHTABLE_channel
-
Animation - Play (Triggering unit)'s spell channel animation
-
Unit Group - Add (Triggering unit) to CHANNEL_unitgroup
-
-
-
Judgement Finish
-
Events
-
Conditions
-
Actions
-
-------- ---------------------------------------------------------------- --------
-
-------- This trigger runs when the channel is complete --------
-
-------- ---------------------------------------------------------------- --------
-
Quest - Display to (All players) the Quest Update message: CASTING FINISHED!
-
-
EDIT - btw, I ran a test and when the channel finishes the casting count and casting time are both -1590.22 instead of 2.5 like they should be.