• 🏆 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!

Force Field v1.0.0.4

  • Like
Reactions: FeelMyRash
[TD] [COLOR=";Green"]Force Field v1.0.0.4[/COLOR] [/TD]
Creates a Force Field around the caster making the caster invulnerable and prevents all enemies from coming, causing certain damage.
Level 1 - 30 damage.
Level 2 - 50 damage.
Level 3 - 70 damage.
Level 4 - 90 damage.

[TD] SAMPLE IMAGES [/TD]

Sample One

Sample Two


Mirko%20Supot.png


Mirko%20Supot%202.png


[TD] CHANGELOGS: [/TD]
[TD]
v1.0.0.0 - Initial Release
v1.0.0.1 - Added a Terrain Pathing Type
v1.0.0.2 - Well Fixed, No Leaks, and Good Coding (I think)
v1.0.0.3 - Duration is now Configurable, (Dying unit) changed to -> (Triggering unit)
v1.0.0.4 - Remove Leaks, Clean Coding. :D
[/TD]

Configuration

Cast

Loop

Dummy Remover

  • Force Field Configuration
    • Events
      • Map initialization
    • Conditions
    • Actions
      • -------- ---------------------------------------------------------- --------
      • -------- Storing Variables --------
      • -------- ---------------------------------------------------------- --------
      • -------- Pick Tree AoE --------
      • Set FF_AoE_PickTree = 100.00
      • -------- Area of Effect --------
      • Set FF_AoE = 350.00
      • -------- Attachments --------
      • Set FF_Attachment = origin
      • -------- Special Effects for the Picked Units --------
      • Set FF_SFX = Abilities\Weapons\AncientProtectorMissile\AncientProtectorMissile.mdl
      • -------- Caster's Flying Height --------
      • Set FF_FlyHeight = 245.00
      • -------- Knockback Speed --------
      • Set FF_Speed = 50.00
      • -------- Knockback Damage --------
      • Set FF_Damage[1] = 30.00
      • Set FF_Damage[2] = 50.00
      • Set FF_Damage[3] = 70.00
      • Set FF_Damage[4] = 90.00
      • -------- Duration Per Level --------
      • Set FF_DurPerLevel[1] = 8.00
      • Set FF_DurPerLevel[2] = 10.00
      • Set FF_DurPerLevel[3] = 12.00
      • Set FF_DurPerLevel[4] = 14.00
      • -------- ---------------------------------------------------------- --------
      • -------- Periodic Event --------
      • -------- ---------------------------------------------------------- --------
      • Set FF_Interval = 0.03
      • Trigger - Add to Force Field Loop <gen> the event (Time - Every FF_Interval seconds of game time)
      • -------- ---------------------------------------------------------- --------
      • -------- Creating the Tree Remover (Peasant) --------
      • -------- ---------------------------------------------------------- --------
      • -------- Storing the Order into a Variable --------
      • Custom script: set udg_FF_RemoveOrder = Custom script: set udg_FF_TreeRemover = CreateUnit(Player(15), 'hpea', 0, 0, 0)
  • harvestCustom script: set udg_FF_TreeRemover = CreateUnit(Player(15), 'hpea', 0, 0, 0)
    • -------- Peasant, Peasant - Thanks Magtheridon96 :D Mag-Teh (teh) --------
    • Custom script: set udg_FF_TreeRemover = CreateUnit(Player(15), 'hpea', 0, 0, 0)
    • -------- Making the Peasant Invincible (Locust ,Invisible) --------
    • Custom script: call UnitAddAbility(udg_FF_TreeRemover, 'Aloc')
    • Custom script: call ShowUnit(udg_FF_TreeRemover, false)
  • Force Field Cast
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Force Field
    • Actions
      • -------- IMPORTANT SYSTEM PART START --------
      • -------- Turn the Force Field Loop on, do I need to add anything else here? --------
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • FF_IndexListener Equal to 0
        • Then - Actions
          • Trigger - Turn on Force Field Loop <gen>
        • Else - Actions
      • -------- Check if the Recycle Repository got free slots where you can grab an index --------
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • FF_RecycleSize Greater than 0
        • Then - Actions
          • Set FF_RecycleSize = (FF_RecycleSize - 1)
          • Set FF_Index = FF_Recycle_Repository[FF_RecycleSize]
        • Else - Actions
          • Set FF_Index = FF_IndexSize
          • Set FF_IndexSize = (FF_IndexSize + 1)
      • -------- IMPORTANT SYSTEM PART END --------
      • -------- Register all important variables, remember that the FF_Index var is very important... --------
      • Set FF_Owner[FF_Index] = (Triggering player)
      • Set FF_Caster[FF_Index] = (Triggering unit)
      • Set FF_Loc = (Position of FF_Caster[FF_Index])
      • Unit - Create 1 Shield for FF_Owner[FF_Index] at FF_Loc facing Default building facing degrees
      • Set FF_Level = (Level of Force Field for FF_Caster[FF_Index])
      • Set FF_ForceField[FF_Index] = (Last created unit)
      • -------- Duration --------
      • Set FF_Duration[FF_Index] = FF_DurPerLevel[FF_Level]
      • -------- True or False... It depends on you. Set to true to destroy trees --------
      • -------- Set to False If you don't want to destroy the trees --------
      • Set FF_TreeRemoverSwitch[FF_Index] = True
      • Unit - Add a FF_Duration[FF_Index] second Generic expiration timer to FF_ForceField[FF_Index]
      • -------- Adding Fly to unit (faster and better way) --------
      • Custom script: if UnitAddAbility(udg_FF_Caster[udg_FF_Index], 'Amrf') and UnitRemoveAbility(udg_FF_Caster[udg_FF_Index], 'Amrf') then
      • Custom script: endif
      • -------- IMPORTANT SYSTEM PART START --------
      • -------- Register the current index --------
      • Set FF_IndexRepository[FF_IndexListener] = FF_Index
      • -------- Increase the size of the Index Container --------
      • Set FF_IndexListener = (FF_IndexListener + 1)
      • -------- IMPORTANT SYSTEM PART END --------
      • -------- Removing Leaks --------
      • Custom script: call RemoveLocation(udg_FF_Loc)
  • Force Field Loop
    • Events
    • Conditions
    • Actions
      • -------- Dynamic Loop --------
      • For each (Integer FF_Loop) from 0 to (FF_IndexListener - 1), do (Actions)
        • Loop - Actions
          • -------- Set the current index --------
          • Set FF_Index = FF_IndexRepository[FF_Loop]
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • FF_Duration[FF_Index] Greater than 0.00
            • Then - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (FF_Caster[FF_Index] is alive) Equal to False
                • Then - Actions
                  • Set FF_Duration[FF_Index] = 0.00
                • Else - Actions
              • -------- ------------------------------------------------- --------
              • -------- This will make the Caster Invulnerable --------
              • -------- ------------------------------------------------- --------
              • Custom script: call SetUnitInvulnerable(udg_FF_Caster[udg_FF_Index], true)
              • -------- ---------------------------------------------------------- --------
              • -------- Increases the Flying Height of the Unit --------
              • -------- ---------------------------------------------------------- --------
              • Custom script: call SetUnitFlyHeight(udg_FF_Caster[udg_FF_Index], udg_FF_FlyHeight, 0)
              • -------- ---------------------------------------------------------- --------
              • -------- Stores the Caster's Position into a variable --------
              • -------- and moving the Force Field to FF_Loc --------
              • -------- ---------------------------------------------------------- --------
              • Set FF_Loc = (Position of FF_Caster[FF_Index])
              • Unit - Move FF_ForceField[FF_Index] instantly to FF_Loc
              • -------- ---------------------------------------------------------- --------
              • -------- Knockingback and Damaging Enemies --------
              • -------- ---------------------------------------------------------- --------
              • Custom script: set bj_wantDestroyGroup=true
              • Unit Group - Pick every unit in (Units within FF_AoE of FF_Loc) and do (Actions)
                • Loop - Actions
                  • -------- ---------------------------------------------------------- --------
                  • -------- Stores the Nearby Unit, the Position, and the angle into a Variable --------
                  • -------- ---------------------------------------------------------- --------
                  • Set FF_NearbyUnits[FF_Index] = (Picked unit)
                  • Set FF_Loc2 = (Position of FF_NearbyUnits[FF_Index])
                  • Set FF_Angle[FF_Index] = (Angle from FF_Loc to FF_Loc2)
                  • -------- ---------------------------------------------------------- --------
                  • -------- DON'T CHANGE SOMETHING BELOW THIS --------
                  • -------- ------------------------------IF - Block------------------------------ --------
                  • -------- ---------------------------------------------------------- --------
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • ((FF_NearbyUnits[FF_Index] is alive) Equal to True) and ((Owner of FF_NearbyUnits[FF_Index]) Not equal to FF_Owner[FF_Index])
                    • Then - Actions
                      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                        • If - Conditions
                          • (Terrain pathing at FF_Loc2 of type Walkability is off) Equal to False
                        • Then - Actions
                          • -------- ---------------------------------------------------------- --------
                          • -------- This Script makes the Nearby Units to be Knockedback --------
                          • -------- and this is the best way to make a unit move --------
                          • -------- ---------------------------------------------------------- --------
                          • Custom script: call SetUnitX(udg_FF_NearbyUnits[udg_FF_Index],GetUnitX(udg_FF_NearbyUnits[udg_FF_Index]) + udg_FF_Speed * Cos(udg_FF_Angle[udg_FF_Index] * bj_DEGTORAD))
                          • Custom script: call SetUnitY(udg_FF_NearbyUnits[udg_FF_Index],GetUnitY(udg_FF_NearbyUnits[udg_FF_Index]) + udg_FF_Speed * Sin(udg_FF_Angle[udg_FF_Index] * bj_DEGTORAD))
                        • Else - Actions
                      • -------- ---------------------------------------------------------- --------
                      • -------- and this are The Add and Destroy Special Effects --------
                      • -------- ---------------------------------------------------------- --------
                      • Custom script: call DestroyEffect(AddSpecialEffectTarget(udg_FF_SFX, udg_FF_NearbyUnits[udg_FF_Index], udg_FF_Attachment))
                      • -------- ---------------------------------------------------------- --------
                      • -------- DAMAGE --------
                      • -------- ---------------------------------------------------------- --------
                      • Unit - Cause FF_Caster[FF_Index] to damage FF_NearbyUnits[FF_Index], dealing FF_Damage[FF_Level] damage of attack type Spells and damage type Normal
                      • -------- ---------------------------------------------------------- --------
                      • -------- "The Tree Remover" --------
                      • -------- Sounds creepy Isn't it --------
                      • -------- Well, this trigger will let you destroy trees in no time --------
                      • -------- ---------------------------------------------------------- --------
                      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                        • If - Conditions
                          • FF_TreeRemoverSwitch[FF_Index] Equal to True
                        • Then - Actions
                          • Destructible - Pick every destructible within FF_AoE_PickTree of FF_Loc2 and do (Actions)
                            • Loop - Actions
                              • Set FF_PickTree = (Picked destructible)
                              • Custom script: call IssueTargetOrder(udg_FF_TreeRemover,udg_FF_RemoveOrder,udg_FF_PickTree)
                              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                                • If - Conditions
                                  • (Current order of FF_TreeRemover) Equal to (Order(FF_RemoveOrder))
                                • Then - Actions
                                  • Destructible - Kill FF_PickTree
                                • Else - Actions
                              • Unit - Order FF_TreeRemover to Stop
                        • Else - Actions
                    • Else - Actions
                  • -------- Clearing Leaks --------
                  • Custom script: call RemoveLocation(udg_FF_Loc2)
              • -------- Clearing Leaks --------
              • Custom script: call RemoveLocation(udg_FF_Loc)
              • -------- Decrease distance value --------
              • Set FF_Duration[FF_Index] = (FF_Duration[FF_Index] - 0.03)
            • Else - Actions
              • Unit - Remove FF_ForceField[FF_Index] from the game
              • -------- Resetting Handles --------
              • Custom script: call SetUnitInvulnerable(udg_FF_Caster[udg_FF_Index], false)
              • Custom script: call SetUnitFlyHeight(udg_FF_Caster[udg_FF_Index], 0, 0)
              • -------- IMPORTANT SYSTEM PART START --------
              • -------- Decrease the normal index container size --------
              • Set FF_IndexListener = (FF_IndexListener - 1)
              • -------- Exchange the data from the last index to the current index --------
              • Set FF_IndexRepository[FF_Loop] = FF_IndexRepository[FF_IndexListener]
              • -------- Add an index to the Recycle Container --------
              • Set FF_Recycle_Repository[FF_RecycleSize] = FF_Index
              • -------- Recycle Container Index Size gets increased --------
              • Set FF_RecycleSize = (FF_RecycleSize + 1)
              • -------- Reset Loop --------
              • Set FF_Loop = (FF_Loop - 1)
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • FF_IndexListener Equal to 0
                • Then - Actions
                  • Trigger - Turn off Force Field Loop <gen>
                  • Skip remaining actions
                • Else - Actions
              • -------- IMPORTANT SYSTEM PART END --------
  • Dummy Remover
    • Events
      • Unit - A unit Dies
    • Conditions
      • (Triggering unit) Equal to FF_ForceField[FF_Index]
    • Actions
      • Unit - Remove FF_ForceField[FF_Index] from the game

