Hei, first of, I'm pretty new to the trigger editor. And here I'm trying to make a trigger which gives resources to a player when a unit attacks a another unfriendly unit. Here's a formula to explain what i mean:

Cost of unit being attacked / Hitpoints of the unit being attacked * Damage dealt by attacking unit * Ability ratio.

An example:

200 minerals worth building / with 100 hitpoints * takes 10 damage * the effect has a 0,25 ratio = gives 5 minerals to attacking unit each hit.

Got it all pretty much working but i could not find a way to get the cost of the unit, any help?;)

You need to define the cost of [x] of unit type [x] in variables where X is a unique number for each unit type and then get those values later on to check in a loop. If Triggering unit is UnitType[Loop] then

Hei, first of, I'm pretty new to the trigger editor. And here I'm trying to make a trigger which gives resources to a player when a unit attacks a another unfriendly unit. Here's a formula to explain what i mean:

Cost of unit being attacked / Hitpoints of the unit being attacked * Damage dealt by attacking unit * Ability ratio.

An example:

200 minerals worth building / with 100 hitpoints * takes 10 damage * the effect has a 0,25 ratio = gives 5 minerals to attacking unit each hit.

Got it all pretty much working but i could not find a way to get the cost of the unit, any help?;)

You need to define the cost of [x] of unit type [x] in variables where X is a unique number for each unit type and then get those values later on to check in a loop. If Triggering unit is UnitType[Loop] then

Cost[Loop] etc..

@slaydon: Go

Arg, not possible to get catalog field of triggering unit or something like that?

you can get the cost of the unit from the catalog field value of the unit type in question or you can use the action "get unit property(cost)"

I would suggest saving each of these values to a temp variable before doing any math with them

Tried it and couldn't get it to work, this is what i got so far.

It gave me an error about (Triggering damage amount has no matching event.) Any idea what i did wrong?

Yeah your not using a damage event..... so triggering damage doesnt exist.... You would need to use this event

Well that makes sence, got it working now;) Guess that explains the greyed out fields aswell. And thanks for some damn quick answers.