• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

Pain SpellPack 1.1

This bundle is marked as useful / simple. Simplicity is bliss, low effort and/or may contain minor bugs.
this is spellpack made by me
spells are from pain from naruto anime.
all spells are in jass.
spellpack contains:
Bansho Tenin
Shinra Tensei
Rinnegan

JASS:
function Trig_Shinra_Conditions takes nothing returns boolean
    return GetSpellAbilityId() == 'A001'
endfunction
function shinragroup takes nothing returns nothing
local unit pickedd = GetEnumUnit ()
local unit shinra = LoadUnitHandle(udg_table,udg_h,1)
local group damaged = LoadGroupHandle(udg_table,udg_h,6)
local real sx = LoadReal(udg_table,udg_h,2)
local real sy = LoadReal(udg_table,udg_h,3)
local real gx = GetUnitX(pickedd)
local real gy = GetUnitY(pickedd)
local real angled = bj_RADTODEG * Atan2(gy - sy, gx - sx)
local real x = gx + 32 * Cos(angled * bj_DEGTORAD)
local real y = gy + 32 * Sin(angled * bj_DEGTORAD)

if IsUnitType(pickedd, UNIT_TYPE_STRUCTURE) == false and IsUnitAlly(pickedd, GetOwningPlayer(shinra)) == false then
call SetUnitPosition(pickedd,x,y)
call DestroyEffect(AddSpecialEffect("Abilities\\Spells\\Other\\Stampede\\StampedeMissileDeath.mdl",gx,gy))
endif
if IsUnitInGroup(pickedd, damaged) == false and IsUnitAlly(pickedd, GetOwningPlayer(shinra)) == false then
call GroupAddUnit(damaged,pickedd)
call UnitDamageTarget(shinra,pickedd,(125 * I2R(GetUnitAbilityLevel(shinra,'A001'))),true,false,ATTACK_TYPE_NORMAL, DAMAGE_TYPE_NORMAL,WEAPON_TYPE_WHOKNOWS)
endif
set shinra = null
set pickedd = null
set damaged = null
endfunction

function shinradamage takes nothing returns boolean
return true
endfunction

function takenn takes nothing returns nothing
local timer n = GetExpiredTimer ()
local unit shinra = LoadUnitHandle(udg_table,GetHandleId(n),1)
local real sx = LoadReal(udg_table,GetHandleId(n),2)
local real sy = LoadReal(udg_table,GetHandleId(n),3)
local effect ss = LoadEffectHandle(udg_table,GetHandleId(n),4)
local real expire = LoadReal(udg_table,GetHandleId(n),5)
local group s

if expire <= 0 then
call SetUnitTimeScale(shinra, 100 * 0.01)
call PauseUnit(shinra,false)
call DestroyEffect(ss)
call DestroyGroup(LoadGroupHandle(udg_table,GetHandleId(n),6))
call FlushChildHashtable(udg_table,GetHandleId(n))
set n = null
set shinra = null
set ss = null
set s = null
call DestroyTimer(GetExpiredTimer())
else
call SaveReal(udg_table,GetHandleId(n),5,expire - 2.00)
set udg_h = GetHandleId(n)
set s = CreateGroup ()
call GroupEnumUnitsInRange(s,sx,sy,600,function shinradamage)
call ForGroup(s,function shinragroup)
call DestroyGroup(s)
set n = null
set shinra = null
set ss = null
set s = null
endif
endfunction

function Trig_Shinra_Actions takes nothing returns nothing
local timer n = CreateTimer ()
local unit shinra = GetTriggerUnit ()
local real sx = GetUnitX(shinra)
local real sy = GetUnitY(shinra)
local real expire = 34.00
local effect ss
local group damaged = CreateGroup ()
set ss = AddSpecialEffectTarget ("cronosphere.mdl",shinra,"origin" )
call PauseUnit(shinra,true)
call SetUnitTimeScale(shinra, 200 * 0.01)
call SetUnitAnimation( shinra, "Spell One" )
call SaveUnitHandle(udg_table,GetHandleId(n),1,shinra)
call SaveReal(udg_table,GetHandleId(n),2,sx)
call SaveReal(udg_table,GetHandleId(n),3,sy)
call SaveEffectHandle(udg_table,GetHandleId(n),4,ss)
call SaveReal(udg_table,GetHandleId(n),5,expire)
call SaveGroupHandle(udg_table,GetHandleId(n),6,damaged)
call TimerStart(n,0.02,true,function takenn)
set n = null
set shinra = null
set ss = null
endfunction

