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

[JASS] Explanation :D

Status
Not open for further replies.
Level 9
Joined
Jun 25, 2009
Messages
427
Hey guys, i downloaded one recipe system, which is not clear to me, could you explain what it does? :/
JASS:
function SetupReciepe takes integer iFirstItemType,integer iSecondItemType,integer iThirdItemType,integer iFourthItemType,integer iResultItemType returns nothing
	set udg_iA_DTAX_reciepe_item1_id[udg_i_DTAX_reciepes_counter]=iFirstItemType
	set udg_iA_DTAX_reciepe_item2_id[udg_i_DTAX_reciepes_counter]=iSecondItemType
	set udg_iA_DTAX_reciepe_item3_id[udg_i_DTAX_reciepes_counter]=iThirdItemType
	set udg_iA_DTAX_reciepe_item4_id[udg_i_DTAX_reciepes_counter]=iFourthItemType
	set udg_iA_DTAX_reciepe_result_id[udg_i_DTAX_reciepes_counter]=iResultItemType
	set udg_iA_DTAX_reciepe_lenght[udg_i_DTAX_reciepes_counter]=4
	if(iFirstItemType==0)then
		set udg_iA_DTAX_reciepe_lenght[udg_i_DTAX_reciepes_counter]=udg_iA_DTAX_reciepe_lenght[udg_i_DTAX_reciepes_counter]-1
	endif
	if(iSecondItemType==0)then
		set udg_iA_DTAX_reciepe_lenght[udg_i_DTAX_reciepes_counter]=udg_iA_DTAX_reciepe_lenght[udg_i_DTAX_reciepes_counter]-1
	endif
	if(iThirdItemType==0)then
		set udg_iA_DTAX_reciepe_lenght[udg_i_DTAX_reciepes_counter]=udg_iA_DTAX_reciepe_lenght[udg_i_DTAX_reciepes_counter]-1
	endif
	if(iFourthItemType==0)then
		set udg_iA_DTAX_reciepe_lenght[udg_i_DTAX_reciepes_counter]=udg_iA_DTAX_reciepe_lenght[udg_i_DTAX_reciepes_counter]-1
	endif
	set udg_i_DTAX_reciepes_counter=udg_i_DTAX_reciepes_counter+1
	set udg_i_DTAX_max_reciepes_count=udg_i_DTAX_reciepes_counter
endfunction

