- Joined
- Jul 14, 2011
- Messages
- 3,213
Hi! I started the thread on World Editor zone - http://www.hiveworkshop.com/forums/world-editor-help-zone-98/custom-complex-damage-system-205277/ -, and it already helped me to start with the trigger, but now I need to optimize it, and even know how to use it I'm not good at all on JASS or vJASS, but I understand that this kind of stuff is a lot easier JASS.
I'm trying to make a damage system that triggers game damage, so each unit has 6 types o damage, and 5 types of resistances.
Physic Dmg - Physic Resis
Fire Dmg - Fire Res
Water Dmg - Water Res
Wind Dmg - Wind Res
Earth Dmg - Earth Res
Pure Damage <- This one has no resistance.
So, every time a unit deals damage to another unit, the trigger retrieves all the data from the unit (All the Damage data of the Attacking Unit, and All the Resistance Data from the Attacked Unit) and deals the respective damage. Resistances are just a % of reduction of the attacking unit damage.
I'm thinking of making all units in my map deal 1-1 damage and have 0 armor, since all the damage and resistances are going to be triggered.
Adding all the data this way (or a better one) to every Unit Type in the game:
This is just an example. Since these are going to be damage amounts, and % of resistance, I think these should be 'real array' instead of 'integer array'. Simply, each damage detection would have 6 actions.
Cause 'DamageSource' deal 'PD[DamageSource] - PR[DamagedUnit]'
Cause 'DamageSource' deal 'FD[DamageSource] - FR[DamagedUnit]'
Cause 'DamageSource' deal 'WaD[DamageSource] - WaR[DamagedUnit]'
Cause 'DamageSource' deal 'WiD[DamageSource] - WiR[DamagedUnit]'
Cause 'DamageSource' deal 'ED[DamageSource] - ER[DamagedUnit]'
Cause 'DamageSource' deal 'PD[DamageSource]'
Any help around to do/improve this? I just need the base sytem... I'm the one that's going to place the data
BTW.. if target Unit has 100% resistance, it would deal 0 damage. If It has over 100% resistance, it should deal negative damage, which means heal the target (Hitting a Fire Elemental with a Fire Sword shouldn't damage it)
And I need a way to know if the damage is dealt by Spells or Attacks (I can add a buff to each spell, so the system detects the damage, and if the Unit has the buff, it means that the damage was a spell, remove the buff, and deal the spell damage excluding physical and elemental damage, that should only be done with attacks)
I'm trying to make a damage system that triggers game damage, so each unit has 6 types o damage, and 5 types of resistances.
Physic Dmg - Physic Resis
Fire Dmg - Fire Res
Water Dmg - Water Res
Wind Dmg - Wind Res
Earth Dmg - Earth Res
Pure Damage <- This one has no resistance.
So, every time a unit deals damage to another unit, the trigger retrieves all the data from the unit (All the Damage data of the Attacking Unit, and All the Resistance Data from the Attacked Unit) and deals the respective damage. Resistances are just a % of reduction of the attacking unit damage.
I'm thinking of making all units in my map deal 1-1 damage and have 0 armor, since all the damage and resistances are going to be triggered.
Adding all the data this way (or a better one) to every Unit Type in the game:
JASS:
globals
integer array UnitID
integer array PD // Physical Damage
integer array PR // Physical Resistance
integer array FD // Fire Damage
integer array FR // Fire Resist
integer array WaD // Water Damage
integer array WaR // Water Resistance
integer array ED // Earth Damage
integer array ER // Earth Resistance
integer array WiD // Wind Damage
integer array WiR // Wind Resistance
integer array PD // Pure Damage
integer i = 0
endglobals
function UnitEle_Setup takes nothing returns nothing
//Footman
set i = i + 1
set UnitID = 'h000'
set PD[i] = 15
set PR[i] = 15
set FD[i] = 0
set FR[i] = 10
set WaD[i] = 0
set WaR[i] = 10
set ED[i] = 20
set ER[i] = 50
set WiD[i] = 0
set WiR[i] = 0
set PD[i] 0
//Archer
set i = i + 1
set UnitID = 'h001'
set PD[i] = 5
set PR[i] = 15
set FD[i] = 0
set FR[i] = 0
set WaD[i] = 15
set WaR[i] = 50
set ED[i] = 0
set ER[i] = 0
set WiD[i] = 50
set WiR[i] = 50
set PD[i] 0
//===========================================================================
function InitTrig_ThisTrig takes nothing returns nothing
set gg_trg_ThisTrig = CreateTrigger( )
call TriggerAddAction( gg_trg_ThisTrig, function UnitEle_Setup )
endfunction
This is just an example. Since these are going to be damage amounts, and % of resistance, I think these should be 'real array' instead of 'integer array'. Simply, each damage detection would have 6 actions.
Cause 'DamageSource' deal 'PD[DamageSource] - PR[DamagedUnit]'
Cause 'DamageSource' deal 'FD[DamageSource] - FR[DamagedUnit]'
Cause 'DamageSource' deal 'WaD[DamageSource] - WaR[DamagedUnit]'
Cause 'DamageSource' deal 'WiD[DamageSource] - WiR[DamagedUnit]'
Cause 'DamageSource' deal 'ED[DamageSource] - ER[DamagedUnit]'
Cause 'DamageSource' deal 'PD[DamageSource]'
Any help around to do/improve this? I just need the base sytem... I'm the one that's going to place the data
BTW.. if target Unit has 100% resistance, it would deal 0 damage. If It has over 100% resistance, it should deal negative damage, which means heal the target (Hitting a Fire Elemental with a Fire Sword shouldn't damage it)
And I need a way to know if the damage is dealt by Spells or Attacks (I can add a buff to each spell, so the system detects the damage, and if the Unit has the buff, it means that the damage was a spell, remove the buff, and deal the spell damage excluding physical and elemental damage, that should only be done with attacks)