• 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.

Call of Death 1.0

This bundle is marked as useful / simple. Simplicity is bliss, low effort and/or may contain minor bugs.
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|||||
|||||IF YOU USE THIS SPELL IN YOUR MAP, WRITE ME IN CREDITS!!!!!!!
|||||
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||


This spell is MUI and written on jass. Easy to use and haven't lag.

Code:
function Trig_____________________________________001_Conditions takes nothing returns boolean
    if ( not ( GetSpellAbilityId() == 'AHtb' ) ) then
        return false
    endif
    return true
endfunction

function Trig_____________________________________001_Actions takes nothing returns nothing
    local unit array u
    local integer i
    local unit t
    set i = 0
    set udg_Target = GetSpellTargetUnit()
    set t = udg_Target
    call PauseUnitBJ( true, t )
    call TriggerSleepAction( 0.5 )
    set bj_forLoopAIndex = 1
    set bj_forLoopAIndexEnd = 20
    loop
        exitwhen bj_forLoopAIndex > bj_forLoopAIndexEnd
        call CreateNUnitsAtLoc( 1, 'h000', GetOwningPlayer(GetTriggerUnit()), PolarProjectionBJ(GetUnitLoc(udg_Target), 300.00, ( I2R(GetForLoopIndexA()) * 18.00 )), bj_UNIT_FACING )
        set i = GetForLoopIndexA()
        set u[i] = GetLastCreatedUnit()
        call IssueTargetOrderBJ( u[i], "deathcoil", t )
        set bj_forLoopAIndex = bj_forLoopAIndex + 1
    endloop
    call TriggerSleepAction( 0.75 )
    set bj_forLoopAIndex = 1
    set bj_forLoopAIndexEnd = 20
    loop
        exitwhen bj_forLoopAIndex > bj_forLoopAIndexEnd
        call RemoveUnit( u[GetForLoopIndexA()] )
        set bj_forLoopAIndex = bj_forLoopAIndex + 1
    endloop
    set bj_forLoopAIndex = 1
    set bj_forLoopAIndexEnd = 20
    loop
        exitwhen bj_forLoopAIndex > bj_forLoopAIndexEnd
        set u[GetForLoopIndexA()] = null
        set bj_forLoopAIndex = bj_forLoopAIndex + 1
    endloop
    set t = udg_Target
    call PauseUnitBJ( false, udg_Target )
endfunction

//===========================================================================
function InitTrig_DeathCoil takes nothing returns nothing
    set gg_trg_DeathCoil = CreateTrigger(  )
    call TriggerRegisterAnyUnitEventBJ( gg_trg_DeathCoil, EVENT_PLAYER_UNIT_SPELL_EFFECT )
    call TriggerAddCondition( gg_trg_DeathCoil, Condition( function Trig_____________________________________001_Conditions ) )
    call TriggerAddAction( gg_trg_DeathCoil, function Trig_____________________________________001_Actions )
endfunction

21.05.2011
First upload.


Keywords:
Death, call, spell, Jass, MUI, dont hard spells, test, fight, destroy.
Contents

Call of death by Pel-man (Map)

Reviews
12th Dec 2015 IcemanBo: For long time as NeedsFix. Rejected. Bribe: Not only is it GUI converted to JASS (almost no changes) you are still leaking plenty. I advise sticking with GUI until you can at least learn how to clear leaks and make...

Moderator

M

Moderator

12th Dec 2015
IcemanBo: For long time as NeedsFix. Rejected.

Bribe:

Not only is it GUI converted to JASS (almost no changes) you are still leaking plenty. I advise sticking with GUI until you can at least learn how to clear leaks and make things MUI without using waits.

And it needs an in-game screenshot.
 
Level 6
Joined
Dec 10, 2010
Messages
119
use JASS tags... not code tags...

and you can paste it onto paint... once you hit the Priint screen, it copies the screen into the clipboard...

btw, the code looks converted GUI... needs optimization...

Yea.. but in this spell global varible changed to local.

Rather, he was converted to JASS from GUI in order to change the global variables to the local variables and thereby achieve MUI.
IMHO.
 
