• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

Missle System (No Parabola) and Unit Collision Sys v2

This bundle is marked as useful / simple. Simplicity is bliss, low effort and/or may contain minor bugs.
a Missle system for linear shoots

there are some example trigger in the map and one with description
triggers and map scrips will posted below (updated!!)

v1.1 ==> Removed things that are not needed in the loop
v2 ==> fixed problem with GetLocationZ; repaced move unit with set unit x and y; inproved the unit collision sys and changed it to vJass (using hastables); added damage units in range

thanks to:
Maper Malte (fixing a bug)
Anarchon (fixing a bug and helped me to improve the Unit Collision sys)
Bob666 (help me to fix the GatLocationZ problem)


Keywords:
Missle; Projectile; Collision; Unit; Damage; System
Contents

Missle System (Map)

Reviews
11:46, 3rd Jan 2010 TriggerHappy: Dynamic groups are bad. FirstOfGroup loops are slow. Why are you using locations..? GetUnitState -> GetWidgetLife Please make your constants all capitals, follow blizzards naming convention.

Moderator

M

Moderator

11:46, 3rd Jan 2010
TriggerHappy:

  • Dynamic groups are bad.
  • FirstOfGroup loops are slow.
  • Why are you using locations..?
  • GetUnitState -> GetWidgetLife
  • Please make your constants all capitals, follow blizzards naming convention.
 