// rots = Scepter of the Sea
// rump = Rusty Mining Pick
// mcri = Mechanical Critter
// bfhr = Bloodfeather's Heart'
// stwa = Sturdy War Axe
// tbar = Tiny Barracks
// rsps = Rune of Shielding
// tfar = Tiny Farm
// shdt = Shield of the Deathlord
// srrc = Scroll of Resurrection
// sor9 = Shadow Orb +9
// rej4 = Greater Replenishment Potion
// sor1 = Shadow Orb +1
// ram3 = Ring of the Archmagi
// vddl = Voodoo Doll
// olig = Orb of Lightning
// oli2 = Orb of Lightning
// rwiz = Sobi Mask
// kgal = Keg of Ale
// srbd = Searing Blade
// whwd = Healing Wards
// fgrg = Stone Token
// rde4 = Ring of Protection +5
// bgst = Belt of Giant Strength +6
// sksh = Skull Shield
// spsh = Amulet of Spell Shield
// ram1 = Ring of the Archmagi
// belv = Boots of Quel'Thalas +6'
// tmmt = Totem of Might
// sand = Scroll of Animate Dead
// rde0 = Ring of Protection +1
// wcyc = Wand of the Wind
// rnsp = Ring of Superiority
// srtl = Serathil
// penr = Pendant of Energy
// rugt = Runed Gauntlets
// lure = Monster Lure
// rreb = Rune of Rebirth
// ofir = Orb of Fire
// flag = Human Flag
// rre1 = Rune of Lesser Resurrection
// ocor = Orb of Corruption
// soul = Soul
// rej2 = Lesser Replenishment Potion
// lhst = The Lion Horn of Stormwind
// spre = Staff of Preservation
// rst1 = Gauntlets of Ogre Strength +3
// tgxp = Tome of Greater Experience
// stre = Staff of Reanimation
// hlst = Health Stone
// lgdh = Legion Doom-Horn
// sbok = Spell Book
// gsou = Soul Gem
// ciri = Robe of the Magi +6
// shhn = Shield of Honor
// shrs = Shimmerglaze Roast
// sora = Shadow Orb +10
// pspd = Potion of Speed
// iwbr = Ironwood Branch
// tbsm = Tiny Blacksmith
// mcou = Medallion of Courage
// sfog = Horn of the Clouds
// rdis = Rune of Dispel Magic
// wswd = Sentry Wards
// modt = Mask of Death
// grsl = Grimoire of Souls
// rlif = Ring of Regeneration
// ccmd = Scepter of Mastery
// scul = Scroll of the Unholy Legion
// jdrn = Jade Ring
// ratf = Claws of Attack +15
// gldo = Orb of Kil'jaeden'
// rhe2 = Rune of Healing
// sor2 = Shadow Orb +2
// tmsc = Tome of Sacrifices
// shcw = Shaman Claws
// rej6 = Greater Scroll of Replenishment
// shtm = Shamanic Totem
// prvt = Periapt of Vitality
// horl = Sacred Relic
// pgin = Potion of Greater Invisibility
// hbth = Helm of Battlethirst
// oslo = Orb of Slow
// clfm = Cloak of Flames
// oven = Orb of Venom
// texp = Tome of Experience
// ofro = Orb of Frost
// crys = Crystal Ball
// ram4 = Ring of the Archmagi
// rma2 = Rune of Greater Mana
// rej5 = Lesser Scroll of Replenishment
// lnrn = Lion's Ring'
// mlst = Maul of Strength
// mnsf = Mindstaff
// rej1 = Minor Replenishment Potion
// rspl = Rune of Spirit Link
// tlum = Tiny Lumber Mill
// tkno = Tome of Power
// stel = Staff of Teleportation
// klmm = Killmaim
// tdex = Tome of Agility
// rat6 = Claws of Attack +6
// pgma = Potion of Greater Mana
// pdiv = Potion of Divinity
// pclr = Clarity Potion
// gvsm = Gloves of Spell Mastery
// kybl = Blood Key
// infs = Inferno Stone
// mnst = Mana Stone
// pinv = Potion of Invisibility
// rnec = Rod of Necromancy
// rde2 = Ring of Protection +3
// schl = Scepter of Healing
// bspd = Boots of Speed
// ches = Cheese
// I002 = Necronomicon Level 2
// I001 = Necronomicon Level 3
function SetupAllReciepes takes nothing returns nothing
	set udg_i_DTAX_reciepes_counter=1
	call SetupReciepe('rots','rump','mcri',0,'bfhr')
	call SetupReciepe('stwa','tbar','rsps',0,'tfar')
	call SetupReciepe('shdt','tbar','srrc',0,'sor9')
	call SetupReciepe('rej4','sor1','ram3','vddl','olig')
	call SetupReciepe('rump','oli2','rwiz',0,'kgal')
	call SetupReciepe('srbd','whwd','fgrg',0,'rde4')
	call SetupReciepe('bgst','sksh','spsh',0,'ram1')
	call SetupReciepe('belv','tmmt','sand',0,'rde0')
	call SetupReciepe('ram1','rde0','wcyc',0,'rnsp')
	call SetupReciepe('whwd','srtl','penr',0,'rugt')
	call SetupReciepe('srtl','lure','rreb',0,'ofir')
	call SetupReciepe('flag','stwa','rre1',0,'ocor')
	call SetupReciepe('soul','rej2','lhst',0,'spre')
	call SetupReciepe('rst1','tgxp','stre',0,'hlst')
	call SetupReciepe('tbar','lgdh','sbok',0,'gsou')
	call SetupReciepe('whwd','ciri','shhn',0,'soul')
	call SetupReciepe('srtl','shrs','sora',0,'pspd')
	call SetupReciepe('iwbr','tbsm','mcou',0,'sfog')
	call SetupReciepe('rdis','tmmt','ciri',0,'wswd')
	call SetupReciepe('modt','shhn',0,0,'grsl')
	call SetupReciepe('tmmt','sora','rlif',0,'ccmd')
	call SetupReciepe('scul','jdrn',0,0,'rots')
	call SetupReciepe('ratf','flag','sora',0,'gldo')
	call SetupReciepe('rhe2','sor2','tmsc',0,'lure')
	call SetupReciepe('shcw','rej6',0,0,'ratf')
	call SetupReciepe('shcw','shtm','ciri',0,'rej2')
	call SetupReciepe('jdrn','prvt',0,0,'horl')
	call SetupReciepe('pgin','hbth','oli2',0,'oslo')
	call SetupReciepe('soul','ratf','clfm',0,'oven')
	call SetupReciepe('sor2','sksh','texp',0,'ofro')
	call SetupReciepe('shrs','crys',0,0,'ram4')
	call SetupReciepe('shtm','tmsc','rma2',0,'rej5')
	call SetupReciepe('rej5','rma2',0,0,'lnrn')
	call SetupReciepe('lnrn','rma2',0,0,'mlst')
	call SetupReciepe('mlst','rma2',0,0,'mnsf')
	call SetupReciepe('mnsf','rma2',0,0,'rej1')
	call SetupReciepe('tgxp','rspl',0,0,'tlum')
	call SetupReciepe('iwbr','tkno','stel',0,'klmm')
	call SetupReciepe('tbsm','tmsc','tdex',0,'rat6')
	call SetupReciepe('pgma','stre',0,0,'pdiv')
	call SetupReciepe('pclr','ratf','gvsm',0,'kybl')
	call SetupReciepe('infs','klmm','sfog',0,'mnst')
	call SetupReciepe('belv','flag','pinv',0,'rnec')
	call SetupReciepe('wswd','rde2','oli2',0,'schl')
	call SetupReciepe('bgst','shtm','bspd',0,'ches')
	call SetupReciepe('ches','bspd',0,0,'I002')
	call SetupReciepe('I002','bspd',0,0,'I001')
