- Joined
- May 20, 2006
- Messages
- 43
So, I'm rather new at JASS.
I know how to look at a lot of the coding now, but I really have no idea how to make it from scratch.
I tried my best on this, and clearly I cannot get it right, nor do I know how many memory leaks it has. I'd greatly appreciate if you could fix this up for me so that I could use it, with the concept of making a unit that is buildable do the forging, not a preplaced unit. Here it is:
I know how to look at a lot of the coding now, but I really have no idea how to make it from scratch.
I tried my best on this, and clearly I cannot get it right, nor do I know how many memory leaks it has. I'd greatly appreciate if you could fix this up for me so that I could use it, with the concept of making a unit that is buildable do the forging, not a preplaced unit. Here it is:
Code:
function Forge_System_Actions takes nothing returns nothing
local unit u = GetAttachedUnit()
local item i = GetAttachedItem()
if GetUnitTypeId(u) == 'hbla' then
if GetItemTypeId(belv) == true and GetItemTypeId(bspd) == true then
call DestroyEffect(AddSpecialEffectTarget("Objects\\Spawnmodels\\Other\\ToonBoom\\ToonBoom.mdl",u,"origin"))
call DisplayTextToForce(bj_FORCE_PLAYER[GetConvertedPlayerId(GetOwningPlayer(u))-1],"|cff00dd00Item Forged|r")
call RemoveItem(belv)
call RemoveItem(bspd)
call UnitAddItemByIdSwapped('rat6',u)
endif
endif
set i = null
set u = null
endfunction
//===========================================================================
function InitTrig_Forge_System takes nothing returns nothing
set gg_trg_Forge_System = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_Forge_System, EVENT_PLAYER_UNIT_PICKUP_ITEM )
call TriggerAddAction( gg_trg_Forge_System, function Forge_System_Actions )
endfunction