HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

GUI Spell Help

04-01-2007, 07:10 AM#1
Dil999
I just finished a spell, Red Lightning, and I like the final result so much that I wanted to perfect it.
basically, it creates a ball of lightning at a target point. This lightning moves slowly toward the caster, dealing damage to all units it hits (can only hit once)
Once it reaches the caster, or after 9 seconds, the ball loses charge and stops.

If you see any way i could make it better, clean up a leak I missed (this is my first spell where I really tried to clean up leaks), or make it MUI, tell me.
I also added alot of trigger comments in the map, since i also made this to help out some friends trying to learn GUI.

The following is the triggers (The second one is initially off)
Trigger:
On Use
Collapse Events
Unit - A unit Starts the effect of an ability
Collapse Conditions
(Ability being cast) Equal to Red Thunder
Collapse Actions
Set TriggeringUnit = (Triggering unit)
Set TempPoint = (Target point of ability being cast)
Unit - Create 1 Dummy for (Owner of TriggeringUnit) at TempPoint facing Default building facing degrees
Set LastCreatedDummy = (Last created unit)
Unit Group - Add LastCreatedDummy to TempGroup
Custom script: call RemoveLocation( udg_TempPoint )
Wait 0.03 seconds
Trigger - Turn on Main Trigger <gen>
Wait 8.90 seconds
Trigger - Turn off Main Trigger <gen>
Trigger - Run Deactivation <gen> (ignoring conditions)
Trigger:
Main Trigger
Collapse Events
Time - Every 0.04 seconds of game time
Conditions
Collapse Actions
Set EndPoint = (Position of TriggeringUnit)
Set TempPoint = ((Position of LastCreatedDummy) offset by 13.00 towards (Angle from (Position of LastCreatedDummy) to EndPoint) degrees)
Unit - Create 1 Dummy for (Owner of TriggeringUnit) at TempPoint facing Default building facing degrees
Set LastCreatedDummy = (Last created unit)
Unit Group - Add LastCreatedDummy to TempGroup
Collapse Unit Group - Pick every unit in (Units within 100.00 of TempPoint) and do (Actions)
Collapse Loop - Actions
Collapse If (All Conditions are True) then do (Then Actions) else do (Else Actions)
Collapse If - Conditions
((Picked unit) belongs to an enemy of (Owner of TriggeringUnit)) Equal to True
((Picked unit) is in AlreadyHitUnits) Equal to False
Collapse Then - Actions
Unit - Cause TriggeringUnit to damage (Picked unit), dealing (50.00 + ((Real((Level of Red Thunder for TriggeringUnit))) x 50.00)) damage of attack type Spells and damage type Normal
Unit Group - Add (Picked unit) to AlreadyHitUnits
Else - Actions
Collapse Unit Group - Pick every unit in (Units within 10.00 of TempPoint) and do (Actions)
Collapse Loop - Actions
Collapse If (All Conditions are True) then do (Then Actions) else do (Else Actions)
Collapse If - Conditions
(Picked unit) Equal to TriggeringUnit
Collapse Then - Actions
Trigger - Turn off (This trigger)
Trigger - Run Deactivation <gen> (ignoring conditions)
Else - Actions
Custom script: call RemoveLocation( udg_TempPoint )
Trigger:
Deactivation
Events
Conditions
Collapse Actions
Unit Group - Remove all units from AlreadyHitUnits
Wait 1.00 seconds
Collapse Unit Group - Pick every unit in TempGroup and do (Actions)
Collapse Loop - Actions
Unit - Remove (Picked unit) from the game

The map is also attached.
Attached Files
File type: w3xRed Thunder.w3x (24.2 KB)
04-01-2007, 10:04 AM#2
ixmike88
Trigger:
Set TempPoint = ((Position of LastCreatedDummy) offset by 13.00 towards (Angle from (Position of LastCreatedDummy) to EndPoint) degrees)

"Position of LastCreatedDummy" leaks two locations.

Set TempPoint2=Position of LastCreatedDummy
call RemoveLocation(udg_TempPoint2)

Trigger:
Unit Group - Pick every unit in (Units within 100.00 of TempPoint) and do (Actions)

