• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

Naruto Spell Pack

This bundle is marked as useful / simple. Simplicity is bliss, low effort and/or may contain minor bugs.
Four Jass,MUI Spells.
Rasengan
Kage Bunshin No Jutsu
Sennin Mode
Fuuton Rasen Shuriken


[jass=Jass]
function Trig_Rasengan_Conditions takes nothing returns boolean
return GetUnitAbilityLevel(GetAttacker(), 'B000')>0
endfunction

function SR takes real xa, real ya, real xb, real yb returns real
return SquareRoot((xa-xb)*(xa-xb)+(ya-yb)*(ya-yb))
endfunction

function Trig_Rasengan_Actions2 takes nothing returns nothing
local timer t = GetExpiredTimer()
local integer id = GetHandleId(t)
local unit u = LoadUnitHandle(udg_Hash,id,0)
local unit c = LoadUnitHandle(udg_Hash,id,1)
local real x = LoadReal(udg_Hash,id,2)
local real y = LoadReal(udg_Hash,id,3)
local real x1 = GetUnitX(c)
local real y1 = GetUnitY(c)
local real a = Atan2(y1-y,x1-x)
if SR(x,y,x1,y1) < 1000 then
call SetUnitX(c,x1+25*Cos(a))
call SetUnitY(c,y1+25*Sin(a))
call DestroyEffect(AddSpecialEffectTarget("Objects\\Spawnmodels\\NightElf\\NEDeathSmall\\NEDeathSmall.mdl",c,"origin"))
call DestroyEffect(AddSpecialEffect("Abilities\\Spells\\Human\\Thunderclap\\ThunderClapCaster.mdl",x1,y1))
call UnitApplyTimedLife(CreateUnit(GetOwningPlayer(u),'h002',x1,y1,GetUnitFacing(u)),'B001',0.5)
else
call DestroyTimer(t)
call FlushChildHashtable(udg_Hash,id)
call AddUnitAnimationProperties(u,"Spell 3",false)
call AddUnitAnimationProperties(u,"Spell One",false)
endif
set u = null
set c = null
set t = null
endfunction

function Trig_Rasengan_Actions takes nothing returns nothing
local unit u = GetAttacker()
local unit c = GetTriggerUnit()
local real x = GetUnitX(u)
local real y = GetUnitY(u)
local timer t = CreateTimer()
local unit d = null
local integer id = GetHandleId(t)
local integer lvl = GetUnitAbilityLevel(u,'A001')
if GetUnitTypeId(c) == 'Hpal' then
call AddUnitAnimationProperties(u,"Spell 3",true)
call SetUnitAnimationByIndex(u,9)
call UnitDamageTarget(u,c,100*lvl,true,false,null,null,null)
else
call AddUnitAnimationProperties(u,"Spell One",true)
call SetUnitAnimationByIndex(u,4)
call UnitDamageTarget(u,c,200*lvl,true,false,null,null,null)
endif
call UnitRemoveAbility(u,'B000')
set d = CreateUnit(GetOwningPlayer(u),'h001',x,y,0)
call IssueTargetOrder(d,"cripple",c)
call UnitApplyTimedLife(d,'B001',1)
call SaveUnitHandle(udg_Hash,id,0,u)
call SaveUnitHandle(udg_Hash,id,1,c)
call SaveReal(udg_Hash,id,2,x)
call SaveReal(udg_Hash,id,3,y)
call TimerStart(t,0.025,true,function Trig_Rasengan_Actions2)
set u = null
set t = null
set d = null
set c = null
endfunction

//===========================================================================
function InitTrig_Rasengan takes nothing returns nothing
set gg_trg_Rasengan = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_Rasengan, EVENT_PLAYER_UNIT_ATTACKED )
call TriggerAddCondition( gg_trg_Rasengan, Condition( function Trig_Rasengan_Conditions ) )
call TriggerAddAction( gg_trg_Rasengan, function Trig_Rasengan_Actions )
endfunction
[/code]


[jass=Jass]
function Trig_Futon_Conditions takes nothing returns boolean
return GetSpellAbilityId() == 'A005'
endfunction

function SR2 takes real xa, real ya, real xb, real yb returns real
return SquareRoot((xa-xb)*(xa-xb)+(ya-yb)*(ya-yb))
endfunction