Missile System

  • MS Globals
    • Ereignisse
      • Map initialization
    • Bedingungen
    • Aktionen
      • Hashtabelle - Create a hashtable
      • Set MS_Hash = (Last created hashtable)
      • -------- Creating the hashtable --------
      • -------- ================================ --------
      • Set MS_RefreshRate = 0.03
      • -------- Loop cool down --------
      • -------- ================================ --------
      • Set MS_MaxHeight = 2500.00
      • -------- if a missile gets higher then this vaue it will killed --------
      • Set MS_PlayableMapArena = (Playable map area)
      • -------- if the missile will leave the rect it will also killed --------
      • -------- ================================ --------
      • Set MS_DummyUnit = MissleSystem (dummy)
      • -------- the missile dummy unit --------
      • -------- ================================ --------
      • Custom script: set udg_MS_Missles = CreateGroup()
      • -------- createing the missile group --------
      • -------- ================================ --------
      • Countdown-Timer - Start MS_Timer as a Wiederholt timer that will expire in MS_RefreshRate seconds
      • -------- starting the timer --------
  • MS Init example1 and Read Me Kopieren
    • Ereignisse
      • Einheit - A unit Wird angegriffen
    • Bedingungen
      • (Unit-type of (Attacking unit)) Gleich Fighter
    • Aktionen
      • Set MSI_Caster = (Attacking unit)
      • -------- the caster and the damage dealer --------
      • Set MS_TempUnit[0] = (Attacked unit)
      • -------- the temp unit (for the angle) --------
      • -------- ================================ --------
      • Set MSI_Distance = 2000.00
      • -------- the max distance the missile can travel --------
      • Set MSI_Speed = (2750.00 x MS_RefreshRate)
      • -------- the missile speed (converted) --------
      • Set MSI_Damage = 20.00
      • -------- how much damage the missile deal --------
      • Set MSI_CollisionRadius = 60.00
      • -------- the collisions radius --------
      • Set MSI_DamageRad = 75.00
      • -------- the radius of the damage --------
      • Set MSI_SpeedIncraise = 0.00
      • -------- how much the speed will incraised x udg_MS_RefreshRate --------
      • -------- ================================ --------
      • Set MS_LeakPoint[0] = (Position of MSI_Caster)
      • Set MS_LeakPoint[1] = (Position of MS_TempUnit[0])
      • Set MSI_Angle = (Angle from MS_LeakPoint[0] to MS_LeakPoint[1])
      • -------- ================================ --------
      • Set MS_TempReal[5] = 5.00
      • -------- ================================ --------
      • Custom script: if GetUnitType(udg_MS_TempUnit[0]) == 2 then
      • Custom script: set udg_MS_TempReal[6] = GetUnitHeightCylinder(udg_MS_TempUnit[0])/2
      • Custom script: else
      • Custom script: set udg_MS_TempReal[6] = 0.
      • Custom script: endif
      • Custom script: set udg_MS_TempReal[7]=GetLocationZ(udg_MS_LeakPoint[0])-GetLocationZ(udg_MS_LeakPoint[1])
      • -------- ================================ --------
      • Set MS_TempReal[0] = (((Current flying height of MS_TempUnit[0]) + (MS_TempReal[6] - MS_TempReal[7])) - ((Current flying height of MSI_Caster) + MS_TempReal[5]))
      • Set MS_TempReal[1] = (Distance between MS_LeakPoint[0] and MS_LeakPoint[1])
      • Set MSI_ZAngle = (Atan2(MS_TempReal[0], MS_TempReal[1]))
      • -------- ================================ --------
      • Set MSI_MissleModel = Abilities\Weapons\WardenMissile\WardenMissile.mdl
      • Set MSI_MissleDeadModel = Abilities\Weapons\GyroCopter\GyroCopterImpact.mdl
      • -------- ================================ --------
      • Set MS_TempReal[2] = 0.60
      • Custom script: set udg_MS_TempReal[3]=GetLocationZ(udg_MS_LeakPoint[0])
      • Set MS_TempReal[4] = (Current flying height of MSI_Caster)
      • -------- ================================ --------
      • Set MSI_Angle = (MSI_Angle + (Random real number between -3.00 and 3.00))
      • Set MSI_ZAngle = (MSI_ZAngle + (Random real number between -3.00 and 3.00))
      • -------- ================================ --------
      • Auslöser - Run MS Run <gen> (ignoring conditions)
      • -------- ================================ --------
      • Custom script: call RemoveLocation (udg_MS_LeakPoint[0])
      • Custom script: call RemoveLocation (udg_MS_LeakPoint[1])
  • MS Run
    • Ereignisse
    • Bedingungen
    • Aktionen
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • 'IF'-Bedingungen
          • (MS Loop <gen> is on) Gleich False
        • 'THEN'-Aktionen
          • Auslöser - Turn on MS Loop <gen>
        • 'ELSE'-Aktionen
      • -------- turn the loop on --------
      • Einheit - Create 1 MS_DummyUnit for (Owner of MSI_Caster) at MS_LeakPoint[0] facing MSI_Angle degrees
      • -------- create the dummy unit --------
      • Einheit - Turn collision for (Last created unit) Aus
      • -------- turn the collision off --------
      • Einheit - Move (Last created unit) instantly to MS_LeakPoint[0]
      • -------- this fixes the posiotion of the missile --------
      • Animation - Change (Last created unit)'s size to ((MS_TempReal[2] x 100.00)%, (MS_TempReal[2] x 100.00)%, (MS_TempReal[2] x 100.00)%) of its original size
      • -------- changing the size of the missile --------
      • Einheitengruppe - Add (Last created unit) to MS_Missles
      • -------- adds the missile to the missile group --------
      • -------- ------------------- --------
      • Einheit - Add Krähengestalt to (Last created unit)
      • Animation - Change (Last created unit) flying height to (MS_TempReal[4] + MS_TempReal[5]) at 0.00
      • Einheit - Remove Krähengestalt from (Last created unit)
      • -------- change the height of the missile --------
      • Spezialeffekt - Create a special effect attached to the origin of (Last created unit) using MSI_MissleModel
      • -------- create the missile effect --------
      • -------- ================================ --------
      • -------- ================================ --------
      • Hashtabelle - Save Handle OfMSI_Caster as (Key Caster) of (Key (Last created unit)) in MS_Hash
      • Hashtabelle - Save MSI_Distance as (Key Distance) of (Key (Last created unit)) in MS_Hash
      • Hashtabelle - Save MSI_Speed as (Key Speed) of (Key (Last created unit)) in MS_Hash
      • Hashtabelle - Save MSI_Damage as (Key Damage) of (Key (Last created unit)) in MS_Hash
      • Hashtabelle - Save MSI_ZAngle as (Key ZAngle) of (Key (Last created unit)) in MS_Hash
      • Hashtabelle - Save MSI_MissleDeadModel as (Key DeadSFX) of (Key (Last created unit)) in MS_Hash
      • Hashtabelle - Save MSI_CollisionRadius as (Key CollisionsRad) of (Key (Last created unit)) in MS_Hash
      • Hashtabelle - Save MSI_Angle as (Key Angle) of (Key (Last created unit)) in MS_Hash
      • Hashtabelle - Save Handle Of(Last created special effect) as (Key UnitSFX) of (Key (Last created unit)) in MS_Hash
      • Hashtabelle - Save MSI_DamageRad as (Key DamageRad) of (Key (Last created unit)) in MS_Hash
      • Hashtabelle - Save MSI_SpeedIncraise as (Key SpeedIncraise) of (Key (Last created unit)) in MS_Hash
      • Hashtabelle - Save (MS_TempReal[4] + MS_TempReal[5]) as (Key NormalHeight) of (Key (Last created unit)) in MS_Hash
      • Hashtabelle - Save MS_TempReal[3] as (Key StartZ) of (Key (Last created unit)) in MS_Hash
      • -------- ================================ --------
      • -------- saves all things in the missile hash --------
  • MS Loop
    • Ereignisse
      • Zeit - MS_Timer expires
    • Bedingungen
    • Aktionen
      • Einheitengruppe - Pick every unit in MS_Missles and do (Actions)
        • Schleifen - Aktionen
          • Set MS_TempUnit[0] = (Picked unit)
          • Set MS_TempUnit[1] = (Load (Key Caster) of (Key (Picked unit)) in MS_Hash)
          • -------- ================================ --------
          • Einheit - Turn collision for MS_TempUnit[0] Aus
          • -------- ================================ --------
          • Set MS_TempReal[0] = (Load (Key Damage) of (Key (Picked unit)) from MS_Hash)
          • Set MS_TempReal[1] = (Load (Key CollisionsRad) of (Key (Picked unit)) from MS_Hash)
          • Set MS_TempReal[2] = ((Load (Key ZAngle) of (Key (Picked unit)) from MS_Hash) + 90.00)
          • Set MS_TempReal[3] = ((Cos((Load (Key ZAngle) of (Key (Picked unit)) from MS_Hash))) x (Load (Key Speed) of (Key (Picked unit)) from MS_Hash))
          • Set MS_TempReal[7] = (Load (Key DamageRad) of (Key (Picked unit)) from MS_Hash)
          • -------- ================================ --------
          • Set MS_LeakPoint[0] = (Position of (Picked unit))
          • Set MS_LeakPoint[1] = (MS_LeakPoint[0] offset by MS_TempReal[3] towards (Load (Key Angle) of (Key (Picked unit)) from MS_Hash) degrees)
          • -------- ================================ --------
          • Custom script: call SetUnitX(udg_MS_TempUnit[0],GetLocationX(udg_MS_LeakPoint[1]))
          • Custom script: call SetUnitY(udg_MS_TempUnit[0],GetLocationY(udg_MS_LeakPoint[1]))
          • Einheit - Make (Picked unit) face (Load (Key Angle) of (Key (Picked unit)) from MS_Hash) over 0.00 seconds
          • -------- ================================ --------
          • -------- ================================ --------
          • Set MS_TempReal[6] = ((Load (Key NormalHeight) of (Key (Picked unit)) from MS_Hash) + ((Sin((Load (Key ZAngle) of (Key (Picked unit)) from MS_Hash))) x (Load (Key Speed) of (Key (Picked unit)) from MS_Hash)))
          • Hashtabelle - Save MS_TempReal[6] as (Key NormalHeight) of (Key (Picked unit)) in MS_Hash
          • Custom script: set udg_MS_TempReal[8]=GetLocationZ(udg_MS_LeakPoint[1])
          • Set MS_TempReal[9] = (MS_TempReal[6] + ((Load (Key StartZ) of (Key (Picked unit)) from MS_Hash) - MS_TempReal[8]))
          • -------- ================================ --------
          • Animation - Change MS_TempUnit[0] flying height to MS_TempReal[9] at 0.00
          • -------- ================================ --------
          • -------- ================================ --------
          • Custom script: call SetUnitAnimationByIndex(udg_MS_TempUnit[0], R2I(udg_MS_TempReal[2]))
          • -------- ================================ --------
          • Hashtabelle - Save ((Load (Key Distance) of (Key (Picked unit)) from MS_Hash) - (Load (Key Speed) of (Key (Picked unit)) from MS_Hash)) as (Key Distance) of (Key (Picked unit)) in MS_Hash
          • Hashtabelle - Save ((Load (Key Speed) of (Key (Picked unit)) from MS_Hash) + (Load (Key SpeedIncraise) of (Key (Picked unit)) from MS_Hash)) as (Key Speed) of (Key (Picked unit)) in MS_Hash
          • -------- ================================ --------
          • Custom script: set udg_MS_KillMissle= CheckForCollision(GetLocationX(udg_MS_LeakPoint[1]),GetLocationY(udg_MS_LeakPoint[1]),GetUnitFlyHeight(udg_MS_TempUnit[0]),udg_MS_TempReal[1], GetOwningPlayer(udg_MS_TempUnit[0]))
          • -------- =========================================================================== --------
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • 'IF'-Bedingungen
              • Or - Any (Conditions) are true
                • Bedingungen
                  • MS_KillMissle Gleich True
                  • (MS_PlayableMapArena contains MS_TempUnit[0]) Gleich False
                  • (Current flying height of MS_TempUnit[0]) Größer gleich MS_MaxHeight
                  • (Current flying height of MS_TempUnit[0]) Kleiner gleich 1.00
                  • (Load (Key Distance) of (Key (Picked unit)) from MS_Hash) Kleiner gleich 0.00
            • 'THEN'-Aktionen
              • Custom script: call DamageUnitInRange(GetLocationX(udg_MS_LeakPoint[1]),GetLocationY(udg_MS_LeakPoint[1]),GetUnitFlyHeight(udg_MS_TempUnit[0]),udg_MS_TempReal[0],udg_MS_TempReal[7],udg_MS_TempUnit[1])
              • Set MS_KillMissle = False
              • Einheitengruppe - Remove MS_TempUnit[0] from MS_Missles
              • Spezialeffekt - Destroy (Load (Key UnitSFX) of (Key (Picked unit)) in MS_Hash)
              • Custom script: call SetUnitAnimationByIndex(udg_MS_TempUnit[0], 90)
              • Spezialeffekt - Create a special effect attached to the origin of MS_TempUnit[0] using (Load (Key DeadSFX) of (Key (Picked unit)) from MS_Hash)
              • Spezialeffekt - Destroy (Last created special effect)
              • Hashtabelle - Clear all child hashtables of child (Key (Picked unit)) in MS_Hash
              • Einheit - Add a 2.00 second Standard expiration timer to MS_TempUnit[0]
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • 'IF'-Bedingungen
                  • (Number of units in MS_Missles) Gleich 0
                • 'THEN'-Aktionen
                  • Auslöser - Turn off (This trigger)
                • 'ELSE'-Aktionen
            • 'ELSE'-Aktionen
          • -------- ================================ --------
          • Custom script: call RemoveLocation (udg_MS_LeakPoint[0])
          • Custom script: call RemoveLocation (udg_MS_LeakPoint[1])
