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

[Spell] Dummy Manual Missile Problem

Status
Not open for further replies.

sentrywiz

S

sentrywiz

This is my attempt to make a straight-line projectile. I've used this from somewhere, already pre-made by someone but have forgotten how it was made. So I tried to figure it out on my own, and got it to work for the most part, however:

1) It casts only once. After that one cast, the dummy just appears and stands in place.

2) The missile is moving pretty slowly. Is it either the time but I doubt it (0.05 sec) or the offset value.


Triggers:


  • Spear Launch
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Spear Throw (A)
    • Actions
      • Set spear_thrower = (Casting unit)
      • Set loc_start = (Position of spear_thrower)
      • Set loc_end = (Target point of ability being cast)
      • Unit - Create 1 The Spear for (Owner of spear_thrower) at loc_start facing (Facing of spear_thrower) degrees
      • Set the_spear = (Last created unit)
      • Unit Group - Add the_spear to spear_group
      • Set total_spears = (total_spears + 1)
      • Custom script: call RemoveLocation ( udg_loc_start )
      • Custom script: call RemoveLocation ( udg_loc_end )

  • Move Spear
    • Events
      • Time - Every 0.05 seconds of game time
    • Conditions
    • Actions
      • Unit Group - Pick every unit in spear_group and do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Number of units in spear_group) Greater than 0
            • Then - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • spear_range_ctr Less than 500
                • Then - Actions
                  • Set moving_spear = (Picked unit)
                  • Set loc_move = (Position of moving_spear)
                  • Set spear_hit = (Units within 130.00 of loc_move matching ((((Matching unit) is alive) Equal to True) and (((Matching unit) belongs to an enemy of (Owner of moving_spear)) Equal to True)))
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • (Number of units in spear_hit) Greater than 0
                    • Then - Actions
                      • Unit - Cause moving_spear to damage (Random unit from spear_hit), dealing 100.00 damage of attack type Pierce and damage type Normal
                      • Unit Group - Remove moving_spear from spear_group
                      • Set total_spears = (total_spears - 1)
                      • Unit - Kill moving_spear
                    • Else - Actions
                      • Set spear_range_ctr = (spear_range_ctr + 25)
                      • Unit - Move moving_spear instantly to (loc_move offset by 25.00 towards (Facing of moving_spear) degrees), facing (Facing of moving_spear) degrees
                  • Custom script: call RemoveLocation ( udg_loc_move )
                  • Custom script: call DestroyGroup ( udg_spear_hit )
                • Else - Actions
                  • Unit Group - Remove moving_spear from spear_group
                  • Set total_spears = (total_spears - 1)
                  • Unit - Kill moving_spear
            • Else - Actions

EDIT: Nvm I figured it out myself :)
Close this thread.
 
Last edited by a moderator:

Kusanagi Kuro

Hosted Project: SC
Level 10
Joined
Mar 11, 2012
Messages
708
Why dont u use Hashtable or Unit Indexer? In ur trigger may cause bugs. (But I dont know what that bug is :D). Also, ur trigger has so many point leaks.

If u can import the Unit Indexer to ur map, I have the trigger for that spell for u (I only trigger the movement, the damage and target is all urs :D):
  • Spear Throw Base
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Spear Throw
    • Actions
      • Set tempPoint = (Position of (Triggering unit))
      • Unit - Create 1 S_Missle for (Owner of (Triggering unit)) at tempPoint facing (Facing of Triggering Unit) degrees
      • Set S_CV = (Custom value of (Last created unit))
      • Set S_CasterPos[S_CV] = (Position of (Triggering unit))
      • Set S_LVLs[S_CV] = (Level of Spear Throw for (Triggering unit))
      • Set S_Caster[S_CV] = (Triggering unit)
      • Set S_TargetPoint[S_CV] = (Target point of ability being cast)
      • Set S_Speed[S_CV] = 18.00
      • Custom script: set udg_S_DamagedUnit[udg_S_CV]=CreateGroup()
      • Unit - Turn collision for (Last created unit) Off
      • Unit Group - Add (Last created unit) to S_DummyGroup
      • Set S_Angle[S_CV] = (Angle from S_CasterPos[S_CV] to S_TargetPoint[S_CV])
      • Set S_Distance[S_CV] = 500
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Spear Throw Loop <gen> is on) Equal to False
        • Then - Actions
          • Trigger - Turn on Spear Throw Move <gen>
        • Else - Actions
      • Custom script: call RemoveLocation(udg_tempPoint)
      • Custom script: call RemoveLocation(udg_S_CasterPos[udg_S_CV])
      • Custom script: call RemoveLocation(udg_S_TargetPos[udg_S_CV])
  • Spear Throw Move
    • Events
      • Time - Every 0.02 seconds of game time
    • Conditions
    • Actions
      • Unit Group - Pick every unit in S_DummyGroup and do (Actions)
        • Loop - Actions
          • Set S_CV = (Custom value of (Picked unit))
          • Set S_CasterPos[S_CV] = (Position of (Picked unit))
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
              • If - Conditions
                • S_Distance[S_CV] Greater than 0.00
              • Then - Actions
                • Set S_MovePos[S_CV] = (S_CasterPos[S_CV] offset by S_Speed[S_CV] towards S_Angle[S_CV] degrees)
                • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                  • If - Conditions
                    • ((Playable map area) contains S_MovePos[S_CV]) Equal to True
                  • Then - Actions
                  • Else - Actions
                    • Set S_MovePos[S_CV] = (S_CasterPos[S_CV] offset by 0.00 towards S_Angle[S_CV] degrees)
                • Unit - Move (Picked unit) instantly to S_MovePos[S_CV]
                • Set S_Distance[S_CV] = (S_Distance[S_CV] - S_Speed[S_CV])
                • Custom script: call RemoveLocation(udg_S_MovePos[udg_S_CV])
                • Custom script: call RemoveLocation(udg_S_CasterPos[udg_S_CV])
                • Else - Actions
                  • Unit - Turn collision for (Picked unit) On
                  • Unit - Kill (Picked unit)
                  • Unit Group - Remove (Picked unit) from S_DummyGroup
        • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
          • If - Conditions
            • (Number of units in S_DummyGroup) Equal to 0
          • Then - Actions
            • Trigger - Turn off (This trigger)
          • Else - Actions