Keywords:
ForceField, Field, Force, Force Field, doomhammer99, custom scripts, Magtheridon96 is handsome, Bob marley, Bob
Contents

Just another Warcraft III map (Map)

Reviews
00:12, 4th Nov 2012 Magtheridon96: Approved. Well done. edit Re-evaluated to 4/5 because the code is really clean and readable ;)

Moderator

M

Moderator

00:12, 4th Nov 2012
Magtheridon96: Approved.
Well done.

edit
Re-evaluated to 4/5 because the code is really clean and readable ;)
 
  • -------- Peasant, Peasant - Thanks Magtheridon96 :D Mag-Teh (teh) --------
  • Custom script: set udg_FF_RemoveOrder = "harvest"
  • Custom script: set udg_FF_TreeRemover = CreateUnit(Player(15), 'hpea', 0, 0, 0)
  • -------- Making the Peasant Invincible (Locust ,Invisible) --------
    • Custom script: call UnitAddAbility(udg_FF_TreeRemover, 'Aloc')
    • Custom script: call ShowUnit(udg_FF_TreeRemover, false)
 
Last edited:
You should put in the tooltip the damage mechanism of this spell...

Also, I'd prefer a timer event than a periodic one... but nothing big really I think... unless the user wants the interval to be changeable in-game...