Your script should look something like this:
(It requires TimerUtils)
JASS:
scope DeathCoil initializer Init
// It requires TimerUtils
	globals
		private constant integer ABIL_CODE='AHtb'
	endglobals

	private struct Data
		unit u
		unit t
		player p
		group g
		private static method Remove takes nothing returns nothing
			call RemoveUnit(GetEnumUnit())
		endmethod

		private static method expire2 takes nothing returns nothing
			local timer tmr=GetExpiredTimer()
			local thistype this=GetTimerData(tmr)
			call ForGroup(g,function Data.Remove)
			call PauseUnit(u,false)
			call ReleaseTimer(tmr)
			set tmr=null
		endmethod

		static method expire takes nothing returns nothing
			local timer tmr=GetExpiredTimer()
			local timer tmr2=NewTimer()
			local thistype this=GetTimerData(tmr)
			local integer i=1
			local unit v
			loop
				exitwhen i>20
				// I didn't use my World editor, so there may be syntax errors here :P
				set v=CreateUnit(Player(12),'h000',GetUnitX(u)+300.*Sin(i*18.0*bj_DEGTORAD),GetUnitY(u)+300.*Cos(i*18.0*bj_DEGTORAD),270.)
				call GroupAddUnit(g,v)
				call IssueTargetOrder(v,"deathcoil",t)
				set i=i+1
			endloop
			call ReleaseTimer(tmr)
			call SetTimerData(tmr2,this)
			call TimerStart(tmr2,0.75,false,function Data.expire2)
			set tmr=null
			set tmr2=null
			set v=null
		endmethod

		static method create takes unit v, unit w returns thistype
			local thistype this=thistype.allocate()
			set this.u=v
			set this.t=w
			set this.p=GetOwningPlayer(this.u)
			set this.g=CreateGroup()
			return this
		endmethod

		method destroy takes nothing returns nothing
			set this.u=null
			set this.t=null
			set this.p=null
			call DestroyGroup(this.g)
			call this.deallocate()
		endmethod
	endstruct

	private function Actions takes nothing returns nothing
		local Data d=Data.create(GetTriggerUnit(),GetSpellTargetUnit())
		local timer t=NewTimer()
                call PauseUnit(d.t,true)
		call SetTimerData(t,d)
		call TimerStart(t,0.5,false,function Data.expire)
		set t=null
	endfunction

	private function Cond takes nothing returns boolean
		return GetSpellAbilityId()==ABIL_CODE
	endfunction

	private function Init takes nothing returns nothing
		local trigger t = CreateTrigger()
		call TriggerRegisterAnyUnitEventBJ(t,EVENT_PLAYER_UNIT_SPELL_EFFECT)
		call TriggerAddCondition(t,Condition(function Cond))
		call TriggerAddAction(t,function Actions)
		set t=null
	endfunction
endscope

