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

projectile spells

Status
Not open for further replies.
Level 12
Joined
Mar 24, 2011
Messages
1,082
You have a dummy ability. No damage no effect. Just to cast.
With trigger when that ability is cast create a dummy unit. Turn on another loop trigger.
In the loop trigger move it forward.
Check if there are units around it and if there are deal some damage and destroy the dummy.

Oooh I was going to whrite the whole spell but thought that it should be somewhere around. I wouldn't do it the same way but anyway here:
http://www.hiveworkshop.com/forums/spells-569/elunes-arrow-v1-1-a-148816/?prev=search%3Darrow%26d%3Dlist%26r%3D20

  • Elune Arrow
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Channel
    • Actions
      • -------- Those integers are used to index each cast and arrow. I would use a unit indexer for that purpose. --------
      • -------- A indexing is a must for any non instant spell. It prevents one units arrow to bug other units arrows. --------
      • -------- Spell of which only one can be casted at a time without a bug is refered as OSI - One Single Instance. Only 1 unit can cast the spell on the map at the same time. If another unit casts the spell while the first units spell is still taking effect a bug occurs.Those don't use index.--------
      • -------- Spell of which only one can be casted at a time for each player without a bug is refered as MPI - Muilty Player Instanceable. Each player can have only one spell running at a time. Those mostly use player number as index. Systems as Custom resources are made MPI.--------
      • -------- Spell of which only one can be casted at a time for each unit without a bug is refered as MUI - Multy Unit Instanceable. This allows each unit to be able to cast a spell without bugging other units spells. This is the minimum for your spell to be marked as accepted. Mostly done by hashtables or indexing systems.--------
      • -------- A spell which doesn't interfere with each instance of the spell. A unit can cast the spell multiple times and each cast wont interrupt other casts of teh same spell is refered as SUMI - Same Unit Multy Instanceable. Mostly spells without CD or stack.--------
      • -------- The current spell is SUMI. --------
      • Set Arrow_Counts = (Arrow_Counts + 1)
      • Set Arrow_CountMaxSize = 8191
      • -------- This refreshes the index if it reaches max. --------
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • Arrow_Counts Greater than Arrow_CountMaxSize
        • Then - Actions
          • Set Arrow_Counts = 1
        • Else - Actions
      • -------- Sets cast related variables. --------
      • -------- First the casting unit. You want it to deal the damage --------
      • Set Arrow_Caster[Arrow_Counts] = (Casting unit)
      • -------- The position of the caster (The start location of the spell) --------
      • Set Arrow_CasterLoc = (Position of Arrow_Caster[Arrow_Counts])
      • -------- The target of the spell. --------
      • Set Arrow_TargetPoint = (Target point of ability being cast)
      • -------- The angle betwen the caster and the target. Because the spell has fixed distance and no specific end point the arrow would be moved towards angle. --------
      • Set Arrow_Angle = (Angle from Arrow_CasterLoc to Arrow_TargetPoint)
      • -------- Creates the dummy and sets its custom value. That wouldn't stack with unit indexer but it wouldn't be done that way if unit indexer is used. --------
      • Unit - Create 1 Elune Arrow for (Owner of Arrow_Caster[Arrow_Counts]) at Arrow_CasterLoc facing Arrow_Angle degrees
      • Unit - Set the custom value of (Last created unit) to Arrow_Counts
      • --------Adds the arrow to a unit group. Arrows would get "selected" in the loop using this unit group.--------
      • Unit Group - Add (Last created unit) to Arrow_StartGroup
      • -------- Sets distance related variables. --------
      • -------- Sets max distance an arrow can travel. --------
      • Set Arrow_Distance[Arrow_Counts] = 2300.00
      • -------- Sets its current traveled distnce to 0. That is because if the index gets refreshed it the traveled distance would be around 2300. Evades epick fails. --------
      • Set Arrow_DistanceTravel[Arrow_Counts] = 0.00
      • -------- Sets its stun duration to minimum. Same reason.--------
      • Set Arrow_StunDuration[Arrow_Counts] = 1
      • -------- Sets the stun increase traveled distance to 0. Same reason.--------
      • Set Arrow_DistanceCount[Arrow_Counts] = 0.00
      • -------- Turns on the loop. --------
      • Trigger - Turn on Elune Arrow Move <gen>
      • -------- cleans leaks --------
      • Custom script: call RemoveLocation (udg_Arrow_CasterLoc)
      • Custom script: call RemoveLocation (udg_Arrow_TargetPoint)
  • Elune Arrow Move
    • Events
      • Time - Every 0.02 seconds of game time
    • Conditions
    • Actions
      • -------- Picks all arrows --------
      • Unit Group - Pick every unit in Arrow_StartGroup and do (Actions)
        • Loop - Actions
          • -------- Sets arrows values. --------
          • Set Arrow_CusValue = (Custom value of (Picked unit))
          • Set Arrow_DummyLoc = (Position of (Picked unit))
          • Set Arrow_Movement = (Arrow_DummyLoc offset by 20.00 towards (Facing of (Picked unit)) degrees)
          • Unit - Move (Picked unit) instantly to Arrow_Movement
          • -------- Sets treaveled distance. --------
          • Set Arrow_DistanceTravel[Arrow_CusValue] = (Arrow_DistanceTravel[Arrow_CusValue] + 18.00)
          • Set Arrow_DistanceCount[Arrow_CusValue] = (Arrow_DistanceCount[Arrow_CusValue] + 18.00)
          • -------- Increases stun duration for traveled distance. --------
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • Arrow_DistanceCount[Arrow_CusValue] Greater than or equal to 225.00
            • Then - Actions
              • Set Arrow_StunDuration[Arrow_CusValue] = (Arrow_StunDuration[Arrow_CusValue] + 1)
              • Set Arrow_DistanceCount[Arrow_CusValue] = 0.00
            • Else - Actions
          • -------- Sets a unit group. Checks if there are units around the arrow. Thats how ppl simulate collision or hits with this kind of spells. --------
          • Set Arrow_UnitGroup = (Units within 150.00 of Arrow_Movement matching ((((Matching unit) is A structure) Not equal to True) and ((((Matching unit) is alive) Equal to True) and (((Matching unit) belongs to an enemy of (Owner of Arrow_Caster[Arrow_CusValue])) Equal to True))))
          • -------- Sets a unit to random unit from units around the arrow. That refers to hit unit by arrow. --------
          • Set Arrow_RandomUnit = (Random 1 units from Arrow_UnitGroup)
          • Unit Group - Pick every unit in Arrow_RandomUnit and do (Actions)
            • Loop - Actions
              • -------- Deals damage. --------
              • Unit - Cause Arrow_Caster[Arrow_CusValue] to damage (Picked unit), dealing (90.00 x (Real((Level of Channel for Arrow_Caster[Arrow_CusValue])))) damage of attack type Spells and damage type Normal
              • -------- Creates a dummy unit which will stun. --------
              • Unit - Create 1 Dummy for (Owner of Arrow_Caster[Arrow_CusValue]) at Arrow_Movement facing Default building facing degrees
              • -------- Adds stun ability and sets its level to apropriate value depending on Arrow_StunDuration. --------
              • Unit - Add Elune Arrow Stun to (Last created unit)
              • Unit - Set level of Elune Arrow Stun for (Last created unit) to Arrow_StunDuration[Arrow_CusValue]
              • -------- Orders the dummy to use the stun ability. --------
              • Unit - Order (Last created unit) to Human Mountain King - Storm Bolt (Picked unit)
              • -------- Adds expiration timer to the dummy. --------
              • Unit - Add a 1.50 second Generic expiration timer to (Last created unit)
          • -------- Checks if the arrow has traveled max distance. --------
          • -------- or it has hit a unit. --------
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • Or - Any (Conditions) are true
                • Conditions
                  • Arrow_DistanceTravel[Arrow_CusValue] Greater than or equal to Arrow_Distance[Arrow_CusValue]
                  • (Number of units in Arrow_UnitGroup) Greater than 0
            • Then - Actions
              • -------- Removes arrow dummy from the unit group and destroys it --------
              • -------- Thats because even if a unit is dead or removed from game it still exists in the unit group. --------
              • Unit - Kill (Picked unit)
              • Unit Group - Remove (Picked unit) from Arrow_StartGroup
            • Else - Actions
          • -------- Clears leaks. --------
          • Custom script: call RemoveLocation (udg_Arrow_DummyLoc)
          • Custom script: call RemoveLocation (udg_Arrow_Movement)
          • Custom script: call DestroyGroup (udg_Arrow_UnitGroup)
          • Custom script: call DestroyGroup (udg_Arrow_RandomUnit)
      • -------- Checks if no arrows are currently in flight. If no are in flight turns off the loop. No need for trigger to run if nothing is done. --------
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Number of units in Arrow_StartGroup) Equal to 0
        • Then - Actions
          • Trigger - Turn off (This trigger)
        • Else - Actions
I don't know the other 2 spells. Maybe you'd explain them ?

Edited^^ Will continue later.
 
Last edited:
Status
Not open for further replies.
Top