//===========================================================================
function InitTrig_Shinra takes nothing returns nothing
    local trigger shinrar = CreateTrigger(  )
    call Preload("cronosphere.mdl")
    call Preload("Abilities\\Spells\\Other\\Stampede\\StampedeMissileDeath.mdl")
    call TriggerRegisterAnyUnitEventBJ( shinrar , EVENT_PLAYER_UNIT_SPELL_EFFECT )
    call TriggerAddCondition( shinrar , Condition( function Trig_Shinra_Conditions ) )
    call TriggerAddAction( shinrar , function Trig_Shinra_Actions )
    set shinrar = null
endfunction
JASS:
function Trig_Bansho_Conditions takes nothing returns boolean
    return GetSpellAbilityId() == 'A000' 
endfunction

function banshomove takes nothing returns nothing
local timer b = GetExpiredTimer ()
local unit pain = LoadUnitHandle(udg_table,GetHandleId(b),1)
local unit target = LoadUnitHandle(udg_table,GetHandleId(b),2)
local real px = LoadReal(udg_table,GetHandleId(b),3)
local real py = LoadReal(udg_table,GetHandleId(b),4)
local real tx = GetUnitX(target)
local real ty = GetUnitY(target)
local real angles = LoadReal(udg_table,GetHandleId(b),5)
local real x = tx + 30 * Cos(angles * bj_DEGTORAD)
local real y = ty + 30 * Sin(angles * bj_DEGTORAD)
local real wx
local real wy
local group g

call SetUnitPosition(target,x,y)
set wx = tx - px
set wy = ty - py

if SquareRoot(wx * wx + wy * wy) <= 125 then
call UnitDamageTarget(pain,target,(75 * I2R(GetUnitAbilityLevel(pain,'A000'))),true,false,ATTACK_TYPE_NORMAL, DAMAGE_TYPE_NORMAL,WEAPON_TYPE_WHOKNOWS)
call PauseUnit(pain,false)
call PauseUnit(target,false)
call SetUnitPathing(target,true)
call FlushChildHashtable(udg_table,GetHandleId(b))
set g = null
set b = null
set pain = null
set target = null
call DestroyTimer(GetExpiredTimer())
else
call SetUnitFacing(target,angles)
call DestroyEffect(AddSpecialEffect("Abilities\\Spells\\Other\\Stampede\\StampedeMissileDeath.mdl",tx,ty))
set b = null
set pain = null
set target = null
endif
endfunction

function Trig_Bansho_Actions takes nothing returns nothing
local timer b = CreateTimer ()
local unit pain = GetTriggerUnit ()
local unit target = GetSpellTargetUnit ()
local real px = GetUnitX(pain)
local real py = GetUnitY(pain)
local real tx = GetUnitX(target)
local real ty = GetUnitY(target)
local real angles = bj_RADTODEG * Atan2 (py - ty, px - tx)

call PauseUnit(pain,true)
call PauseUnit(target,true)
call SetUnitPathing(target,false)
call SetUnitAnimation(pain, "Spell")
call SaveUnitHandle(udg_table,GetHandleId(b),1,pain)
call SaveUnitHandle(udg_table,GetHandleId(b),2,target)
call SaveReal(udg_table,GetHandleId(b),3,px)
call SaveReal(udg_table,GetHandleId(b),4,py)
call SaveReal(udg_table,GetHandleId(b),5,angles)
call TimerStart(b,0.03,true,function banshomove)

set b = null
set pain = null
set target = null
endfunction
//===========================================================================
function InitTrig_Bansho takes nothing returns nothing
    local trigger bansho = CreateTrigger(  )
    call Preload("Abilities\\Spells\\Other\\Stampede\\StampedeMissileDeath.mdl")
    call TriggerRegisterAnyUnitEventBJ( bansho, EVENT_PLAYER_UNIT_SPELL_EFFECT )
    call TriggerAddCondition( bansho, Condition( function Trig_Bansho_Conditions ) )
    call TriggerAddAction( bansho, function Trig_Bansho_Actions )
    set bansho = null
endfunction
JASS:
function Trig_Rinnegan_Conditions takes nothing returns boolean
    return GetUnitAbilityLevel(GetTriggerUnit(), 'B000') > 0 and ( GetRandomInt(1, 100) <= 17 )
