percentage question

Advena

Just casually observing atm ;)
Reaction score
42
Hey everyone, a quick question for those who play around with Real variables a lot.
I have an ability that's supposed to insta-kill all units below blablabla % of their max hp. The ability have 10 levels.
The bold numbers in the ability triggercode below are supposed to mean 5% (of picked unit's life). I have no good way of testing it atm so I thought I could ask if anyone can say right away that it looks good or bad.

Code:
Cold Night
    Events
        Unit - A unit Finishes casting an ability
    Conditions
        (Ability being cast) Equal to Cold Night (Spellcasting Frost Px25)
    Actions
        Unit Group - Pick every unit in (Units in (Playable map area) matching ((Percentage life of (Picked unit)) Less than or equal to ((Real((Level of (Ability being cast) for (Casting unit)))) x 0.05))) and do (Actions)
            Loop - Actions
                If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    If - Conditions
                        ((Picked unit) is A Hero) Equal to False
                    Then - Actions
                        Unit - Kill (Picked unit)
                    Else - Actions
                        Do nothing

If there's anything else you wanna know or if you got any ideas to imporve the trigger, post away :)

Cheers guys
 

the Lumpy

►►►
Reaction score
53
I think that (Percentage life of (Picked Unit)) will equal 5.00 if the unit has 5% of its life, for example. So I think you'll need to use 5.00 instead of 0.05 in your trigger.
 

Genyuumaru

New Member
Reaction score
15
Looks good.

Just replace the Finishes casting an ability to Starts the effect of an ability.

Also to remove the unit group leak you could:

Code:
set Temp_Unit_Group = (Units in (Playable map area) matching ((Percentage life of (Picked unit)) Less than or equal to ((Real((Level of (Ability being cast) for (Casting unit)))) x 0.05)))
Unit Group - Pick every unit in Temp_Unit_Group and do bla bla bla...
Custom Script: call DestroyGroup (udg_Temp_Unit_Group)

Also, if you are using a single condition/action I suggest to use the simple If/Then/Else action, not the multi one.

That trigger would be perfect and wouldn't contain any memory leaks.

Edit: +1 to the Lumpy
 

Advena

Just casually observing atm ;)
Reaction score
42
Aha, I had a feeling that I might've been wrong there. That's why I asked :p
Thanks guys, I'll implement those leak-removing lines as well.

Thanks :thup:
 

vypur85

Hibernate
Reaction score
803
Code:
Cold Night
    Events
        Unit - A unit Finishes casting an ability
    Conditions
        (Ability being cast) Equal to Cold Night (Spellcasting Frost Px25)
    Actions
        Unit Group - Pick every unit in (Units in (Playable map area) matching ((Percentage life of ([B]Picked unit[/B])) Less than or equal to ((Real((Level of (Ability being cast) for ([B]Casting unit[/B])))) x 0.05))) and do (Actions)
            Loop - Actions
                If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    If - Conditions
                        ((Picked unit) is A Hero) Equal to False
                    Then - Actions
                        [I]Unit - Cause (Triggering unit) to damage (Picked unit) dealing 9999.00 damage of type Something[/I]
                    Else - Actions
                        Do nothing

For the bolded words, change to Matching unit and Triggering unit, respectively. Also, the italise line to make sure you get the bounty for kills.
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Members online

      No members online now.

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top