Leaks a group.

Set UnitGroup=Every unit in 100 range of TempPoint
call DestroyGrouP(udg_UnitGroup)
04-01-2007, 10:11 AM#3
Av3n
Also adding to it your 2nd trigger leaks 2 unit groups as well (even though there are based off locations)

-Av3n
04-01-2007, 03:03 PM#4
Fireeye
I overworked your spell, making it MUI, i hope i didn't forgot any leaks/bugs.
In my tests the Spell worked clean without bugs, but i'm kinda lazy atm to descripe the entire Spell, i propably will add one to this post later.
Attached Files
File type: w3xRed Thunder.w3x (24.5 KB)
04-01-2007, 05:11 PM#5
Dil999
Wow, thanks for all the help (even though I still cant make heads or tails of JASS ) And just a note, the call DestroyGrouP(udg_UnitGroup) in the second post doesnt work, the P in grouP cant be capitalized.
I redid the first 2 triggers to make them unleaky the way you said, but now it only removes dummies the first time i use them, the rest of the time the dummies stay.
Heres the triggers now. I think it has something to do with destroying those unitgroups in the last trigger, as it works without them.
Trigger:
On Use
Collapse Events
Unit - A unit Starts the effect of an ability
Collapse Conditions
(Ability being cast) Equal to Red Thunder
Collapse Actions
-------- Set the targeted position, the caster --------
Set TriggeringUnit = (Triggering unit)
Set TempPoint = (Target point of ability being cast)
-------- Create the first unit, this is so the Last Created Unit things can work (In Main Trigger), and add it to the last created dummy variable so it wont get mixed up with other units that are created --------
Unit - Create 1 Dummy for (Owner of TriggeringUnit) at TempPoint facing Default building facing degrees
Set TempPoint2 = (Position of (Last created unit))
-------- Add that unit to a unit group so it can be removed later --------
Unit Group - Add (Last created unit) to UnitGroup
-------- Clean up that point --------
Custom script: call RemoveLocation( udg_TempPoint )
-------- Turn on the main trigger, so more bolts start spawning --------
Wait 0.03 seconds
Trigger - Turn on Main Trigger <gen>
-------- Wait 9 seconds, which is the limit to how long the spell can go on for --------
Wait 8.90 seconds
-------- Turn off the unit spawinng trigger, stoping dummies from being created --------
Trigger - Turn off Main Trigger <gen>
Trigger - Run Deactivation <gen> (ignoring conditions)
Trigger:
Main Trigger
Collapse Events
Time - Every 0.04 seconds of game time
Conditions
Collapse Actions
-------- Creating Variables of the Caster's Point and the last Spark --------
Set EndPoint = (Position of TriggeringUnit)
Set TempPoint = (TempPoint2 offset by 13.00 towards (Angle from TempPoint2 to EndPoint) degrees)
-------- Creating the next spark, and add it to the last created dummy variable so it doesnt get mixed up with any other triggers that spawn stuff, and adding it to the dummy unit group, to be removed at the end --------
Unit - Create 1 Dummy for (Owner of TriggeringUnit) at TempPoint facing Default building facing degrees
Custom script: call RemoveLocation( udg_TempPoint2 )
Set TempPoint2 = (Position of (Last created unit))
Unit Group - Add (Last created unit) to UnitGroup
-------- Deal Damage --------
Set UnitGroup2 = (Units within 100.00 of TempPoint)
Collapse Unit Group - Pick every unit in UnitGroup2 and do (Actions)
Collapse Loop - Actions
Collapse If (All Conditions are True) then do (Then Actions) else do (Else Actions)
Collapse If - Conditions
((Picked unit) belongs to an enemy of (Owner of TriggeringUnit)) Equal to True
((Picked unit) is in UnitGroup2) Equal to False
Collapse Then - Actions
Unit - Cause TriggeringUnit to damage (Picked unit), dealing (50.00 + ((Real((Level of Red Thunder for TriggeringUnit))) x 50.00)) damage of attack type Spells and damage type Normal
Unit Group - Add (Picked unit) to UnitGroup2
Else - Actions
-------- Stop the lightning when its too near to the caster --------
Set UnitGroup2 = (Units within 10.00 of TempPoint)
Collapse Unit Group - Pick every unit in UnitGroup2 and do (Actions)
Collapse Loop - Actions
Collapse If (All Conditions are True) then do (Then Actions) else do (Else Actions)
Collapse If - Conditions
(Picked unit) Equal to TriggeringUnit
Collapse Then - Actions
Trigger - Turn off (This trigger)
Trigger - Run Deactivation <gen> (ignoring conditions)
Else - Actions
-------- Clean up the point --------
Custom script: call RemoveLocation( udg_TempPoint )
Trigger:
Deactivation
Events
Conditions
Collapse Actions
Unit Group - Remove all units from UnitGroup2
-------- Wait, so the effects can finish (so they dont get removed abruptly) --------
Wait 1.00 seconds
-------- Remove the dummies, and clean up the unit group --------
Collapse Unit Group - Pick every unit in UnitGroup and do (Actions)
Collapse Loop - Actions
Unit - Remove (Picked unit) from the game
Custom script: call DestroyGroup(udg_UnitGroup)
Custom script: call DestroyGroup(udg_UnitGroup2)