endfunction
function rineganpush takes nothing returns nothing
local timer w = GetExpiredTimer ()
local unit attacker = LoadUnitHandle(udg_table,GetHandleId(w),1)
local unit attacked = LoadUnitHandle(udg_table,GetHandleId(w),2)
local real timeleft = LoadReal(udg_table,GetHandleId(w),3)
local real ax = GetUnitX(attacker)
local real ay = GetUnitY(attacker)
local real dx = GetUnitX(attacked)
local real dy = GetUnitY(attacked)
local real angle = bj_RADTODEG * Atan2(dy - ay, dx - ax)
local real x = dx + 27 * Cos(angle * bj_DEGTORAD)
local real y = dy + 27 * Sin(angle * bj_DEGTORAD)
call SetUnitPosition(attacked,x,y)

if timeleft <= 0 then
call PauseUnit(attacked,false)
call SetUnitPathing(attacked,true)
call FlushChildHashtable(udg_table,GetHandleId(w))
set w = null
set attacker = null
set attacked = null
call DestroyTimer(GetExpiredTimer())
else
call SaveReal(udg_table,GetHandleId(w),3,timeleft - 2)
call DestroyEffect(AddSpecialEffect("Abilities\\Spells\\Other\\Stampede\\StampedeMissileDeath.mdl",dx,dy))
set w = null
set attacker = null
set attacked = null
endif
endfunction

function Trig_Rinnegan_Actions takes nothing returns nothing
local timer w = CreateTimer()
local unit attacker = GetTriggerUnit ()
local unit attacked = GetAttacker ()
local real timeleft = 10
call PauseUnit(attacked,true)
call SetUnitPathing(attacked,false)
call SaveUnitHandle(udg_table,GetHandleId(w),1,attacker)
call SaveUnitHandle(udg_table,GetHandleId(w),2,attacked)
call SaveReal(udg_table,GetHandleId(w),3,timeleft)
call TimerStart(w,0.02,true,function rineganpush)
set w = null
set attacker = null
set attacked = null
endfunction

//===========================================================================
function InitTrig_Rinnegan takes nothing returns nothing
    local trigger Rinnegan = CreateTrigger(  )
    call Preload("Abilities\\Spells\\Other\\Stampede\\StampedeMissileDeath.mdl")
    call TriggerRegisterAnyUnitEventBJ( Rinnegan, EVENT_PLAYER_UNIT_ATTACKED )
    call TriggerAddCondition( Rinnegan, Condition( function Trig_Rinnegan_Conditions ) )
    call TriggerAddAction( Rinnegan, function Trig_Rinnegan_Actions )
    set Rinnegan = null
endfunction



Keywords:
naruto,pain,chibacu,shinra,rinnegan,rinengan,bansho,madara
Contents

Pain Spell Pack by straja (Map)

Reviews
12.12 IcemanBo: For long time as NeedsFix. Rejected. 12:48, 3rd Jun 2011 Maker: Add ability level support for the spells. Do this check only after you subtract the number: G_Index Equal to 0, not during every loop.

Moderator

M

Moderator

12.12
IcemanBo: For long time as NeedsFix. Rejected.

12:48, 3rd Jun 2011
Maker:
Add ability level support for the spells.
Do this check only after you subtract the number: G_Index Equal to 0, not during every loop.
 
Level 10
Joined
Apr 25, 2009
Messages
296
Well, I tested the abilities.

I find it kind of silly that the attacking unit gets knocked back, as, your just kind of like 'WTF just happened?!' But it works fine otherwise.

I'd suggest removing the models and icons if you don't give credits, unless they're yours.


Overall the spells worked fine, or atleast to the extent that I tested them. However, I believe several knockback spells with blood SFX fit a pain spell pack. However, that's an opinion on my part.
 
this is spellpack made by me

DUH!

Just to do everybody a favor, I'm indenting your code properly.

JASS:
function Trig_Shinra_Conditions takes nothing returns boolean
    return GetSpellAbilityId() == 'A001'
endfunction

function shinragroup takes nothing returns nothing
    local unit pickedd = GetEnumUnit()
    local unit shinra = LoadUnitHandle(udg_table,udg_h,1)
    local group damaged = LoadGroupHandle(udg_table,udg_h,6)
    local real sx = LoadReal(udg_table,udg_h,2)
    local real sy = LoadReal(udg_table,udg_h,3)
    local real gx = GetUnitX(pickedd)
    local real gy = GetUnitY(pickedd)
    local real angled = bj_RADTODEG * Atan2(gy - sy, gx - sx)
    local real x = gx + 32 * Cos(angled * bj_DEGTORAD)
    local real y = gy + 32 * Sin(angled * bj_DEGTORAD)

    if IsUnitType(pickedd, UNIT_TYPE_STRUCTURE) == false and /*
    */ IsUnitAlly(pickedd, GetOwningPlayer(shinra)) == false then
        call SetUnitPosition(pickedd,x,y)
        call DestroyEffect(AddSpecialEffect("Abilities\\Spells\\Other\\Stampede\\StampedeMissileDeath.mdl",gx,gy))
    endif
    
    if IsUnitInGroup(pickedd, damaged) == false and /*
    */ IsUnitAlly(pickedd, GetOwningPlayer(shinra)) == false then
        call GroupAddUnit(damaged,pickedd)
        call UnitDamageTarget(shinra,pickedd,(125 * I2R(GetUnitAbilityLevel(shinra,'A001'))),true,false,ATTACK_TYPE_NORMAL, DAMAGE_TYPE_NORMAL,WEAPON_TYPE_WHOKNOWS)
    endif
    
    set shinra = null
    set pickedd = null
    set damaged = null
