hi people ^^
i am still trying hard to get my system working...
since i can't do struct because i sux at coding, i am trying to do it with normal triggers...
but it seems i have problem linking those 2.
[Jass=]
function callRecipe takes nothing returns nothing
local integer i = 0
local integer abi
set udg_hero = GetTriggerUnit()
set udg_owner = GetOwningPlayer(udg_hero)
set abi = GetSpellAbilityId()
loop
if abi == LoadIntegerBJ(1, i, udg_recipe) then
set udg_marker = i
call TriggerExecute( gg_trg_RecipeSystem(udg_hero, udg_owner, udg_marker) )
return
endif
exitwhen i == udg_itemCounter
set i = i + 1
endloop
set abi = 0
set udg_marker = 0
set udg_hero = null
set udg_owner = null
endfunction
//===========================================================================
function InitTrig_RecipeSystem_Check takes nothing returns nothing
set gg_trg_RecipeSystem_Check = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_RecipeSystem_Check, EVENT_PLAYER_UNIT_SPELL_CAST )
call TriggerAddAction( gg_trg_RecipeSystem_Check, function Trig_callRecipe )
endfunction[/code]
[Jass=]
function RecipeMain takes unit udg_hero, player udg_owner, integer udg_marker returns nothing
local integer array id
local integer array ic
local integer array n
local integer array md
local integer i = 1
local integer j = 1
local item ti = null
loop
exitwhen i > 6
set id = GetItemTypeId(UnitItemInSlotBJ(udg_hero, i))
set ic = GetItemCharges(UnitItemInSlotBJ(udg_hero, i))
set ti = UnitItemInSlotBJ(udg_hero, i)
if ( id == LoadIntegerBJ(3, udg_marker, udg_recipe) ) and ( ti != null ) then
set n[1] = ( n[1] + ic )
call RemoveItem( UnitItemInSlotBJ(udg_hero, i) )
elseif ( id == LoadIntegerBJ(4, udg_marker, udg_recipe) ) and ( ti != null ) then
set n[2] = ( n[2] + ic )
call RemoveItem( ti )
elseif ( id == LoadIntegerBJ(5, udg_marker, udg_recipe) ) and ( ti != null ) then
set n[3] = ( n[3] + ic )
call RemoveItem( ti )
elseif ( id == LoadIntegerBJ(6, udg_marker, udg_recipe) ) and ( ti != null ) then
set n[4] = ( n[4] + ic )
call RemoveItem( ti )
elseif ( id == LoadIntegerBJ(7, udg_marker, udg_recipe) ) and ( ti != null ) then
set n[5] = ( n[5] + ic )
call RemoveItem( ti )
elseif ( id == LoadIntegerBJ(8, udg_marker, udg_recipe) ) and ( ti != null ) then
set n[6] = ( n[6] + ic )
call RemoveItem( ti )
endif
set ti = null
set i = i + 1
endloop
set i = 1
loop
exitwhen i > 6
set id = 0
set ic = 0
set i = i + 1
endloop
set md[0] = LoadIntegerBJ(9, udg_marker, udg_recipe)
set md[6] = ModuloInteger(md[0], 10)
set md[0] = ( ( md[0] - md[6] ) / 10 )
set md[5] = ModuloInteger(md[0], 10)
set md[0] = ( ( md[0] - md[5] ) / 10 )
set md[4] = ModuloInteger(md[0], 10)
set md[0] = ( ( md[0] - md[4] ) / 10 )
set md[3] = ModuloInteger(md[0], 10)
set md[0] = ( ( md[0] - md[3] ) / 10 )
set md[2] = ModuloInteger(md[0], 10)
set md[0] = ( ( md[0] - md[2] ) / 10 )
set md[1] = ModuloInteger(md[0], 10)
if ( n[1] >= md[1] ) and ( n[2] >= md[2] ) and ( n[3] >= md[3] ) and ( n[4] >= md[4] ) and ( n[5] >= md[5] ) and ( n[6] >= md[6] ) then
set n[1] = ( n[1] - md[1] )
set n[2] = ( n[2] - md[2] )
set n[3] = ( n[3] - md[3] )
set n[4] = ( n[4] - md[4] )
set n[5] = ( n[5] - md[5] )
set n[6] = ( n[6] - md[6] )
call UnitAddItemByIdSwapped( LoadIntegerBJ(2, udg_marker, udg_recipe), udg_hero )
call DisplayTextToPlayer(udg_owner, 0.,0., ( "|c0000c400Troll:|r |c00ffff64Me haz crafted " + LoadStringBJ(10, udg_marker, udg_recipe) ) )
else
call DisplayTextToPlayer(udg_owner, 0.,0., ( "|c0000c400Troll:|r |c00ffff64Me haz no resourcez for " + LoadStringBJ(10, udg_marker, udg_recipe) ) )
call DisplayTextToPlayer(udg_owner, 0.,0., LoadStringBJ(11, udg_marker, udg_recipe) )
endif
set i = 1
loop
exitwhen i > 6
if ( n > 0 ) then
set j = 1
loop
exitwhen j > n
call UnitAddItemByIdSwapped( LoadIntegerBJ((i + 2), udg_marker, udg_recipe), udg_hero )
set j = j + 1
endloop
endif
set i = i + 1
endloop
set i = 1
loop
exitwhen i > 6
set n = 0
set i = i + 1
endloop
set udg_marker = 0
set udg_owner = null
set udg_hero = null
endfunction
//===========================================================================
function InitTrig_RecipeSystem takes unit udg_hero, player udg_owner, integer udg_marker returns nothing
set gg_trg_RecipeSystem = CreateTrigger( )
call TriggerAddAction( gg_trg_RecipeSystem, function Trig_RecipeMain, udg_hero, udg_owner, udg_marker )
endfunction[/code]
it says too many arguments :
call TriggerAddAction( gg_trg_RecipeSystem, function Trig_RecipeMain, udg_hero, udg_owner, udg_marker )
but i have others with more arguments and it didn't stop them.
EDIT
well it did stop them also....
how to do that? call trigger wich takes variable.....
i am still trying hard to get my system working...
since i can't do struct because i sux at coding, i am trying to do it with normal triggers...
but it seems i have problem linking those 2.
[Jass=]
function callRecipe takes nothing returns nothing
local integer i = 0
local integer abi
set udg_hero = GetTriggerUnit()
set udg_owner = GetOwningPlayer(udg_hero)
set abi = GetSpellAbilityId()
loop
if abi == LoadIntegerBJ(1, i, udg_recipe) then
set udg_marker = i
call TriggerExecute( gg_trg_RecipeSystem(udg_hero, udg_owner, udg_marker) )
return
endif
exitwhen i == udg_itemCounter
set i = i + 1
endloop
set abi = 0
set udg_marker = 0
set udg_hero = null
set udg_owner = null
endfunction
//===========================================================================
function InitTrig_RecipeSystem_Check takes nothing returns nothing
set gg_trg_RecipeSystem_Check = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_RecipeSystem_Check, EVENT_PLAYER_UNIT_SPELL_CAST )
call TriggerAddAction( gg_trg_RecipeSystem_Check, function Trig_callRecipe )
endfunction[/code]
[Jass=]
function RecipeMain takes unit udg_hero, player udg_owner, integer udg_marker returns nothing
local integer array id
local integer array ic
local integer array n
local integer array md
local integer i = 1
local integer j = 1
local item ti = null
loop
exitwhen i > 6
set id = GetItemTypeId(UnitItemInSlotBJ(udg_hero, i))
set ic = GetItemCharges(UnitItemInSlotBJ(udg_hero, i))
set ti = UnitItemInSlotBJ(udg_hero, i)
if ( id == LoadIntegerBJ(3, udg_marker, udg_recipe) ) and ( ti != null ) then
set n[1] = ( n[1] + ic )
call RemoveItem( UnitItemInSlotBJ(udg_hero, i) )
elseif ( id == LoadIntegerBJ(4, udg_marker, udg_recipe) ) and ( ti != null ) then
set n[2] = ( n[2] + ic )
call RemoveItem( ti )
elseif ( id == LoadIntegerBJ(5, udg_marker, udg_recipe) ) and ( ti != null ) then
set n[3] = ( n[3] + ic )
call RemoveItem( ti )
elseif ( id == LoadIntegerBJ(6, udg_marker, udg_recipe) ) and ( ti != null ) then
set n[4] = ( n[4] + ic )
call RemoveItem( ti )
elseif ( id == LoadIntegerBJ(7, udg_marker, udg_recipe) ) and ( ti != null ) then
set n[5] = ( n[5] + ic )
call RemoveItem( ti )
elseif ( id == LoadIntegerBJ(8, udg_marker, udg_recipe) ) and ( ti != null ) then
set n[6] = ( n[6] + ic )
call RemoveItem( ti )
endif
set ti = null
set i = i + 1
endloop
set i = 1
loop
exitwhen i > 6
set id = 0
set ic = 0
set i = i + 1
endloop
set md[0] = LoadIntegerBJ(9, udg_marker, udg_recipe)
set md[6] = ModuloInteger(md[0], 10)
set md[0] = ( ( md[0] - md[6] ) / 10 )
set md[5] = ModuloInteger(md[0], 10)
set md[0] = ( ( md[0] - md[5] ) / 10 )
set md[4] = ModuloInteger(md[0], 10)
set md[0] = ( ( md[0] - md[4] ) / 10 )
set md[3] = ModuloInteger(md[0], 10)
set md[0] = ( ( md[0] - md[3] ) / 10 )
set md[2] = ModuloInteger(md[0], 10)
set md[0] = ( ( md[0] - md[2] ) / 10 )
set md[1] = ModuloInteger(md[0], 10)
if ( n[1] >= md[1] ) and ( n[2] >= md[2] ) and ( n[3] >= md[3] ) and ( n[4] >= md[4] ) and ( n[5] >= md[5] ) and ( n[6] >= md[6] ) then
set n[1] = ( n[1] - md[1] )
set n[2] = ( n[2] - md[2] )
set n[3] = ( n[3] - md[3] )
set n[4] = ( n[4] - md[4] )
set n[5] = ( n[5] - md[5] )
set n[6] = ( n[6] - md[6] )
call UnitAddItemByIdSwapped( LoadIntegerBJ(2, udg_marker, udg_recipe), udg_hero )
call DisplayTextToPlayer(udg_owner, 0.,0., ( "|c0000c400Troll:|r |c00ffff64Me haz crafted " + LoadStringBJ(10, udg_marker, udg_recipe) ) )
else
call DisplayTextToPlayer(udg_owner, 0.,0., ( "|c0000c400Troll:|r |c00ffff64Me haz no resourcez for " + LoadStringBJ(10, udg_marker, udg_recipe) ) )
call DisplayTextToPlayer(udg_owner, 0.,0., LoadStringBJ(11, udg_marker, udg_recipe) )
endif
set i = 1
loop
exitwhen i > 6
if ( n > 0 ) then
set j = 1
loop
exitwhen j > n
call UnitAddItemByIdSwapped( LoadIntegerBJ((i + 2), udg_marker, udg_recipe), udg_hero )
set j = j + 1
endloop
endif
set i = i + 1
endloop
set i = 1
loop
exitwhen i > 6
set n = 0
set i = i + 1
endloop
set udg_marker = 0
set udg_owner = null
set udg_hero = null
endfunction
//===========================================================================
function InitTrig_RecipeSystem takes unit udg_hero, player udg_owner, integer udg_marker returns nothing
set gg_trg_RecipeSystem = CreateTrigger( )
call TriggerAddAction( gg_trg_RecipeSystem, function Trig_RecipeMain, udg_hero, udg_owner, udg_marker )
endfunction[/code]
it says too many arguments :
call TriggerAddAction( gg_trg_RecipeSystem, function Trig_RecipeMain, udg_hero, udg_owner, udg_marker )
but i have others with more arguments and it didn't stop them.
EDIT
well it did stop them also....
how to do that? call trigger wich takes variable.....