Unit is Alive doesn't like more conditions

sentrywiz

New Member
Reaction score
25
I'm doing some fun map and this is one of the item abilities there. It works for the most part, but the part that REALLY needs to work, doesn't.

Here is the trigger:


Trigger:
  • Touch of Death
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • ((Casting unit) has an item of type Touch of Death) Equal to True
    • Actions
      • Set DeathLoc = ((Position of (Casting unit)) offset by 100.00 towards (Facing of (Casting unit)) degrees)
      • Game - Display to (All players) for 1.00 seconds the text: Death Location
      • Wait 0.05 seconds
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Random real number between 1.00 and 100.00) Less than or equal to 7.00
        • Then - Actions
          • Unit Group - Pick every unit in (Units within 400.00 of DeathLoc matching ((((Matching unit) belongs to an enemy of (Owner of (Casting unit))) Equal to True) and (((Matching unit) is alive) Equal to True))) and do (Actions)
            • Loop - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (Life of (Picked unit)) Less than or equal to ((Life of (Picked unit)) / 2.00)
                • Then - Actions
                  • Special Effect - Create a special effect at (Position of (Picked unit)) using Objects\Spawnmodels\Undead\UndeadDissipate\UndeadDissipate.mdl
                  • Special Effect - Destroy (Last created special effect)
                  • Unit - Kill (Picked unit)
                  • Game - Display to (All players) for 5.00 seconds the text: ((Name of (Owner of (Picked unit))) + just tasted the Grim Reaper's Scythe!)
                • Else - Actions
        • Else - Actions
      • Custom script: call RemoveLocation(udg_DeathLoc)
      • Game - Display to (All players) for 1.00 seconds the text: Removing Death



So what its supposed to do?

-a 7% chance on spell cast to pick units that are alive and enemy, see if their health is 50% or lower and if it is, to kill it.

I did notice two things about it. Unit is Alive doesn't cope with the condition if unit has 50% of lower health or vice versa. If you put those two in condition, trigger doesn't kill the unit. So its either alive or has 50% lower health. This wouldn't be a problem... but due to testing, if there are corpses around the trigger picks the corpses and applies the kill trigger to them.


Ideas, suggestions and fixes.
 

Jedi

New Member
Reaction score
63
Unit alive condition checks unit's hp is greater than 0.

You can use:
Life > 0 and Percentage life < 50

Also your condition wrong

Trigger:
  • (Life of (Picked unit)) Less than or equal to ((Life of (Picked unit)) / 2.00)

This will never return true.It should be
Trigger:
  • (Percentage life of (Picked unit)) Less than or equal to 50.00

or
Trigger:
  • (Life of (Picked unit)) Less than or equal to ((Max life of (Picked unit)) / 2.00)
 

Bogrim

y hello thar
Reaction score
154
Trigger:
  • Set DeathLoc = ((Position of (Casting unit)) offset by 100.00 towards (Facing of (Casting unit)) degrees)

Leaks.

Trigger:
  • Wait 0.05 seconds

Is more likely to be around 0.10 to 0.30 seconds wait, possibly longer. If you need short precise waits, use a timer.

Trigger:
  • Unit Group - Pick every unit in (Units within 400.00 of DeathLoc matching ((((Matching unit) belongs to an enemy of (Owner of (Casting unit))) Equal to True) and (((Matching unit) is alive) Equal to True))) and do (Actions)

Leaks. Also, use "Triggering unit" and not "Casting unit". Triggering unit is a local variable, which will persist through waits.

Trigger:
  • (Life of (Picked unit)) Less than or equal to ((Life of (Picked unit)) / 2.00)

This condition is the problem, as you mean for to compare the life of the picked unit to the max life of the picked unit. The life of the unit will never be equal to or less than half its remaining life.

Trigger:
  • Unit - Kill (Picked unit)

Isn't going to grant the casting unit credit for casting the spell. You may want to just cause universal chaos damage rather than kill the unit.
 

sentrywiz

New Member
Reaction score
25
Actually, that doesn't work in this case. IIt worked for me before...


I will do what you said though
 

sentrywiz

New Member
Reaction score
25
Trigger:
  • Set DeathLoc = ((Position of (Casting unit)) offset by 100.00 towards (Facing of (Casting unit)) degrees)

Leaks.

Trigger:
  • Wait 0.05 seconds

Is more likely to be around 0.10 to 0.30 seconds wait, possibly longer. If you need short precise waits, use a timer.

Trigger:
  • Unit Group - Pick every unit in (Units within 400.00 of DeathLoc matching ((((Matching unit) belongs to an enemy of (Owner of (Casting unit))) Equal to True) and (((Matching unit) is alive) Equal to True))) and do (Actions)

Use "Triggering unit", not "Casting unit". Triggering unit is a local variable, which will persist through waits.

Trigger:
  • (Life of (Picked unit)) Less than or equal to ((Life of (Picked unit)) / 2.00)

This condition is the problem, as you mean for to compare the life of the picked unit to the max life of the picked unit. The life of the unit will never be equal to or less than half its remaining life.

Trigger:
  • Unit - Kill (Picked unit)

Isn't going to grant the casting unit credit for casting the spell. You may want to just cause universal chaos damage rather than kill the unit.

Just a habit... of using casting unit. So how do I make it check for 50% health or lower? I know about the Real percentage life, but I never really knew to compose a trigger out of that.

Universal Chaos damage. Sure why not. 10^9999 is prolly good enough to kill the map editor


EDIT: +rep to both. Learned something new today ^_^

@Bogrim
@Jedi
 

Bogrim

y hello thar
Reaction score
154
Just a habit... of using casting unit. So how do I make it check for 50% health or lower? I know about the Real percentage life, but I never really knew to compose a trigger out of that.
In the "Property of unit", you can change the "Life of" to "Max life of".
 

perkeyone

something clever
Reaction score
71
just an observation here
(Random real number between 1.00 and 100.00) Less than or equal to 7.00
isnt that a 6.00/99.00 chance?
if you use "integer number between 1 and 100 less than or equal to 7"
or "real number between 0.01 and 100.00 less than or equal to 7.00"
then it would be closer to the 7% you wanted
 

Jedi

New Member
Reaction score
63
real number between 1 and 10 less than or equal to 7 = 7/10 = 70/100
Possibilities = 1,2,3,4,5,6,7
Max numbers = 10

real number between 1 and 100 less than or equal to 7 = 7/100
Possibilities = 1,2,3,4,5,6,7
Max numbers = 100(Count them if you want)

(These numbers are not real, but list could be too long if I showed all reals :D)

Edit:Actually BETWEEN is not BETWEEN, they are minimum and maximum number.
 

perkeyone

something clever
Reaction score
71
integer number between 1 and 100 less than or equal to 7
7 out of 100 = 7%

real number between 1.00 and 100.00 less than or equal to 7.00
601 out of 9901 = 6.07%

im not sure if we are agreeing or disagreeing.
 
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