# Help to fix a spell trigger?

#### Warplord

##### Cool Member
Ok, hello guys.
I want to make a spell that basically creates a boulder that moves forward and can only hit a unit ONCE for (75 x Lvl of ability) damage.

Here are my triggers:

cast

Rolling Bouldr Cast
Events
Unit - A unit Starts the effect of an ability
Conditions
(Ability being cast) Equal to Rolling Boulder
Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
RB_Index Equal to 0
Then - Actions
Trigger - Turn on Rolling Bouldr Loop <gen>
Else - Actions
Set RB_Index = (RB_Index + 1)
Set RB_MUI = (RB_MUI + 1)
Set RB_check[RB_MUI] = True
Set TempLoc[1] = (Position of (Casting unit))
Set TempLoc[2] = (Target point of ability being cast)
Set RB_Angle[RB_MUI] = (Angle from TempLoc[1] to TempLoc[2])
Set TempLoc[3] = (TempLoc[1] offset by 17.00 towards RB_Angle[RB_MUI] degrees)
Unit - Create 1 Spell Dummy for (Owner of (Casting unit)) at TempLoc[1] facing RB_Angle[RB_MUI] degrees
Animation - Change (Last created unit)'s size to (350.00%, 350.00%, 350.00%) of its original size
Animation - Change (Last created unit)'s animation speed to 65.00% of its original speed
Special Effect - Create a special effect attached to the origin of (Last created unit) using abilities\weapons\catapult\catapultmissile.mdl
Set RB_Boulder[RB_MUI] = (Last created unit)
Set RB_Distance[RB_MUI] = 800.00
Set RB_Distance_Traveled[RB_MUI] = 0.00
Set RB_Speed[RB_MUI] = 6.20
Set RB_Damage[RB_MUI] = (75.00 x (Real((Level of Rolling Boulder for (Casting unit)))))
Custom script: call RemoveLocation(udg_TempLoc[1])
Custom script: call RemoveLocation(udg_TempLoc[2])
Custom script: call RemoveLocation(udg_TempLoc[3])
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(Level of Binding Slam for (Casting unit)) Greater than 0
Then - Actions
Set BS_Level = (Level of Binding Slam for (Casting unit))
Set TempLoc[1] = (Position of (Casting unit))
Unit - Create 1 Spell Dummy for (Owner of (Casting unit)) at TempLoc[1] facing Default building facing degrees
Unit - Add dummy_BS_clap to (Last created unit)
Unit - Set level of dummy_BS_clap for (Last created unit) to BS_Level
Unit - Order (Last created unit) to Human Mountain King - Thunder Clap
Unit - Add a 2.00 second Generic expiration timer to (Last created unit)
Custom script: call RemoveLocation(udg_TempLoc[1])
Else - Actions

loop

