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

Lock On Battle System Version 2.0a

This bundle is marked as useful / simple. Simplicity is bliss, low effort and/or may contain minor bugs.
neku99 presents . . .

Lock On Battle System Version 2.0

Re-done the triggers and made the system MUI

Features:

- Using the "Target" ability you can aquire a unit and mark it as your target

- Targeted units will have an arrow above them with the same color as the targeting unit's owner and can only be seen by you and your allies

- Spells and abilties do not need any targets to be casted, instead your aquired "Target" will be subjected to the spell's effects. (there is an example spell inside the test map)

Upcoming Features:

- A multiboard that shows the aquired target's stats (e.g. name, hitpoints, etc.)

- Spells will have a triggered cooldown (or maybe casting time)

- Also whenever you cast a spell a counter will be shown on the multiboard showing the spells cooldown

- An enemy AI that uses the system

Credits:

wyrmlord and his "Multi-Instancible GUI Spell Making" - Without this tutorial I would have not made MUI spells

ap0calypse - For his very useful information and tips about making MUI spells and actually helping me a bit with my system

UPCOMING FEATURES WILL EITHER BE CHANGED OR ADDED

PLEASE PM ME BUGS AND ERRORS

THANKS ^^

Change Log

2.0a - Fixed some bugs and memory leaks
2.0 - re-submitted
1.0 - Submitted, rejected, deleted


Keywords:
target, neku99, battle, system
Contents

Neku's Test Map+ (Map)

Reviews
16:50, 16th Jun 2010 Hanky: Find an other way to attach the datas to your units. To use the custom value of an unit is the wrong way. You should at least use hashtables.

Moderator

M

Moderator

16:50, 16th Jun 2010
Hanky:
Find an other way to attach the datas to your units. To use the custom value of an unit is the wrong way. You should at least use hashtables.
 
Level 14
Joined
Nov 2, 2008
Messages
579
I just quickly went thru your code and here's a few things you can fix.

Don't use

  • Do nothing
I mean, nothing is nothing right? just leave it blank :)

In this trigger you don't destroy the group. Add a custom script like this:

  • Target Loop
    • Events
      • Time - Every 0.03 seconds of game time
    • Conditions
    • Actions
      • Unit Group - Pick every unit in TargetCasterGroup and do (Actions)
        • Loop - Actions
          • Multiple FunctionsIf (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • ((TargetCaster[(Custom value of (Picked unit))] is dead) Equal to (==) True) or ((TargetUnit[(Custom value of (Picked unit))] is dead) Equal to (==) True)
            • Then - Actions
              • Unit - Kill TargetDummy[(Custom value of (Picked unit))]
              • Custom script: call RemoveLocation(udg_TargetPoint[GetUnitUserData(GetEnumUnit())])
              • Custom script: call RemoveLocation(udg_TargetCasterPoint[GetUnitUserData(GetEnumUnit())])
              • Unit Group - Remove TargetCaster[(Custom value of (Picked unit))] from TargetCasterGroup
            • Else - Actions
              • Set TargetPoint[(Custom value of (Picked unit))] = (Position of TargetUnit[(Custom value of (Picked unit))])
              • Set TargetCasterPoint[(Custom value of (Picked unit))] = (Position of TargetCaster[(Custom value of (Picked unit))])
              • Unit - Move TargetDummy[(Custom value of (Picked unit))] instantly to TargetPoint[(Custom value of (Picked unit))]
      • Custom script: call DestroyGroup( udg_TargetCasterGroup )
Same deal here:

  • Flare Loop
    • Events
      • Time - Every 0.03 seconds of game time
    • Conditions
    • Actions
      • Unit Group - Pick every unit in FlareCasterGroup and do (Actions)
        • Loop - Actions
          • Unit - Order TargetCaster[(Custom value of (Picked unit))] to Stop
          • Animation - Play TargetCaster[(Custom value of (Picked unit))]'s attack animation
          • Unit - Make TargetCaster[(Custom value of (Picked unit))] face TargetUnit[(Custom value of (Picked unit))] over 0.00 seconds
          • Special Effect - Create a special effect at TargetPoint[(Custom value of (Picked unit))] using Abilities\Spells\Other\Doom\DoomDeath.mdl
          • Set FlareDamager = TargetCaster[(Custom value of (Picked unit))]
          • Unit Group - Pick every unit in FlareGroup and do (Actions)
            • Loop - Actions
              • Unit - Cause FlareDamager to damage (Picked unit), dealing 50.00 damage of attack type Spells and damage type Normal
          • Unit Group - Remove TargetCaster[(Custom value of (Picked unit))] from FlareCasterGroup
          • Custom script: call DestroyGroup( udg_FlareGroup )
      • Custom script: call RemoveLocation(udg_TargetPoint[GetUnitUserData(GetEnumUnit())])
      • Custom script: call RemoveLocation(udg_TargetCasterPoint[GetUnitUserData(GetEnumUnit())])
      • Custom script: call DestroyGroup( udg_FlareCasterGroup )
 
Level 10
Joined
Sep 3, 2009
Messages
458
I just quickly went thru your code and here's a few things you can fix.

Don't use

  • Do nothing
I mean, nothing is nothing right? just leave it blank :)

