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

Simple Missile system

This bundle is marked as useful / simple. Simplicity is bliss, low effort and/or may contain minor bugs.
  • Like
Reactions: makai
This system allows move dummy missiles to their targets. Target could be unit or area. You can set speed, collision range and some trigger which will triggered when missile hits target.

For move unit set variables which contains example spells MoveToUnit, MoveToPoint, Fire missile to unit and Fire missile to area

Trigger which will trigger when missile hits target can read following variables:

SystemMoveCaster: variable with unit which fired missile
SystemMoveMovedUnit: variable with missile
SystemMoveTargetUnit: variable with targeted unit (move to unit)
SystemMoveTargetAoE: variable with targeted area (move to point)

You can change this system if you want.

Main Triggers:

1. To Unit Target:

  • Events
  • Conditions
  • Actions
    • Unit Group - Pick every unit in SystemMoveToUnitGroup and do (Actions)
      • Loop - Actions
        • -------- Set Units Positions --------
        • Set CachePoint1 = (Position of (Picked unit))
        • Set CachePoint2 = (Position of (Load (Key (Picked unit)) of (Key Target) in SystemMoveHash))
        • -------- Convert speed from 1s to 0.04s --------
        • Set SytemMoveSpeed = ((Load (Key (Picked unit)) of (Key Speed) from SystemMoveHash) x (RepeatingPerSecond))
        • -------- Move Unit to target unit --------
        • Set CachePoint3 = (CachePoint1 offset by SytemMoveSpeed towards (Angle from CachePoint1 to CachePoint2) degrees)
        • Unit - Move (Picked unit) instantly to CachePoint3
        • Unit - Make (Picked unit) face (Load (Key (Picked unit)) of (Key Target) in SystemMoveHash) over 0.00 seconds
        • -------- Check if is unit colided with target unit --------
        • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
          • If - Conditions
            • Or - Any (Conditions) are true
              • Conditions
                • (Distance between CachePoint1 and CachePoint2) Less than (Load (Key (Picked unit)) of (Key Collision) from SystemMoveHash)
                • ((Picked unit) is alive) Equal to False
          • Then - Actions
            • -------- Set variables contains Units data from moved units --------
            • Set SystemMoveCaster = (Load (Key (Picked unit)) of (Key Caster) in SystemMoveHash)
            • Set SystemMoveTargetUnit = (Load (Key (Picked unit)) of (Key Target) in SystemMoveHash)
            • Set SystemMoveMovedUnit = (Picked unit)
            • -------- Run Trigger which does action triggered when unit collided --------
            • Trigger - Run (Load (Key (Picked unit)) of (Key CollisionAction) in SystemMoveHash) (checking conditions)
            • -------- Clear Hash and removes point leaks --------
            • Hashtable - Clear all child hashtables of child (Key (Triggering unit)) in SystemMoveHash
            • Unit - Turn collision for (Picked unit) On
            • Unit Group - Remove (Picked unit) from SystemMoveToUnitGroup
            • Custom script: call RemoveLocation (udg_CachePoint1)
            • Custom script: call RemoveLocation (udg_CachePoint2)
            • Custom script: call RemoveLocation (udg_CachePoint3)
          • Else - Actions
            • Custom script: call RemoveLocation (udg_CachePoint1)
            • Custom script: call RemoveLocation (udg_CachePoint2)
            • Custom script: call RemoveLocation (udg_CachePoint3)

