• 🏆 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] Partial Spell Help.

Status
Not open for further replies.
Level 9
Joined
Jun 7, 2008
Messages
440
I need to create 8 dummy units around, the caster of the spell. Each at 45 degree intervals (45, 90, 135, 180, 225, 270, 315, 360). How do i do this and make it so they are selectable to do another event (order(windwalk))? I have the models dummies and the spell ready, i just don't know how to create the units at those specific areas, nor how to make them cast another spell. Any help please?
 
Level 6
Joined
Sep 13, 2008
Messages
261
You can use triggers similiar to this.

  • Untitled Trigger 001
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to (==) DummyAbility
    • Actions
      • Set Temp_Point[0] = (Position of (Triggering unit))
      • Set Temp_Point[1] = (Temp_Point[0] offset by 256.00 towards 45.00 degrees)
      • Unit - Create 1 DummyUnit for (Owner of (Triggering unit)) at Temp_Point[1] facing Default building facing (270.0) degrees
      • Unit - Order (Last created unit) to Orc Blademaster - Wind Walk
      • Custom script: call RemoveLocation(udg_Temp_Point[0])
      • Custom script: call RemoveLocation(udg_Temp_Point[1])
you just have to copy the create unit and locations for each dummy. Also you may want to set an expiration timer on the dummy unit.

If you can't figure it out from here I recommend you request a whole spell in the request section.
 
Level 6
Joined
Jul 25, 2005
Messages
221
Here is a good example on how to use equations to your advantage
Equations is also done faster than adding one new location for each instance
(When a computer calculates, it works really fast, because it's what it's designed to do)

Given that,
360/8 = 45.00
360/16 = 22.50
360/4 = 90.00

