• 🏆 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!

X-Banner

This bundle is marked as useful / simple. Simplicity is bliss, low effort and/or may contain minor bugs.
Spell for Tsuna.
Channel
Jass
No JNGP
Unlimited Levels

Update Code!


[jass=Jass]

function Trig_X_Banner_Conditions takes nothing returns boolean
return GetSpellAbilityId() == 'A002'
endfunction

function Trig_X_Banner_Actions2 takes nothing returns nothing
local timer t = GetExpiredTimer()
local integer id = GetHandleId(t)
local unit u = LoadUnitHandle(udg_Hash,id,0)
local unit d1 = LoadUnitHandle(udg_Hash,id,1)
local unit d2 = LoadUnitHandle(udg_Hash,id,11)
local real x = GetUnitX(u)
local real y = GetUnitY(u)
local real x1 = LoadReal(udg_Hash,id,5)
local real y1 = LoadReal(udg_Hash,id,6)
local real i = LoadReal(udg_Hash,id,7)
local real f = GetUnitFacing(u)
local boolean b = LoadBoolean(udg_Hash,id,10)
local group g = CreateGroup()
local unit e
local real a
local real r = 0
local real x2
local real y2
local player p = GetOwningPlayer(u)
if x==x1 and y==y1 and OrderId2String(GetUnitCurrentOrder(u)) == "channel" and GetUnitState(u,UNIT_STATE_MANA) > 1 then
if b == true then
call SetUnitState(u,UNIT_STATE_MANA,GetUnitState(u,UNIT_STATE_MANA)-1)
loop
exitwhen r == 6
call UnitApplyTimedLife(CreateUnit(p,'h002',x+r*300*Cos(f*bj_DEGTORAD),y+r*300*Sin(f*bj_DEGTORAD),f),'BTLF',0.1)
call GroupEnumUnitsInRange(g,x+r*300*Cos(f*bj_DEGTORAD),y+r*300*Sin(f*bj_DEGTORAD),300,null)
set r = r+1
loop
set e = FirstOfGroup(g)
if IsUnitEnemy(e,p) then
call UnitDamageTarget(u,e,5,true,false,null,null,null)
set x2 = GetUnitX(e)
set y2 = GetUnitY(e)
set a = Atan2(y-y2,x-x2)
call SetUnitX(e,x2-1*Cos(a))
call SetUnitY(e,y2-1*Sin(a))
endif
call GroupRemoveUnit(g,e)
exitwhen e == null
endloop
endloop
endif
else
call DestroyTimer(t)
call RemoveUnit(d1)
call RemoveUnit(d2)
call FlushChildHashtable(udg_Hash,id)
endif
if i < 40 then
call SaveReal(udg_Hash,id,7,i+1)
else
if b == false then
set d2 = CreateUnit(p,'h003',x+25*Cos((f)*bj_DEGTORAD),y+25*Sin((f)*bj_DEGTORAD),f)
call SaveUnitHandle(udg_Hash,id,11,d2)
call SetUnitVertexColor(d2,255,50,50,255)
call SaveBoolean(udg_Hash,id,10,true)
endif
endif
call DestroyGroup(g)
set e = null
set d1 = null
set d2 = null
set p = null
set u = null
set t = null
endfunction

function Trig_X_Banner_Actions takes nothing returns nothing
local unit u = GetTriggerUnit()
local real x = GetUnitX(u)
local real y = GetUnitY(u)
local real f = GetUnitFacing(u)
local unit d1 = CreateUnit(GetOwningPlayer(u),'h003',x+50*Cos((f+180)*bj_DEGTORAD),y+50*Sin((f+180)*bj_DEGTORAD),f+180)
local timer t = CreateTimer()
local integer id = GetHandleId(t)
call UnitAddAbility(d1,'A003')
call SaveUnitHandle(udg_Hash,id,0,u)
call SaveUnitHandle(udg_Hash,id,1,d1)
call SaveReal(udg_Hash,id,2,GetSpellTargetX())
call SaveReal(udg_Hash,id,3,GetSpellTargetY())
call SaveReal(udg_Hash,id,5,x)
call SaveReal(udg_Hash,id,6,y)
call SaveBoolean(udg_Hash,id,4,true)
call TimerStart(t,0.025,true,function Trig_X_Banner_Actions2)
set u = null
set d1 = null
set t = null
endfunction

//===========================================================================
function InitTrig_X_Banner takes nothing returns nothing
set gg_trg_X_Banner = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_X_Banner, EVENT_PLAYER_UNIT_SPELL_CAST )
call TriggerAddCondition( gg_trg_X_Banner, Condition( function Trig_X_Banner_Conditions ) )
call TriggerAddAction( gg_trg_X_Banner, function Trig_X_Banner_Actions )
endfunction
[/code]


Keywords:
Reborn,Tsuna,X-Banner
Contents

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

Reviews
12th Dec 2015 IcemanBo: Too long as NeedsFix. Rejected. 21st May 2012 Bribe: Fix the local group creation to make it use a global group instead, for example bj_lastCreatedGroup and DO NOT destroy it.

Moderator

M

Moderator

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

21st May 2012
Bribe: Fix the local group creation to make it use a global group instead, for example bj_lastCreatedGroup and DO NOT destroy it.
 
Level 28
Joined
Oct 28, 2011
Messages
4,759
Here are your triggers

JASS:
//TESH.scrollpos=20
//TESH.alwaysfold=0
function Trig_X_Banner_Conditions takes nothing returns boolean
        return GetSpellAbilityId() == 'A002'