2. To Point target

  • Events
  • Conditions
  • Actions
    • Unit Group - Pick every unit in SystemMoveToPoint and do (Actions)
      • Loop - Actions
        • -------- Set Positions --------
        • Set CachePoint1 = (Position of (Picked unit))
        • Set CachePoint2 = (Load (Key (Picked unit)) of (Key Target) in SystemMoveHash)
        • -------- Convert speed from 1s to 0.04s --------
        • Set SytemMoveSpeed = ((Load (Key (Picked unit)) of (Key Speed) from SystemMoveHash) x (RepeatingPerSecond))
        • -------- Move Unit to target point --------
        • Set CachePoint3 = (CachePoint1 offset by SytemMoveSpeed towards (Angle from CachePoint1 to CachePoint2) degrees)
        • Unit - Move (Picked unit) instantly to CachePoint3
        • Unit - Make (Picked unit) face CachePoint2 over 0.00 seconds
        • -------- Check if is unit is in target --------
        • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
          • If - Conditions
            • (Distance between CachePoint1 and CachePoint2) Less than SytemMoveSpeed
          • Then - Actions
            • -------- Set variables contains Units data from moved units --------
            • Set SystemMoveCaster = (Load (Key (Picked unit)) of (Key Caster) in SystemMoveHash)
            • Set SystemMoveMovedUnit = (Picked unit)
            • Set SystemMoveTargetAoE = (Load (Key (Picked unit)) of (Key Target) in SystemMoveHash)
            • -------- Run Trigger which does action triggered when unit collided --------
            • Trigger - Run (Load (Key (Picked unit)) of (Key CollisionAction) in SystemMoveHash) (checking conditions)
            • -------- Clear Hash and removes point leaks --------
            • Unit Group - Remove (Picked unit) from SystemMoveToPoint
            • Hashtable - Clear all child hashtables of child (Key (Triggering unit)) in SystemMoveHash
            • Custom script: call RemoveLocation (udg_CachePoint1)
            • Custom script: call RemoveLocation (udg_CachePoint2)
            • Custom script: call RemoveLocation (udg_CachePoint3)
          • Else - Actions
            • Custom script: call RemoveLocation (udg_CachePoint1)
            • Custom script: call RemoveLocation (udg_CachePoint3)

Keywords:
missile, move
Contents

MissileSystem (Map)

Reviews
The Hiveworkshop spell database already has two approved GUI missile systems and both are better than this. You need to create exceptionally good missile system to get it approved.

Moderator

M

Moderator

Reviewed by Maker, Simple Missile system, 28th Dec 2012

The Hiveworkshop spell database already has two approved GUI missile systems
and both are better than this.
You need to create exceptionally good missile system to get it approved.
 
Level 25
Joined
Jul 10, 2006
Messages
3,315
You should post the triggers in the main post.

I did take a look, though:
  • Take the disable fog of war/black mask actions out of the system trigger. Users should never have to edit system triggers.
  • Change the loop speed to 0.03 for a smoother ride, or make it configurable.
  • Instead of constantly loading all the data from the hashtable, you should cache the data in temp variables like TempTargetUnit. You should also cache (Picked unit).
  • In your examples, the users will be editting hash tables. You should rather make a "Save unit to system" function/trigger, and let users write targetting data to a temporary variable, and then have them execute that trigger.
  • In Unit2Point trigger, you have this instead of your RunTrigger action:
    • If ((Unit-type of (Triggering unit)) Equal to Footman) then do (Do nothing) else do (Do nothing)
  • In your move triggers, you are only removing the cache locations in the "then" actions of the if/then/else, so every time it's "else", they are leaking. Put all the RemoveLocations outside of the if/then/else.

You should maybe also make an example where you create a projectile.

I like this system.
 
Level 25
Joined
Jul 10, 2006
Messages
3,315
People see animation with 24 fps, and with 0.04 loop is 25 fps so i think that 0.03 is useless, because it use more memory. I created this for big map so i need systems which low memory use. Disable Fog of war is only for testing, because you need to see targets. Footman condition is bug and leak too, so thx for info :) i will fix it.

It's noticeable at higher speeds in Warcraft 3. Please make it configurable.

I know that disable fog of war is only for testing, that's why I said you should take it out of the system triggers, which users shouldn't have to edit.
 
Level 37
Joined
Mar 6, 2006
Messages
9,240
The system is too simple, the z-offset of the missile does not behave correctly. It should support linear movement. Now the missile can go up and down hills. The triggers should be off when there are no missiles. You shouldn't have separate triggers for 25 fps and 33 fps, use Trigger - add new event instead. ToUnit3 and ToPoint3 triggers are leaking.
 
Top