Ignore those comments, they havent been changed since the first time i made it.

Edit: attached the map
Attached Files
File type: w3xRed Thunder.w3x (24.5 KB)
04-01-2007, 06:07 PM#6
akolyt0r
still some bugs left ...see pic -.-
+make the dummy unit not use any upkeep ^^

Zoom (requires log in)
set main trigger to off at the beginning -.-

isnt quite unimportant to clean the groups and points since they are globals !?
04-01-2007, 06:17 PM#7
Dil999
Yeah.. idk why Main Trigger was on. Anyways, I fixed the problem I said 2 posts above because i wasnt recreating the Groups. Heres the final nonleaky (I Hope) nonMUI result. If anyone knows how I could make this MUI, tell me.
Trigger:
On Use
Collapse Events
Unit - A unit Starts the effect of an ability
Collapse Conditions
(Ability being cast) Equal to Red Thunder
Collapse Actions
-------- Set the targeted position, the caster --------
Set TriggeringUnit = (Triggering unit)
Set TempPoint = (Target point of ability being cast)
-------- Create the first unit, this is so the Last Created Unit things can work (In Main Trigger), and add it to the last created dummy variable so it wont get mixed up with other units that are created --------
Unit - Create 1 Dummy for (Owner of TriggeringUnit) at TempPoint facing Default building facing degrees
Set TempPoint2 = (Position of (Last created unit))
-------- Add that unit to a unit group so it can be removed later --------
Unit Group - Add (Last created unit) to UnitGroup
-------- Clean up that point --------
Custom script: call RemoveLocation( udg_TempPoint )
-------- Turn on the main trigger, so more bolts start spawning --------
Wait 0.03 seconds
Trigger - Turn on Main Trigger <gen>
-------- Wait 9 seconds, which is the limit to how long the spell can go on for --------
Wait 8.90 seconds
-------- Turn off the unit spawinng trigger, stoping dummies from being created --------
Trigger - Turn off Main Trigger <gen>
Trigger - Run Deactivation <gen> (ignoring conditions)
Trigger:
Main Trigger (Starts out off)
Collapse Events
Time - Every 0.04 seconds of game time
Conditions
Collapse Actions
-------- Creating Variables of the Caster's Point and the last Spark --------
Set EndPoint = (Position of TriggeringUnit)
Set TempPoint = (TempPoint2 offset by 13.00 towards (Angle from TempPoint2 to EndPoint) degrees)
-------- Creating the next spark, and add it to the last created dummy variable so it doesnt get mixed up with any other triggers that spawn stuff, and adding it to the dummy unit group, to be removed at the end --------
Unit - Create 1 Dummy for (Owner of TriggeringUnit) at TempPoint facing Default building facing degrees
Custom script: call RemoveLocation( udg_TempPoint2 )
Set TempPoint2 = (Position of (Last created unit))
Unit Group - Add (Last created unit) to UnitGroup
-------- Deal Damage --------
Set UnitGroup2 = (Units within 100.00 of TempPoint)
Collapse Unit Group - Pick every unit in UnitGroup2 and do (Actions)
Collapse Loop - Actions
Collapse If (All Conditions are True) then do (Then Actions) else do (Else Actions)
Collapse If - Conditions
((Picked unit) belongs to an enemy of (Owner of TriggeringUnit)) Equal to True
((Picked unit) is in UnitGroup3) Equal to False
Collapse Then - Actions
Unit - Cause TriggeringUnit to damage (Picked unit), dealing (50.00 + ((Real((Level of Red Thunder for TriggeringUnit))) x 50.00)) damage of attack type Spells and damage type Normal
Unit Group - Add (Picked unit) to UnitGroup3
Else - Actions
-------- Stop the lightning when its too near to the caster --------
Set UnitGroup2 = (Units within 10.00 of TempPoint)
Collapse Unit Group - Pick every unit in UnitGroup2 and do (Actions)
Collapse Loop - Actions
Collapse If (All Conditions are True) then do (Then Actions) else do (Else Actions)
Collapse If - Conditions
(Picked unit) Equal to TriggeringUnit
Collapse Then - Actions
Trigger - Turn off (This trigger)
Trigger - Run Deactivation <gen> (ignoring conditions)
Else - Actions
-------- Clean up the point --------
Custom script: call RemoveLocation( udg_TempPoint )
Trigger:
Deactivation
Events
Conditions
Collapse Actions
Unit Group - Remove all units from UnitGroup2
-------- Wait, so the effects can finish (so they dont get removed abruptly) --------
Wait 1.00 seconds
-------- Remove the dummies, and clean up the unit group --------
Collapse Unit Group - Pick every unit in UnitGroup and do (Actions)
Collapse Loop - Actions
Unit - Remove (Picked unit) from the game
Custom script: call DestroyGroup(udg_UnitGroup)
Custom script: call DestroyGroup(udg_UnitGroup2)
Custom script: call DestroyGroup(udg_UnitGroup3)
Custom script: set udg_UnitGroup = CreateGroup()
Custom script: set udg_UnitGroup2 = CreateGroup()
Custom script: set udg_UnitGroup3 = CreateGroup()
04-01-2007, 07:17 PM#8
akolyt0r
im workin on it -.-