endfunction

function shinradamage takes nothing returns boolean
    return true
endfunction

function takenn takes nothing returns nothing
    local timer n = GetExpiredTimer()
    local unit shinra = LoadUnitHandle(udg_table,GetHandleId(n),1)
    local real sx = LoadReal(udg_table,GetHandleId(n),2)
    local real sy = LoadReal(udg_table,GetHandleId(n),3)
    local effect ss = LoadEffectHandle(udg_table,GetHandleId(n),4)
    local real expire = LoadReal(udg_table,GetHandleId(n),5)
    local group s

    if expire <= 0 then
        call SetUnitTimeScale(shinra, 100 * 0.01)
        call PauseUnit(shinra,false)
        call DestroyEffect(ss)
        call DestroyGroup(LoadGroupHandle(udg_table,GetHandleId(n),6))
        call FlushChildHashtable(udg_table,GetHandleId(n))
        set n = null
        set shinra = null
        set ss = null
        set s = null
        call DestroyTimer(GetExpiredTimer())
    else
        call SaveReal(udg_table,GetHandleId(n),5,expire - 2.00)
        set udg_h = GetHandleId(n)
        set s = CreateGroup()
        call GroupEnumUnitsInRange(s,sx,sy,600,function shinradamage)
        call ForGroup(s,function shinragroup)
        call DestroyGroup(s)
        set n = null
        set shinra = null
        set ss = null
        set s = null
    endif
endfunction

function Trig_Shinra_Actions takes nothing returns nothing
    local timer n = CreateTimer()
    local unit shinra = GetTriggerUnit()
    local real sx = GetUnitX(shinra)
    local real sy = GetUnitY(shinra)
    local real expire = 34.00
    local effect ss
    local group damaged = CreateGroup()
    
    set ss = AddSpecialEffectTarget ("cronosphere.mdl",shinra,"origin" )
    call PauseUnit(shinra,true)
    call SetUnitTimeScale(shinra, 200 * 0.01)
    call SetUnitAnimation( shinra, "Spell One" )
    call SaveUnitHandle(udg_table,GetHandleId(n),1,shinra)
    call SaveReal(udg_table,GetHandleId(n),2,sx)
    call SaveReal(udg_table,GetHandleId(n),3,sy)
    call SaveEffectHandle(udg_table,GetHandleId(n),4,ss)
    call SaveReal(udg_table,GetHandleId(n),5,expire)
    call SaveGroupHandle(udg_table,GetHandleId(n),6,damaged)
    call TimerStart(n,0.02,true,function takenn)
    set n = null
    set shinra = null
    set ss = null
endfunction

function InitTrig_Shinra takes nothing returns nothing
    local trigger shinrar = CreateTrigger()
    call Preload("cronosphere.mdl")
    call Preload("Abilities\\Spells\\Other\\Stampede\\StampedeMissileDeath.mdl")
    call TriggerRegisterAnyUnitEventBJ(shinrar, EVENT_PLAYER_UNIT_SPELL_EFFECT)
    call TriggerAddCondition(shinrar, Condition(function Trig_Shinra_Conditions))
    call TriggerAddAction(shinrar, function Trig_Shinra_Actions)
    set shinrar = null
endfunction

JASS:
function Trig_Bansho_Conditions takes nothing returns boolean
    return GetSpellAbilityId() == 'A000' 
endfunction