endfunction

// ANab = Acid Bomb
function Trig_Setup_Reciepes_Actions takes nothing returns nothing
	local integer iUnknown1
	local integer iUnknown2
	call SetupAllReciepes()
endfunction

function StartTrigger_Setup_Reciepes takes nothing returns nothing
	set gg_trg_Setup_Reciepes=CreateTrigger()
	call TriggerRegisterTimerEventSingle(gg_trg_Setup_Reciepes,.01)
	call TriggerAddAction(gg_trg_Setup_Reciepes,function Trig_Setup_Reciepes_Actions)
endfunction

function InitTrig_Setup_Reciepes takes nothing returns nothing
endfunction

JASS:
// tsct = Ivory Tower
// mcri = Mechanical Critter
// tst2 = Tome of Strength +2
// vddl = Voodoo Doll
// tpow = Tome of Knowledge
// tstr = Tome of Strength
// tint = Tome of Intelligence
// tin2 = Tome of Intelligence +2
// tdx2 = Tome of Agility +2
// texp = Tome of Experience
// rwat = Rune of the Watcher
// tdex = Tome of Agility
// rspd = Rune of Speed
// rspl = Rune of Spirit Link
// rres = Rune of Restoration
// rsps = Rune of Shielding
// rman = Rune of Mana
// rreb = Rune of Rebirth
// rhe1 = Rune of Lesser Healing
// rre1 = Rune of Lesser Resurrection
// rre2 = Rune of Greater Resurrection
// rhe2 = Rune of Healing
// rhe3 = Rune of Greater Healing
// rma2 = Rune of Greater Mana
// manh = Manual of Health
// rdis = Rune of Dispel Magic
// guvi = Glyph of Ultravision
// gold = Gold Coins
// gfor = Glyph of Fortification
// gomn = Glyph of Omniscience
// lmbr = Bundle of Lumber
// ward = Warsong Battle Drums
// evtl = Talisman of Evasion
// lhst = The Lion Horn of Stormwind
// ssil = Staff of Silence
// stel = Staff of Teleportation
// rag1 = Slippers of Agility +3
// rwiz = Sobi Mask
// brac = Runed Bracers
// sbch = Scourge Bone Chimes
// rde3 = Ring of Protection +4
// rlif = Ring of Regeneration
// rde1 = Ring of Protection +2
// rde2 = Ring of Protection +3
// pmna = Pendant of Mana
// prvt = Periapt of Vitality
// odef = Orb of Darkness
// penr = Pendant of Energy
// rin1 = Mantle of Intelligence +3
// mcou = Medallion of Courage
// kpin = Khadgar's Pipe of Insight'
// lgdh = Legion Doom-Horn
// hcun = Hood of Cunning
// rhth = Khadgar's Gem of Health'
// gcel = Gloves of Haste
// hval = Helm of Valor
// dsum = Diamond of Summoning
// rst1 = Gauntlets of Ogre Strength +3
// clsd = Cloak of Shadows
// crys = Crystal Ball
// rat9 = Claws of Attack +9
// clfm = Cloak of Flames
// cnob = Circlet of Nobility
// ratc = Claws of Attack +12
// ajen = Ancient Janggo of Endurance
// bspd = Boots of Speed
// afac = Alleria's Flute of Accuracy'
// spsh = Amulet of Spell Shield
// wlsd = Wand of Lightning Shield
// wcyc = Wand of the Wind
// woms = Wand of Mana Stealing
// wshs = Wand of Shadowsight
// totw = Talisman of the Wild
// will = Wand of Illusion
// fgfh = Spiked Collar
// fgrg = Stone Token
// sres = Scroll of Restoration
// srrc = Scroll of Resurrection
// I003 = Yasha - 600
// sand = Scroll of Animate Dead
// pghe = Potion of Greater Healing
// pgma = Potion of Greater Mana
// shar = Ice Shard
// infs = Inferno Stone
// hslv = Healing Salve
// pclr = Clarity Potion
// moon = Moonstone
// pinv = Potion of Invisibility
function Trig_Item_ReplaceReciepeDummies_Actions takes nothing returns nothing
	local integer iItemTypeId=GetItemTypeId(GetManipulatedItem())
	local unit uTriggeringUnit=GetTriggerUnit()
	if(iItemTypeId=='tsct')then
		call RemoveItem(GetItemOfTypeFromUnitBJ(uTriggeringUnit,'tsct'))
		call UnitAddItemByIdSwapped('mcri',uTriggeringUnit)
	endif
	if(iItemTypeId=='tst2')then
		call RemoveItem(GetItemOfTypeFromUnitBJ(uTriggeringUnit,'tst2'))
		call UnitAddItemByIdSwapped('vddl',uTriggeringUnit)
	endif
	if(iItemTypeId=='tpow')then
		call RemoveItem(GetItemOfTypeFromUnitBJ(uTriggeringUnit,'tpow'))
		call UnitAddItemByIdSwapped('tstr',uTriggeringUnit)
	endif
	if(iItemTypeId=='tint')then
		call RemoveItem(GetItemOfTypeFromUnitBJ(uTriggeringUnit,'tint'))
		call UnitAddItemByIdSwapped('tin2',uTriggeringUnit)
	endif
	if(iItemTypeId=='tdx2')then
		call RemoveItem(GetItemOfTypeFromUnitBJ(uTriggeringUnit,'tdx2'))
		call UnitAddItemByIdSwapped('texp',uTriggeringUnit)
	endif
	if(iItemTypeId=='rwat')then
		call RemoveItem(GetItemOfTypeFromUnitBJ(uTriggeringUnit,'rwat'))
		call UnitAddItemByIdSwapped('tdex',uTriggeringUnit)
	endif
	if(iItemTypeId=='rspd')then
		call RemoveItem(GetItemOfTypeFromUnitBJ(uTriggeringUnit,'rspd'))
		call UnitAddItemByIdSwapped('rspl',uTriggeringUnit)
	endif
	if(iItemTypeId=='rres')then
		call RemoveItem(GetItemOfTypeFromUnitBJ(uTriggeringUnit,'rres'))
		call UnitAddItemByIdSwapped('rsps',uTriggeringUnit)
	endif
	if(iItemTypeId=='rman')then
		call RemoveItem(GetItemOfTypeFromUnitBJ(uTriggeringUnit,'rman'))
		call UnitAddItemByIdSwapped('rreb',uTriggeringUnit)
	endif
	if(iItemTypeId=='rhe1')then
		call RemoveItem(GetItemOfTypeFromUnitBJ(uTriggeringUnit,'rhe1'))
		call UnitAddItemByIdSwapped('rre1',uTriggeringUnit)
	endif
	if(iItemTypeId=='rre2')then
		call RemoveItem(GetItemOfTypeFromUnitBJ(uTriggeringUnit,'rre2'))
		call UnitAddItemByIdSwapped('rhe2',uTriggeringUnit)
	endif
	if(iItemTypeId=='rhe3')then
		call RemoveItem(GetItemOfTypeFromUnitBJ(uTriggeringUnit,'rhe3'))
		call UnitAddItemByIdSwapped('rma2',uTriggeringUnit)
	endif
	if(iItemTypeId=='manh')then
		call RemoveItem(GetItemOfTypeFromUnitBJ(uTriggeringUnit,'manh'))
		call UnitAddItemByIdSwapped('rdis',uTriggeringUnit)
	endif
	if(iItemTypeId=='guvi')then
		call RemoveItem(GetItemOfTypeFromUnitBJ(uTriggeringUnit,'guvi'))
		call UnitAddItemByIdSwapped('gold',uTriggeringUnit)
	endif
	if(iItemTypeId=='gfor')then
		call RemoveItem(GetItemOfTypeFromUnitBJ(uTriggeringUnit,'gfor'))
		call UnitAddItemByIdSwapped('gomn',uTriggeringUnit)
	endif
	if(iItemTypeId=='lmbr')then
		call RemoveItem(GetItemOfTypeFromUnitBJ(uTriggeringUnit,'lmbr'))
		call UnitAddItemByIdSwapped('ward',uTriggeringUnit)
	endif
	if(iItemTypeId=='evtl')then
		call RemoveItem(GetItemOfTypeFromUnitBJ(uTriggeringUnit,'evtl'))
		call UnitAddItemByIdSwapped('lhst',uTriggeringUnit)
	endif
	if(iItemTypeId=='ssil')then
		call RemoveItem(GetItemOfTypeFromUnitBJ(uTriggeringUnit,'ssil'))
		call UnitAddItemByIdSwapped('stel',uTriggeringUnit)
	endif
	if(iItemTypeId=='rag1')then
		call RemoveItem(GetItemOfTypeFromUnitBJ(uTriggeringUnit,'rag1'))
		call UnitAddItemByIdSwapped('rwiz',uTriggeringUnit)
	endif
	if(iItemTypeId=='brac')then
		call RemoveItem(GetItemOfTypeFromUnitBJ(uTriggeringUnit,'brac'))
		call UnitAddItemByIdSwapped('sbch',uTriggeringUnit)
	endif
	if(iItemTypeId=='rde3')then
		call RemoveItem(GetItemOfTypeFromUnitBJ(uTriggeringUnit,'rde3'))
		call UnitAddItemByIdSwapped('rlif',uTriggeringUnit)
	endif
	if(iItemTypeId=='rde1')then
		call RemoveItem(GetItemOfTypeFromUnitBJ(uTriggeringUnit,'rde1'))
		call UnitAddItemByIdSwapped('rde2',uTriggeringUnit)
	endif
	if(iItemTypeId=='pmna')then
		call RemoveItem(GetItemOfTypeFromUnitBJ(uTriggeringUnit,'pmna'))
		call UnitAddItemByIdSwapped('prvt',uTriggeringUnit)
	endif
	if(iItemTypeId=='odef')then
		call RemoveItem(GetItemOfTypeFromUnitBJ(uTriggeringUnit,'odef'))
		call UnitAddItemByIdSwapped('penr',uTriggeringUnit)
	endif
	if(iItemTypeId=='rin1')then
		call RemoveItem(GetItemOfTypeFromUnitBJ(uTriggeringUnit,'rin1'))
		call UnitAddItemByIdSwapped('mcou',uTriggeringUnit)
	endif
	if(iItemTypeId=='kpin')then
		call RemoveItem(GetItemOfTypeFromUnitBJ(uTriggeringUnit,'kpin'))
		call UnitAddItemByIdSwapped('lgdh',uTriggeringUnit)
	endif
	if(iItemTypeId=='hcun')then
		call RemoveItem(GetItemOfTypeFromUnitBJ(uTriggeringUnit,'hcun'))
		call UnitAddItemByIdSwapped('rhth',uTriggeringUnit)
	endif
	if(iItemTypeId=='gcel')then
		call RemoveItem(GetItemOfTypeFromUnitBJ(uTriggeringUnit,'gcel'))
		call UnitAddItemByIdSwapped('hval',uTriggeringUnit)
	endif
	if(iItemTypeId=='dsum')then
		call RemoveItem(GetItemOfTypeFromUnitBJ(uTriggeringUnit,'dsum'))
		call UnitAddItemByIdSwapped('rst1',uTriggeringUnit)
	endif
	if(iItemTypeId=='clsd')then
		call RemoveItem(GetItemOfTypeFromUnitBJ(uTriggeringUnit,'clsd'))
		call UnitAddItemByIdSwapped('crys',uTriggeringUnit)
	endif
	if(iItemTypeId=='rat9')then
		call RemoveItem(GetItemOfTypeFromUnitBJ(uTriggeringUnit,'rat9'))
		call UnitAddItemByIdSwapped('clfm',uTriggeringUnit)
	endif
	if(iItemTypeId=='cnob')then
		call RemoveItem(GetItemOfTypeFromUnitBJ(uTriggeringUnit,'cnob'))
		call UnitAddItemByIdSwapped('ratc',uTriggeringUnit)
	endif
	if(iItemTypeId=='ajen')then
		call RemoveItem(GetItemOfTypeFromUnitBJ(uTriggeringUnit,'ajen'))
		call UnitAddItemByIdSwapped('bspd',uTriggeringUnit)
	endif
	if(iItemTypeId=='afac')then
		call RemoveItem(GetItemOfTypeFromUnitBJ(uTriggeringUnit,'afac'))
		call UnitAddItemByIdSwapped('spsh',uTriggeringUnit)
	endif
	if(iItemTypeId=='wlsd')then
		call RemoveItem(GetItemOfTypeFromUnitBJ(uTriggeringUnit,'wlsd'))
		call UnitAddItemByIdSwapped('wcyc',uTriggeringUnit)
	endif
	if(iItemTypeId=='woms')then
		call RemoveItem(GetItemOfTypeFromUnitBJ(uTriggeringUnit,'woms'))
		call UnitAddItemByIdSwapped('wshs',uTriggeringUnit)
	endif
	if(iItemTypeId=='totw')then
		call RemoveItem(GetItemOfTypeFromUnitBJ(uTriggeringUnit,'totw'))
		call UnitAddItemByIdSwapped('will',uTriggeringUnit)
	endif
	if(iItemTypeId=='fgfh')then
		call RemoveItem(GetItemOfTypeFromUnitBJ(uTriggeringUnit,'fgfh'))
		call UnitAddItemByIdSwapped('fgrg',uTriggeringUnit)
	endif
	if(iItemTypeId=='sres')then
		call RemoveItem(GetItemOfTypeFromUnitBJ(uTriggeringUnit,'sres'))
		call UnitAddItemByIdSwapped('srrc',uTriggeringUnit)
	endif
	if(iItemTypeId=='I003')then
		call RemoveItem(GetItemOfTypeFromUnitBJ(uTriggeringUnit,'I003'))
		call UnitAddItemByIdSwapped('sand',uTriggeringUnit)
	endif
	if(iItemTypeId=='pghe')then
		call RemoveItem(GetItemOfTypeFromUnitBJ(uTriggeringUnit,'pghe'))
		call UnitAddItemByIdSwapped('pgma',uTriggeringUnit)
	endif
	if(iItemTypeId=='shar')then
		call RemoveItem(GetItemOfTypeFromUnitBJ(uTriggeringUnit,'shar'))
		call UnitAddItemByIdSwapped('infs',uTriggeringUnit)
	endif
	if(iItemTypeId=='hslv')then
		call RemoveItem(GetItemOfTypeFromUnitBJ(uTriggeringUnit,'hslv'))
		call UnitAddItemByIdSwapped('pclr',uTriggeringUnit)
	endif
	if(iItemTypeId=='moon')then
		call RemoveItem(GetItemOfTypeFromUnitBJ(uTriggeringUnit,'moon'))
		call UnitAddItemByIdSwapped('pinv',uTriggeringUnit)
	endif
