HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Auto-Casting Abilities

08-03-2007, 06:03 AM#1
InNeedofHelp
I don't know how to word this correctly, so, I'll try my best. I'm trying to create a trigger that will make an Auto-Casted ability automatically cast on a unit (Gold Mine) within range. This will allow it to stand near the unit (Gold Mine) to gain gold everytime the auto-casted ability is finished casting. I don't know if my triggers are incorrect, or if I'm just using a whacky spell to base it off of. The spell I'm basing it off of is the unit ability "Heal." The only problem is when more than one unit is trying to cast the ability on the Gold Mine, it says "Unit is already being healed."

The trigger goes like this:

Trigger:
Collapse Events:
Unit - A unit finishes casting an ability
Collapse Conditions:
(Ability being cast) Eqaul to Gold!
Collapse Actions:
Player - Add 1 to (Owner of (Casting unit)) Current Gold

Any help is appreciated.
Thanks.
08-03-2007, 06:45 AM#2
darkwulfv
The problem is that heal is hardcoded not to allow more than one heal to be used on the unit at once.

Try a different auto-cast ability. I don't know what one. Just experiment though, you'll find one.
08-03-2007, 08:59 AM#3
Anitarf
I think what limits you from having multiple heals is the heal buff. Unfortunately, it seems it's duration is hardcoded to be either one second or to equal the cooldown of the heal ability.

A good autocast ability might be hard to find, instead, you could try a regular ability and reorder it's casting with your gain gold trigger. The tricky part here is that you would need to wait until the end of the cooldown, and using the bugged "casting unit" and "target unit of ability being cast" after a wait is a no-no. You can use the not bugged "triggering unit" instead of "casting unit", but for the "target unit of ability being cast" you would need to store it to a local variable before the wait. Also, use the event "starts the effect of an ability" rather than the one you're using now.
08-03-2007, 03:51 PM#4
InNeedofHelp
Quote:
Originally Posted by Anitarf
I think what limits you from having multiple heals is the heal buff. Unfortunately, it seems it's duration is hardcoded to be either one second or to equal the cooldown of the heal ability.

A good autocast ability might be hard to find, instead, you could try a regular ability and reorder it's casting with your gain gold trigger. The tricky part here is that you would need to wait until the end of the cooldown, and using the bugged "casting unit" and "target unit of ability being cast" after a wait is a no-no. You can use the not bugged "triggering unit" instead of "casting unit", but for the "target unit of ability being cast" you would need to store it to a local variable before the wait. Also, use the event "starts the effect of an ability" rather than the one you're using now.

Oh, ok. So, what you're trying to say here is that it'll take me a while to find a good auto-cast. Hmm.. I see.. Thanks for the post, I'll try it out.
08-03-2007, 04:57 PM#5
darkwulfv
I think Anitarf's method would work best. Simply add another action that says "Issue order targeting a unit", and make the triggering unit cast it on the original target unit.

I'd do it in JASS for you, but I've got no time. But it's fairly simple. Just store the casting unit and the gold mine unit in 2 local unit variables, add the gold, wait a short time (a second would work), and then issue the order again.
08-03-2007, 08:22 PM#6
InNeedofHelp
Alright, so, I don't quite get it, sorry.. I'm not very good with World Editor. I stored the casting unit and the gold mine in two local variables, but then I got stuck. I'm doing "Issue Order Targeting a Unit" and setting my caster to cast a spell on the Gold Mine. I don't know if I did it right, but I can only allow them to cast actual spells, and not the custom spell that I made. I made gold out of the original spell "Storm Bolt," but I don't know if that's right.


Trigger:
Collapse Events
Unit - A unit Starts the effect of an ability
Collapse Conditions
(Ability being cast) Equal to Gold!
Collapse Actions
Set Gold_Mine = (Target unit of issued order)
Set Animal_caster = (Triggering unit)
Unit - Order Animal_caster to Human Mountain King - Storm Bolt Gold_Mine (trying to cast the spell called Gold!?)
Player - Add 1 to (Owner of (Casting unit)) Current gold
08-03-2007, 08:31 PM#7
blu_da_noob
That is the correct way to issue the order. Issueing a unit to cast one of the original spells will make it cast any spell based on that original.

Are you sure your stormbolt can target the gold mine? Perhaps try a non-offensive spell for a base (inner fire).
08-03-2007, 08:34 PM#8
InNeedofHelp
Well, see, the thing is my gold mine isn't actually a gold mine, it's just a unit in control of an enemy player that was based off of a Farm and modeled into a Gold Mine. So, technically, if I allow Storm Bolt to target a mechanical or structural unit, it should work. I should use Inner Fire, shouldn't I, so I can auto-cast the spell? My objective is to allow units who have the auto-cast ability on auto-cast to gain gold when they're next to the Gold Mine.
08-03-2007, 09:07 PM#9
botanic
you can do something like this (it is how i detected an autocast in a map before)

Just make the buff for the spell that gives gold give a buff named Gold

This also checks for the Goldmine unit in range doesn't matter who controls it

Trigger:
Get Gold
Collapse Events
Time - Every 0.20 seconds of game time
Conditions
Collapse Actions
Collapse Unit Group - Pick every unit in (Units in (Playable map area) matching (((Matching unit) has buff Gold ) Equal to True)) and do (Actions)
Collapse Loop - Actions
Collapse If unit in Range of Picked Unit of type Goldmine Then do
Unit - Remove Gold buff from (Picked unit)
Collapse For Intiger A from 1-12 do
Set Oldgold = Player [ Intiger A ]
Player Gold for player [Intiger A] Set to Oldgold + Amounttogive
Collapse Else
Unit - Remove Gold buff from (Picked unit)
08-03-2007, 10:32 PM#10
Anitarf
Quote:
Originally Posted by InNeedofHelp
Well, see, the thing is my gold mine isn't actually a gold mine, it's just a unit in control of an enemy player that was based off of a Farm and modeled into a Gold Mine. So, technically, if I allow Storm Bolt to target a mechanical or structural unit, it should work. I should use Inner Fire, shouldn't I, so I can auto-cast the spell? My objective is to allow units who have the auto-cast ability on auto-cast to gain gold when they're next to the Gold Mine.
Inner fire actualy might be doable. If, for every gold mine, you had a dummy attacker with minimal damage attacking it, then units with inner fire that can target the gold mine should autocast it (because inner fire autocast conditions are if the unit is attacking (for the +10% damage bonus) or attacked (for the +5 armour bonus)). Just set it's duration to something like 0.01 and targets allowd so that it cn only target your custom gold mines (use one of the classifications for that, like suicidal).