function banshomove takes nothing returns nothing
    local timer b = GetExpiredTimer ()
    local unit pain = LoadUnitHandle(udg_table,GetHandleId(b),1)
    local unit target = LoadUnitHandle(udg_table,GetHandleId(b),2)
    local real px = LoadReal(udg_table,GetHandleId(b),3)
    local real py = LoadReal(udg_table,GetHandleId(b),4)
    local real tx = GetUnitX(target)
    local real ty = GetUnitY(target)
    local real angles = LoadReal(udg_table,GetHandleId(b),5)
    local real x = tx + 30 * Cos(angles * bj_DEGTORAD)
    local real y = ty + 30 * Sin(angles * bj_DEGTORAD)
    local real wx
    local real wy
    local group g

    call SetUnitPosition(target,x,y)
    set wx = tx - px
    set wy = ty - py

    if SquareRoot(wx * wx + wy * wy) <= 125 then
        call UnitDamageTarget(pain,target,(75 * I2R(GetUnitAbilityLevel(pain,'A000'))),true,false,ATTACK_TYPE_NORMAL, DAMAGE_TYPE_NORMAL,WEAPON_TYPE_WHOKNOWS)
        call PauseUnit(pain,false)
        call PauseUnit(target,false)
        call SetUnitPathing(target,true)
        call FlushChildHashtable(udg_table,GetHandleId(b))
        set g = null
        set b = null
        set pain = null
        set target = null
        call DestroyTimer(GetExpiredTimer())
    else
        call SetUnitFacing(target,angles)
        call DestroyEffect(AddSpecialEffect("Abilities\\Spells\\Other\\Stampede\\StampedeMissileDeath.mdl",tx,ty))
        set b = null
        set pain = null
        set target = null
    endif
endfunction

function Trig_Bansho_Actions takes nothing returns nothing
    local timer b = CreateTimer ()
    local unit pain = GetTriggerUnit ()
    local unit target = GetSpellTargetUnit ()
    local real px = GetUnitX(pain)
    local real py = GetUnitY(pain)
    local real tx = GetUnitX(target)
    local real ty = GetUnitY(target)
    local real angles = bj_RADTODEG * Atan2 (py - ty, px - tx)

    call PauseUnit(pain,true)
    call PauseUnit(target,true)
    call SetUnitPathing(target,false)
    call SetUnitAnimation(pain, "Spell")
    call SaveUnitHandle(udg_table,GetHandleId(b),1,pain)
    call SaveUnitHandle(udg_table,GetHandleId(b),2,target)
    call SaveReal(udg_table,GetHandleId(b),3,px)
    call SaveReal(udg_table,GetHandleId(b),4,py)
    call SaveReal(udg_table,GetHandleId(b),5,angles)
    call TimerStart(b,0.03,true,function banshomove)

    set b = null
    set pain = null
    set target = null
endfunction

function InitTrig_Bansho takes nothing returns nothing
    local trigger bansho = CreateTrigger()
    call Preload("Abilities\\Spells\\Other\\Stampede\\StampedeMissileDeath.mdl")
    call TriggerRegisterAnyUnitEventBJ(bansho, EVENT_PLAYER_UNIT_SPELL_EFFECT)
    call TriggerAddCondition(bansho, Condition(function Trig_Bansho_Conditions))
    call TriggerAddAction(bansho, function Trig_Bansho_Actions)
    set bansho = null
endfunction

You're gonna have to do the third one by yourself ;)

Also, move these:

JASS:
set b = null
        set pain = null
        set target = null

Outside of the if/then/else/endif block.
You're going to do them anyways, so it's best to put them outside.
This way, you'd save space :)
 
Level 29
Joined
Mar 10, 2009
Messages
5,016
- no need to think of local trigger names, the letter t will do for all...
- you should store configurables in a function, like integers, reals, strings, etc...
- in my opinion this is better...
JASS:
local timer n = CreateTimer()
local integer mykey = GetHandleId(n)
- 0.02 is very low, use 0.03
- your timer is running 0.02 but you deduct 2., that's too fast...
- lastly, your code is really hard to read without the indent as the others say...
 
Level 37
Joined
Mar 6, 2006
Messages
9,240
Shinra:
Store the handle into an integer variable, and use the variable instead of repeatedly calling the function. Like this:
local integer id = GetHandleId(n)
call SaveUnitHandle(udg_table,id,1,shinra)

You're setting the time scale like this, why the multiplication?
call SetUnitTimeScale(shinra, 200 * 0.01)

You're nulling things in both the THEN and ELSE branches. To cut down the amount of lines of code, move the nullings outside the IF/THEN/ELSE.

Instead of WEAPON_TYPE_WHOKNOWS, you can jsut use null.

Get rid of the degtorad and radtodeg:
JASS:
local real angled = bj_RADTODEG * Atan2(gy - sy, gx - sx)
    local real x = gx + 32 * Cos(angled * bj_DEGTORAD)
    local real y = gy + 32 * Sin(angled * bj_DEGTORAD)

I didn't check the rest, but ablities should support more than one level.
 
Top