HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Autocast problem

10-25-2006, 05:32 AM#1
Wyvernoid
Hello ^^ Sorry for being vague last time, and this time a more specific problem... How could I make the following work?
Trigger:
Spell Cheer
Collapse Events
Time - Every 1.00 seconds of game
Collapse Conditions
(Current Order of (My hero)) Equal to order(stop)
Collapse Actions
Set tempLocation = (Position of (My hero))
Set tempUG = (Units in 600.00 of tempLocation)
Collapse Unit Group - Pick every unit in tempUG and do (Actions)
Collapse Loop - Actions
Collapse If (All conditions are true) then do (Actions) else do (Actions)
Collapse If - Conditions
((Picked unit) belongs to an enemy of (Owner of (My hero))) Equal to False
(Life of (Picked unit)) Less than (Max Life of (Picked unit))
Collapse Then - Actions
Unit - Order (My hero) to Cheer (Picked unit)
Else - Actions
Custom Script: call RemoveLocation(udg_tempLocation)
Custom Script: call DestroyGroup(udg_tempUG)
Well that "Cheer" was made out of inner fire, but I wanted it to work as a heal. The problems are:
1. This didn't work at all (:-P), "My hero" wouldn't move. I think the problem is in that "order = stop" but can't find any other solutions.
2. Even it works, I didn't check whether the autocast is on. This means that even the autocast is off "My hero" would go and cheer others. However how to check?
3. Something I am curious about is that, if the above trigger worked, will an error message show if the cooldown is not complete or mana is not enough when the trigger orders "My hero" to cheer? (sry for being foolish - and btw I think not)
Hmm, specific enough? Maybe... ^^ Well if I'm vague again, please point out. Thanks!
10-25-2006, 07:19 AM#2
Archmage Owenalacaster
I ran three tests.

First with the "stop" order string under similar conditions: the condition was, somehow, never fulfilled.

Second with the "stop" order string but with the event occuring every 0.10 seconds: same effect - nothing.

Third with the the "move" order string: right-clicking did not fulfill the condition, but issuing the move order from the command card fulfilled the condition.

Perhaps you need another trigger for storing the unit's current order in a value and then comparing it in the condition of the original trigger.
10-25-2006, 09:24 AM#3
shadowange1
Try putting the action inside an IF..Then..Else
And before it enters the IF set var = current order
Also move the first condition to the condition of the IF with all the other things inside of it.

Also another problem may be that it is trying to cast the spell on all the units at the same time to maybe try adding a wait action after every pick.(Maybe, not sure)
10-25-2006, 11:17 AM#4
Archmage Owenalacaster
Quote:
Originally Posted by shadowange1
Also move the first condition to the condition of the IF with all the other things inside of it.
Bad idea. Those initial conditions are there so the trigger actions aren't needlessly activated.

Quote:
Originally Posted by shadowange1
Also another problem may be that it is trying to cast the spell on all the units at the same time
Good idea. I knew I was forgetting something in my previous post. Shadowange1 is nearly correct: before the unit could even begin casting the first spell, it will have received orders to cast another.

Quote:
Originally Posted by shadowange1
maybe try adding a wait action after every pick.
Bad idea. The wait action in a loop would not be able to compensate for many of a variety of influences upon the casting of the spell, such as stun, slow, disability, and spell casting time / animation casting time. And it would also disrupt your attempts at breaking the loop with other orders.

Two suggestions with no scripting neccessary:
[Ichi] Use an aura with similar effects to Inner Fire.
[Ni] Use Inner Fire as is and for the unit that shall cast your version of Inner Fire, reduce two stats in the Object Editor. Art - Animation - Cast Backswing and Art - Animation - Cast Point; these two stats determine the amount of time spent in spellcasting animation after and before the spell's effects respectively. If you reduce these to 0.000, you will have a nearly instant casting speed while the spell is auto-cast. Not having it on before a battle would be inconsequential because you would cast quickly enough to satisfy your troops' needs.