function Trig_Futon_Actions2 takes nothing returns nothing
local timer t = GetExpiredTimer()
local integer id = GetHandleId(t)
local unit u = LoadUnitHandle(udg_Hash,id,0)
local unit d = LoadUnitHandle(udg_Hash,id,1)
local real x = GetUnitX(d)
local real y = GetUnitY(d)
local real x1 = LoadReal(udg_Hash,id,4)
local real y1 = LoadReal(udg_Hash,id,5)
local real a = Atan2(y1-y,x1-x)
local real a2
local unit e
local group g = CreateGroup()
local real r
local real an
local boolean b = LoadBoolean(udg_Hash,id,8)
local player p = GetOwningPlayer(u)
local real f = GetUnitFacing(u)
if GetUnitState(d,UNIT_STATE_LIFE) > 0 then
if SR2(x,y,x1,y1) > 30 then
call SetUnitX(d,x+35*Cos(a))
call SetUnitY(d,y+35*Sin(a))
call DestroyEffect(AddSpecialEffect("Objects\\Spawnmodels\\NightElf\\NEDeathSmall\\NEDeathSmall.mdl",x,y))
call DestroyEffect(AddSpecialEffect("Objects\\Spawnmodels\\Undead\\ImpaleTargetDust\\ImpaleTargetDust.mdl",x,y))
call UnitApplyTimedLife(CreateUnit(GetOwningPlayer(u),'h002',x,y,f),'B001',0.5)
call GroupEnumUnitsInRange(g,x,y,200,null)
loop
set e = FirstOfGroup(g)
exitwhen e == null
if IsUnitEnemy(e,p) then
set a2 = Atan2(GetUnitY(e)-y,GetUnitX(e)-x)
call SetUnitX(e,GetUnitX(e)-45*Cos(a2))
call SetUnitY(e,GetUnitY(e)-45*Sin(a2))
endif
call GroupRemoveUnit(g,e)
endloop
else
if b == false then
call SaveUnitHandle(udg_Hash,id,7,CreateUnit(p,'h005',x,y,f))
call SaveBoolean(udg_Hash,id,8,true)
call SetUnitScale(d,3.3,3.3,3.3)
call SaveUnitHandle(udg_Hash,id,9,CreateUnit(p,'h006',x,y,f))
endif
call GroupEnumUnitsInRange(g,x,y,400,null)
set r = GetRandomReal(0,400)
set an = GetRandomReal(0,359)
call DestroyEffect(AddSpecialEffect("Objects\\Spawnmodels\\Undead\\ImpaleTargetDust\\ImpaleTargetDust.mdl",x+r*Cos(an*bj_DEGTORAD),y+r*Sin(an*bj_DEGTORAD)))
loop
set e = FirstOfGroup(g)
exitwhen e == null
if IsUnitEnemy(e,p) then
set a2 = Atan2(GetUnitY(e)-y,GetUnitX(e)-x)
call SetUnitX(e,GetUnitX(e)-10*Cos(a2))
call SetUnitY(e,GetUnitY(e)-10*Sin(a2))
call UnitDamageTarget(u,e,0.1*GetUnitAbilityLevel(u,'A001')*GetHeroStr(u,true),true,false,null,null,null)
endif
call GroupRemoveUnit(g,e)
endloop
endif
else
call RemoveUnit(LoadUnitHandle(udg_Hash,id,7))
call RemoveUnit(LoadUnitHandle(udg_Hash,id,9))
call DestroyTimer(t)
call FlushChildHashtable(udg_Hash,id)
call AddUnitAnimationProperties(u,"Spell Channel Five",false)
endif
call DestroyGroup(g)
set g = null
set d = null
set u = null
set e = null
set t = null
endfunction