Unit Collision System

JASS:
//made by hell gate

library UnitCollision initializer Init
    globals
        private hashtable           UC_Hash
        private constant integer    Sphere     = 1
        private constant integer    Cylinder   = 2
        private real                MaxCollSize = 0.
        private constant integer    DummyId    = 'h000' // your private dummy unit
    endglobals
    
    function GetUnitCollSizeSphere takes unit u returns real
        return LoadReal( UC_Hash, GetUnitTypeId(u), 1)
    endfunction
    
    function GetUnitRadCylinder takes unit u returns real
        return LoadReal( UC_Hash, GetUnitTypeId(u), 1)
    endfunction
    
    function GetUnitHeightCylinder takes unit u returns real
        return LoadReal( UC_Hash, GetUnitTypeId(u), 2)
    endfunction
    
    function GetUnitType takes unit u returns integer
        return LoadInteger(UC_Hash,GetUnitTypeId(u),0)
    endfunction
    
    function AddUnitCollisionSphere takes integer uID, real rad returns nothing
        call SaveInteger(UC_Hash, uID, 0, Sphere)
        call SaveReal(UC_Hash, uID, 1, rad)
        if rad >= MaxCollSize then
            set MaxCollSize =rad+.5
        endif
    endfunction
    
    function AddUnitCollisionCylinder takes integer uID, real rad, real height returns nothing
        local real x = SquareRoot((rad*rad)+(height*height))
        call SaveInteger(UC_Hash, uID, 0, Cylinder)
        call SaveReal(UC_Hash, uID, 1, rad)
        call SaveReal(UC_Hash, uID, 2, height)
        if x >= MaxCollSize then
            set MaxCollSize = x+.5
        endif
    endfunction
    
    function CheckForCollision takes real x, real y, real z, real size, player p returns boolean
        local group			g = CreateGroup()
        local unit			u = null
        local real array	r
        local boolean		b = false
        local location      p1
        local location      p2
        call GroupEnumUnitsInRange( g, x, y, MaxCollSize, null)
        loop
            set u = FirstOfGroup(g)
            exitwhen u == null or b == true
            if GetUnitTypeId(u)!= DummyId and GetUnitState(u,UNIT_STATE_LIFE) > 0.405 then
                if GetUnitType(u) == Sphere then
                    set r[0] = x - GetUnitX(u)
                    set r[1] = y - GetUnitY(u)
                    set r[2] = SquareRoot(r[0] * r[0] + r[1] * r[1])
                    set p1    = GetUnitLoc(u)
                    set p2   = Location(x,y)
                    set r[3] = (GetUnitFlyHeight(u)+GetLocationZ(p1))-(z+GetLocationZ(p2))
                    set r[4] = SquareRoot(r[2] * r[2] + r[3] * r[3])
                    set b = ((r[4] <= GetUnitCollSizeSphere(u)+size) and GetOwningPlayer(u) != p)
                    call RemoveLocation(p1)
                    call RemoveLocation(p2)
                elseif GetUnitType(u) == Cylinder then
                    set r[0] = x - GetUnitX(u)
                    set r[1] = y - GetUnitY(u)
                    set r[2] = SquareRoot(r[0] * r[0] + r[1] * r[1])
                    set p1   = GetUnitLoc(u)
                    set p2   = Location(x,y)
                    set r[3] = GetUnitFlyHeight(u)
                    set b = (r[2] <= GetUnitRadCylinder(u)+size and z+GetLocationZ(p2) > r[3]-size+GetLocationZ(p1) and z+GetLocationZ(p2) < r[3]+GetUnitHeightCylinder(u)+size+GetLocationZ(p1) and GetOwningPlayer(u) != p)
                    call RemoveLocation(p1)
                    call RemoveLocation(p2)
                endif
            endif
            call GroupRemoveUnit(g,u)
            set u = null
        endloop
        call DestroyGroup(g)
        set g 	= null
        set u 	= null
        return b
    endfunction
    
    // extra function to damage units in range with the unit collision system
    // (simpel edit from the check for collision function)
    function DamageUnitInRange takes real x, real y, real z, real damage, real rad, unit damagedealer returns nothing
        local group			g = CreateGroup()
        local unit			u = null
        local real array	r
        local location      p1
        local location      p2
        call GroupEnumUnitsInRange( g, x, y, MaxCollSize, null)
        loop
            set u = FirstOfGroup(g)
            exitwhen u == null
            if GetUnitTypeId(u)!= DummyId and GetUnitState(u,UNIT_STATE_LIFE) > 0.405 then
                if GetUnitType(u) == Sphere then
                    set r[0] = x - GetUnitX(u)
                    set r[1] = y - GetUnitY(u)
                    set r[2] = SquareRoot(r[0] * r[0] + r[1] * r[1])
                    set p1   = GetUnitLoc(u)
                    set p2   = Location(x,y)
                    set r[3] = (GetUnitFlyHeight(u)+GetLocationZ(p1))-(z+GetLocationZ(p2))
                    set r[4] = SquareRoot(r[2] * r[2] + r[3] * r[3])
                    if (r[4] <= GetUnitCollSizeSphere(u)+rad) and GetOwningPlayer(u) != GetOwningPlayer(damagedealer) then
                        call UnitDamageTarget(damagedealer, u, damage, true, false, ATTACK_TYPE_MELEE, DAMAGE_TYPE_NORMAL, WEAPON_TYPE_WHOKNOWS)
                    endif
                    call RemoveLocation(p1)
                    call RemoveLocation(p2)
                elseif GetUnitType(u) == Cylinder then
                    set r[0] = x - GetUnitX(u)
                    set r[1] = y - GetUnitY(u)
                    set r[2] = SquareRoot(r[0] * r[0] + r[1] * r[1])
                    set p1   = GetUnitLoc(u)
                    set p2   = Location(x,y)
                    set r[3] = GetUnitFlyHeight(u)
                    if r[2] <= GetUnitRadCylinder(u)+rad and z+GetLocationZ(p2) > r[3]-rad+GetLocationZ(p1) and z+GetLocationZ(p2) < r[3]+GetUnitHeightCylinder(u)+rad+GetLocationZ(p1) and GetOwningPlayer(u) != GetOwningPlayer(damagedealer) then
                        call UnitDamageTarget(damagedealer, u, damage, true, false, ATTACK_TYPE_MELEE, DAMAGE_TYPE_NORMAL, WEAPON_TYPE_WHOKNOWS)
                    endif
                    call RemoveLocation(p1)
                    call RemoveLocation(p2)
                endif
            endif
            call GroupRemoveUnit(g,u)
            set u = null
        endloop
        call DestroyGroup(g)
        set g 	= null
        set u 	= null
    endfunction

    private function Init takes nothing returns nothing
        set UC_Hash = InitHashtable()
        call AddUnitCollisionSphere('h004',100)
        call AddUnitCollisionSphere('h001',30)
        call AddUnitCollisionSphere('h005',50)
        call AddUnitCollisionSphere('h007',90)
        call AddUnitCollisionCylinder('h002',50,45)
        call AddUnitCollisionCylinder('h008',45,100)
        call AddUnitCollisionCylinder('h006',100,240)
        call AddUnitCollisionCylinder('h003',60,280)
        call AddUnitCollisionCylinder('h009',12.5,35)
        call AddUnitCollisionCylinder('h00A',14,35)
    endfunction