Otherwise, you'll need regulated target acquisition at timed intervals. Every R-seconds, compare the Unit is Alive equal to true and compare the value of a variable holding an order to stop, then go through a process of elimination through if statements until you're left with one unit, and the spell will successfully cast. I apologize for the lack of detail on how a variable holds a value pointing to an order (called "interception", perhaps?), but I have not implemented it myself and so I have no experience with it.
10-25-2006, 11:53 AM#5
The)TideHunter(
Welcome to Wc3c Archmage Owenalacaster, it seems you have some knowledge here.

I would create a dummy caster in the loop, order that to inner fire, and add a timed life effect to the dummy, it will all clear up fine and cast them all.
Heres an example:

Trigger:
Actions
Set TempLoc = (Position of (My Hero))
Set TempGroup = (Units within 600.00 of TempLoc)
Collapse Unit Group - Pick every unit in TempGroup and do (Actions)
Collapse Loop - Actions
Collapse If (All Conditions are True) then do (Then Actions) else do (Else Actions)
Collapse If - Conditions
((Owner of (My Hero)) is an ally of (Owner of (Picked unit))) Equal to True
(Life of (Picked unit)) Less than (Max life of (Picked unit))
Collapse Then - Actions
Unit - Create 1 Dummy unit for (Owner of (My Hero)) at TempLoc facing Default building facing degrees
Unit - Order (Last created unit) to Cheer (Picked unit)
Unit - Add a 5.00 second Generic expiration timer to (Last created unit)
Else - Actions
Custom script: call RemoveLocation(udg_TempLoc)
Custom script: call DestroyGroup(udg_TempGroup)

Btw, you need a dummy unit with this spell.
10-25-2006, 07:40 PM#6
Archmage Owenalacaster
I'm curious, though, if the desired effect is to include forcing the hero using Cheer to actually cast the ability (which would include casting time, mana consumption, cooldown, and "disablibility" or in other words the potential for the ability to be disabled through effects like Polymorph, Hex, Soul Burn, et cetera). While your trigger would work, Tidehunter, it would be nearly equivocal to having the Devotion and Command auras, as opposed to constantly auto-casting the Inner Fire-like spell as was specified.

(If there is any ambiguity, by "constantly auto-casting" I mean the desired function is to have an Inner Fire-like effect cast on any allied units in range if able, as opposed to the standard Inner Fire auto-cast which activates the ability when allied units enter combat with an enemy.)

This is a tricky problem for me, as I don't have enough triggering experience to be able to determine a solution. Anyone else have an idea?

EDIT: Modified for clarity
10-26-2006, 08:58 AM#7
DioD
use empty order eg

Order("")

if unit just stay order != stop
10-26-2006, 09:50 AM#8
The)TideHunter(
Order("") will just return 0, as you can see by:

Collapse JASS:
function String2OrderIdBJ takes string orderIdString returns integer
    local integer orderId
    
    // Check to see if it's a generic order.
    set orderId = OrderId(orderIdString)
    if (orderId != 0) then
        return orderId
    endif

    // Check to see if it's a (train) unit order.
    set orderId = UnitId(orderIdString)
    if (orderId != 0) then
        return orderId
    endif

    // Unrecognized - return 0
    return 0
endfunction
10-27-2006, 05:11 AM#9
Wyvernoid
Long not online. Let me see your good suggestions one by one:
>>Archmage<< Hmm, I think you have been suggesting an aura-like thing right? But I'm not goin' to do that. I just want to make it act like a heal, a normal priest's heal. That is, when "My hero" is busy, he can't cast the spell - he's like a priest, hmm yeah, not a "Fountain of Health".
As for those stopped by polymorph, silence, soulburn, etc, I don't think that the "My hero" will be able to cast the Cheer when under effects of those.
As for (again^^) the cast backswing, I know that, but I think it's away from my idea. But by suggesting this you remind me that using pick might not be a good idea? Well, I'm just confused. Use your Brilliance Aura to make it clearer plz ^^

>>TideHunter<< You suggested a good way, but I think it would also not work as a heal - multiple units get healed at the same time, a priest can not do that for sure...
Then you said Order("")=0, hmm what difference does that make? Are you suggesting that I should make the condition as GetUnitCurrentOrder(udg_My_hero) = 0?

>>DioD<< Hmm I think you mean that "if unit just stay then order = "" ". Then can you check if I'm right at the following? 1. When the unit attacks automatically not manually, the order = "". 2. When the unit finishes moving to its destination, the order = "". 3. When the unit is ordered to stop, the order = "".
In fact, the above 3 conditions are all in which I want the "My hero" to cast, just like that a priest would do a heal in all the 3 conditions.

Well... is this too hard? I never expected it to be... The fact is, normal Inner Fire is only autocast when nearby allied units are attacking, but I want it to autocast when the hero is in the 3 conditions above and nearby allied units are injured. The problem present is that the hero doesn't cheer the wounded unless they attack >:<
10-27-2006, 10:41 AM#10
The)TideHunter(
Quote:
Originally Posted by Wyvernoid
>>TideHunter<< You suggested a good way, but I think it would also not work as a heal - multiple units get healed at the same time, a priest can not do that for sure...
Then you said Order("")=0, hmm what difference does that make? Are you suggesting that I should make the condition as GetUnitCurrentOrder(udg_My_hero) = 0?

You did not state what you was asking for.
By the looks of your current trigger, that would do exactly the same as mine but mine would work, by the looks of it, you wanted all units in range of 600 to get healed, its in a loop.
10-27-2006, 11:59 AM#11
Thunder_Eye
You will need to stop the loop when the priest has aquired its first target.
10-28-2006, 04:51 AM#12
Wyvernoid
Quote:
Originally Posted by Wyvernoid
Well that "Cheer" was made out of inner fire, but I wanted it to work as a heal. The problems are:

2. Even it works, I didn't check whether the autocast is on. This means that even the autocast is off "My hero" would go and cheer others. However how to check?

>>TideHunter<< Sorry for that, all I wanted to state is that I want to make it work as a normal priest's heal. My trigger is a wrong one, I know ;-)
One more thing to ask: would it be laggy if you created a dummy every 1 sec?

>>Thunder_Eye<< Thank you! But how could I do it?
Collapse JASS:
call ForGroup(udg_tempUG, function EnumFunc)
...
function EnumFunc takes nothing returns nothing
...
return // After cheering the unit
...
endfunction
or just cheer FirstOfGroup(udg_UG)?

Hmm, I still want to ask - Does anyone of you know how to check if the autocast is on? I have an idea to use 3 triggers(one checks on, one checks off, one does actions), will it work?
10-28-2006, 08:01 AM#13
The)TideHunter(
Yes, FirstOfGroup would work, but it might always pick the same unit.
And if use FirstOfGroup, remember to change the way you select units in the group, add a condition that its not on max life, because if you get it in the group and its the first one there, then it dosent meet the condition, it wont heal anybody.

And to check if autocast is on, yes i think you should have 3 triggers that set a boolean or something.
10-28-2006, 08:12 AM#14
Pheonix-IV
There's a far easier way to do this:

Give the unit a dummy ability based on heal. Give it the tooltip, icon ect for Cheer or whatever and make the dummy heal 0 hitpoints. Have a trigger which detects when the dummy heal is cast, spawns a dummy unit and casts the real Cheer ability on the target of the dummy heal. Simple, no hassle, works like a charm.

Seriously, big phat JASS triggers arn't the answer to everything.
10-28-2006, 08:22 AM#15
darkwulfv
Quote:
Seriously, big phat JASS triggers arn't the answer to everything.
Holy crap, that had to be the best line ever. I am quoting that in my sig for all of eternity.

Phoenix-IV's method is perfect. That's insanely easy. Just make a trigger that kicks in whenever the effect of Cheer (the dummy one) is started on a unit, then make a dummy caster put the real Cheer spell on said unit. No loops, no variables (I don't think, I left GUI for JASS a month ago and I've forgotten how to do GUI...), and pretty damn easy. Phoenix-IV, you get some rep.