endfunction

function StartTrigger_Item_ReplaceReciepeDummies takes nothing returns nothing
	set gg_trg_Item_ReplaceReciepeDummies=CreateTrigger()
	call TriggerRegisterAnyUnitEventBJ(gg_trg_Item_ReplaceReciepeDummies,EVENT_PLAYER_UNIT_PICKUP_ITEM)
	call TriggerAddAction(gg_trg_Item_ReplaceReciepeDummies,function Trig_Item_ReplaceReciepeDummies_Actions)
endfunction

function InitTrig_Item_ReplaceReciepeDummies takes nothing returns nothing
endfunction

JASS:
function ApplyReciepeOnUnit takes unit uUnit,integer iFirstItemType,integer iSecondItemType,integer iThirdItemType,integer iFourthItemType,integer iResultItemType,integer iReciepeLenght returns boolean
	local effect eReciepeEffect
	if(iReciepeLenght==2)then
		if(UnitHasItemOfTypeBJ(uUnit,iFirstItemType))then
			if(UnitHasItemOfTypeBJ(uUnit,iSecondItemType))then
				call RemoveItem(GetItemOfTypeFromUnitBJ(uUnit,iFirstItemType))
				call RemoveItem(GetItemOfTypeFromUnitBJ(uUnit,iSecondItemType))
				set eReciepeEffect=AddSpecialEffectTargetUnitBJ("origin",uUnit,"Abilities\\Spells\\Items\\AIem\\AIemTarget.mdl")
				call UnitAddItemById(uUnit,iResultItemType)
				call DestroyEffect(eReciepeEffect)
				return true
			endif
		endif
	endif
	if(iReciepeLenght==3)then
		if(UnitHasItemOfTypeBJ(uUnit,iFirstItemType))then
			if(UnitHasItemOfTypeBJ(uUnit,iSecondItemType))then
				if(UnitHasItemOfTypeBJ(uUnit,iThirdItemType))then
					call RemoveItem(GetItemOfTypeFromUnitBJ(uUnit,iFirstItemType))
					call RemoveItem(GetItemOfTypeFromUnitBJ(uUnit,iSecondItemType))
					call RemoveItem(GetItemOfTypeFromUnitBJ(uUnit,iThirdItemType))
					set eReciepeEffect=AddSpecialEffectTargetUnitBJ("origin",uUnit,"Abilities\\Spells\\Items\\AIem\\AIemTarget.mdl")
					call UnitAddItemById(uUnit,iResultItemType)
					call DestroyEffect(eReciepeEffect)
					return true
				endif
			endif
		endif
	endif
	if(iReciepeLenght==4)then
		if(UnitHasItemOfTypeBJ(uUnit,iFirstItemType))then
			if(UnitHasItemOfTypeBJ(uUnit,iSecondItemType))then
				if(UnitHasItemOfTypeBJ(uUnit,iThirdItemType))then
					if(UnitHasItemOfTypeBJ(uUnit,iFourthItemType))then
						call RemoveItem(GetItemOfTypeFromUnitBJ(uUnit,iFirstItemType))
						call RemoveItem(GetItemOfTypeFromUnitBJ(uUnit,iSecondItemType))
						call RemoveItem(GetItemOfTypeFromUnitBJ(uUnit,iThirdItemType))
						call RemoveItem(GetItemOfTypeFromUnitBJ(uUnit,iFourthItemType))
						set eReciepeEffect=AddSpecialEffectTargetUnitBJ("origin",uUnit,"Abilities\\Spells\\Items\\AIem\\AIemTarget.mdl")
						call UnitAddItemById(uUnit,iResultItemType)
						call DestroyEffect(eReciepeEffect)
						return true
					endif
				endif
			endif
		endif
	endif
	return false
