scope Combo initializer InitTrig_Illusion_Slash
// SETTINGS
globals
private constant integer dummy_id = 'h000' // the ID of the dummy unit
private constant integer spell_id = 'A000' // the ID of the spell
private constant real anim_delay = 1.00 // the delay before the dummy dies
private constant integer red = 100 // the color red of the dummy
private constant integer green = 100 // the color green of the dummy
private constant integer blue = 100 // the color blue of the dummy
private constant integer alpha = 75 // the color transparency of the dummy
private constant integer red_c = 100 // the color red of the caster
private constant integer green_c = 100 // the color green of the caster
private constant integer blue_c = 100 // the color blue of the caster
private constant integer alpha_c = 75 // the color transparency of the caster
private constant real tag_red = 100 // the text tag color : red
private constant real tag_green = 10 // the text tag color : green
private constant real tag_blue = 10 // the text tag color : blue
private constant string animation = "slam" // the animation the dummy will play
private constant boolean attack = true // is the spell a attack?
private constant boolean ranged = false // is the spell ranged?
private constant attacktype atk_type = ATTACK_TYPE_CHAOS // the attack type of the dummy damage
private constant damagetype dmg_type = DAMAGE_TYPE_NORMAL // the damage type of the dummy damage
private constant weapontype wep_type = WEAPON_TYPE_WHOKNOWS // the weapon type of the dummy damage
private constant boolean enable_texttag = true // if set to true, it will show the damage dealt by the dummy
private constant string special_effect = "Abilities\\Spells\\Orc\\MirrorImage\\MirrorImageCaster.mdl"
private constant string attachment_point = "origin" // this is where the above special effect is placed
private real array extra_damage // set the extra damage bellow in function Settings
private integer array chance // set the chance bellow in function Settings
endglobals
function Settings takes nothing returns nothing
// set the chances:
set chance[1] = 20
set chance[2] = 40
set chance[3] = 60
// set the extra damage values
set extra_damage[1] = 20
set extra_damage[2] = 35
set extra_damage[3] = 50
endfunction
// END OF SETTINGS
private function Conditions takes nothing returns boolean
return GetUnitAbilityLevel(GetEventDamageSource(), spell_id ) >= 1
endfunction
private function Actions takes nothing returns nothing
local unit u = GetEventDamageSource()
local unit t = GetTriggerUnit()
local unit dummy
local integer lvl = GetUnitAbilityLevel(u , spell_id)
local real dmg = GetEventDamage() + extra_damage[lvl]
local real angle = GetUnitFacing(t) + 180
local player owner = GetOwningPlayer(u)
local location l = GetUnitLoc(u)
local location l2
local integer ch = GetRandomInt(1 , 100)
local texttag text
local real pos = 60.
// We call the chance function
call Settings()
if chance[lvl] >= ch then
call AddSpecialEffectTarget(special_effect , u , attachment_point)
call SetUnitVertexColor(u, red_c , green_c, blue_c, alpha_c)
set dummy = CreateUnitAtLoc(owner, dummy_id , l , angle)
set l2 = GetUnitLoc(dummy)
call PauseUnit(dummy, true)
call SetUnitVertexColor(dummy , red , green, blue, alpha)
call SetUnitAnimation(dummy , animation)
if enable_texttag == true then
set text = CreateTextTagLocBJ( R2S(dmg)+"!" , l2, pos, 12, tag_red, tag_green, tag_blue, 0 )
call SetTextTagVelocityBJ( text, 60.00, 90 )
call SetTextTagPermanent( text, false )
call SetTextTagLifespan( text, 1)
call SetTextTagFadepoint( text, 0.1)
endif
call TriggerSleepAction(anim_delay)
call UnitDamageTarget(u, t, dmg, attack, ranged, atk_type , dmg_type , wep_type)
call RemoveUnit(dummy)
call SetUnitVertexColor(u, 255 , 255, 255, 255)
endif
set u = null
set t = null
set dummy = null
call RemoveLocation(l)
call RemoveLocation(l2)
call DestroyTextTag(text)
endfunction
//===========================================================================
private function InitTrig_Illusion_Slash takes nothing returns nothing
set gg_trg_Illusion_Slash = CreateTrigger( )
call TriggerAddCondition( gg_trg_Illusion_Slash, Condition( function Conditions ) )
call TriggerAddAction( gg_trg_Illusion_Slash, function Actions )
endfunction
endscope