Exide
I am amazingly focused right now!
- Reaction score
- 448
Hi.
I was bored, so I created a new spell. Which I then turned into an item. The name Wisp Wheel is probably a bad name, but it doesn't matter.
I'm quite bad at coming up with tooltips and descriptions so I just ignored them.
It was hard getting good screenshots, so I decided to leave them out as well. -You'll just have to download the map and see for yourself.
Yes, I know some of the codes are horrible. (Suggestions to improve appriciated.)
I edited the Moonkey icon for the items I'm using. The .rar file containing the icons can be downloaded here: (TheHelper wouldn't let me upload .rar ) http://www.freewebs.com/idtatwc3/Fire%20Ice%20Poison%20Pack.rar
Map attached.
//==========================
What the item does is the following:
There are three items: Fire, Ice and Poison.
Each item spawn a wisp that circles around the hero and attacks nearby enemy units.
If a unit acquires two of these items, they will merge into one. (Complete of six different items; 'Fire', 'Ice', 'Poison', 'Fire + Ice', 'Fire + Poison', 'Ice + Poison', 'all three'.)
So without further ado.. Enjoy!
Codes:
I was bored, so I created a new spell. Which I then turned into an item. The name Wisp Wheel is probably a bad name, but it doesn't matter.
I'm quite bad at coming up with tooltips and descriptions so I just ignored them.
It was hard getting good screenshots, so I decided to leave them out as well. -You'll just have to download the map and see for yourself.
Yes, I know some of the codes are horrible. (Suggestions to improve appriciated.)
I edited the Moonkey icon for the items I'm using. The .rar file containing the icons can be downloaded here: (TheHelper wouldn't let me upload .rar ) http://www.freewebs.com/idtatwc3/Fire%20Ice%20Poison%20Pack.rar
Map attached.
//==========================
What the item does is the following:
There are three items: Fire, Ice and Poison.
Each item spawn a wisp that circles around the hero and attacks nearby enemy units.
If a unit acquires two of these items, they will merge into one. (Complete of six different items; 'Fire', 'Ice', 'Poison', 'Fire + Ice', 'Fire + Poison', 'Ice + Poison', 'all three'.)
So without further ado.. Enjoy!
Codes:
JASS:
function Trig_Moving_Unit_Actions takes nothing returns nothing
local location heroloc
local location hlocoffset
local integer loopnr = 1
loop
exitwhen loopnr > udg_MUICounter
if ( udg_DegreeValueIce[loopnr] >= 360.00 ) then
set udg_DegreeValueIce[loopnr] = 1.00
else
set udg_DegreeValueIce[loopnr] = udg_DegreeValueIce[loopnr] + 5.00
endif
set heroloc = GetUnitLoc(udg_OrbOwner[loopnr])
set hlocoffset = PolarProjectionBJ(heroloc, 95.00, udg_DegreeValueIce[loopnr])
call SetUnitPositionLoc( udg_IceUnit[loopnr], hlocoffset )
call RemoveLocation(heroloc)
call RemoveLocation(hlocoffset)
set loopnr = loopnr + 1
endloop
set loopnr = 1
loop
exitwhen loopnr > udg_MUICounter
if ( udg_DegreeValueFire[loopnr] <= 1.00 ) then
set udg_DegreeValueFire[loopnr] = 360.00
else
set udg_DegreeValueFire[loopnr] = udg_DegreeValueFire[loopnr] - 5.00
endif
set heroloc = GetUnitLoc(udg_OrbOwner[loopnr])
set hlocoffset = PolarProjectionBJ(heroloc, 65.00, udg_DegreeValueFire[loopnr])
call SetUnitPositionLoc( udg_FireUnit[loopnr], hlocoffset )
call RemoveLocation(heroloc)
call RemoveLocation(hlocoffset)
set loopnr = loopnr + 1
endloop
set loopnr = 1
loop
exitwhen loopnr > udg_MUICounter
if ( udg_DegreeValuePoison[loopnr] <= 1.00 ) then
set udg_DegreeValuePoison[loopnr] = 360.00
else
set udg_DegreeValuePoison[loopnr] = udg_DegreeValuePoison[loopnr] - 5.00
endif
set heroloc = GetUnitLoc(udg_OrbOwner[loopnr])
set hlocoffset = PolarProjectionBJ(heroloc, 115, udg_DegreeValuePoison[loopnr])
call SetUnitPositionLoc( udg_PoisonUnit[loopnr], hlocoffset )
call RemoveLocation(heroloc)
call RemoveLocation(hlocoffset)
set loopnr = loopnr + 1
endloop
set heroloc = null
set hlocoffset = null
endfunction
//===========================================================================
function InitTrig_Moving_Unit takes nothing returns nothing
local trigger Moving_Unit = CreateTrigger( )
call TriggerRegisterTimerEventPeriodic( Moving_Unit, 0.03 )
call TriggerAddAction( Moving_Unit, function Trig_Moving_Unit_Actions )
endfunction
JASS:
function Trig_Pwn_Enters_Map_Actions takes nothing returns nothing
if ( GetUnitTypeId(GetTriggerUnit()) == 039;h000039; ) then
call SetUnitVertexColorBJ( GetTriggerUnit(), 70.00, 40.00, 40.00, 7.00 )
endif
if ( GetUnitTypeId(GetTriggerUnit()) == 039;h001039; ) then
call SetUnitVertexColorBJ( GetTriggerUnit(), 40.00, 40.00, 70.00, 7.00 )
endif
if ( GetUnitTypeId(GetTriggerUnit()) == 039;h002039; ) then
call SetUnitVertexColorBJ( GetTriggerUnit(), 40.00, 70.00, 40.00, 7.00 )
endif
endfunction
//===========================================================================
function InitTrig_Orb_Enters_Map takes nothing returns nothing
local trigger Pwn_Enters_Map = CreateTrigger( )
call TriggerRegisterEnterRectSimple( Pwn_Enters_Map, GetPlayableMapRect() )
call TriggerAddAction( Pwn_Enters_Map, function Trig_Pwn_Enters_Map_Actions )
endfunction
JASS:
function sfx_func takes nothing returns nothing
local real x = GetUnitX(GetTriggerUnit())
local real y = GetUnitY(GetTriggerUnit())
call DestroyEffect(AddSpecialEffect( "Abilities\\Spells\\Human\\HolyBolt\\HolyBoltSpecialArt.mdl", x, y ))
endfunction
function removeitem_func takes nothing returns nothing
local item newitem = GetManipulatedItem()
local integer newitemid = GetItemTypeId(newitem)
local unit u = GetTriggerUnit()
local player p = GetOwningPlayer(u)
call UnitRemoveItem( u, newitem )
call DisplayTextToPlayer( p, 0, 0, "You can only carry one of those items!" )
set newitem = null
set p = null
set u = null
endfunction
function Trig_Merging_Items_Actions takes nothing returns nothing
local item newitem = GetManipulatedItem()
local integer newitemid = GetItemTypeId(newitem)
local unit u = GetTriggerUnit()
local item array itemindex
local integer loopnr = 0
loop
exitwhen loopnr > 6
set itemindex[loopnr] = UnitItemInSlot( u, loopnr )
if ( (GetItemTypeId(itemindex[loopnr]) == newitemid) and (newitem != itemindex[loopnr]) ) then
call removeitem_func()
endif
set loopnr = loopnr + 1
endloop
if (UnitHasItemOfTypeBJ( u, 039;I006039; )) then
if (newitemid == 039;I000039;) or (newitemid == 039;I001039;) or (newitemid == 039;I002039;) or (newitemid == 039;I003039;) or (newitemid == 039;I004039;) or (newitemid == 039;I005039;) then
call removeitem_func()
endif
endif
if (UnitHasItemOfTypeBJ( u, 039;I005039; )) then
if (newitemid == 039;I000039;) or (newitemid == 039;I001039;) or (newitemid == 039;I003039;) or (newitemid == 039;I004039;) then
call removeitem_func()
endif
endif
if (UnitHasItemOfTypeBJ( u, 039;I004039; )) then
if (newitemid == 039;I001039;) or (newitemid == 039;I002039;) or (newitemid == 039;I003039;) or (newitemid == 039;I005039;) then
call removeitem_func()
endif
endif
if (UnitHasItemOfTypeBJ( u, 039;I003039; )) then
if (newitemid == 039;I000039;) or (newitemid == 039;I002039;) or (newitemid == 039;I004039;) or (newitemid == 039;I005039;) then
call removeitem_func()
endif
endif
if (newitemid == 039;I000039;) then
if (UnitHasItemOfTypeBJ(u, 039;I001039;)) then
call RemoveItem( newitem )
call RemoveItem( GetItemOfTypeFromUnitBJ(u, 039;I001039;) )
call UnitAddItemById( u, 039;I005039; )
call sfx_func()
endif
if (UnitHasItemOfTypeBJ(u, 039;I002039;)) then
call RemoveItem( newitem )
call RemoveItem( GetItemOfTypeFromUnitBJ(u, 039;I002039;) )
call UnitAddItemById( u, 039;I003039; )
call sfx_func()
endif
if (UnitHasItemOfTypeBJ(u, 039;I004039;)) then
call RemoveItem( newitem )
call RemoveItem( GetItemOfTypeFromUnitBJ(u, 039;I004039;) )
call UnitAddItemById( u, 039;I006039; )
call sfx_func()
endif
endif
if (newitemid == 039;I001039;) then
if (UnitHasItemOfTypeBJ(u, 039;I000039;)) then
call RemoveItem( newitem )
call RemoveItem( GetItemOfTypeFromUnitBJ(u, 039;I000039;) )
call UnitAddItemById( u, 039;I005039; )
call sfx_func()
endif
if (UnitHasItemOfTypeBJ(u, 039;I002039;)) then
call RemoveItem( newitem )
call RemoveItem( GetItemOfTypeFromUnitBJ(u, 039;I002039;) )
call UnitAddItemById( u, 039;I004039; )
call sfx_func()
endif
if (UnitHasItemOfTypeBJ(u, 039;I003039;)) then
call RemoveItem( newitem )
call RemoveItem( GetItemOfTypeFromUnitBJ(u, 039;I003039;) )
call UnitAddItemById( u, 039;I006039; )
call sfx_func()
endif
endif
if (newitemid == 039;I002039;) then
if (UnitHasItemOfTypeBJ(u, 039;I001039;)) then
call RemoveItem( newitem )
call RemoveItem( GetItemOfTypeFromUnitBJ(u, 039;I001039;) )
call UnitAddItemById( u, 039;I004039; )
call sfx_func()
endif
if (UnitHasItemOfTypeBJ(u, 039;I000039;)) then
call RemoveItem( newitem )
call RemoveItem( GetItemOfTypeFromUnitBJ(u, 039;I000039;) )
call UnitAddItemById( u, 039;I003039; )
call sfx_func()
endif
if (UnitHasItemOfTypeBJ(u, 039;I005039;)) then
call RemoveItem( newitem )
call RemoveItem( GetItemOfTypeFromUnitBJ(u, 039;I005039;) )
call UnitAddItemById( u, 039;I006039; )
call sfx_func()
endif
endif
if (newitemid == 039;I003039;) then
if (UnitHasItemOfTypeBJ(u, 039;I001039;)) then
call RemoveItem( newitem )
call RemoveItem( GetItemOfTypeFromUnitBJ(u, 039;I001039;) )
call UnitAddItemById( u, 039;I006039; )
call sfx_func()
endif
endif
if (newitemid == 039;I004039;) then
if (UnitHasItemOfTypeBJ(u, 039;I000039;)) then
call RemoveItem( newitem )
call RemoveItem( GetItemOfTypeFromUnitBJ(u, 039;I000039;) )
call UnitAddItemById( u, 039;I006039; )
call sfx_func()
endif
endif
if (newitemid == 039;I005039;) then
if (UnitHasItemOfTypeBJ(u, 039;I002039;)) then
call RemoveItem( newitem )
call RemoveItem( GetItemOfTypeFromUnitBJ(u, 039;I002039;) )
call UnitAddItemById( u, 039;I006039; )
call sfx_func()
endif
endif
set newitem = null
set u = null
endfunction
//===========================================================================
function InitTrig_Merging_Items takes nothing returns nothing
local trigger Merging_Items = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( Merging_Items, EVENT_PLAYER_UNIT_PICKUP_ITEM )
call TriggerAddAction( Merging_Items, function Trig_Merging_Items_Actions )
endfunction
JASS:
function Trig_Acquire_Orb_Actions takes nothing returns nothing
local item newitem = GetManipulatedItem()
local integer itemid = GetItemTypeId(newitem)
local real x = GetUnitX(GetTriggerUnit())
local real y = GetUnitY(GetTriggerUnit())
local unit u = GetTriggerUnit()
local integer counter = udg_MUICounter
local integer compareinteger = GetUnitUserData(u)
if (compareinteger == counter) then
set counter = compareinteger
else
set udg_MUICounter = udg_MUICounter + 1
endif
if ( itemid == 039;I000039; ) then
set udg_OrbOwner[counter] = u
call SetUnitUserData( u, counter )
set udg_IceUnit[counter] = CreateUnit( Player(bj_PLAYER_NEUTRAL_EXTRA), 039;h001039;, x, y, 270.00 )
call SetUnitUserData( udg_IceUnit[counter], counter )
call SetUnitOwner( udg_IceUnit[counter], GetOwningPlayer(u), false )
endif
if ( itemid == 039;I001039; ) then
set udg_OrbOwner[counter] = u
call SetUnitUserData( u, counter )
set udg_FireUnit[counter] = CreateUnit( Player(bj_PLAYER_NEUTRAL_EXTRA), 039;h000039;, x, y, 270.00 )
call SetUnitUserData( udg_FireUnit[counter], counter )
call SetUnitOwner( udg_FireUnit[counter], GetOwningPlayer(u), false )
endif
if ( itemid == 039;I002039; ) then
set udg_OrbOwner[counter] = u
call SetUnitUserData( u, counter )
set udg_PoisonUnit[counter] = CreateUnit( Player(bj_PLAYER_NEUTRAL_EXTRA), 039;h002039;, x, y, 270.00 )
call SetUnitUserData( udg_PoisonUnit[counter], counter )
call SetUnitOwner( udg_PoisonUnit[counter], GetOwningPlayer(u), false )
endif
if ( itemid == 039;I003039; ) then
call KillUnit(udg_PoisonUnit[counter])
call KillUnit(udg_IceUnit[counter])
set udg_OrbOwner[counter] = u
call SetUnitUserData( u, counter )
set udg_PoisonUnit[counter] = CreateUnit( Player(bj_PLAYER_NEUTRAL_EXTRA), 039;h002039;, x, y, 270.00 )
call SetUnitUserData( udg_PoisonUnit[counter], counter )
call SetUnitOwner( udg_PoisonUnit[counter], GetOwningPlayer(u), false )
set udg_IceUnit[counter] = CreateUnit( Player(bj_PLAYER_NEUTRAL_EXTRA), 039;h001039;, x, y, 270.00 )
call SetUnitUserData( udg_IceUnit[counter], counter )
call SetUnitOwner( udg_IceUnit[counter], GetOwningPlayer(u), false )
endif
if ( itemid == 039;I004039; ) then
call KillUnit(udg_PoisonUnit[counter])
call KillUnit(udg_FireUnit[counter])
set udg_OrbOwner[counter] = u
call SetUnitUserData( u, counter )
set udg_PoisonUnit[counter] = CreateUnit( Player(bj_PLAYER_NEUTRAL_EXTRA), 039;h002039;, x, y, 270.00 )
call SetUnitUserData( udg_PoisonUnit[counter], counter )
call SetUnitOwner( udg_PoisonUnit[counter], GetOwningPlayer(u), false )
set udg_FireUnit[counter] = CreateUnit( Player(bj_PLAYER_NEUTRAL_EXTRA), 039;h000039;, x, y, 270.00 )
call SetUnitUserData( udg_FireUnit[counter], counter )
call SetUnitOwner( udg_FireUnit[counter], GetOwningPlayer(u), false )
endif
if ( itemid == 039;I005039; ) then
call KillUnit(udg_IceUnit[counter])
call KillUnit(udg_FireUnit[counter])
set udg_OrbOwner[counter] = u
call SetUnitUserData( u, counter )
set udg_FireUnit[counter] = CreateUnit( Player(bj_PLAYER_NEUTRAL_EXTRA), 039;h000039;, x, y, 270.00 )
call SetUnitUserData( udg_FireUnit[counter], counter )
call SetUnitOwner( udg_FireUnit[counter], GetOwningPlayer(u), false )
set udg_IceUnit[counter] = CreateUnit( Player(bj_PLAYER_NEUTRAL_EXTRA), 039;h001039;, x, y, 270.00 )
call SetUnitUserData( udg_IceUnit[counter], counter )
call SetUnitOwner( udg_IceUnit[counter], GetOwningPlayer(u), false )
endif
if ( itemid == 039;I006039; ) then
call KillUnit(udg_IceUnit[counter])
call KillUnit(udg_FireUnit[counter])
call KillUnit(udg_PoisonUnit[counter])
set udg_OrbOwner[counter] = u
call SetUnitUserData( u, counter )
set udg_FireUnit[counter] = CreateUnit( Player(bj_PLAYER_NEUTRAL_EXTRA), 039;h000039;, x, y, 270.00 )
call SetUnitUserData( udg_FireUnit[counter], counter )
call SetUnitOwner( udg_FireUnit[counter], GetOwningPlayer(u), false )
set udg_IceUnit[counter] = CreateUnit( Player(bj_PLAYER_NEUTRAL_EXTRA), 039;h001039;, x, y, 270.00 )
call SetUnitUserData( udg_IceUnit[counter], counter )
call SetUnitOwner( udg_IceUnit[counter], GetOwningPlayer(u), false )
set udg_PoisonUnit[counter] = CreateUnit( Player(bj_PLAYER_NEUTRAL_EXTRA), 039;h002039;, x, y, 270.00 )
call SetUnitUserData( udg_PoisonUnit[counter], counter )
call SetUnitOwner( udg_PoisonUnit[counter], GetOwningPlayer(u), false )
endif
set newitem = null
set u = null
endfunction
//===========================================================================
function InitTrig_Acquire_Orb takes nothing returns nothing
local trigger Acquire_Orb = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( Acquire_Orb, EVENT_PLAYER_UNIT_PICKUP_ITEM )
call TriggerAddAction( Acquire_Orb, function Trig_Acquire_Orb_Actions )
endfunction
JASS:
function Trig_Lose_Orb_Actions takes nothing returns nothing
local item lostitem = GetManipulatedItem()
local integer itemid = GetItemTypeId(lostitem)
local unit u = GetTriggerUnit()
local integer counter = GetUnitUserData(u)
if (itemid == 039;I000039;) then
call KillUnit(udg_IceUnit[counter])
endif
if (itemid == 039;I001039;) then
call KillUnit(udg_FireUnit[counter])
endif
if (itemid == 039;I002039;) then
call KillUnit(udg_PoisonUnit[counter])
endif
if (itemid == 039;I003039;) then
call KillUnit(udg_IceUnit[counter])
call KillUnit(udg_PoisonUnit[counter])
endif
if (itemid == 039;I004039;) then
call KillUnit(udg_FireUnit[counter])
call KillUnit(udg_PoisonUnit[counter])
endif
if (itemid == 039;I005039;) then
call KillUnit(udg_IceUnit[counter])
call KillUnit(udg_FireUnit[counter])
endif
if (itemid == 039;I006039;) then
call KillUnit(udg_IceUnit[counter])
call KillUnit(udg_PoisonUnit[counter])
call KillUnit(udg_FireUnit[counter])
endif
set lostitem = null
set u = null
endfunction
//===========================================================================
function InitTrig_Lose_Orb takes nothing returns nothing
local trigger Lose_Orb = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( Lose_Orb, EVENT_PLAYER_UNIT_DROP_ITEM )
call TriggerAddAction( Lose_Orb, function Trig_Lose_Orb_Actions )
endfunction
JASS:
function isunitalive_func takes nothing returns boolean
return (GetUnitState(GetTriggerUnit(), UNIT_STATE_LIFE) > 0)
endfunction
function Trig_Unit_Dies_Actions takes nothing returns nothing
local integer userdata = GetUnitUserData(GetTriggerUnit())
local player p = GetOwningPlayer(GetTriggerUnit())
local real x = GetUnitX(GetTriggerUnit())
local real y = GetUnitY(GetTriggerUnit())
local unit u = GetTriggerUnit()
local integer loopnr = 1
loop
exitwhen loopnr > udg_MUICounter
if ( GetTriggerUnit() == udg_OrbOwner[loopnr] ) then
call KillUnit(udg_IceUnit[userdata])
call KillUnit(udg_FireUnit[userdata])
call KillUnit(udg_PoisonUnit[userdata])
loop
exitwhen ( isunitalive_func() )
call TriggerSleepAction(RMaxBJ(bj_WAIT_FOR_COND_MIN_INTERVAL, 0.50))
endloop
if (UnitHasItemOfTypeBJ(u, 039;I006039;)) then
set udg_IceUnit[userdata] = CreateUnit( Player(bj_PLAYER_NEUTRAL_EXTRA), 039;h001039;, x, y, 270.00 )
set udg_FireUnit[userdata] = CreateUnit( Player(bj_PLAYER_NEUTRAL_EXTRA), 039;h000039;, x, y, 270.00 )
set udg_PoisonUnit[userdata] = CreateUnit( Player(bj_PLAYER_NEUTRAL_EXTRA), 039;h002039;, x, y, 270.00 )
endif
if (UnitHasItemOfTypeBJ(u, 039;I005039;)) then
set udg_IceUnit[userdata] = CreateUnit( Player(bj_PLAYER_NEUTRAL_EXTRA), 039;h001039;, x, y, 270.00 )
set udg_FireUnit[userdata] = CreateUnit( Player(bj_PLAYER_NEUTRAL_EXTRA), 039;h000039;, x, y, 270.00 )
endif
if (UnitHasItemOfTypeBJ(u, 039;I004039;)) then
set udg_FireUnit[userdata] = CreateUnit( Player(bj_PLAYER_NEUTRAL_EXTRA), 039;h000039;, x, y, 270.00 )
set udg_PoisonUnit[userdata] = CreateUnit( Player(bj_PLAYER_NEUTRAL_EXTRA), 039;h002039;, x, y, 270.00 )
endif
if (UnitHasItemOfTypeBJ(u, 039;I003039;)) then
set udg_IceUnit[userdata] = CreateUnit( Player(bj_PLAYER_NEUTRAL_EXTRA), 039;h001039;, x, y, 270.00 )
set udg_PoisonUnit[userdata] = CreateUnit( Player(bj_PLAYER_NEUTRAL_EXTRA), 039;h002039;, x, y, 270.00 )
endif
if (UnitHasItemOfTypeBJ(u, 039;I002039;)) then
set udg_PoisonUnit[userdata] = CreateUnit( Player(bj_PLAYER_NEUTRAL_EXTRA), 039;h002039;, x, y, 270.00 )
endif
if (UnitHasItemOfTypeBJ(u, 039;I001039;)) then
set udg_FireUnit[userdata] = CreateUnit( Player(bj_PLAYER_NEUTRAL_EXTRA), 039;h000039;, x, y, 270.00 )
endif
if (UnitHasItemOfTypeBJ(u, 039;I000039;)) then
set udg_IceUnit[userdata] = CreateUnit( Player(bj_PLAYER_NEUTRAL_EXTRA), 039;h001039;, x, y, 270.00 )
endif
call SetUnitOwner( udg_IceUnit[userdata], p, false )
call SetUnitOwner( udg_FireUnit[userdata], p, false )
call SetUnitOwner( udg_PoisonUnit[userdata], p, false )
endif
set loopnr = loopnr + 1
endloop
set p = null
set u = null
endfunction
//===========================================================================
function InitTrig_Unit_Dies takes nothing returns nothing
local trigger Unit_Dies = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( Unit_Dies, EVENT_PLAYER_UNIT_DEATH )
call TriggerAddAction( Unit_Dies, function Trig_Unit_Dies_Actions )
endfunction