endfunction

function Trig_Item_ApplyReciepe_Actions takes nothing returns nothing
	local unit uTriggeringUnit=GetTriggerUnit()
	local integer iSCounter=1
	local integer iFCounter=udg_i_DTAX_max_reciepes_count
	loop
		exitwhen iSCounter>iFCounter
		if(ApplyReciepeOnUnit(uTriggeringUnit,udg_iA_DTAX_reciepe_item1_id[iSCounter],udg_iA_DTAX_reciepe_item2_id[iSCounter],udg_iA_DTAX_reciepe_item3_id[iSCounter],udg_iA_DTAX_reciepe_item4_id[iSCounter],udg_iA_DTAX_reciepe_result_id[iSCounter],udg_iA_DTAX_reciepe_lenght[iSCounter]))then
			set iSCounter=iFCounter+1
		endif
		set iSCounter=iSCounter+1
	endloop
endfunction

function StartTrigger_Item_ApplyReciepe takes nothing returns nothing
	set gg_trg_Item_ApplyReciepe=CreateTrigger()
	call TriggerRegisterAnyUnitEventBJ(gg_trg_Item_ApplyReciepe,EVENT_PLAYER_UNIT_PICKUP_ITEM)
	call TriggerAddAction(gg_trg_Item_ApplyReciepe,function Trig_Item_ApplyReciepe_Actions)
