HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Splitting Fireball Help

06-23-2006, 10:05 AM#1
TGhost
Hi All

So the basic idea of the spell im trying to make is that the caster throws a fireball at the target unit, then after abit of time (0.75 Seconds), the fireball splits into new fireballs, 6 on last level, each fireball finds a random valid target within 500 range. The spell works great first time and then starts not really working next time? Something must be ruining the trigger, but i cant seem to find the problem. Since the first time everything is working as intented.
Heres the trigger itself
Trigger:
Bouncing Fireball
Collapse Events
Unit - A unit Starts the effect of an ability
Collapse Conditions
(Ability being cast) Equal to Splitting Fireball
Collapse Actions
Set Caster = (Casting unit)
Set Temp_Point = (Position of (Casting unit))
Unit - Create 1 Dummy Unit for (Owner of Caster) at Temp_Point facing Default building facing degrees
Custom script: call RemoveLocation(udg_Temp_Point)
Unit - Add a 2.00 second Generic expiration timer to (Last created unit)
Unit - Add Firebolt (Splitting Fireball) to (Last created unit)
Unit - Set level of Firebolt (Splitting Fireball) for (Last created unit) to (Level of Caster)
Set Temp_Target = (Target unit of ability being cast)
Unit - Order (Last created unit) to Neutral - Firebolt Temp_Target
Set Temp_Point = (Position of Temp_Target)
Wait 0.75 seconds
Collapse Unit Group - Pick every unit in (Units within 500.00 of Temp_Point matching (((Owner of (Matching unit)) is an enemy of (Owner of Caster)) Equal to True)) and do (Actions)
Collapse Loop - Actions
Unit Group - Add (Picked unit) to Temp_Group
Unit Group - Remove Temp_Target from Temp_Group
Collapse Unit Group - Pick every unit in (Random ((Level of Splitting Fireball for Caster) + 2) units from Temp_Group) and do (Actions)
Collapse Loop - Actions
Unit - Create 1 Dummy Unit for (Owner of Caster) at Temp_Point facing Default building facing degrees
Unit - Add a 3.00 second Generic expiration timer to (Last created unit)
Unit - Add Firebolt (Splitting Fireball) to (Last created unit)
Unit - Set level of Firebolt (Splitting Fireball) for (Last created unit) to (Level of Caster)
Unit - Order (Last created unit) to Neutral - Firebolt (Picked unit)
Custom script: call RemoveLocation(udg_Temp_Point)
Unit Group - Remove all units from Temp_Group
Thanks in advance

P.S Please tell me if there are any memory leaks, im trying to learn how to get rid of them all.
06-23-2006, 10:51 AM#2
yuripro84
I don't know much about how this trigger is working, and don't know a whole lot about certain variable types, but could it be possible that without clearing these variables, something went wrong? Maybe you did too, i don't really know. I am tired too.

Set Caster=(Casting unit)
Set Temp_Target=(Target unit of ability being cast)

I think the second one is ok, but you never cleared the variable labled Caster, did you?
06-23-2006, 10:56 AM#3
TGhost
well, i dont think there would be any need to clear the caster variable. Since its a global varibale it can just be reassigned the next time the spell is casted.
Atleast as far as i know, someone correct me if im wrong.
06-23-2006, 11:40 AM#4
Rising_Dusk
Clearing it wont matter since you reset it the next instance of the spell.
It's only a problem if you can cast another time before the spell finishes the first time.

I recommend setting (last created unit) to a variable as well. GetLastCreatedUnit() is problematic in many cases.

Also, TriggerSleepAction(...) is problematic in most cases too since it's delayed. [Im referring to the wait]
Perhaps consider using a countdown timer instead.

Other than that, it looks ok to me.
I would imagine some other trigger must interfere if this isnt working past the first time. Either that or what I noted above.