HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

AoE %-based Death Spell-trigger?

10-28-2004, 02:37 PM#1
Norwegian
Okay, I'm making this spell, it's just... it never works!

The idea goes;
When the hero casts the spell it picks every unit within 'range', and checks if their HP are lower than the specified %, then kills them if that's the case... it just never works...

I did like I allways does in 'AoE singe-target abilities';

Event
- Unit starts the effect of an ability
Conditions
- Abiliti being cast equal to Extinct
Actions
- Pick every unit within (600 of (casting unit) (matching condition (owner of picked unit) equal to (allied of casting unit) equal to (false)) and do actions... If I check for them being enemies of the caster, then nothing happens...
- - Loop
- - - Create (1) (The Dummy Unit) for (Owner of (Casting unit)) at (position of (picked unit) facing (default building degrees)).
- - - Hide (Last created unit)
- - - Add (Last created unit) to (UnitGroup_Extinct_Casters)
- - - Add a (2 second) (Generic) expiration timer to (Last Created unit)
- - - Add ability (Instant Kill (With Corpse)) to (Last created Unit)
- - - If (Picked unit)'s (Life) less than or equal to ((((Max Life of (Picked unit)) / (4) * (Level of Ability (Extinct) for Casting Unit)) then do (Order Last (Created Unit) to (Human - Mountain King Storm Bolt) (Picked Unit)) else do (Do Nothing)
- Wait (2 seconds)
- Pick every unit in (UnitGroup_Extincy_Casters) and do (remove (picked unit) from the game)

Okay, I'm sorry for the sketchy-ness of the trigger, but I'm doing this on memory, 'cuz Service Pack 2 killed my home LAN. Basically it's your average easy-to-use trigger, that I've used on several occations to create AoE-versions of spells like Inner Fire, Raise Dead, or Cripple, etc. Odd tihng is, it doesn't work! It only picks 1 unit, then kills it (If its Life is low enough), and nothing else!

I made 2 other triggers (In reality it's gonna be a little more complicated (not to mention including fancy effects), checking for if the picked unit is a hero, and doing it's own calculation in connection with that, etc. But that didn't work when I created it, so I kept reducing the complexity to find what I did wrong.)

Even when I reduce the trigger to these most basic levels I can't get it to work properly...

Any and all help would be apprieciated. If and when I get my home computer online I'll post the actual trigger(s) if no solution has revealed itself.

Maybe somebody could create a fonctional trigger for me to look at?

Basically the spell has 3 levels;
Level 1: Every enemy unit within the AoE with HP equal to, or less than, 25% of its own max HP die. (Half for heroes)
Level 1: Every enemy unit within the AoE with HP equal to, or less than, 50% of its own max HP die. (Half for heroes)
Level 1: Every enemy unit within the AoE with HP equal to, or less than, 75% of its own max HP die. (Half for heroes)
10-28-2004, 05:21 PM#2
Klownkiller
what i saw was that you were only killing the units in the group that you created. that group only contained the dummy units. i say units because you did your dummy creation inside your loop. this would make a dummy unit for each picked unit. You wouls also have to make sure the ability (Storm bolt) that you are casting is avaliable for your dummy units to use, and that it will kill the picked units in one shot. I am assuming that you are having a dummy unit so that you can gain the proper experience for the kill. I hope i understood right. Here is what i would do:


Events
Unit - A unit Begins casting an ability
Conditions
Actions
Unit Group - Pick every unit in (Units within 600.00 of (Position of (Casting unit)) matching ((((Picked unit) belongs to an ally of (Owner of (Casting unit))) Equal to False) and ((Life of (Picked unit)) Less than or equal to (((Max life of (Picked unit)) / 4.00) x (Real((Level of Acid Bom and do (Actions)
Loop - Actions
Unit - Create 1 Footman for (Owner of (Casting unit)) at (Position of (Picked unit)) facing Default building facing degrees
Unit - Hide (Last created unit)
Unit Group - Add (Last created unit) to extinctcasters
Unit - Order (Last created unit) to Human Mountain King - Storm Bolt (Picked unit)

// new actions under pick unit groups and do action here.

Wait 2.00 seconds
Unit Group - Pick every unit in extinctcasters and do (Actions)
Loop - Actions
Unit - Remove (Picked unit) from the game



I hope this helps. let me know how it turns out.
10-28-2004, 07:47 PM#3
Anitarf
Matching unit, matching unit! Under the conditions in the "pick all units..." actions, you must use matching unit, not picked unit. Like this:

Unit Group - Pick every unit in (Units within 600.00 of (Position of (Casting unit)) matching ((((matching unit) belongs to an ally of (Owner of (Casting unit))) Equal to False) and ((Life of (matching unit)) Less than or equal to (((Max life of (matching unit)) / 4.00) x (Real((Level of Acid Bom and do (Actions)

Be careful, though, inside the loop, when you have an "if-then-else", there, it is proper to use "picked unit" in the conditions, because, there, the unit is already picked, but before that, when you are still picking the unit, it is not picked yet, so, when using "pick all units matching condition", you must use "matching unit" in the condition.


Anyway, you give your dummy casters an expiration timer, there's no need to remove them later, they die anyway. You also don't need to hide them, just use an invisible model for them like "zone indicator".

Also, you mem-leak one unit group object and a number of point objects every time this trigger runs. That's not too dramatic, but it's always nice to clean up memory leaks.
10-29-2004, 08:29 AM#4
Klownkiller
man i acn't believe i forgot about the matching unit instead of picked. that was dumb of me. Norwegian said it right, i was wrong. guess i'll be ok. hope i helped.
10-29-2004, 05:53 PM#5
Norwegian
Hmmmm, thanks. I'll try that. Still, kinda odd that 1 unit keeps getting killed, seeing as it's a 'picked unit'...

I'll try it ;)