endfunction

function InitTrig_Item_ApplyReciepe takes nothing returns nothing
endfunction

JASS:
// flag = Human Flag
// will = Wand of Illusion
// tels = Goblin Night Scope
// gvsm = Gloves of Spell Mastery
// hbth = Helm of Battlethirst
// ward = Warsong Battle Drums
// thdm = Thunderlizard Diamond
function Trig_Item_SomeExtraReciepes_Actions takes nothing returns nothing
	local unit uTriggeringUnit=GetTriggerUnit()
	local integer iSCounter=1
	local integer iFCounter=6
	local integer iUnknown=0
	local effect eEffect
	loop
		exitwhen iSCounter>iFCounter
		if(GetItemTypeId(UnitItemInSlotBJ(uTriggeringUnit,iSCounter))=='flag')then
			set iUnknown=iUnknown+1
		endif
		set iSCounter=iSCounter+1
	endloop
	if(iUnknown>1 and UnitHasItemOfTypeBJ(uTriggeringUnit,'will'))then
		set eEffect=AddSpecialEffectTargetUnitBJ("overhead",uTriggeringUnit,"Abilities\\Spells\\Items\\AIem\\AIemTarget.mdl")
		call DestroyEffect(eEffect)
		call RemoveItem(GetItemOfTypeFromUnitBJ(uTriggeringUnit,'will'))
		call RemoveItem(GetItemOfTypeFromUnitBJ(uTriggeringUnit,'flag'))
		call RemoveItem(GetItemOfTypeFromUnitBJ(uTriggeringUnit,'flag'))
		call UnitAddItemByIdSwapped('tels',uTriggeringUnit)
	endif
	set iUnknown=0
	set iSCounter=1
	loop
		exitwhen iSCounter>iFCounter
		if(GetItemTypeId(UnitItemInSlotBJ(uTriggeringUnit,iSCounter))=='gvsm')then
			set iUnknown=iUnknown+1
		endif
		set iSCounter=iSCounter+1
	endloop
	if(iUnknown>1 and UnitHasItemOfTypeBJ(uTriggeringUnit,'hbth') and UnitHasItemOfTypeBJ(uTriggeringUnit,'ward'))then
		set eEffect=AddSpecialEffectTargetUnitBJ("origin",uTriggeringUnit,"Abilities\\Spells\\Items\\AIem\\AIemTarget.mdl")
		call DestroyEffect(eEffect)
		call RemoveItem(GetItemOfTypeFromUnitBJ(uTriggeringUnit,'hbth'))
		call RemoveItem(GetItemOfTypeFromUnitBJ(uTriggeringUnit,'ward'))
		call RemoveItem(GetItemOfTypeFromUnitBJ(uTriggeringUnit,'gvsm'))
		call RemoveItem(GetItemOfTypeFromUnitBJ(uTriggeringUnit,'gvsm'))
		call UnitAddItemByIdSwapped('thdm',uTriggeringUnit)
	endif