edit: i wont work without ...JASS
edit2: you will need extreme much jass ..to make it fully MUI...i think i cant do that ..i can only make it possible that every player can have one hero with this ability...
04-01-2007, 08:12 PM#9
akolyt0r
i changed all the variables to arrays using the playernumber as index...
in order to do that properly i changed much of the actions into JASS

But it isnt MUI yet, because when Maintrigger starts via the periodic event it wont get the right integer yet, when more than one player uses the ability at the same time
04-01-2007, 08:25 PM#10
Fireeye
Well, my version should be completly MUI and is easy to configure, but it's 100% in JASS, uses gamecache and i was too lazy till now to search for leaks/bugs.
04-01-2007, 09:03 PM#11
akolyt0r
indeed your version is just superior ^^..
but on the other side its very hard to understand for people who are new to jass ...i had also some problems ..i first tought it isnt MUI till i found this: "local string s = I2S(H2I(t))" you could add some more explanations ^^

nevertheless ...my version works now too ...
its NOT FULLY MUI, but every player can have 1 hero with this ability...
(at least i think it should work...but im 2 lazy to test it)

..
04-01-2007, 09:36 PM#12
Dil999
We should just turn this into a contest..
Anyways, I forgot to mention that this doesn't need to be MUI for the map its going into (a hero defense), but it would be cool to have it MUI.
04-01-2007, 09:58 PM#13
akolyt0r
contest is crap ...caus its impossible to make it fully MUI in GUI..
If you want MUI then take Fireeyes Jass version...
if my pseudo-MUI is enough for you ...well you decide ^^
04-01-2007, 10:47 PM#14
Dil999
I'm probably gonna stick with my own, as I'm most familiar with it and I know how to easily change it.