• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

life into damage

Status
Not open for further replies.
Level 4
Joined
Jun 14, 2008
Messages
72
Hello i need a trigger that makes it when a type of unit loses life it does more damage, i cant figure out how to make it for every 4 life it loses it does 1 extra damage.
 
Level 4
Joined
May 4, 2008
Messages
113
You need to use a Damage Detection system.

Simplest way to make one yourself is to just do this

Code:
Events
 Unit enters playable map area

Actions
 Add the event "(Entering unit) Takes damage" to <YOUR TRIGGER>

You will also want to do this at map initialization:

Code:
Events
 Map initialization

Actions
 Set Temp_Group = Units in (Playable map area)
 Unit Group - Pick every unit in Temp_Group and do:
  Loop - (Actions):
   Add the event "(Entering unit) Takes damage" to <YOUR TRIGGER>
 Custom Script: call DestroyGroup(udg_Temp_Group)

However, you will need to be careful, because if a unit re-enters the map, the event will be added twice so the trigger will fire off twice. To get around this, you can add a Dummy Ability that does nothing, and that can't be seen (Base it off of an item ability like Item Armour Bonus), to these triggers, and then make a condition check that the entering unit does not have that ability, else it will not fire.

THE EASIER WAY TO DO THAT:
Download a damage detection system. Search them up, there's several on Hive and on other websites too - I don't use one, so I can't recommend any.

Anyways, from there on, you have your trigger that does the actions:

Code:
Events
 (none, because it is added through another trigger)

Conditions
 Level of <ABILITY> for (Damage source) Greater than or Equal to 1

Actions
 Cause (Damage source) to damage (Triggering unit) for (((Max life of (Damage source)) - (Current life of (Damage source)) / 4)

Hope that makes sense.
 
Level 15
Joined
Aug 14, 2007
Messages
936
There is a simplier way

You need a unit ability, damage bonus (item ability), make it 100 levels, each level with 1 damage increment

You need a trigger that activates Trigger2

Then

Trigger2(disabled at start)

Every 0.5 seconds of the game

local int life = 0
local real lifemissing = 0

set lifemissing = unit maxlife - unit currentlife
life = converttoINT(lifemissing/4)
if (level of item damage bonus <1)
add item damage bonus to unit
endif
set damage bonus of unit to life


Hope you get it, sorry about no trigger tags =(
 
Level 4
Joined
Jun 14, 2008
Messages
72
could you explain that a little more clear i get what your saying but its not totaly making sence... could u do trigger tags n' stuff?
 
Level 37
Joined
Mar 6, 2006
Messages
9,240
There is a simplier way

You need a unit ability, damage bonus (item ability), make it 100 levels, each level with 1 damage increment

You need a trigger that activates Trigger2

Then

Trigger2(disabled at start)

Every 0.5 seconds of the game

local int life = 0
local real lifemissing = 0

set lifemissing = unit maxlife - unit currentlife
life = converttoINT(lifemissing/4)
if (level of item damage bonus <1)
add item damage bonus to unit
endif
set damage bonus of unit to life


Hope you get it, sorry about no trigger tags =(

That's definately not the way to do it for several reasons.
 
Status
Not open for further replies.
Top