endfunction

function StartTrigger_Item_SomeExtraReciepes takes nothing returns nothing
	set gg_trg_Item_SomeExtraReciepes=CreateTrigger()
	call TriggerRegisterAnyUnitEventBJ(gg_trg_Item_SomeExtraReciepes,EVENT_PLAYER_UNIT_PICKUP_ITEM)
	call TriggerAddAction(gg_trg_Item_SomeExtraReciepes,function Trig_Item_SomeExtraReciepes_Actions)
endfunction

function InitTrig_Item_SomeExtraReciepes takes nothing returns nothing
endfunction

Could anyone explain what those things do, and what to replace to get a normal recipe system, for items i want. +3rep for the guy who explains it.

Tiche3:sad:

Additional note: This map contains many items from dota, it combines them just the same, without the error message while having full inventory and etc, although i don't know how to customize it, to put in items and etc.
 
Level 18
Joined
Jan 21, 2006
Messages
2,552
That seems like a really bad item recipe system.

It seems like it is programmed in JASS, not vJass, which is where all of the inconveniences come from (like nothing here being in scopes and the inability to declare global variables). I think that you would be better of using a vJass one since they are far more portable.

Also there are BJ functions all over the place. Where did you get this from?
 
Level 9
Joined
Jun 25, 2009
Messages
427
That seems like a really bad item recipe system.

It seems like it is programmed in JASS, not vJass, which is where all of the inconveniences come from (like nothing here being in scopes and the inability to declare global variables). I think that you would be better of using a vJass one since they are far more portable.

Also there are BJ functions all over the place. Where did you get this from?

Downloaded somewhere in the internet :( Although TriggerHappy linked me to a great system, that i'll probably implement, thanks for the suggestions.
 
Status
Not open for further replies.
Top