endlibrary
Sry for german triggers
 
Last edited:
Level 11
Joined
Dec 5, 2009
Messages
846
I love this one! Just what i needed... But im wondering some things...

1.Why doesn't you just copy the trigger and use it for all units? Like what's the difference between theese triggers?

  • MS Init example9
    • Events
      • Unit - A unit Is attacked
    • Conditions
      • (Unit-type of (Attacking unit)) Equal to Blocker
    • Actions
      • For each (Integer A) from 1 to 2, do (Actions)
        • Loop - Actions
          • Set MSI_Caster = (Attacking unit)
          • Set MS_TempUnit[0] = (Attacked unit)
          • -------- ================================ --------
          • Set MSI_Distance = 1500.00
          • Set MSI_Speed = (500.00 x MS_RefreshRate)
          • Set MSI_Damage = 100.00
          • Set MSI_CollisionRadius = 60.00
          • Set MSI_DamageRad = 200.00
          • Set MSI_SpeedIncraise = (5.00 x MS_RefreshRate)
          • -------- ================================ --------
          • Set MS_LeakPoint[2] = (Position of MSI_Caster)
          • Set MS_LeakPoint[1] = (Position of MS_TempUnit[0])
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Integer A) Equal to 1
            • Then - Actions
              • Set MS_LeakPoint[0] = (MS_LeakPoint[2] offset by 20.00 towards ((Angle from MS_LeakPoint[2] to MS_LeakPoint[1]) + 90.00) degrees)
            • Else - Actions
              • Set MS_LeakPoint[0] = (MS_LeakPoint[2] offset by 20.00 towards ((Angle from MS_LeakPoint[2] to MS_LeakPoint[1]) - 90.00) degrees)
          • Set MSI_Angle = (Angle from MS_LeakPoint[2] to MS_LeakPoint[1])
          • -------- ================================ --------
          • Set MS_TempReal[5] = 80.00
          • -------- ================================ --------
          • Custom script: if GetUnitType(udg_MS_TempUnit[0]) == 2 then
          • Custom script: set udg_MS_TempReal[6] = GetUnitHeightCylinder(udg_MS_TempUnit[0])/2
          • Custom script: else
          • Custom script: set udg_MS_TempReal[6] = 0.
          • Custom script: endif
          • Custom script: set udg_MS_TempReal[7]=GetLocationZ(udg_MS_LeakPoint[0])-GetLocationZ(udg_MS_LeakPoint[1])
          • -------- ================================ --------
          • Set MS_TempReal[0] = (((Current flying height of MS_TempUnit[0]) + (MS_TempReal[6] - MS_TempReal[7])) - ((Current flying height of MSI_Caster) + MS_TempReal[5]))
          • Set MS_TempReal[1] = (Distance between MS_LeakPoint[0] and MS_LeakPoint[1])
          • Set MSI_ZAngle = (Atan2(MS_TempReal[0], MS_TempReal[1]))
          • -------- ================================ --------
          • Set MSI_MissleModel = Abilities\Spells\Orc\LightningBolt\LightningBoltMissile.mdl
          • Set MSI_MissleDeadModel = Abilities\Spells\Human\ThunderClap\ThunderClapCaster.mdl
          • -------- ================================ --------
          • Set MS_TempReal[2] = 0.80
          • Custom script: set udg_MS_TempReal[3]=GetLocationZ(udg_MS_LeakPoint[0])
          • Set MS_TempReal[4] = (Current flying height of MSI_Caster)
          • -------- ================================ --------
          • Trigger - Run MS Run <gen> (ignoring conditions)
          • -------- ================================ --------
          • Custom script: call RemoveLocation (udg_MS_LeakPoint[0])
          • Custom script: call RemoveLocation (udg_MS_LeakPoint[1])
          • Custom script: call RemoveLocation (udg_MS_LeakPoint[2])
  • MS Init example10
    • Events
      • Unit - A unit Is attacked
    • Conditions
      • (Unit-type of (Attacking unit)) Equal to Marine
    • Actions
      • Set MSI_Caster = (Attacking unit)
      • Set MS_TempUnit[0] = (Attacked unit)
      • -------- ================================ --------
      • Set MSI_Distance = 2000.00
      • Set MSI_Speed = (2250.00 x MS_RefreshRate)
      • Set MSI_Damage = 5.00
      • Set MSI_CollisionRadius = 67.50
      • Set MSI_DamageRad = 70.00
      • Set MSI_SpeedIncraise = 0.00
      • -------- ================================ --------
      • Set MS_LeakPoint[0] = (Position of MSI_Caster)
      • Set MS_LeakPoint[1] = (Position of MS_TempUnit[0])
      • Set MSI_Angle = (Angle from MS_LeakPoint[0] to MS_LeakPoint[1])
      • -------- ================================ --------
      • Set MS_TempReal[5] = 30.00
      • -------- ================================ --------
      • Custom script: if GetUnitType(udg_MS_TempUnit[0]) == 2 then
      • Custom script: set udg_MS_TempReal[6] = GetUnitHeightCylinder(udg_MS_TempUnit[0])/2
      • Custom script: else
      • Custom script: set udg_MS_TempReal[6] = 0.
      • Custom script: endif
      • Custom script: set udg_MS_TempReal[7]=GetLocationZ(udg_MS_LeakPoint[0])-GetLocationZ(udg_MS_LeakPoint[1])
      • -------- ================================ --------
      • Set MS_TempReal[0] = (((Current flying height of MS_TempUnit[0]) + (MS_TempReal[6] - MS_TempReal[7])) - ((Current flying height of MSI_Caster) + MS_TempReal[5]))
      • Set MS_TempReal[1] = (Distance between MS_LeakPoint[0] and MS_LeakPoint[1])
      • Set MSI_ZAngle = (Atan2(MS_TempReal[0], MS_TempReal[1]))
      • -------- ================================ --------
      • Set MSI_MissleModel = Abilities\Weapons\WardenMissile\WardenMissile.mdl
      • Set MSI_MissleDeadModel = Abilities\Weapons\WardenMissile\WardenMissile.mdl
      • -------- ================================ --------
      • Set MS_TempReal[2] = 0.40
      • Custom script: set udg_MS_TempReal[3]=GetLocationZ(udg_MS_LeakPoint[0])
      • Set MS_TempReal[4] = (Current flying height of MSI_Caster)
      • -------- ================================ --------
      • Set MSI_Angle = (MSI_Angle + (Random real number between -1.25 and 1.25))
      • Set MSI_ZAngle = (MSI_ZAngle + (Random real number between -1.25 and 1.25))
      • -------- ================================ --------
      • Trigger - Run MS Run <gen> (ignoring conditions)
      • -------- ================================ --------
      • Custom script: call RemoveLocation (udg_MS_LeakPoint[0])
      • Custom script: call RemoveLocation (udg_MS_LeakPoint[1])
