| 07-19-2004, 07:11 PM | #1 |
I want to make a spell that works like the Druid of the Claws' Roar, but gives surrounding units AMS instead of 25% faster attack rate. Any suggestions? Thanks. |
| 07-19-2004, 08:38 PM | #2 |
you pick all the units in range of triggering unit (using the "a unit starts the effect of an ability " event ) then you create a caster and order it to cast antimagic shield on the units |
| 07-20-2004, 01:44 AM | #3 | |
Quote:
Thanks, Lord Vexorian, but I didn't quite follow the trigger. So far I have: Events - Unit- A unit starts the effect of an ability Conditions -Ability being cast Equal to Roar Events -Unit group -Pick every unit in Units within 300 of Position of Casting unit and do actions - Loop actions... I don't know what to do for 'Loop actions'. I cant find anything that would put AMS on the unit group. Help would be appreciated. Also, they way this is set up, will this put AMS on enemy units, too? Thanks. |
| 07-20-2004, 01:58 AM | #4 |
Make a caster that has AMS with no cooldown and no mana cost. Change your trigger to something more like Create (caster) Unit group -Pick every unit in Units within 300 of Position of Casting unit and (owner of (matching unit) equal to owner of (casting unit)) and do actions and then Order caster to (anti magic shell) on (picked unit) and then get rid of the caster; that should do it. And you do know you can copy a trigger to text by right clicking and pressing copy to text. |
| 07-20-2004, 05:48 AM | #5 |
The trigger happens in an instant, so I'm not sure a single caster can cast the spel on one unit before it is ordered to cast it on the next. To get around this, you need to make a new caster for every unit. Code:
Events:
A unit starts the effect of an ability
Conditions:
Ability being cast equal to customRoar
Actions:
unit roup - pick every unit in range of unit matching condition and do actions - every unit in (1000 of (casting unit)) matching ((owner of (matching unit) is an ally of (casting unit) equal to true) and ((matching unit) has buff (roar) equal to true))
loop - actions:
unit - create 1 dummy caster (this unit must be invisible and unselectable; give it the locust ability, no model, no shadow, and no attack in the object editor) for (owner of (casting unit)) at (position of (casting unit))
unit - add ability - add AMS to last created unit
unit - add expiration timer - add a 1 second generic expiration timer to (last created unit)
unit - issue order targeting a unit - order (last created unit) to (undead banshee - AMS) (picked unit) |
| 07-21-2004, 09:54 PM | #6 | |
Quote:
|
| 07-25-2004, 10:04 PM | #7 |
:o Wow. Thanks a lot, guys. That was a huge trigger! Thanks for putting that together. That was more help than I expected.^_^ It works as far as I can tell, but there's one small discrepency. My hot keyed units that get AMS are highlighted in red, as though they're afflicted w/ a debuff. This is no big deal, though. Thanks again. |
| 07-26-2004, 09:03 AM | #8 |
Hey, glad to hear it works, now, you may wish to try an upgraded version, because the original one has a nasty memory leak. Code:
Events:
A unit starts the effect of an ability
Conditions:
Ability being cast equal to customRoar
Actions:
set variable - set tempPoint = (postion of (casting unit))
unit group - pick every unit in range of unit matching condition and do actions - every unit in (1000 of (casting unit)) matching ((owner of (matching unit) is an ally of (casting unit) equal to true) and ((matching unit) has buff (roar) equal to true))
loop - actions:
unit - create 1 dummy caster for (owner of (casting unit)) at tempPoint
unit - add ability - add AMS to last created unit
unit - add expiration timer - add a 1 second generic expiration timer to (last created unit)
unit - issue order targeting a unit - order (last created unit) to (undead banshee - AMS) (picked unit)
custom script: call RemoveLocation ( udg_tempPoint ) |
| 07-26-2004, 11:17 AM | #9 |
couldnt you just add the buff or something.... |
| 07-26-2004, 12:56 PM | #10 |
Nope, you couldn't just add a buff. Buffs are nothing more than just graphical effects and tooltips. The effect of the spell is done by, you wouldn't believe it, the spell itself. If we just added the buff (if it were even possible), we would have accomplished nothing. |
| 08-01-2004, 04:46 AM | #11 | |
Quote:
Thanks, Anitarf. Sorry for my late reply, my internet's been screwy lately. But, what makes this trigger more useful than the first one? Also, I'm not sure I follow what the 'custom script' is at the bottom. Is it something I should worry about? Thanks again. |
| 08-01-2004, 11:39 AM | #12 |
mo i dont mean change the buff in object editor... i mean in the trigger editor. |
| 08-01-2004, 12:41 PM | #13 |
Event:A unit begin casting an ability Condition:Ability being cast equal to [Ability name] Action: -Pick every unit within 300 radius of position of triggering unit do add AMS to picked unit. -Wait:0.10s -Order picked unit AMS to picked unit -Wait:0.25s -Remove ability AMS from picked unit -I think it work and simple to do ^^ |
| 08-01-2004, 03:37 PM | #14 |
"Picked unit" reference only works in a unit group loop and waits don't work in unit group loops. That trigger wouldn't work at all. Anitar's new trigger is more efficient because it cleans up memory leaks in the code. If you do not use his new trigger, each time the spell is cast the game will waste about 8 (IIRC, can't remember the size of War3's non-primitive data types off-hand) bytes of RAM. While in this case a mem leak won't have any visible effect on your game, it is good practice to clean up memory. |
| 08-01-2004, 08:44 PM | #15 |
Yes, as th15 explained, the only difference between the old and the new trigger is the fact that now, before using the (position of (casting unit)) in the "create unit" action, the trigger first sets that point to a variable and then uses the variable instead. The reason for this is that this way, we can keep track of the point object (the "position of casting unit"), because we have a variable pointing to it; this way, we can destroy this object at the end of the trigger (that's what the custom script does; careful when typing that, I think JASS is case sensitive), thus eliminating a memory leak (objects such as points, unit groups, special effects, player groups.... otherwise stay in memory even after the trigger doesn't use them anymore, so if you have some triggers repeating a lot of times, it's prudent to remove such memory leaks; but even if the triggers don't run that much, it's still nice to write a clean code, even if it has no practical effect). |
