• 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.

how are the projectiles in warlocks triggered?

Status
Not open for further replies.
Level 7
Joined
Jul 20, 2008
Messages
377
The projectiles are actually locusted units (units with the "locust" ability, making them unselectable and as a result, unattackable and unacquirable, etc.). The game is moving each projectile periodically rapidly (0.03-0.05 second). Each projectile has data associated with it such as:

  • Facing
  • Speed
  • Damage dealt (possibly calculated on impact, though)
  • Owner of the projectile (or perhaps even team)

When an enemy unit is within a certain distance of the projectile at any one interval, the projectile is considered "impacting" and the impact trigger is fired, basically.

Yes, it is possible to do in GUI. You just use a custom value ID system (each projectile has an UNIQUE custom value that links to a certain slot in array variables). Periodically, you then pick the unit group of projectile units (added to this unit group as they were created) and just do your stuff.
 
Level 29
Joined
Jul 29, 2007
Messages
5,174
if somebody else doesn't take over, that is.

I am evil and cunning, and thus I shall take over.

Anyhow, you basically make a few arrays. One is the actual array of units which are the projectiles, and then a new array for each attribute you want to "link" to them.
For example, movement velocities and the owner.

Now, each time a new projectile is created (when a unit casts a spell, for example), you fill a new slot of your projectiles with a new unit, and fill in all your other linked arrays with the needed info.

Each time a projectile is destroyed (if it hit the target, for example), you need to do something with the space it takes in the arrays, else you'll just go over garbage data and your array will also get bigger and bigger for no reason.
The easiest way to solve it is to take the last index in the array and move it into the one that is now garbage.

To make everything actually work (moving projectiles, for example), every time that a projectile is created, you check if the sum of "active" projectiles is 0, if it is you start a global timer, if it isn't, you do nothing.

You will also check if the sum of the active projectiles is 0 when destroying a projectile, because if it is, you can pause the timer.

In the timer's trigger, you loop through all your active projectiles and use whatever linked arrays you want.

Now since this is probably a bit weird, here's a basic example:

Variables (if it isn't too obvious):
Projectile - unit array
Proj_Owner - player array
Proj_Vel_X - real array
Proj_Vel_Y - real array
Proj_Timer - timer
Total - integer
Location - point

  • Create
    • Events
      • Unit - A unit Begins casting an ability
    • Conditions
    • Actions
      • Unit - Create 1 Footman for (Owner of (Triggering unit)) at (Center of (Playable map area)) facing Default building facing degrees
      • Set Projectile[Total] = (Last created unit)
      • Set Proj_Owner[Total] = (Owner of (Triggering unit))
      • -------- In case you don't know what velocity is, it's the distance the unit will move every time the timer runs --------
      • Set Proj_Vel_X[Total] = 3.00
      • Set Proj_Vel_Y[Total] = 2.00
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • Total Equal to 0
        • Then - Actions
          • Countdown Timer - Start Proj_Timer as a Repeating timer that will expire in 0.04 seconds
        • Else - Actions
      • Set Total = (Total + 1)
  • Loop
    • Events
      • Time - Proj_Timer expires
    • Conditions
    • Actions
      • -------- Arrays start at 0, not 1 as shown in *cough* lame */cough* GUI --------
      • For each (Integer A) from 0 to (Total - 1), do (Actions)
        • Loop - Actions
          • Set Location = (Position of Projectile[(Integer A)])
          • Unit - Move Projectile[(Integer A)] instantly to (Location offset by (Proj_Vel_X[(Integer A)], Proj_Vel_Y[(Integer A)]))
          • Custom script: call RemoveLocation(udg_Location)
          • -------- The next condition will run if a collision is detected, although I'm not going to write here how to check for one (too lazy) --------
          • -------- It can also run based on any other condition you want, of course (time, for example) --------
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
            • Then - Actions
              • -------- We are replacing all the current projectile's slot with the last projectile's info --------
              • -------- The next time a projectile is created, this last slot will be over-written because we set Total = Total - 1 --------
              • Set Total = (Total - 1)
              • Set Projectile[(Integer A)] = Projectile[Total]
              • Set Proj_Owner[(Integer A)] = Proj_Owner[Total]
              • Set Proj_Vel_X[(Integer A)] = Proj_Vel_X[Total]
              • Set Proj_Vel_Y[(Integer A)] = Proj_Vel_X[Total]
            • Else - Actions
And after writing this, I remember why GUI sucks.
 
Level 7
Joined
Oct 13, 2008
Messages
301
Yah, And you woulda create the pushback so that you create Region, And move it with triggers to the position that the projectile dummy is heading, And create ''Wait For Condition - Unit is in region Checking every 0.10 Seconds'' However it was, And when the projectile dummy reaches the region, It would create dummy with an stomp ability that triggers the paladon's Knockback at the targed location, That might be good way to create knockback easily? Lemme give a fast try xP
 
Level 29
Joined
Jul 29, 2007
Messages
5,174
timers? regions?

i use every 0.06 secs pick every unit in Projectiles group

Yes, and that's why all your projectiles have the same values... for everthing.
This is beside the fact that Timed Events suck (don't ask me why, Poot said so and I believe him).

By the way, referring to the second trigger I wrote - when removing a unit you should also check if Total is 0. If it is you should pause the timer.
 
Status
Not open for further replies.
Top