That was question 1.

2. You didn't explain theese GUI lines what this is, And what i should change for like a archer or another ground unit:

  • Set MS_TempReal[5] = 5.00
  • Set MS_TempReal[2] = 0.60
  • Set MSI_Angle = (MSI_Angle + (Random real number between -3.00 and 3.00))
  • Set MSI_ZAngle = (MSI_ZAngle + (Random real number between -3.00 and 3.00))
That was question 2.

3. To make this work you have to change the collision system to the unit id you want. You have done like this:
JASS:
        call AddUnitCollisionCylinder('h009',12.5,35)

First i wonder the ,12.5,35 is doing? And what you should change for another ground unit?

Second the :
JASS:
     call AddUnitCollisionSphere('h004',100)

What is this function doing? What's the difference between theese JASS codes? And what is the ,100 doing at the end ? xP

Sorry for all theese questions but this systems looks very useful and it is very useful. And i wanted to use this system in my map thats why im asking all the questions. I hope it didn't bother you too much.

If you explain theese things this system will get a 5/5 from me!

Trust me you deserve it!
 
the differenc between the first and the second one is the missile count, the damage....


Set MSI_Angle = (MSI_Angle + (Random real number between -3.00 and 3.00))
Set MSI_ZAngle = (MSI_ZAngle + (Random real number between -3.00 and 3.00))

is to make it spread out a bit (only for test map but you also can use it if you want)


Set MS_TempReal[2] = 0.60

is the size of the missile (60%)


Set MS_TempReal[5] = 5.00

is the shoot offset (he shoots a missile with his height + 5)


call AddUnitCollisionCylinder('h009',12.5,35)

set the collision of the unit type 'h009' to a cylinder with the radius 12.5 and the height 35.


call AddUnitCollisionSphere('h004',100)

set the collision of the unit type 'h004' to a sphere with the raduis 100
 
Top