HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

"Soul Spire" Triggers

02-23-2004, 09:32 AM#1
Pheonix-IV
ok, its pritty simple, i have a "Soul Spire" that cant be destroyed, when a unit dies i want a spirit (Spirit Tower Projectile) to fly from the corpse and into the spire, when it hits the spire i want the owner of the spire to gain 1 gold. Its for a campaign and there will only ever be 1 owner of the spire, but i need help, i want the gold to be gained at the point when the soul hits the spire not before or after it.
02-23-2004, 03:47 PM#2
Shimrra
Create a custom unit with no shadow and no collision size that uses the missile animation you want and set it's speed to what you want. Use this as the first trigger:
Code:
[b]Event:[/b] Unit - A unit Dies
[b]Condition:[/b] None
[b]Actions:[/b] Unit - Create 1 Soul for Player 1 (Red) at (Position of (Dying unit)) facing Default building facing degrees
Unit - Order (Last created unit) to Move To (Position of Soul Spire 0000 <gen>)
Create a region on the location of the Soul Spire and create another trigger like this:
Code:
[b]Event:[/b] Unit - A unit enters SoulSpire <gen>
[b]Condition:[/b] (Unit-type of (Triggering unit)) Equal to Soul
[b]Actions:[/b] Unit - Remove (Triggering unit) from the game
Player - Set Player 1 (Red) Current gold to ((Player 1 (Red) Current gold) + 1)

I hope this helps you!

[edit] - I made an example map that worked perfectly. If you want it, let me know!
02-24-2004, 07:40 AM#3
Pheonix-IV
i have actually tried that, but i cant get the unit to go any faster than 533, and i need to to be moving at least 900 speed.
02-24-2004, 07:52 AM#4
Newhydra
Then use a projectile and do some math...

Create a unit whenever any unit dies, and order it to attack the spire, whenever one of those units attacks the spire, figure out how long it will take the projectile to reach the spire by getting it's distance and knowing the speed it's moving, when that timer expires, add one gold to the proper player...
02-24-2004, 07:58 AM#5
Pheonix-IV
i'm not too good with math, i figured thats how i'd have to do it, but i dunno what equasions i'd need (i'm only 15 and i dont do advanced maths) hence why i asked here.
02-24-2004, 08:15 AM#6
Newhydra
That's not really advanced math...Just a line...The projectile moves at X units/second, and needs to go Y units, it will arrive at its destination after Z seconds. ( Y/X = number of seconds it will take, provided X is units/second. If not, then (Y/X) * (T seconds), where X is units per T seconds)

For example, if the projectile moves at 900 units per second, and it needs to go 1800 units total, then it would take 1800/900 (or two) seconds to go that distance.

Of course, this assumes that the projectile travels in a straight path...
02-24-2004, 08:23 AM#7
Pheonix-IV
it does, but how can i create a trigger that will do this, i understand the basic princepal, but i dont play around with the mathematical side of triggers often and i absolutly hate maths.
02-24-2004, 08:31 AM#8
Newhydra
...I already answered that.

When a unit dies, create a unit under them for some neutral player.

Whenever that unit (the type you just created) attacks get the distance (a function in the WE GUI) from that unit to its target, the spire.

Since you know which unit attacked, you know the speed of it's projectile, so you figure out what a speed of 900 means (does it mean 900 units/in game second?) and then just plug the numbers into the formula I gave you in my second post.

That will tell you how long it will take for the projectile to reach the spire.

Then just create a timer, set it equal to the number you just calculated, and add event "timer (last created timer) expires" to a trigger which gives the owner of the spire 1 gold(whatever) and destroyes the timer which just expired. (The last part isn't *required* but if you don't do it you'll have unused timers floating around in memory...leading to decreasing performance the longer you play)