HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Trouble with Autocasting

03-13-2007, 12:35 AM#1
Castlemaster
I have a spell based on dark arrows that has a trigger to add % damage based on the hero's agil. Problem is that I want to balance the ability to be autocast, but have a 3-5 second CD.

As of now I have the trigger for the manual cast set up to trigger on ability cast. For the Autocast, when the unit is given the order(blackarrowon) it turns on the autocast trigger (initially off), and turns off the autocast trigger if the unit is given the order (blackarrowoff).

The autocast trigger triggers on unit attack (instead of spell cast) and causes the trigger-driven damage and orders the unit to cast the black arrow spell. My problem is that I don't wan't the trigger to run if the ability is on cooldown. My question is: what is the simplest way (GUI) to make the trigger damage not run if the ability is on cooldown, i.e. make a trigger so that it will only run the damage trigger if the spell is actually cast, or make an "if" statement to check if the spell is on cooldown.

P.S. I tried making the autocast trigger Run(checking conditions) the manual cast trigger and that didnt work.
03-13-2007, 02:06 AM#2
Pyrogasm
You'll need another trigger:
Trigger:
Collapse Events
Unit - A unit starts the effect of an ability
Collapse Conditions
Ability being cast equal to <Your Ability>
Collapse Actions
Set Your_Ability_Boolean = false
Wait <Whatever the cooldown should be; use a formula if you have to> game-time seconds
Set Your_Ability_Boolean = true
And just only do the damage things if the boolean is true.
03-13-2007, 02:40 PM#3
Castlemaster
Cool, thanks. That works for me.
03-13-2007, 04:29 PM#4
WNxCryptic
You could also give the ability a cooldown itself. The Poison arrow has a c/d that works even with a cooldown.
03-13-2007, 07:20 PM#5
Pyrogasm
His problem was not that the spell didn't have an autocast, but that he didn't know how to get the triggered effect to not happen, because it was a generic event that he couldn't filter.
03-13-2007, 07:23 PM#6
WNxCryptic
Ah I thought he had a trigger which appropriately detected the firing of an ability, but the auto-cast was firing quicker than the trigger was supposed to...

The solution in my mind that seemed simplest was to put a c/d on the ability..lol, guess I got confused :)
03-13-2007, 07:46 PM#7
Castlemaster
No biggie, like pyro said, I had a trigger driven effect of the spell that I wanted to fire only when it wasnt on CD. Autocast spells w/no CD don't have this problem, but since I only want mine going every 3-5 seconds, I had to make a trigger to keep it form firing while on CD
03-15-2007, 05:29 PM#8
WNxCryptic
I have another quick question with autocasting, and I figured this is as good a spot as any (aside the fact that its off-topic from the original post).

Is there anyway to detect when an ability autocast has been turned on (and thus, immediately turn it back off again) ?
03-15-2007, 05:32 PM#9
Earth-Fury
Detect the "activate" order, i do belive. (check the object editor to find out what it is for a specific ability)
03-16-2007, 02:28 AM#10
Pyrogasm
Earth-Fury is correct.

A example with Immolation by me is shown here.
03-16-2007, 05:28 PM#11
Szythe
I don't think anyone here has properly answered your question, so I'll try my hand at it.

From what I understand, whenever the unit attacks you want to reissue it to instead cast the dark arrows ability on the unit. I dont have access to WE right now, but I'll try to write some pseudo-code for you

When the unit attacks, run this:

EDIT: Here's the GUI way of doing what I initially posted in JASS:

First declare a boolean variable called TempBoolean
Next, In your Trigger that runs when the unit attacks while autocast is on, put these actions in place of whatever you had:

Trigger:
Custom Script: set udg_TempBoolean = IssueTargetOrder(GetAttacker(), "darkarrows", GetAttackedUnit())
Collapse if TempBoolean = True then
Deal damage to the target and/or add the damage to the hero's attack

IMPORTANT: Since I don't have access to WE right now, I'm not sure if the syntax for GetAttackedUnit() and GetAttacker() is exactly right. When I get home I'll doublecheck them. Also, I'm not sure if the actual orderstring is "darkarrows", make sure you doublecheck that.

If you look, the IssueOrder natives all return a boolean. This boolean returns true if the unit was able to go through with the order, and false if it wasnt (due to cooldown, or not enough mana).
03-16-2007, 05:46 PM#12
WNxCryptic
Thanks for the help guys, hopefully that'll take care of me! :D

EDIT: Wrote a small script based on that immolation example, but the spell doesn't automatically turn of autocasting like it aught to.
03-16-2007, 07:26 PM#13
Pyrogasm
Quote:
Originally Posted by Szythe
I don't think anyone here has properly answered your question, so I'll try my hand at it.

From what I understand, whenever the unit attacks you want to reissue it to instead cast the dark arrows ability on the unit. I dont have access to WE right now, but I'll try to write some pseudo-code for you

When the unit attacks, run this:

EDIT: Here's the GUI way of doing what I initially posted in JASS:

First declare a boolean variable called TempBoolean
Next, In your Trigger that runs when the unit attacks while autocast is on, put these actions in place of whatever you had:

Trigger:
Custom Script: set udg_TempBoolean = IssueTargetOrder(GetAttacker(), "darkarrows", GetAttackedUnit())
Collapse if TempBoolean = True then
Deal damage to the target and/or add the damage to the hero's attack

IMPORTANT: Since I don't have access to WE right now, I'm not sure if the syntax for GetAttackedUnit() and GetAttacker() is exactly right. When I get home I'll doublecheck them. Also, I'm not sure if the actual orderstring is "darkarrows", make sure you doublecheck that.

If you look, the IssueOrder natives all return a boolean. This boolean returns true if the unit was able to go through with the order, and false if it wasnt (due to cooldown, or not enough mana).
o.O That's useful. +Rep!

And WNxCryptic, what do you mean by "doesn't turn off like it should"?
03-18-2007, 05:21 AM#14
WNxCryptic
I have a trigger setup so that the ability appropriately works when it is clicked (or hotkeyed) and used on a target unit...

However, if autocast is on, then that trigger will never fire (because autocast cannot be accurately detected for an ability)

And yes, i need to base the spell off of searing arrows (OR, I need to force the unit to play a particular animation INSTEAD of the default "spell" animation of the unit)
03-18-2007, 05:41 AM#15
Pyrogasm
Searing arrows is broken. Use Dark Arrows.

Quote:
OR, I need to force the unit to play a particular animation INSTEAD of the default "spell" animation of the unit
In GUI:
Animation - Play YourUnit 's "spell channel" animation
Collapse Or in JASS:
call SetUnitAnimation(YourUnit, "spell channel")
//Or
call SetUnitAnimationByIndex(YourUnit, 9)
That may help :D