Rolling Bouldr Loop
Events
Time - Every 0.03 seconds of game time
Conditions
Actions
For each (Integer RB_loop) from 1 to RB_MUI, do (Actions)
Loop - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
RB_check[RB_loop] Equal to True
Then - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
RB_Distance_Traveled[RB_loop] Less than RB_Distance[RB_MUI]
Then - Actions
Set TempLoc[1] = (Position of RB_Boulder[RB_loop])
Set TempLoc[2] = (TempLoc[1] offset by RB_Speed[RB_loop] towards RB_Angle[RB_loop] degrees)
Unit - Move RB_Boulder[RB_loop] instantly to TempLoc[2]
Special Effect - Create a special effect at TempLoc[1] using Abilities\Spells\Other\Volcano\VolcanoDeath.mdl
Special Effect - Destroy (Last created special effect)
Set RB_Distance_Traveled[RB_loop] = (RB_Distance_Traveled[RB_loop] + RB_Speed[RB_loop])
Set TempGroup[1] = (Units within 45.00 of TempLoc[2] matching ((((Matching unit) is A structure) Equal to False) and ((((Matching unit) is dead) Equal to False) and ((((Matching unit) belongs to an enemy of (Owner of RB_Boulder[RB_loop])) Equal to True) and (((Matching unit) is
Unit Group - Pick every unit in TempGroup[1] and do (Actions)
Loop - Actions
Unit - Cause RB_Boulder[RB_loop] to damage (Picked unit), dealing RB_Damage[RB_loop] damage of attack type Spells and damage type Universal
Unit Group - Remove all units from TempGroup[1]
Custom script: call DestroyGroup(udg_TempGroup[1])
Custom script: call RemoveLocation(udg_TempLoc[1])
Custom script: call RemoveLocation(udg_TempLoc[2])
Else - Actions
Set TempLoc[1] = (Position of RB_Boulder[RB_loop])
Unit - Kill RB_Boulder[RB_loop]
Unit - Remove RB_Boulder[RB_loop] from the game
Special Effect - Create a special effect at TempLoc[1] using Objects\Spawnmodels\Human\HCancelDeath\HCancelDeath.mdl
Special Effect - Destroy (Last created special effect)
-------- -------------------- --------
Set RB_Index = (RB_Index - 1)
-------- -------------------- --------
Set RB_Boulder[RB_loop] = No unit
Set RB_Angle[RB_loop] = 0.00
Set RB_Distance[RB_loop] = 0.00
Set RB_Distance_Traveled[RB_loop] = 0.00
Set RB_Speed[RB_loop] = 0.00
Set RB_Damage[RB_loop] = 0.00
Unit Group - Remove all units from RB_AlreadyHit[RB_loop]
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
RB_Index Equal to 0
Then - Actions
Trigger - Turn off (This trigger)
Set RB_MUI = 0
Else - Actions
Else - Actions

Ecerything seemed to work fine with moving and the spells looks MUI etc but the damage is applied every 0.03 seconds inspite of my check for unit is in group "AlreadyHit". Any idea where I was wrong? And also if u find any wrong or not good parts of the spell - pls infor me!

Ty very much

P.S
Apparently I cant make it look like GUI, if anyone knows how to - pls say so and I will.

#### thorhunter

##### You can change this now in User CP.
Use [<wc3>] tags (without <>)

Code:
``Set RB_AlreadyHit[RB_MUI] = RB_AlreadyHit[RB_MUI]``
Code:
``Custom script: call DestroyGroup(udg_RB_AlreadyHit[udg_RB_loop])``
From what I see, these two don't corespond. You should use 'empty group' or something when initializing the group.

Also:
Code:
``Set TempGroup[1] = (Units within 45.00 of TempLoc[2] matching ((((Matching unit) is A structure) Equal to False) and ((((Matching unit) is dead) Equal to False) and ((((Matching unit) belongs to an enemy of (Owner of RB_Boulder[RB_loop])) Equal to True) and (((Matching unit) is``
Some of this lane is missing, perhaps it would be easier for you to cut some of these requirements and put the rest in the 'If/then/else statement'.[/wc3]

#### Warplord

##### Cool Member
1. you are right.
This line is illogical and not right, Ijust don't find a preset value of "Empty group" or something like that? What should I use ?

2. The line cheks 4 things:
unit building = false
unit enemy = true
unit is in RB_AlreadyHit = false

Any idea how to make the loop trigger 'read' the correct group or something?

#### thorhunter

##### You can change this now in User CP.
Another faulty line:
Code:
``RB_Distance_Traveled[RB_loop] Less than RB_Distance[RB_MUI]``
From what I remember you could possibly use UnitGroup->convert unit to unit group-> no unit, but if there's no empty group preset I'm not sure whether it would work. Theoretically it should, since there is 'Unit group is empty' boolean check.

#### Warplord

##### Cool Member
I do not hink there is such an option in the Set variable line. I know it exists but it is not there. Perhaps "= Last created unit group should work" OR something?

#### Imp Midna

##### Active Member
Preset would be pointless because if you use destroy group on a variable using the preset, the preset would be dead. There is no "create new unitgroup" in gui because there also is no "destroy unit group" in guy, and this function would do nothing but leak unless you use destroy unitgroup somewhere, which requires custom script, and if you use custom script to destroy it, you could just as well use custom script to create a new empty one.
In words:
Trigger:
• Custom Script: set udg_RB_AllreadyHit[RB_MUI] = CreateGroup() //&lt;--- new empty group

Oc, thinking about how you destroy it and then create a new empty group, you might as well ask yourself if simply clearing the unit group would do the same work. (i must confess i didnt look into your triggers so i dont know)

edit:
"P.S
Apparently I cant make it look like GUI, if anyone knows how to - pls say so and I will."

waiting ^.^
note: go in the "More Options" part first, THEN paste your trigger between the wc3 tags. Else, shit will happen.

#### thorhunter

##### You can change this now in User CP.
He's not destroying the group using preset, he destroys it then presets.

#### Warplord

##### Cool Member
This custom scrip is Exactly what I needed and it works perfectly. Tyvm for help

General chit-chat
Help Users
• No one is chatting at the moment.
• jonas:
• The Helper:
Have a great vacation Tom!
• The Helper:
Happy Friday Night!
+1
• V-SNES:
Happy Friday Night!
+1
• The Helper:
Going out of a town for the weekend will be back sunday night! Hope everyone has a great weekend!
+2
• The Helper:
Happy Monday!
• Ghan:
Monday? Speak for yourself.
+2
• The Helper:
Happy Taco Tuesday!
+1
• The Helper:
Tacos!
• The Helper:
Check out the discord for taco pictures You cannot put pictures in this chat
+1
• The Helper:
Damn here come the bots again - 193 online but they are totally invisible to any stats - bunch of bots!'
• C cubanismo:
Re: Taco Tuesday, if there were some way to share edible tacos over the internet, technology would be complete.
+2
• The Helper:
One can only wish!
• tom_mai78101:
I'm back from Taiwan
+1
• The Helper:
I am reorganizing the site I know nobody will notice but I am not done quite yet but the main forums order has been changed and there is a new news category in Other News which is all the remaining headline news stuff not categorized - Headline News is just the stuff that shows on the main page now and the news archive is off the main forums page
• The Helper:
and the real archive lives off of headline news
• The Helper:
Happy Monday!

### Members online

No members online now.