• 🏆 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!
  • ✅ The POLL for Hive's Texturing Contest #33 is OPEN! Vote for the TOP 3 SKINS! 🔗Click here to cast your vote!

[JASS] Spell Custom Cooldown

Status
Not open for further replies.
Level 8
Joined
Jun 28, 2008
Messages
356
I'm having a tank, with a rotating turret. I'm also having a Point-Target Channel-Based Shoot spell. When I click on the spell and select a point to shoot at, the triggers activate instantly from the issued point order, rotate the turret and after a set amount of time fire a shell. But the problem is, this does not cast the spell. The spell gets casted when the tank slowly spins to the direction of the target point, which happens a lot of time after the actual triggered shooting and therefore I can avoid the cooldown, by simply pressing Stop or issuing another order before the tank actually casts the spell. Can anybody give me tips or suggestions on how to fix this cooldown problem? Thanks in advance. :)
 
Level 8
Joined
Jun 28, 2008
Messages
356
What I have:
1. A tank.
2. The tank has a rotating turret.
3. A bullet system.
4. An ability, that fires the rounds.

What happens:
1. I click on the ability.
2. I click somewhere on the ground to shoot with the tank.
3. The shooting trigger activates instantly by the given order.
4. In the mean time, the tank starts rotating it's body to the target point in order to actually cast the ability.
5. The trigger rotates the tank's turret using SetUnitLookAt.
6. A shell is created and projected to the target location by the trigger.
7. Shooting is done.
8. The tank is still slowly rotating towards the target point in order to cast the ability.
9. The tank finally faces the target point and casts the ability.
10. Cooldown begins.

The point is, I can just press STOP or issue a MOVE order by right clicking and interrupt the spell casting process after (step 7) and there will be no cooldown. The shooting trigger activates by the issued order of the ability, not by the abillity itself being casted. Summarized, I want a Shooting Ability, which fires a triggered projectile with a cooldown and with a tank rotating turret.

Right now I'm doing this:

1. Tank is issued an order to cast the shoot ability.
2. Disable ability for player
3. Create and launch projectile.
4. Wait 3.00 seconds
5. Enable ability for player

But I don't like that. It makes the ability disappear for 3 seconds, it doesn't add cooldown to it. :(
 
Level 11
Joined
Sep 12, 2008
Messages
657
if theres only 1 tank per person, it wont be hard..

each time BEFORE a bullet appears, or before the tank turrent rotates,
check if a boolean is true for a specific player..
if its not, make him shoot the bullet and rotate, then make the boolean TRUE,
and then let him rotate and shoot..
(or tried to add 3 seconds cooldown for the spell? o_O)
 
Level 8
Joined
Jun 28, 2008
Messages
356
you're using the event Unit is issued an order?

put the shoot effect in a Unit starts the effect of an ability or use a SpellEngine... (the SpellEngine is the spell section can do wonders, you can set what it does on init, oncast, on effect, etc, but requires some vjass knowledge)

Omfg... I must really suck at explaining things, or maybe just at English, but if you didn't understand, I said that I want to have a rotating turret, if I use "Unit starts the effect of an ability" I will have to wait for the tank to rotate in order to execute the trigger. =_=
 
Level 8
Joined
Jun 28, 2008
Messages
356
you're using the event Unit is issued an order?

put the shoot effect in a Unit starts the effect of an ability or use a SpellEngine... (the SpellEngine is the spell section can do wonders, you can set what it does on init, oncast, on effect, etc, but requires some vjass knowledge)

Omfg... I must really suck at explaining things, or maybe just at English, but if you didn't understand, I said that I want to have a rotating turret, if I use "Unit starts the effect of an ability" I will have to wait for the tank to rotate in order to execute the trigger. =_=

EDIT: Spell Engine is of no use to me.
EDIT2: WTF, Why did that message went double-post :mad:
 
Omfg... I must really suck at explaining things, or maybe just at English, but if you didn't understand, I said that I want to have a rotating turret, if I use "Unit starts the effect of an ability" I will have to wait for the tank to rotate in order to execute the trigger. =_=

EDIT: Spell Engine is of no use to me.
EDIT2: WTF, Why did that message went double-post :mad:

well that's pretty hard... you can try making the tank animations run faster(But I think you dont want that)... anyway a delay timer can do this... you can use TimerUtils + struct or just a struct loop to do this...
 
Level 18
Joined
Jan 21, 2006
Messages
2,552
You may be able to manually control the cool down by interrupting the unit when he initializes the cast. There would be a problem with instant-cast abilities though since these immediately execute their effects. From there just use a unit indexing system to keep track of the ability cool down values and only allow a unit to proceed through casting if the associated cool down value is 0.
 
Level 8
Joined
Jun 28, 2008
Messages
356
Solution found:

1. Player issues the tank to 'channel' somewhere
2. Trigger activates
3. Trigger issues 'Stop' order and interrupts the tank's order instantly
4. Trigger uses SetUnitLookAt to make the turret face the target-point
5. Trigger creates a dummy tank projectile unit
6. Trigger fires the projectile to the target-point
7. Trigger disables itself
8. Trigger issues unit to cast the ability directly infront of the tank (Instant cast)
9. Cooldown begins
10. Trigger enables itself
11. Tank kills people with shiny explosions
12. I am happy
 
Status
Not open for further replies.
Top