Hi! This time I'm trying to create a spell that do damage and knock all enemies units around the caster away from the caster.
But I don't know how to properly detect all the unit and make them knockback, I only how to do that on one unit
The spell is that: when cast it knock back all unit around the caster to exactly the position of the caster offset by 825 distance. (So For example: if one unit is standing 225 distance away from the caster they would be knockback for 600 Range while if another unit is standing 725 distance away from the caster then they would only be knockback for 100 range ) This is my method, stored all enemies units within Area of Effect by first storing storing them into unit group and then Loop Integer the number of units group to stored all of them individually into a variable with arrays
then turn on a time based trigger that'll do the knockback
This is my attept, full of Arrays and Integer
To tell you the truth, I don't really know the method of creating a spell which affect all unit within the range yet (So far it's either a spell based on one already existed or if it ones that I created by myself it would only affected one unit)
So could anyone tell me how to this spell? I feel that it is essential and I would be using it a lot if I were to continued making my map
But I don't know how to properly detect all the unit and make them knockback, I only how to do that on one unit
The spell is that: when cast it knock back all unit around the caster to exactly the position of the caster offset by 825 distance. (So For example: if one unit is standing 225 distance away from the caster they would be knockback for 600 Range while if another unit is standing 725 distance away from the caster then they would only be knockback for 100 range ) This is my method, stored all enemies units within Area of Effect by first storing storing them into unit group and then Loop Integer the number of units group to stored all of them individually into a variable with arrays
then turn on a time based trigger that'll do the knockback
This is my attept, full of Arrays and Integer
Trigger:
- Blast Wave
- Events
- Unit - A unit Starts the effect of an ability
- Conditions
- (Ability being cast) Equal to Blast Wave
- Actions
- Set BlastWave_ArrayInteger = 0
- Set BlastWave_Caster = (Triggering unit)
- If (All Conditions are True) then do (Then Actions) else do (Else Actions)
- If - Conditions
- (Level of Blast Wave for BlastWave_Caster) Equal to 1
- Then - Actions
- Set BlastWave_Group = (Units within 625.00 of (Position of BlastWave_Caster) matching (((Matching unit) belongs to an enemy of (Owner of BlastWave_Caster)) Equal to True))
- Unit Group - Remove all units of (Units within 625.00 of (Position of BlastWave_Caster) matching (((Matching unit) is A structure) Equal to True)) from BlastWave_Group
- Unit Group - Remove all units of (Units within 625.00 of (Position of BlastWave_Caster) matching (((Matching unit) is dead) Equal to True)) from BlastWave_Group
- For each (Integer BlastWave_Integer) from 1 to (Number of units in BlastWave_Group), do (Actions)
- Loop - Actions
- Set BlastWave_ArrayInteger = (BlastWave_ArrayInteger + 1)
- Set BlastWave_Target[BlastWave_ArrayInteger] = (Picked unit)
- Set BlastWave_Distance[BlastWave_ArrayInteger] = (Distance between (Position of BlastWave_Caster) and (Position of BlastWave_Target[BlastWave_ArrayInteger]))
- Set BlastWave_KnockBack[BlastWave_ArrayInteger] = (625.00 - BlastWave_Distance[BlastWave_ArrayInteger])
- Unit - Set the custom value of BlastWave_Target[BlastWave_ArrayInteger] to BlastWave_ArrayInteger
- Loop - Actions
- Trigger - Turn on Blast Wave Knockback <gen>
- Else - Actions
- If - Conditions
- Events
Trigger:
- Blast Wave Knockback
- Events
- Time - Every 0.03 seconds of game time
- Conditions
- Actions
- Unit Group - Pick every unit in BlastWave_Group and do (Actions)
- Loop - Actions
- Unit - Turn collision for (Picked unit) Off
- Unit - Move (Picked unit) instantly to ((Position of (Picked unit)) offset by 25.00 towards (Angle from (Position of BlastWave_Caster) to (Position of (Picked unit))) degrees)
- Special Effect - Create a special effect at (Position of (Picked unit)) using Abilities\Spells\Human\ThunderClap\ThunderClapCaster.mdl
- Special Effect - Destroy (Last created special effect)
- Set BlastWave_KnockBack[(Custom value of (Picked unit))] = (BlastWave_KnockBack[(Custom value of (Picked unit))] - 25.00)
- If (All Conditions are True) then do (Then Actions) else do (Else Actions)
- If - Conditions
- (Integer(BlastWave_KnockBack[(Custom value of (Picked unit))])) Less than or equal to 0
- Then - Actions
- Unit - Turn collision for (Picked unit) On
- Unit Group - Remove (Picked unit) from BlastWave_Group
- If (All Conditions are True) then do (Then Actions) else do (Else Actions)
- If - Conditions
- (Number of units in BlastWave_Group) Equal to 0
- Then - Actions
- Trigger - Turn off (This trigger)
- Else - Actions
- If - Conditions
- Else - Actions
- If - Conditions
- Loop - Actions
- Unit Group - Pick every unit in BlastWave_Group and do (Actions)
- Events
To tell you the truth, I don't really know the method of creating a spell which affect all unit within the range yet (So far it's either a spell based on one already existed or if it ones that I created by myself it would only affected one unit)
So could anyone tell me how to this spell? I feel that it is essential and I would be using it a lot if I were to continued making my map