Question...

Rab

New Member
Reaction score
1
ok so this is a spell that i sort of edited to change it to the way i want it to be..
it basically makes the user deal damage to the units in front of him..
but the problem is,i want more of the same spell but with different cooldowns/effects.
these are the triggers
(the knockback trigger isnt used in this one thats why i want another same ability that has a knockback with a different cooldown)
Trigger:
  • Beast Attack
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Attack
    • Actions
      • -------- --------------------------------------------------------- --------
      • -------- Spell setup --------
      • -------- --------------------------------------------------------- --------
      • Set Beast_Attack_Caster = (Triggering unit)
      • Set Beast_Attack_Ability_Level = (Level of (Ability being cast) for Beast_Attack_Caster)
      • Set Beast_Attack_Location = (Position of Beast_Attack_Caster)
      • Set Beast_Attack_Direction = (Facing of Beast_Attack_Caster)
      • -------- ------------------------------------------------------------------------------------------------------------------ --------
      • -------- -==*////##############\\\\*==- --------
      • -------- --------------------------------------------------------- --------
      • -------- Yes / No, options --------
      • -------- ----- --------
      • Set Beast_Attack_Destroy_Trees = True
      • Set Beast_Attack_Knock_Back_on = False
      • Set Beast_Attack_Random_Distance = False
      • -------- ----- --------
      • -------- Special effect strings used in KB trigger --------
      • -------- ----- --------
      • Set Beast_Attack_KB_Special_Effect = Abilities\Weapons\AncientProtectorMissile\AncientProtectorMissile.mdl
      • Set Beast_Attack_Destroy_Trees_SE = Abilities\Spells\Human\FlakCannons\FlakTarget.mdl
      • -------- ----- --------
      • -------- How far away the damage group is --------
      • -------- ----- --------
      • Set Beast_Attack_Base_Offset = 60.00
      • Set Beast_Attack_Bonus_Offset = 20.00
      • -------- ----- --------
      • -------- How big the damage group is --------
      • -------- ----- --------
      • Set Beast_Attack_Base_Radius = 50.00
      • Set Beast_Attack_Bonus_Radius = 40.00
      • -------- ----- --------
      • -------- Damage type and multiplier --------
      • -------- ----- --------
      • Set Beast_Attack_Atribute = (Strength of Beast_Attack_Caster (Include bonuses))
      • Set Beast_Attack_Damage_Multiplier = 2.50
      • -------- ----- --------
      • -------- Knockback setings --------
      • -------- ----- --------
      • Set Beast_Attack_Destruct_Kill_AoE = 150.00
      • Set Beast_Attack_KB_Minim_Distance = 20.00
      • Set Beast_Attack_KB_Base_Distance = 100.00
      • Set Beast_Attack_KB_Bonus_Distance = 50.00
      • Set Beast_Attack_KB_Speed = 8.00
      • -------- --------------------------------------------------------- --------
      • -------- -==*\\\\##############////*==- --------
      • -------- ------------------------------------------------------------------------------------------------------------------ --------
      • -------- Final spell calculations --------
      • -------- --------------------------------------------------------- --------
      • Set Beast_Attack_Total_Radius = (Beast_Attack_Base_Radius + (Beast_Attack_Bonus_Radius x (Real(Beast_Attack_Ability_Level))))
      • Set Beast_Attack_Total_Offset = (Beast_Attack_Base_Offset + (Beast_Attack_Bonus_Offset x (Real(Beast_Attack_Ability_Level))))
      • Set Beast_Attack_Total_Damage = ((Real(Beast_Attack_Atribute)) x (Beast_Attack_Damage_Multiplier x (Real(Beast_Attack_Ability_Level))))
      • Set Beast_Attack_KB_Total_Distance = (Beast_Attack_KB_Base_Distance + (Beast_Attack_KB_Bonus_Distance x (Real(Beast_Attack_Ability_Level))))
      • -------- --------------------------------------------------------- --------
      • -------- Setting the damage area --------
      • -------- --------------------------------------------------------- --------
      • Set Beast_Attack_Damage_Location = (Beast_Attack_Location offset by Beast_Attack_Total_Offset towards Beast_Attack_Direction degrees)
      • Set Beast_Attack_Damage_Group = (Units within Beast_Attack_Total_Radius of Beast_Attack_Damage_Location matching ((((Matching unit) is A structure) Equal to False) and ((((Matching unit) is alive) Equal to True) and ((((Owner of (Matching unit)) is an enemy of (Owner of Beast_Attack_Caster)
      • -------- --------------------------------------------------------- --------
      • -------- Creating nice special effects --------
      • -------- --------------------------------------------------------- --------
      • Unit - Create 1 Dummy for (Owner of Beast_Attack_Caster) at Beast_Attack_Damage_Location facing Beast_Attack_Direction degrees
      • Unit - Kill (Last created unit)
      • -------- --------------------------------------------------------- --------
      • -------- Creating a nice floating text --------
      • -------- --------------------------------------------------------- --------
      • Floating Text - Create floating text that reads ((String((Integer(Beast_Attack_Total_Damage)))) + !) at Beast_Attack_Location with Z offset 0.00, using font size 13.00, color (90.00%, 5.00%, 5.00%), and 0.00% transparency
      • Floating Text - Change (Last created floating text): Disable permanence
      • Floating Text - Set the velocity of (Last created floating text) to 40.00 towards 90.00 degrees
      • Floating Text - Change the fading age of (Last created floating text) to 1.00 seconds
      • Floating Text - Change the lifespan of (Last created floating text) to 3.00 seconds
      • -------- --------------------------------------------------------- --------
      • -------- Starting the execution --------
      • -------- --------------------------------------------------------- --------
      • Unit Group - Pick every unit in Beast_Attack_Damage_Group and do (Actions)
        • Loop - Actions
          • -------- --------------------------------------------------------- --------
          • -------- Damaging the units and creating special effects --------
          • -------- --------------------------------------------------------- --------
          • Unit - Cause Beast_Attack_Caster to damage (Picked unit), dealing Beast_Attack_Total_Damage damage of attack type Normal and damage type Unknown
          • Special Effect - Create a special effect attached to the origin of (Picked unit) using Abilities\Spells\Other\Stampede\StampedeMissileDeath.mdl
          • Special Effect - Destroy (Last created special effect)
          • -------- --------------------------------------------------------- --------
          • -------- This runs if Knock back is on // True --------
          • -------- --------------------------------------------------------- --------
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • Beast_Attack_Knock_Back_on Equal to True
            • Then - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (Number of units in Beast_Attack_Damage_Group) Greater than or equal to 1
                • Then - Actions
                  • Trigger - Turn on Beast Attack Knock <gen>
                • Else - Actions
              • -------- --------------------------------------------------------- --------
              • -------- Adding units to the knockback group --------
              • -------- --------------------------------------------------------- --------
              • Set Beast_Attack_LocationII = (Position of (Picked unit))
              • Unit - Turn collision for (Picked unit) Off
              • Unit Group - Add (Picked unit) to Beast_Attack_KB_Group
              • -------- --------------------------------------------------------- --------
              • -------- This runs if random distance is on //True --------
              • -------- --------------------------------------------------------- --------
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • Beast_Attack_Random_Distance Equal to True
                • Then - Actions
                  • Set Beast_Attack_KB_Total_Distance = (Random real number between Beast_Attack_KB_Minim_Distance and Beast_Attack_KB_Total_Distance)
                • Else - Actions
              • -------- --------------------------------------------------------- --------
              • -------- Saving values into hashtable --------
              • -------- --------------------------------------------------------- --------
              • Set Beast_Attack_KB_Angle = (Angle from Beast_Attack_Location to Beast_Attack_LocationII)
              • Hashtable - Save Beast_Attack_KB_Total_Distance as (Key distance) of (Key (Picked unit)) in Beast_Attack_Table
              • Hashtable - Save Beast_Attack_KB_Speed as (Key speed) of (Key (Picked unit)) in Beast_Attack_Table
              • Hashtable - Save Beast_Attack_KB_Angle as (Key angle) of (Key (Picked unit)) in Beast_Attack_Table
              • Custom script: call RemoveLocation(udg_Beast_Attack_LocationII)
            • Else - Actions
      • -------- --------------------------------------------------------- --------
      • -------- Clearing leaks --------
      • -------- --------------------------------------------------------- --------
      • Custom script: call RemoveLocation(udg_Beast_Attack_Location)
      • Custom script: call RemoveLocation(udg_Beast_Attack_Damage_Location)
      • Custom script: call DestroyGroup(udg_Beast_Attack_Damage_Group)

Trigger:
  • Beast Attack Knock
    • Events
      • Time - Every 0.03 seconds of game time
    • Conditions
    • Actions
      • -------- ================================================================== --------
      • -------- LEAVE THIS TRIGGER AS IT IS --------
      • -------- ================================================================== --------
      • Unit Group - Pick every unit in Beast_Attack_KB_Group and do (Actions)
        • Loop - Actions
          • -------- --------------------------------------------------------- --------
          • -------- Loading values --------
          • -------- --------------------------------------------------------- --------
          • Set Beast_Attack_KB_Total_Distance = (Load (Key distance) of (Key (Picked unit)) from Beast_Attack_Table)
          • Set Beast_Attack_KB_Speed = (Load (Key speed) of (Key (Picked unit)) from Beast_Attack_Table)
          • Set Beast_Attack_KB_Angle = (Load (Key angle) of (Key (Picked unit)) from Beast_Attack_Table)
          • -------- --------------------------------------------------------- --------
          • -------- Checking the remaining distance --------
          • -------- --------------------------------------------------------- --------
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • Beast_Attack_KB_Total_Distance Greater than 0.00
            • Then - Actions
              • -------- --------------------------------------------------------- --------
              • -------- Setting the knockback locations --------
              • -------- --------------------------------------------------------- --------
              • Set Beast_Attack_KB_LocI = (Position of (Picked unit))
              • Set Beast_Attack_KB_LocII = (Beast_Attack_KB_LocI offset by Beast_Attack_KB_Speed towards Beast_Attack_KB_Angle degrees)
              • Hashtable - Save (Beast_Attack_KB_Total_Distance - Beast_Attack_KB_Speed) as (Key distance) of (Key (Picked unit)) in Beast_Attack_Table
              • -------- --------------------------------------------------------- --------
              • -------- Removing a unit from unit group, if the pathing is off --------
              • -------- --------------------------------------------------------- --------
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (Terrain pathing at Beast_Attack_KB_LocII of type Walkability is off) Equal to True
                • Then - Actions
                  • Unit - Turn collision for (Picked unit) On
                  • Unit Group - Remove (Picked unit) from Beast_Attack_KB_Group
                  • Hashtable - Clear all child hashtables of child (Key (Picked unit)) in Beast_Attack_Table
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • (Number of units in Beast_Attack_KB_Group) Equal to 0
                    • Then - Actions
                      • Trigger - Turn off Beast Attack Knock <gen>
                    • Else - Actions
                • Else - Actions
                  • -------- --------------------------------------------------------- --------
                  • -------- Moving a unit --------
                  • -------- --------------------------------------------------------- --------
                  • Unit - Move (Picked unit) instantly to Beast_Attack_KB_LocII
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (Random real number between 1.00 and 10.00) Less than or equal to 3.33
                • Then - Actions
                  • -------- --------------------------------------------------------- --------
                  • -------- Creating a nice special effect --------
                  • -------- --------------------------------------------------------- --------
                  • Special Effect - Create a special effect attached to the origin of (Picked unit) using Beast_Attack_KB_Special_Effect
                  • Special Effect - Destroy (Last created special effect)
                • Else - Actions
              • -------- --------------------------------------------------------- --------
              • -------- If destroy tress is on //True this will destroy trees --------
              • -------- --------------------------------------------------------- --------
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • Beast_Attack_Destroy_Trees Equal to True
                • Then - Actions
                  • Destructible - Pick every destructible within Beast_Attack_Destruct_Kill_AoE of Beast_Attack_KB_LocII and do (Actions)
                    • Loop - Actions
                      • Set Beast_Attack_KB_LocIII = (Position of (Picked destructible))
                      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                        • If - Conditions
                          • ((Picked destructible) is alive) Equal to True
                        • Then - Actions
                          • Special Effect - Create a special effect at Beast_Attack_KB_LocIII using Beast_Attack_Destroy_Trees_SE
                          • Special Effect - Destroy (Last created special effect)
                        • Else - Actions
                      • Destructible - Kill (Picked destructible)
                      • Custom script: call RemoveLocation(udg_Beast_Attack_KB_LocIII)
                • Else - Actions
              • -------- --------------------------------------------------------- --------
              • -------- Clearing leaks --------
              • -------- --------------------------------------------------------- --------
              • Custom script: call RemoveLocation(udg_Beast_Attack_KB_LocI)
              • Custom script: call RemoveLocation(udg_Beast_Attack_KB_LocII)
            • Else - Actions
              • -------- --------------------------------------------------------- --------
              • -------- Ending execution, removing units, clearing hashtable --------
              • -------- --------------------------------------------------------- --------
              • Unit - Turn collision for (Picked unit) On
              • Unit Group - Remove (Picked unit) from Beast_Attack_KB_Group
              • Hashtable - Clear all child hashtables of child (Key (Picked unit)) in Beast_Attack_Table
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (Number of units in Beast_Attack_KB_Group) Equal to 0
                • Then - Actions
                  • Trigger - Turn off Beast Attack Knock <gen>
                • Else - Actions

So do i just copy the triggers and change "(Ability being cast) Equal to Attack" to another dummy spell?
 

Dirac

22710180
Reaction score
147
Well first of all you're turning on the other trigger inside the the group loop, that "if/then/else" should be outside.
Second of all you're hittin all units around the caster, not just the ones in front of it, for that use this formula i wrote
JASS:
//Returns if the angle "b" is inside a cone pointing towards angle "a" of overture "o"
//if Cone(GetUnitFacing(unit),Atan2(GetUnitY(target)-GetUnitY(unit),GetUnitX(target)-GetUnitX(unit)),bj_PI/12) then
    function Cone takes real a, real b, real o returns boolean
        return Cos(b-a)>=Cos(o)
    endfunction

I see you're using hashtables, so i can't really tell what you're doing wrong attempting to make this spell MUI (but i haven't read the whole code, i'm done with GUI)
 

Rab

New Member
Reaction score
1
Well first of all you're turning on the other trigger inside the the group loop, that "if/then/else" should be outside.
Second of all you're hittin all units around the caster, not just the ones in front of it, for that use this formula i wrote
JASS:
//Returns if the angle "b" is inside a cone pointing towards angle "a" of overture "o"
//if Cone(GetUnitFacing(unit),Atan2(GetUnitY(target)-GetUnitY(unit),GetUnitX(target)-GetUnitX(unit)),bj_PI/12) then
    function Cone takes real a, real b, real o returns boolean
        return Cos(b-a)>=Cos(o)
    endfunction

I see you're using hashtables, so i can't really tell what you're doing wrong attempting to make this spell MUI (but i haven't read the whole code, i'm done with GUI)

i think you misintepreted...this actually is a spell made by someone else i was desperate for a spell that attacks units in front of the caster,basically a spell that is an attack that needs some aiming so if you were to cast it,the user will do his attack animation and the damage will coincide with the unit in front of him which is in range.But the main point is... i basically want two spells of the same kind but i am afraid that if i copy the spells something might intefere because both spells use the same variables?If you dont understand what im saying i will try again...
 

Dirac

22710180
Reaction score
147
It would cause great conflict if both spells use the same variables.
This is why JASS is a better option, any work done by anyone is easily adapted to your needs since none of the variables are actually in the variable editor
 

Dirac

22710180
Reaction score
147
It would cause great conflict if both spells use the same variables.
This is why JASS is a better option, any work done by anyone is easily adapted to your needs since none of the variables are actually in the variable editor
 

Rab

New Member
Reaction score
1
It would cause great conflict if both spells use the same variables.
This is why JASS is a better option, any work done by anyone is easily adapted to your needs since none of the variables are actually in the variable editor
Unfortunately i do not know jass..i can try copying all the variables but it would be pretty messy.. it would work right?
 

Dirac

22710180
Reaction score
147
Same as you i didn't know jass once upon a time
I know jass now because i read some really good tutorials on this site plus the jass-helper manual
I found it easy to learn
Now that i know JASS I don't have to do most coding on my own, i can copy what other people did online.
I can make a MUI spell in 30 lines of code
 

Rab

New Member
Reaction score
1
Same as you i didn't know jass once upon a time
I know jass now because i read some really good tutorials on this site plus the jass-helper manual
I found it easy to learn
Now that i know JASS I don't have to do most coding on my own, i can copy what other people did online.
I can make a MUI spell in 30 lines of code
Ok i will try reading the tutorials in a few hours but if i copy all the variables and use the copied ones on an exact same spell which is also copied will it have any problems?
 

Dirac

22710180
Reaction score
147
Wont cause any problems if they don't use the same variable, doesn't matter which is the variable's name
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Members online

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top