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

[Trigger] Projectiles turns??

Status
Not open for further replies.
Level 17
Joined
Jun 28, 2008
Messages
776
Ok, here is the story :

I am making a spell, Ice Shards. The spell fires ice shards to a target location, if a shard comes into contact with an enemy it is destroyed and damages the target. I have no problem doing that, the problem is this :

When the user casts the spell he selects a point to where the shards must go and then the shards go.

151783-albums1222-picture9079.bmp


and then

151783-albums1222-picture9081.bmp


finally

151783-albums1222-picture9082.bmp


so in other words the shards have to move like this

151783-albums1222-picture9083.bmp


The shards near the caster has to follow the purple lines to the shards at the end.

I have no idea how to make some of the shards face a certain angle and the other another angle.

If you have any idea please tell me or if you want to plz create a demo spell on how to implement the turning shards.(BTW the shards/projectiles are dummy units)

Thanks in advance.
 
Level 18
Joined
Aug 23, 2008
Messages
2,319
Ah, I see. Well there are 2 solutions for this.
1) Make a dummy unit at the position of the caster that attacks with that shard model as projectile when the previous shard (going towards caster at first) hits the caster. This way doesn't look too good, since the shard will disappear for about half a second or less before the new 1 towards the target is launched.
2) Make a unit with the shard model, and make the shard unit move where you want it to move to. This looks a lot better, but doesn't allow you to use it as base attack, since creating a lot of units in a very short time will cause lag.
 
Level 17
Joined
Jun 28, 2008
Messages
776
I have no problem creating the spell, I just have a problem with the turning of the shards. Here is the code and test map :

  • Ice Cast
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Ice Shards
    • Actions
      • -------- Set Var --------
      • Set Pos_Ice[(Player number of (Owner of (Casting unit)))] = (Position of (Casting unit))
      • Set Pos_Ice_Target[(Player number of (Owner of (Casting unit)))] = (Target point of ability being cast)
      • -------- Timed Life Calculate --------
      • Set Real_Distance = (Distance between Pos_Ice[(Player number of (Owner of (Casting unit)))] and Pos_Ice_Target[(Player number of (Owner of (Casting unit)))])
      • Set Real_Time = (Real_Distance / 600.00)
      • -------- Create Units --------
      • For each (Integer A) from 1 to (10 x (Level of (Ability being cast) for (Casting unit))), do (Actions)
        • Loop - Actions
          • Unit - Create 1 Ice Shard for (Owner of (Casting unit)) at Pos_Ice[(Player number of (Owner of (Casting unit)))] facing ((Angle from Pos_Ice[(Player number of (Owner of (Casting unit)))] to Pos_Ice_Target[(Player number of (Owner of (Casting unit)))]) + (Random real number between -25.00 and 25.00)) degrees
          • Unit - Add a Real_Time second Generic expiration timer to (Last created unit)
and then

  • Ice Move
    • Events
      • Time - Every 0.05 seconds of game time
    • Conditions
    • Actions
      • Unit Group - Pick every unit in (Units of type Ice Shard) and do (Actions)
        • Loop - Actions
          • Set Pos_Ice_Temp[1] = (Position of (Picked unit))
          • Set Pos_Ice_Temp[2] = (Pos_Ice_Temp[1] offset by 30.00 towards (Facing of (Picked unit)) degrees)
          • Set Unit_Ice = (Picked unit)
          • Unit - Move (Picked unit) instantly to Pos_Ice_Temp[2]
          • Unit Group - Pick every unit in (Units within 50.00 of Pos_Ice_Temp[1]) and do (Actions)
            • Loop - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • ((Picked unit) is A structure) Equal to False
                  • ((Picked unit) belongs to an enemy of (Owner of Unit_Ice)) Equal to True
                  • ((Picked unit) is alive) Equal to True
                • Then - Actions
                  • Unit - Cause Unit_Ice to damage (Picked unit), dealing 100.00 damage of attack type Spells and damage type Normal
                  • Special Effect - Create a special effect attached to the origin of (Picked unit) using Abilities\Spells\Undead\FrostNova\FrostNovaTarget.mdl
                  • Special Effect - Destroy (Last created special effect)
                  • Unit - Kill Unit_Ice
                • Else - Actions
          • Custom script: call RemoveLocation( udg_Pos_Ice_Temp[1] )
          • Custom script: call RemoveLocation( udg_Pos_Ice_Temp[2] )
and here is the test map : View attachment Spell Pack 101.w3x
 
Status
Not open for further replies.
Top