endfunction

function Trig_X_Banner_Actions2 takes nothing returns nothing
local timer t = GetExpiredTimer()
local integer id = GetHandleId(t)
local unit u = LoadUnitHandle(udg_Hash,id,0)
local unit d1 = LoadUnitHandle(udg_Hash,id,1)
local unit d2 = LoadUnitHandle(udg_Hash,id,11)
local real x = GetUnitX(u)
local real y = GetUnitY(u)
local real x1 = LoadReal(udg_Hash,id,5)
local real y1 = LoadReal(udg_Hash,id,6)
local real i = LoadReal(udg_Hash,id,7)
local real f = GetUnitFacing(u)
local boolean b = LoadBoolean(udg_Hash,id,10)
local group g = CreateGroup()
local unit e
local real a 
local real r = 0
local real x2
local real y2
local player p = GetOwningPlayer(u)
if x==x1 and y==y1 and OrderId2String(GetUnitCurrentOrder(u)) == "channel" and GetUnitState(u,UNIT_STATE_MANA) > 1 then
if b == true then
call SetUnitState(u,UNIT_STATE_MANA,GetUnitState(u,UNIT_STATE_MANA)-1)
loop
exitwhen r == 6
call UnitApplyTimedLife(CreateUnit(p,'h002',x+r*300*Cos(f*bj_DEGTORAD),y+r*300*Sin(f*bj_DEGTORAD),f),'BTLF',0.1)
call GroupEnumUnitsInRange(g,x+r*300*Cos(f*bj_DEGTORAD),y+r*300*Sin(f*bj_DEGTORAD),300,null)
set r = r+1
loop
set e = FirstOfGroup(g)
if IsUnitEnemy(e,GetOwningPlayer(u)) then
call UnitDamageTarget(u,e,5,true,false,null,null,null)
set x2 = GetUnitX(e)
set y2 = GetUnitY(e)
set a = Atan2(y-y2,x-x2)
call SetUnitX(e,x2-1*Cos(a))
call SetUnitY(e,y2-1*Sin(a))
endif
call GroupRemoveUnit(g,e)
exitwhen e == null
endloop
endloop
endif
else
call DestroyTimer(t)
call RemoveUnit(d1)
call RemoveUnit(d2)
call FlushChildHashtable(udg_Hash,id)
endif
if i < 40 then
call SaveReal(udg_Hash,id,7,i+1)
else
if b == false then
set d2 = CreateUnit(GetOwningPlayer(u),'h003',x+25*Cos((f)*bj_DEGTORAD),y+25*Sin((f)*bj_DEGTORAD),f)
call SaveUnitHandle(udg_Hash,id,11,d2)
call SetUnitVertexColor(d2,255,50,50,255)
call SaveBoolean(udg_Hash,id,10,true)
endif
endif
call DestroyGroup(g)
set e = null
set d1 = null
set d2 = null
set p = null
set u = null
set t = null
endfunction

function Trig_X_Banner_Actions takes nothing returns nothing
local unit u = GetTriggerUnit()
local real x = GetUnitX(u)
local real y = GetUnitY(u)
local real x1 = GetSpellTargetX()
local real y1 = GetSpellTargetY()
local real f = GetUnitFacing(u)
local unit d1
local boolean b = true
local timer t = CreateTimer()
local integer id = GetHandleId(t)
set d1 = CreateUnit(GetOwningPlayer(u),'h003',x+50*Cos((f+180)*bj_DEGTORAD),y+50*Sin((f+180)*bj_DEGTORAD),f+180)
call UnitAddAbility(d1,'A003')
call SaveUnitHandle(udg_Hash,id,0,u)
call SaveUnitHandle(udg_Hash,id,1,d1)
call SaveReal(udg_Hash,id,2,x1)
call SaveReal(udg_Hash,id,3,y1)
call SaveReal(udg_Hash,id,5,x)
call SaveReal(udg_Hash,id,6,y)
call SaveBoolean(udg_Hash,id,4,b)
call TimerStart(t,0.025,true,function Trig_X_Banner_Actions2)
set u = null
set d1 = null
set t = null
endfunction

//===========================================================================
function InitTrig_X_Banner takes nothing returns nothing
    set gg_trg_X_Banner = CreateTrigger(  )
    call TriggerRegisterAnyUnitEventBJ( gg_trg_X_Banner, EVENT_PLAYER_UNIT_SPELL_CAST )
    call TriggerAddCondition( gg_trg_X_Banner, Condition( function Trig_X_Banner_Conditions ) )
    call TriggerAddAction( gg_trg_X_Banner, function Trig_X_Banner_Actions )
endfunction

JASS:
//TESH.scrollpos=0
//TESH.alwaysfold=0
function Trig_die_Conditions takes nothing returns boolean
        return GetUnitTypeId(GetTriggerUnit()) == 'h002'
endfunction

function Trig_die_Actions takes nothing returns nothing
call RemoveUnit(GetTriggerUnit())
endfunction

//===========================================================================
function InitTrig_die takes nothing returns nothing
    set gg_trg_die = CreateTrigger(  )
    call TriggerRegisterAnyUnitEventBJ( gg_trg_die, EVENT_PLAYER_UNIT_DEATH )
    call TriggerAddCondition( gg_trg_die, Condition( function Trig_die_Conditions ) )
    call TriggerAddAction( gg_trg_die, function Trig_die_Actions )
endfunction

I guess this have leaks, since my computer start to lag when I cast it a couple of times
 
Top