And this is the Hashtable version:
  • Spear Throw Base
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Spear Throw
    • Actions
      • Set Smoke_LVLs = (Level of Smoke Bomb for (Triggering unit))
      • Set S_Dummy = Smoke_Missle
      • Set S_Caster = (Triggering unit)
      • Set S_Speed = 18.00
      • Set S_AOERadius = 300.00
      • Set S_TargetPoint = (Target point of ability being cast)
      • Trigger - Run Spear Throw Setup <gen> (ignoring conditions)
  • Spear Throw Setup
    • Events
    • Conditions
    • Actions
      • Set S_CasterPos = (Position of S_Caster)
      • Unit - Create 1 S_Dummy for (Owner of S_Caster) at S_CasterPos facing (Facing of S_Caster) degrees
      • Set S_Angle = (Angle from S_CasterPos to S_TargetPoint)
      • Set S_Distance = (Distance between S_CasterPos and S_TargetPoint)
      • Hashtable - Save Handle OfS_Caster as (Key caster) of (Key (Last created unit)) in Hashtable
      • Hashtable - Save S_Angle as (Key angle) of (Key (Last created unit)) in Hashtable
      • Hashtable - Save S_Distance as (Key dist) of (Key (Last created unit)) in Hashtable
      • Hashtable - Save S_Speed as (Key spd) of (Key (Last created unit)) in Hashtable
      • Custom script: set udg_S_AffectedUnit = CreateGroup()
      • Unit - Turn collision for (Last created unit) Off
      • Unit Group - Add (Last created unit) to S_DummyGroup
      • Trigger - Turn on Spear Throw Loop <gen>
      • Custom script: call RemoveLocation(udg_S_CasterPos)
      • Custom script: call RemoveLocation(udg_S_TargetPoint)
  • Smoke Bomb Loop
    • Events
      • Time - Every 0.02 seconds of game time
    • Conditions
    • Actions
      • Unit Group - Pick every unit in S_DummyGroup and do (Actions)
        • Loop - Actions
          • Set S_Caster = (Load (Key caster) of (Key (Picked unit)) in Hashtable)
          • Set S_Speed = (Load (Key spd) of (Key (Picked unit)) from Hashtable)
          • Set S_CasterPos = (Position of (Picked unit))
          • Set S_Angle = (Load (Key angle) of (Key (Picked unit)) from Hashtable)
          • Set S_Distance = (Load (Key dist) of (Key (Picked unit)) from Hashtable)
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • S_Distance Greater than 0.00
            • Then - Actions
              • Set S_MovePos = (S_CasterPos offset by S_Speed towards S_Angle degrees)
              • Unit - Move (Picked unit) instantly to S_MovePos, facing S_Angle degrees
              • Hashtable - Save (S_Distance - S_Speed) as (Key dist) of (Key (Picked unit)) in Hashtable
              • Custom script: call RemoveLocation(udg_S_MovePos)
            • Else - Actions
              • Unit - Turn collision for (Picked unit) On
              • Unit - Kill (Picked unit)
              • Unit Group - Remove (Picked unit) from S_DummyGroup
              • Hashtable - Clear all child hashtables of child (Key (Picked unit)) in Hashtable
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (Number of units in S_AffectedUnit) Equal to 0
                • Then - Actions
                  • Trigger - Turn off (This trigger)
                • Else - Actions
          • Custom script: call RemoveLocation(udg_S_CasterPos)
 
Status
Not open for further replies.
Top