btw, since you've gone through putting comments, I think the first AoE comment should be changed to Pick Tree AOE instead of just AoE. I know that the variable after that is self-explanatory but since you've already done the part of putting comments, why not make it more direct?

same thing for the special effects comment, If I'll just read it, I would think that it is the special effect for the field itself...

Also, I think it's better to make the AoE, changeable per level and as such, make the scale of the shield unit changeable per level too... doing this for the height and speed is optional...
 
Instead of this:
set bj_lastCreatedEffect = AddSpecialEffectTarget(udg_FF_SFX, udg_FF_NearbyUnits[udg_FF_Index], udg_FF_Attachment)
Custom script: call DestroyEffect(bj_lastCreatedEffect)
you could use this:
call DestroyEffect(AddSpecialEffectTarget(udg_FF_SFX, udg_FF_NearbyUnits[udg_FF_Index], udg_FF_Attachment))

Instead of creating so many tree remover,just create a peasant at the start of the game,hide it,cache it,add locust to it.

Skip remaining actions
You can remove this one because it just skips nothing

You could add the unit type of the field to the dummy remover :D

Move the removelocation loc2 inside the pick unit block,cause you are leaking ( number of units in that group - 1) positions every 0.03 seconds.
Unit groups are just like integer loops,as you can see,when you put this integer or variable:
set count = count + 1
The group is picking the units,then applying actions to it.This is the same to integers thats why you leak locations.
In short,unit groups are loops

Dont use unit in the condition of the dummy remover,use unittype instead

You could also make this a channeling spell :D


You should read this,then this spell will be approved
 
Instead of this:
set bj_lastCreatedEffect = AddSpecialEffectTarget(udg_FF_SFX, udg_FF_NearbyUnits[udg_FF_Index], udg_FF_Attachment)
Custom script: call DestroyEffect(bj_lastCreatedEffect)
you could use this:
call DestroyEffect(AddSpecialEffectTarget(udg_FF_SFX, udg_FF_NearbyUnits[udg_FF_Index], udg_FF_Attachment))

LOOK
Leaks.png
 
Level 2
Joined
Apr 22, 2013
Messages
28
harvestCustom script: set udg_FF_TreeRemover = CreateUnit(Player(15), 'hpea', 0, 0, 0)
need to see this command completely ....
this action does not appear in the file
 
Last edited:
Top