As you can see, if we divide the total amount of units we want in the circle with 360 degrees we get the differential degree in the circle.
So this gives us the equation (Look! It's calculating math with variables, it's a 'wonderfun' sight isn't it?)
( a = b*c ) ( b = a/c ) ( c = a/b )
a represents the total amount of units
b represents the difference in degrees in relation with the circle
c represents the circle's degrees

Note that the reason why the amount of units in the loop is (n-1) is because we start counting from 0 instead of 1

Now let's use all this in the map, look how wonderfully general and easy it is!
  • Requested Spell
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Request
    • Actions
      • -------- How big do you want the circle to be? --------
      • Set real_HowMuchOfACircle = 360.00
      • -------- How many units do you want in the circle? --------
      • Set integer_Amount_of_units = 8
      • -------- How far away do you wish for them to be from the caster? --------
      • Set real_DistanceDummyTarget = 250.00
      • -------- How many degrees do you have to turn for each new unit in the circle? --------
      • Set real_DegreePerUnit = (real_HowMuchOfACircle / (Real(integer_Amount_of_units)))
      • -------- Where is the caster? --------
      • Set temporary_point[1] = (Position of (Triggering unit))
      • -------- Place all units in the circle --------
      • For each (Integer A) from 0 to (integer_Amount_of_units - 1), do (Actions)
        • Loop - Actions
          • -------- Place the dummy using polar projection. DegreesPerUnit is placed there. Take a look. --------
          • Set temporary_point[2] = (temporary_point[1] offset by real_DistanceDummyTarget towards ((Real((Integer A))) x real_DegreePerUnit) degrees)
          • Unit - Create 1 Dummy for Player 1 (Red) at temporary_point[2] facing temporary_point[1]
          • Set unit_WindWalker[(Integer A)] = (Last created unit)
          • -------- Some cool effect --------
          • Animation - Add the stand work animation tag to (Last created unit)
          • -------- Remove the location to save memory. ( Otherwise it will leak, and a leaking programing takes memory from your computer) --------
          • Custom script: call RemoveLocation( udg_temporary_point[2] )
      • -------- Add a timer with additional cool effects! --------
      • Countdown Timer - Start timer_Timer1 as a One-shot timer that will expire in 2.00 seconds
      • -------- Remove the location to save memory. ( Otherwise it will leak, and a leaking programing takes memory from your computer) --------
      • Custom script: call RemoveLocation( udg_temporary_point[1] )
  • Timer Wind Walk
    • Events
      • Time - timer_Timer1 expires
    • Conditions
    • Actions
      • -------- Now we can just refer to them again! --------
      • For each (Integer A) from 0 to (integer_Amount_of_units - 1), do (Actions)
        • Loop - Actions
          • Animation - Remove the stand work animation tag to unit_WindWalker[(Integer A)]
          • Unit - Order unit_WindWalker[(Integer A)] to Orc Blademaster - Wind Walk
          • -------- Make each unit turn 180 degrees --------
          • Unit - Make unit_WindWalker[(Integer A)] face ((Facing of unit_WindWalker[(Integer A)]) + 180.00) over 0.01 seconds
      • Countdown Timer - Start timer_Timer2 as a One-shot timer that will expire in 1.00 seconds
And here's another simple equation
  • Walk
    • Events
      • Time - timer_Timer2 expires
    • Conditions
    • Actions
      • For each (Integer A) from 0 to (integer_Amount_of_units - 1), do (Actions)
        • Loop - Actions
          • -------- Here we calculate how long an expiration timer needs to be, by using v = d/t, velocity = distance/time --------
          • Set temporary_point[1] = ((Position of unit_WindWalker[(Integer A)]) offset by 300.00 towards (Facing of unit_WindWalker[(Integer A)]) degrees)
          • Unit - Order unit_WindWalker[(Integer A)] to Move To temporary_point[1]
          • Unit - Make unit_WindWalker[(Integer A)] Explode on death
          • -------- Now, you might wonder, how do we know the velocity of our unit? The movment speed. --------
          • Set real_HowLong = ((Distance between (Position of unit_WindWalker[(Integer A)]) and temporary_point[1]) / (Current movement speed of unit_WindWalker[(Integer A)]))
          • Unit - Add a real_HowLong second Generic expiration timer to unit_WindWalker[(Integer A)]
          • Set unit_WindWalker[(Integer A)] = No unit
          • Custom script: call RemoveLocation( udg_temporary_point[1] )
 

Attachments

  • ExampleSpell.w3x
    43.8 KB · Views: 34
Last edited:
Level 9
Joined
Jun 7, 2008
Messages
440
Can i use something other than " (last created unit) " ??
I have another trigger which creates a unit every second, if i use (last created unit, won't Ihave a chance of getting a different unit other than the dummy to try to use windwalk?
 
Level 6
Joined
Jul 25, 2005
Messages
221
I suggest you create a counter.
An integer variable that increases in number every time the timer ticks, then store the unit created in an array with the counter number.

Like this:

  • The Use of Counters
    • Events
      • Time - Every 1.00 seconds of game time
    • Conditions
    • Actions
      • Set integer_Counter = (integer_counter+1)
      • Unit - Create 1 Footman for Player 1 (Red) at (Location)) facing Default building facing degrees
      • Set UnitArray[integer_Counter] = (Last Created Unit)
Then if you want all of your spawned units to do something at the same time you do like this:
  • Something happens
    • Events
      • Unit - A unit Begins casting an ability
    • Conditions
    • Actions
      • For each (Integer A) from 1 to MaxArraySize, do (Actions)
        • Loop - Actions
          • Unit - Order UnitArray[Integer A] to Attack (Triggering Unit)
 
Level 9
Joined
Jun 7, 2008
Messages
440
Okay. So the unit creation works, however iswitched the spell from windwalk, to a custom ability based off of the chainlightning spell. When i try to get the dummy units to cast it at Caster of the ability, it doesnt work. Allowable targets was included. What am i doing wrong? (This is more for effect than to do damage)
 
Level 15
Joined
Dec 18, 2007
Messages
1,098
Don't listen to Super-Sheep. Last Created Unit literally refers to the unit that was last created using "Unit-Create Unit" and it can only refer to any one unit on the map at any pointof time, so you should try to use Last Created Unit only if you are referring to the unit immediately after creation.
Also, when do you want them to use Windwalk? Immediately upon creation? If not, a unit group could always be useful. I'll tell you more about it if you need the knowledge for your spell :)
 
Level 9
Joined
Jun 7, 2008
Messages
440
I basically changed the spell from windwalk to a chain lighting spell, castable only on friendly units. The spell itself does no damage, but as an animation for a heightened effect of my spell. The models have the (chain lightning) spell, but won't cast it when created... :confused:

As well, please do, im interested in learning. Aside from reading the tuts that is.
 
Level 9
Joined
Jun 7, 2008
Messages
440
Im aware of that, i removed the windwalk spell, as well as affiliated triggers, and made a chain lightning spell. The trigger itself is posing problems. For Some reason, i can't make the dummy model cast chain lightning.
 
Level 9
Joined
Jun 7, 2008
Messages
440
Okay, Thanks. It Worked! +rep. I have another Curious thing. The dummy has the lightning Bolt <base> model. It flashes when i create it, but doesnt continue flashing. My spell channels for 20 seconds, any idea on how to make it continue flashing - aside from creating new units?
 
Level 29
Joined
Jul 29, 2007
Messages
5,174
Yeah nvm its not event response, but how I have got no problems? I've always used more than one trigger with last created units.

If you are using no waits or timers, there is no reason it will ever have any problems.
The moment you add a wait or a timer, however, is the moment that triggers can run at the "same time" (warcraft just jumps between them) and then using the same globals would need to be questioned.

Okay, Thanks. It Worked! +rep. I have another Curious thing. The dummy has the lightning Bolt <base> model. It flashes when i create it, but doesnt continue flashing. My spell channels for 20 seconds, any idea on how to make it continue flashing - aside from creating new units?

You are probably using the wrong model, there are many abilities with two actual models, I forgot already what each represents.
 
Status
Not open for further replies.
Top