:] Your welcome ;D
(There might be syntax errors since I didn't use the WE
 
Level 22
Joined
Nov 14, 2008
Messages
3,256
JASS:
function Trig_____________________________________001_Conditions takes nothing returns boolean
    if ( not ( GetSpellAbilityId() == 'AHtb' ) ) then
        return false
    endif
    return true
endfunction

function Trig_____________________________________001_Actions takes nothing returns nothing
    local unit array u
    local integer i
    local unit t
    set i = 0
    set udg_Target = GetSpellTargetUnit()
    set t = udg_Target
    call PauseUnitBJ( true, t )
    call TriggerSleepAction( 0.5 )
    set bj_forLoopAIndex = 1
    set bj_forLoopAIndexEnd = 20
    loop
        exitwhen bj_forLoopAIndex > bj_forLoopAIndexEnd
        call CreateNUnitsAtLoc( 1, 'h000', GetOwningPlayer(GetTriggerUnit()), PolarProjectionBJ(GetUnitLoc(udg_Target), 300.00, ( I2R(GetForLoopIndexA()) * 18.00 )), bj_UNIT_FACING )
        set i = GetForLoopIndexA()
        set u[i] = GetLastCreatedUnit()
        call IssueTargetOrderBJ( u[i], "deathcoil", t )
        set bj_forLoopAIndex = bj_forLoopAIndex + 1
    endloop
    call TriggerSleepAction( 0.75 )
    set bj_forLoopAIndex = 1
    set bj_forLoopAIndexEnd = 20
    loop
        exitwhen bj_forLoopAIndex > bj_forLoopAIndexEnd
        call RemoveUnit( u[GetForLoopIndexA()] )
        set bj_forLoopAIndex = bj_forLoopAIndex + 1
    endloop
    set bj_forLoopAIndex = 1
    set bj_forLoopAIndexEnd = 20
    loop
        exitwhen bj_forLoopAIndex > bj_forLoopAIndexEnd
        set u[GetForLoopIndexA()] = null
        set bj_forLoopAIndex = bj_forLoopAIndex + 1
    endloop
    set t = udg_Target
    call PauseUnitBJ( false, udg_Target )
endfunction

//===========================================================================
function InitTrig_DeathCoil takes nothing returns nothing
    set gg_trg_DeathCoil = CreateTrigger(  )
    call TriggerRegisterAnyUnitEventBJ( gg_trg_DeathCoil, EVENT_PLAYER_UNIT_SPELL_EFFECT )
    call TriggerAddCondition( gg_trg_DeathCoil, Condition( function Trig_____________________________________001_Conditions ) )
    call TriggerAddAction( gg_trg_DeathCoil, function Trig_____________________________________001_Actions )
endfunction

Very nice converted GUI. And btw refering to some comments, you can use locals in GUI as well.
 
Level 6
Joined
Aug 20, 2009
Messages
95
Whilst that is more efficient, this is better for HIM. I took 5 minutes to fix it.
Don't maul him with that code, its good code, but its horrible for him, as obviously he isn't very efficient with JASS and that looks like nothing to him.
Also, @Maker (Maker being Maker of this spell), this removes any globals needed.

JASS:
function OnCast takes nothing returns boolean
    local unit array u
    local real i
    local real p
    local unit t
    local real tx
    local real ty
    local real offsetx
    local real offsety
    local real angle
    if GetSpellAbilityId() == 'AHtb'  then
        set t = GetSpellTargetUnit()
        call PauseUnit( t, true )
        call TriggerSleepAction( 0.5 )
        set tx = GetUnitX(t)
        set ty = GetUnitY(t)
//Targets X and Y
        set i = 1
        set p = 20
        loop
            exitwhen i > p
            set offsetx = tx + 300 * Cos( bj_DEGTORAD * (i * 18))
            set offsety = ty + 300 * Sin( bj_DEGTORAD * (i * 18))
//OffsetX and Y are simply a polar offset
            set angle = bj_RADTODEG * Atan2( offsety - ty, offsetx - x)
//Angle between the offset and the target
            set u[i] = CreateUnit(GetTriggerPlayer(), 'h000', offsetx, offsety, angle)            
            call IssueTargetOrder( u[i], "deathcoil", t )
            set i = i + 1
        endloop
        call TriggerSleepAction( 0.75 )
        set set i = 1
        set p = 20
//No need for two loops to do something that one loop can do.
        loop
            exitwhen i > p
            call RemoveUnit( u[i] )
            set u[i] = null
            set i = i + 1
        endloop
        call PauseUnit(t, false )
        set t = null
    endif
return true
endfunction

//===========================================================================
function InitTrig_DeathCoil takes nothing returns nothing
    local trigger t = CreateTrigger(  )
    call TriggerRegisterAnyUnitEventBJ( t, EVENT_PLAYER_UNIT_SPELL_EFFECT ) )
    call TriggerAddAction( t, Condition( function OnCast) )
endfunction
 
Level 22
Joined
Nov 14, 2008
Messages
3,256
And why are everybody using TSA? TSA sucks due to it scales different depending on the player's latency and it cannot use values below 0.27. Timers is the key.

Also this could be made in GUI as well (above post). And why are you returning true on a "condition" when there are no actions? (Yes I know what Adiktuz said above).
 
Top