function Trig_Futon_Actions takes nothing returns nothing
local unit u = GetTriggerUnit()
local unit d
local timer t = CreateTimer()
local integer id = GetHandleId(t)
local real x = GetUnitX(u)
local real y = GetUnitY(u)
local real f = GetUnitFacing(u)
local player p = GetOwningPlayer(u)
local effect e = AddSpecialEffectTarget("war3mapImported\\RasurikenbyValk_2nd.mdx",u,"right hand")
call AddUnitAnimationProperties(u,"Spell Channel Five",true)
call SaveUnitHandle(udg_Hash,id,0,u)
call SaveReal(udg_Hash,id,4,GetSpellTargetX())
call SaveReal(udg_Hash,id,5,GetSpellTargetY())
//-------------------------------------------------
set d = CreateUnit(GetOwningPlayer(u),'h003',x+100*Cos((f-90)*bj_DEGTORAD),y+100*Sin((f-90)*bj_DEGTORAD),f)
call SetUnitFacingToFaceUnitTimed(d,u,0)
call UnitApplyTimedLife(d,'B001',1.5)
call UnitApplyTimedLife(CreateUnit(p,'h002',x,y,f),'B001',0.5)
call DestroyEffect(AddSpecialEffectTarget("war3mapImported\\shadowclone.mdx",d,"origin"))
call AddUnitAnimationProperties(u,"Spell One",true)
call SetUnitAnimationByIndex(d,9)
set d = null
//-------------------------------------------------
set d = CreateUnit(p,'h003',x+100*Cos((f+90)*bj_DEGTORAD),y+100*Sin((f+90)*bj_DEGTORAD),f)
call SetUnitFacingToFaceUnitTimed(d,u,0)
call UnitApplyTimedLife(d,'B001',1.5)
call UnitApplyTimedLife(CreateUnit(p,'h002',x,y,f),'B001',0.5)
call DestroyEffect(AddSpecialEffectTarget("war3mapImported\\shadowclone.mdx",d,"origin"))
call AddUnitAnimationProperties(u,"Spell One",true)
call SetUnitAnimationByIndex(d,9)
set d = null
//-------------------------------------------------
call TriggerSleepAction(1.00)
set d = CreateUnit(p,'h004',x,y,f)
call UnitApplyTimedLife(d,1,8)
call SaveUnitHandle(udg_Hash,id,1,d)
call UnitAddAbility(d,'Arav')
call DestroyEffect(e)
call SetUnitAnimationByIndex(u,4)
call TimerStart(t,0.025,true,function Trig_Futon_Actions2)
set d = null
set t = null
set u = null
set e = null
set p = null
endfunction


//===========================================================================
function InitTrig_Futon takes nothing returns nothing
set gg_trg_Futon = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_Futon, EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerAddCondition( gg_trg_Futon, Condition( function Trig_Futon_Conditions ) )
call TriggerAddAction( gg_trg_Futon, function Trig_Futon_Actions )
endfunction
[/code]


[jass=Jass]
function Trig_Klons_Conditions takes nothing returns boolean
return GetSpellAbilityId() == 'A002'
endfunction

function Trig_Klons_Actions takes nothing returns nothing
local unit u = GetTriggerUnit()
local real x = GetUnitX(u)
local real y = GetUnitY(u)
local player p = GetOwningPlayer(u)
local unit d = null
local integer i = 0
local integer lvl = GetUnitAbilityLevel(u,'A002')
loop
exitwhen i == 4+lvl
set d = CreateUnit(p,'h001',x,y,0)
call IssueTargetOrderById(d,852274,u)
call UnitApplyTimedLife(d,'B001',1)
set i = i+1
endloop
call UnitApplyTimedLife(CreateUnit(p,'h002',x,y,GetUnitFacing(u)),'B001',0.5)
set u = null
set p = null
set d = null
endfunction

//===========================================================================
function InitTrig_Klons takes nothing returns nothing
set gg_trg_Klons = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_Klons, EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerAddCondition( gg_trg_Klons, Condition( function Trig_Klons_Conditions ) )
call TriggerAddAction( gg_trg_Klons, function Trig_Klons_Actions )
endfunction
[/code]


Keywords:
Naruto,Rasengan,Sennin Mode.
Contents

Еще одна карта (Map)

Reviews
12th Dec 2015 IcemanBo: Too long as NeedsFix. Rejected. 21st May 2012 Bribe: I will review your spell once you fix your indentation.

Moderator

M

Moderator

12th Dec 2015
IcemanBo: Too long as NeedsFix. Rejected.

21st May 2012
Bribe: I will review your spell once you fix your indentation.
 
  • The indentation is terrible, you need to indent your code so people could read it easily.
  • You shouldn't be using a loop to create units and order them. Orders are very slow in Warcraft III,
    so in an actual map, you're going to find that the dummies are going to move and stop and move and stop and move and etc...
  • You should make the Ability and Buff Ids configurable.
  • When you create a local and set it to something, it would be more efficient to use that local instead of referencing the same
    thing again. For example, in the trigger "Rasengan", you declared a local unit c, set it to triggering unit, and in the if block, you
    used GetTriggerUnit() instead of c.
 
1. Use IssueTargetOrderById instead of IssueTargetOrder. Order ID an be determined using ConvOrder.
2. Use .025 instead of 0.025.
3. Make the parameters of the spells configurable.
4. SR must have appropriate prefix.
5. You use GetUnitState(d,UNIT_STATE_LIFE). GetWidgetLife(d) would be much better.
6. Null d only in the end of the trigger.
7. Where is the code for 4th spell?
 
Top