- Joined
- Nov 21, 2008
- Messages
- 316
I imported the spell omnislash into my map, but it only works for heros wat part of it must i change so it can work for regular units. Keep in mind i already changed the ability from a hero spell to unit.
JASS:
//TESH.scrollpos=0
//TESH.alwaysfold=0
////////////////////////////////////////////////////////////////////////////
// By Barathrum (Dark_Lord_12) //
// //
// //
// To import the spell: //
// //
// Create a new trigger, convert it and replace the whole code with myne. //
// //
// You will also need an ability, you can copy mine or create your own. //
// //
// I used the ID A000, if you use an other, just change it. //
////////////////////////////////////////////////////////////////////////////
function Slash_Condition takes nothing returns boolean
return GetSpellAbilityId() == 'A000'
endfunction
function Death takes nothing returns boolean
return ( GetWidgetLife(GetFilterUnit()) <= 0) == false
endfunction
function Slash_Actions takes nothing returns nothing
local unit caster = GetSpellAbilityUnit() // casting unit
local location start_position = GetUnitLoc(caster) // casting units original location when casted
local group enemies = CreateGroup() // the group of units that will be hit by the spell
local unit temp // the current slashed target
local integer count = GetUnitAbilityLevel (caster, 'A000') * 5 // number of slashes (currently set to do 5 slashes x level of omnislash)
local location temp_loc //location of temp (current slashed unit)
local effect blinkEffect // the effect of caster (blink)
local effect targetEffect // the effect of slashed unit (phoenix misle)
local real delay = 0.10 // this is the delay between slashes. Currently 0.10
call GroupEnumUnitsInRangeOfLoc(enemies, start_position, 750.0, Condition(function Death)) // the range of caster wich units will be picked for targets (currently 750 )
call DestroyEffect( AddSpecialEffectLoc("Abilities\\Spells\\NightElf\\Blink\\BlinkTarget.mdl", GetUnitLoc (caster)))
loop
call TriggerSleepAction (delay)
set temp = null
set temp = GroupPickRandomUnit(enemies)
loop
if GetWidgetLife(temp) <= 0 then
set temp = null
set temp = GroupPickRandomUnit(enemies)
else
exitwhen caster != null
endif
endloop
exitwhen temp == null or count <= 0
if IsUnitEnemy(temp, GetOwningPlayer(caster)) then
set temp_loc = GetUnitLoc(temp)
call DestroyEffect( AddSpecialEffectLoc("Abilities\\Spells\\NightElf\\Blink\\BlinkTarget.mdl", GetUnitLoc (caster)))
call SetUnitPositionLoc(caster, temp_loc)
call SetUnitAnimation( caster, "attack" )
call UnitDamageTarget(caster, temp, GetUnitAbilityLevel (caster, 'A000') * 50, true, false, ATTACK_TYPE_CHAOS, DAMAGE_TYPE_NORMAL, null) // the demage dealt (currently 75 x level of spell omnislash)
set targetEffect = AddSpecialEffectTarget("Abilities\\Weapons\\PhoenixMissile\\Phoenix_Missile_mini.mdl",temp,"chest")
call DestroyEffect (targetEffect)
set count = count - 1
call RemoveLocation(temp_loc)
endif
//call GroupRemoveUnit(enemies, temp)
endloop
call RemoveLocation(start_position)
call DestroyGroup(enemies)
set caster = null
set start_position = null
set enemies = null
set temp = null
call RemoveLocation (temp_loc)
set temp_loc = null
call DestroyEffect (blinkEffect)
call DestroyEffect (targetEffect)
endfunction
function InitTrig_Slash_Copy takes nothing returns nothing
set gg_trg_Slash_Copy = CreateTrigger()
call TriggerRegisterAnyUnitEventBJ(gg_trg_Slash_Copy, EVENT_PLAYER_UNIT_SPELL_EFFECT)
call TriggerAddCondition(gg_trg_Slash_Copy, Condition(function Slash_Condition))
call TriggerAddAction(gg_trg_Slash_Copy, function Slash_Actions)
endfunction