In this trigger you don't destroy the group. Add a custom script like this:

  • Target Loop
    • Events
      • Time - Every 0.03 seconds of game time
    • Conditions
    • Actions
      • Unit Group - Pick every unit in TargetCasterGroup and do (Actions)
        • Loop - Actions
          • Multiple FunctionsIf (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • ((TargetCaster[(Custom value of (Picked unit))] is dead) Equal to (==) True) or ((TargetUnit[(Custom value of (Picked unit))] is dead) Equal to (==) True)
            • Then - Actions
              • Unit - Kill TargetDummy[(Custom value of (Picked unit))]
              • Custom script: call RemoveLocation(udg_TargetPoint[GetUnitUserData(GetEnumUnit())])
              • Custom script: call RemoveLocation(udg_TargetCasterPoint[GetUnitUserData(GetEnumUnit())])
              • Unit Group - Remove TargetCaster[(Custom value of (Picked unit))] from TargetCasterGroup
            • Else - Actions
              • Set TargetPoint[(Custom value of (Picked unit))] = (Position of TargetUnit[(Custom value of (Picked unit))])
              • Set TargetCasterPoint[(Custom value of (Picked unit))] = (Position of TargetCaster[(Custom value of (Picked unit))])
              • Unit - Move TargetDummy[(Custom value of (Picked unit))] instantly to TargetPoint[(Custom value of (Picked unit))]
      • Custom script: call DestroyGroup( udg_TargetCasterGroup )
Same deal here:

  • Flare Loop
    • Events
      • Time - Every 0.03 seconds of game time
    • Conditions
    • Actions
      • Unit Group - Pick every unit in FlareCasterGroup and do (Actions)
        • Loop - Actions
          • Unit - Order TargetCaster[(Custom value of (Picked unit))] to Stop
          • Animation - Play TargetCaster[(Custom value of (Picked unit))]'s attack animation
          • Unit - Make TargetCaster[(Custom value of (Picked unit))] face TargetUnit[(Custom value of (Picked unit))] over 0.00 seconds
          • Special Effect - Create a special effect at TargetPoint[(Custom value of (Picked unit))] using Abilities\Spells\Other\Doom\DoomDeath.mdl
          • Set FlareDamager = TargetCaster[(Custom value of (Picked unit))]
          • Unit Group - Pick every unit in FlareGroup and do (Actions)
            • Loop - Actions
              • Unit - Cause FlareDamager to damage (Picked unit), dealing 50.00 damage of attack type Spells and damage type Normal
          • Unit Group - Remove TargetCaster[(Custom value of (Picked unit))] from FlareCasterGroup
          • Custom script: call DestroyGroup( udg_FlareGroup )
      • Custom script: call RemoveLocation(udg_TargetPoint[GetUnitUserData(GetEnumUnit())])
      • Custom script: call RemoveLocation(udg_TargetCasterPoint[GetUnitUserData(GetEnumUnit())])
      • Custom script: call DestroyGroup( udg_FlareCasterGroup )

Wow didn't see that in the Flare Loop. Thanks for clarifying ^^

As for the Target Loop, I was told adding/removing units from a unit group do not leak, so I didn't destroy the group.

EDIT:

Thanks X-OMG-X ^^ I'm having cool Ideas for this system

Ok fixed the group leak in Flare Loop
 
Top