• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

[Trigger] MUI Charge Spell

Status
Not open for further replies.
Level 8
Joined
Mar 26, 2009
Messages
301
What I am trying to acomplish is making a MUI Charge (slide) spell that drags nearby units with caster as well. I am too tired of working that right now, I am blanking stupidly at at the screen =) Triggers are:
  • Charge
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Charge
    • Actions
      • Set Charge_Caster[Charge_Current_Index] = (Triggering unit)
      • Set Charge_Current_Index = (Charge_Current_Index + 1)
      • If (Charge_Current_Index Equal to 30) then do (Set Charge_Current_Index = 0) else do (Do nothing)
      • Unit - Turn collision for Charge_Caster[Charge_Current_Index] Off
  • Charge Movement
    • Events
      • Time - Every 0.02 seconds of game time
    • Conditions
    • Actions
      • For each (Integer A) from 0 to 30, do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Charge_Caster[(Integer A)] has buff Charge ) Not equal to True
            • Then - Actions
              • Unit - Turn collision for Charge_Caster[(Integer A)] On
              • Set Charge_Caster[(Integer A)] = No unit
            • Else - Actions
              • Unit - Turn collision for Charge_Caster[(Integer A)] Off
              • Set LOC_TEMP_Charge_Caster = (Position of Charge_Caster[(Integer A)])
              • Unit - Move Charge_Caster[(Integer A)] instantly to (LOC_TEMP_Charge_Caster offset by 15.00 towards (Facing of Charge_Caster[(Integer A)]) degrees)
              • Special Effect - Create a special effect attached to the origin of Charge_Caster[(Integer A)] using Abilities\Weapons\AncientProtectorMissile\AncientProtectorMissile.mdl
              • Special Effect - Destroy (Last created special effect)
              • Custom script: call RemoveLocation (udg_LOC_TEMP_Charge_Caster)
              • Set Charge_Target_Group = (Units within 150.00 of LOC_TEMP_Charge_Caster matching ((((Matching unit) is A structure) Not equal to True) and (((Unit-type of (Matching unit)) Not equal to Turret) and (((Unit-type of (Matching unit)) Not equal to Heavy Turret) or ((Unit-type of (Matching
              • Set INT_A_Conversion = (Integer A)
              • Set LOC_TEMP_Charge_Caster = (Position of Charge_Caster[INT_A_Conversion])
              • Unit Group - Pick every unit in Charge_Target_Group and do (Actions)
                • Loop - Actions
                  • Set LOC_TEMP_Charge_Picked = (Position of (Picked unit))
                  • Unit - Cause Charge_Caster[INT_A_Conversion] to damage (Picked unit), dealing 10.00 damage of attack type Spells and damage type Normal
                  • Unit - Move (Picked unit) instantly to (LOC_TEMP_Charge_Picked offset by 15.00 towards (Angle from LOC_TEMP_Charge_Caster to LOC_TEMP_Charge_Picked) degrees)
                  • Special Effect - Create a special effect attached to the origin of (Picked unit) using Objects\Spawnmodels\Undead\ImpaleTargetDust\ImpaleTargetDust.mdl
                  • Special Effect - Destroy (Last created special effect)
                  • Custom script: call RemoveLocation (udg_LOC_TEMP_Charge_Picked)
              • Custom script: call RemoveLocation (udg_LOC_TEMP_Charge_Caster)
              • Custom script: call DestroyGroup (udg_Charge_Target_Group)
Caster moves alright, but without dragging anything with itself =)
 
Level 22
Joined
Nov 14, 2008
Messages
3,256
1. This line is not complete as the trigger tags failed showing it:
  • Set Charge_Target_Group = (Units within 150.00 of LOC_TEMP_Charge_Caster matching ((((Matching unit) is A structure) Not equal to True) and (((Unit-type of (Matching unit)) Not equal to Turret) and (((Unit-type of (Matching unit)) Not equal to Heavy Turret) or ((Unit-type of (Matching
2.
  • Unit - Move Charge_Caster[(Integer A)] instantly to (LOC_TEMP_Charge_Caster offset by 15.00 towards (Facing of Charge_Caster[(Integer A)]) degrees)
3. Learn this:Link
 
Level 8
Joined
Mar 26, 2009
Messages
301
1-) Set Charge_Target_Group = (Units within 150.00 of LOC_TEMP_Charge_Caster matching ((((Matching unit) is A structure) Not equal to True) and (((Unit-type of (Matching unit)) Not equal to Turret) and (((Unit-type of (Matching unit)) Not equal to Heavy Turret) or ((Unit-type of (Matching Unit) Not equal to Barricade)
2-) If it is the location, there is a custom script that removes that location (third line after that action)
3-) Downloaded and checking it out, thanks! =)
 
Level 8
Joined
Mar 26, 2009
Messages
301
Unless it is going to cause serious problems, I prefer to keep it as it is =) At least for now. Someone else said "use proper indexing etc.." too but I didn't understand a thing from the sample he provided either =) This was my first attempt to make a MUI spell (that includes movement) and many things within WE still confuse me =) For me, change is only necessary when:
- Trigger performs with -visibly- low performance,
- It does not fulfil its job,
- It leaks.
(There is a location leak and a bug with loop trigger here which are now fixed in WE)
So If anyone spots something serious, please warn me =)
I still need help with the spell. Please someone look at why caster does not knockback the nearby units, not the index part =)
 
Level 8
Joined
Mar 26, 2009
Messages
301
Still no good. My brain is melting and I can't find the problem. With the unit group action, caster just moves randomly, damaging itself and affecting things it shouldn't. Triggers and sample map are below:
  • Charge
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Charge
    • Actions
      • Set Charge_Caster[Charge_Current_Index] = (Triggering unit)
      • Set Charge_Current_Index = (Charge_Current_Index + 1)
      • If (Charge_Current_Index Equal to 30) then do (Set Charge_Current_Index = 0) else do (Do nothing)
      • Unit - Turn collision for Charge_Caster[Charge_Current_Index] Off
  • Charge Movement
    • Events
      • Time - Every 0.02 seconds of game time
    • Conditions
    • Actions
      • For each (Integer A) from 0 to 30, do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Charge_Caster[(Integer A)] has buff Charge ) Not equal to True
            • Then - Actions
              • Unit - Turn collision for Charge_Caster[(Integer A)] On
              • Set Charge_Caster[(Integer A)] = No unit
            • Else - Actions
              • Unit - Turn collision for Charge_Caster[(Integer A)] Off
              • Set LOC_TEMP_Charge_Caster = ((Position of Charge_Caster[(Integer A)]) offset by 15.00 towards (Facing of Charge_Caster[(Integer A)]) degrees)
              • Unit - Move Charge_Caster[(Integer A)] instantly to LOC_TEMP_Charge_Caster
              • Special Effect - Create a special effect attached to the origin of Charge_Caster[(Integer A)] using Abilities\Weapons\AncientProtectorMissile\AncientProtectorMissile.mdl
              • Special Effect - Destroy (Last created special effect)
              • Set INT_A_Conversion = (Integer A)
              • Set LOC_TEMP_Charge_Caster_Current = (Position of Charge_Caster[INT_A_Conversion])
              • Set Charge_Target_Group = (Units within 150.00 of LOC_TEMP_Charge_Caster_Current matching ((((Matching unit) is A structure) Not equal to True) and (((Unit-type of (Matching unit)) Not equal to ) and (((Unit-type of (Matching unit)) Not equal to ) or (((Unit-type of (Matching unit)) N
              • Unit Group - Pick every unit in Charge_Target_Group and do (Actions)
                • Loop - Actions
                  • Set LOC_TEMP_Charge_Picked_Unit = (Position of (Picked unit))
                  • Set LOC_TEMP_Charge_Picked = ((Position of (Picked unit)) offset by 15.00 towards (Angle from LOC_TEMP_Charge_Caster_Current to LOC_TEMP_Charge_Picked_Unit) degrees)
                  • Unit - Move (Picked unit) instantly to LOC_TEMP_Charge_Picked
                  • Unit - Cause Charge_Caster[INT_A_Conversion] to damage (Picked unit), dealing 1.00 damage of attack type Spells and damage type Normal
                  • Special Effect - Create a special effect attached to the origin of (Picked unit) using Objects\Spawnmodels\Undead\ImpaleTargetDust\ImpaleTargetDust.mdl
                  • Special Effect - Destroy (Last created special effect)
                  • Custom script: call RemoveLocation (udg_LOC_TEMP_Charge_Picked)
                  • Custom script: call RemoveLocation (udg_LOC_TEMP_Charge_Picked_Unit)
              • Custom script: call RemoveLocation (udg_LOC_TEMP_Charge_Caster)
              • Custom script: call RemoveLocation (udg_LOC_TEMP_Charge_Caster_Current)
              • Custom script: call DestroyGroup (udg_Charge_Target_Group)
 

Attachments

  • Charge.w3x
    38.3 KB · Views: 65
Level 16
Joined
Jun 24, 2009
Messages
1,409
eh this indexing....
instead of 0.02 use 0.03, not much change but can cause wonders
as i see this is a non-target "dash" spell the:
error: don't turn off the collosion because now it can crush the map if the unit moves out of the entire map
here you are a solution(there are much more but i often use this):
create a temp gunit group at the next move point with a radius of 75-125 (depends on the size of the unit) with condition that the unit is alive then check if the temp group is empty
if it's empty then just move the unit towards, if not then turn collosion off, move unit towards then turn it on again
here you are an indexing template by me
first set the maximum array value, try to set it to a proper value under 10.
  • Init
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Ability
    • Actions
      • Set Get = False
      • For each (Integer A) from 1 to Max, do (Actions) [loop till the maximum size given in an init trigger]
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • Get Equal to False
            • Then - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • Recycle[(Integer A)] Equal to True [checks if the integer A slot is free]
                • Then - Actions
                  • Set Index = (Integer A)
                  • Set Get= True [with this the trigger only choose the first free slot]
                • Else - Actions
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • (Integer A) Equal to Max
                    • Then - Actions
                      • Set Max = (Max + 1) [if the current size is not enought it increases it]
                      • Set Recycle[Max] = True
                    • Else - Actions
            • Else - Actions
      • Set Caster[Index] = (Triggering unit)
      • Set Timer[Index] = (2.00 + (Real((Level of Ability for Caster[Index]))))
      • Set Etc.... [other things you want to store example locations or damage]
      • Set Has[Index] = True [this will check if the trigger still have to run for that unit]
      • Set Count = (Count + 1) [counts the number of units casted the spell]
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Loop <gen> is on) Equal to False
        • Then - Actions
          • Trigger - Turn on Loop <gen>
        • Else - Actions
  • Loop
    • Events
      • Time - Every 0.03 seconds of game time
    • Conditions
    • Actions
      • For each (Integer Integer) from 1 to Max, do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • Has[Integer] Equal to True
            • Then - Actions
              • [Things you want to do]
            • Else - Actions
              • Set Has[Index] = False
              • Set Count = (Count - 1)
            • Else - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • Count Equal to 0
                • Then - Actions
                  • Trigger - Turn off (This trigger)
                • Else - Actions
you should add extra configurables just like as:
  • the distance already traveled
  • the maximum distance can be traveled
  • the facing of the caster unit
  • the "speed" of the movement, if you want to travel the distance by a constant(or almost constant) time then use this: Max Distance / Travel Time / Period Time (now it's 0.03)
here you are a spell example made by me called http://www.hiveworkshop.com/forums/spells-569/fade-step-v1-3-a-190489/ it's MUI and leakless
it moves backwards but you can easily move the unit forward by removing the +180 from here
  • Set TempPoint[2] = (FSCasterPoint[FSInteger] offset by FSDistance[FSInteger] towards (FSFace[FSInteger] + 180.00) degrees)
and for the dragging ~.~
just do this:
  • Set TempGroup = Units within Drag Range of Current Caster Position matching (if you want conditions)
  • Unit Group - Pick Every Unit in TempGroup and do Actions
    • Actions
      • Set TempPoint = Position of Picked Unit
      • Set Distance = Distance between Temp Point and Current Caster Position - Drag Move
      • Set TempPoint2 = Current Caster Position offset by Distance angle Angle from Current Caster Position to TempPoint
      • Unit - Move Unit Instantly to TempPoint2
      • Clear Leaks
 
Level 8
Joined
Mar 26, 2009
Messages
301
When I put "Skip Remaining Actions" after Caster's movement action; it alone works well. It looks as if Move action of unit group is malfunctioning. It somehow affects caster and allied units although matching unit conditions are doing not to do so. (It affects barricades too)
 
Level 16
Joined
Jun 24, 2009
Messages
1,409
Lolz why do you want to add the skip action? it's never required
at the TempGroup add the following conditions connected with "And"
Matching unit is Magic Immune Equal to False
Matching unit is a Structure Equal to False
Matching unit is Alive Equal to True
Matching unit is belongs to an enemy of Caster Equal to True
 
Level 8
Joined
Mar 26, 2009
Messages
301
Aren't they connected with and?
  • Set Charge_Target_Group = (Units within 150.00 of LOC_TEMP_Charge_Caster matching ((((Matching unit) is A structure) Not equal to True) and (((Unit-type of (Matching unit)) Not equal to Turret) and (((Unit-type of (Matching unit)) Not equal to Heavy Turret) or ((Unit-type of (Match...
going like this.
It is all "and" =)
 
Level 8
Joined
Mar 26, 2009
Messages
301
Ok, my brain is in complete meltdown =P
The latest form of loop trigger is:
  • Charge Movement
    • Events
      • Time - Every 0.02 seconds of game time
    • Conditions
    • Actions
      • For each (Integer A) from 0 to 30, do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Charge_Caster[(Integer A)] has buff Charge ) Equal to False
            • Then - Actions
              • Set Charge_Caster[(Integer A)] = No unit
            • Else - Actions
              • Set LOC_TEMP_Charge_Caster = ((Position of Charge_Caster[(Integer A)]) offset by 15.00 towards (Facing of Charge_Caster[(Integer A)]) degrees)
              • Unit - Move Charge_Caster[(Integer A)] instantly to LOC_TEMP_Charge_Caster
              • Special Effect - Create a special effect attached to the origin of Charge_Caster[(Integer A)] using Abilities\Weapons\AncientProtectorMissile\AncientProtectorMissile.mdl
              • Special Effect - Destroy (Last created special effect)
              • Set INT_A_Conversion = (Integer A)
              • Set LOC_TEMP_Charge_Caster_Current = (Position of Charge_Caster[INT_A_Conversion])
              • Set Charge_Target_Group = (Units within 150.00 of LOC_TEMP_Charge_Caster_Current matching ((((Matching unit) is A structure) Not equal to True) and (((Unit-type of (Matching unit)) Not equal to Turret) and (((Unit-type of (Matching unit)) Not equal to Heavy Turret) or (((Matching unit
              • Unit Group - Pick every unit in Charge_Target_Group and do (Actions)
                • Loop - Actions
                  • Set LOC_TEMP_Charge_Picked_Unit = (Position of (Picked unit))
                  • Set LOC_TEMP_Charge_Picked = ((Position of (Picked unit)) offset by 15.00 towards (Angle from LOC_TEMP_Charge_Caster_Current to LOC_TEMP_Charge_Picked_Unit) degrees)
                  • Unit - Move (Picked unit) instantly to LOC_TEMP_Charge_Picked
                  • Unit - Cause Charge_Caster[INT_A_Conversion] to damage (Picked unit), dealing 1.00 damage of attack type Spells and damage type Normal
                  • Special Effect - Create a special effect attached to the origin of (Picked unit) using Objects\Spawnmodels\Undead\ImpaleTargetDust\ImpaleTargetDust.mdl
                  • Special Effect - Destroy (Last created special effect)
                  • Custom script: call RemoveLocation (udg_LOC_TEMP_Charge_Picked)
                  • Custom script: call RemoveLocation (udg_LOC_TEMP_Charge_Picked_Unit)
              • Custom script: call RemoveLocation (udg_LOC_TEMP_Charge_Caster)
              • Custom script: call RemoveLocation (udg_LOC_TEMP_Charge_Caster_Current)
              • Custom script: call DestroyGroup (udg_Charge_Target_Group)
Set Charge_Target_Group = (Units within 150.00 of LOC_TEMP_Charge_Caster_Current matching ((((Matching unit) is A structure) Not equal to True) and (((Unit-type of (Matching unit)) Not equal to Turret) and (((Unit-type of (Matching unit)) Not equal to Heavy Turret) or (((Matching unit... not equal to barricade; owner of matching unit equal player 4 (global enemy for players) blah blah..

This is currently the only major problem in my map; what is the problem here people? =)
 
Level 8
Joined
Mar 26, 2009
Messages
301
wtf??? why do you apply them one by one? just make a unit group at the map init and add these units of type then just do this
Matching unit is in NoGroup equal to False
I am sorry, due to meltdown in my brain, I can't understand a damn thing =) Is this related to malfunction with the spell? Please help me with the malfunction, not efficiency, logic and stuff =) *please*
 
Status
Not open for further replies.
Top