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

One Trigger for all recipe item. What do you think?

Status
Not open for further replies.
Level 5
Joined
Jan 4, 2009
Messages
118
I ever example recipe item in DotA from many site. I see that one trigger for one item. I wonder Can I create one trigger for all item? By if else. If I do this. it system map slow? tell me more, plz

sorry for my language I not skill for english.
 
Level 13
Joined
Mar 24, 2010
Messages
950
doesnt really make a difference by a lot. i find it easier to the human eye to have them be all separate triggers but you can just as well put them all in 1 with if/then/else's

for the mess to have a ton in 1 trigger vs the efficiency i'd just make them separate triggers like this:

  • Recipe Gold Boots of Speed
    • Events
      • Unit - A unit Acquires an item
    • Conditions
      • Or - Any (Conditions) are true
        • Conditions
          • (Item-type of (Item being manipulated)) Equal to Gold Boots of Speed Recipe
          • (Item-type of (Item being manipulated)) Equal to Boots of Speed
          • (Item-type of (Item being manipulated)) Equal to Scroll of Speed
          • (Item-type of (Item being manipulated)) Equal to Talisman of Evasion
      • And - All (Conditions) are true
        • Conditions
          • ((Triggering unit) has an item of type Gold Boots of Speed Recipe) Equal to True
          • ((Triggering unit) has an item of type Boots of Speed) Equal to True
          • ((Triggering unit) has an item of type Scroll of Speed) Equal to True
          • ((Triggering unit) has an item of type Talisman of Evasion) Equal to True
    • Actions
      • Set Temp_Point = (Position of (Triggering unit))
      • Special Effect - Create a special effect at Temp_Point using Abilities\Spells\Undead\DarkRitual\DarkRitualTarget.mdl
      • Custom script: call RemoveLocation ( udg_Temp_Point)
      • Item - Remove (Item carried by (Triggering unit) of type Gold Boots of Speed Recipe)
      • Item - Remove (Item carried by (Triggering unit) of type Boots of Speed)
      • Item - Remove (Item carried by (Triggering unit) of type Scroll of Speed)
      • Item - Remove (Item carried by (Triggering unit) of type Talisman of Evasion)
      • Special Effect - Destroy (Last created special effect)
      • Hero - Create Gold Boots of Speed and give it to (Triggering unit)
 
Level 5
Joined
Jan 4, 2009
Messages
118
Code:
function Recipe_Actions takes nothing returns nothing
local unit u = GetManiPulatingUnit() /// I forgot this syntax, sorry ya
local effect sfx

// Bracers
if(UnitHasItemBJ(u, 'item1') == true and UnitHasItemBJ(u, 'item2') == true and UnitHasItemBJ(u, 'itemy') == true)then
call RemoveItem(GetItemOfTypeFromUnit(u, 'item1')
call RemoveItem(GetItemOfTypeFromUnit(u, 'item2')
call RemoveItem(GetItemOfTypeFromUnit(u, 'item3')
call UnitAddItemById(u, 'new_item')
set sfx = AddSpecialEffect("Effect", GetUnitX(u), GetUnitY(U))
call DestroyEffect(sfx)
set sfx = null
set u = null
endif

//Wraith Band
if(UnitHasItemBJ(u, 'item1') == true and UnitHasItemBJ(u, 'item2') == true and UnitHasItemBJ(u, 'itemy') == true)then
call RemoveItem(GetItemOfTypeFromUnit(u, 'item1')
call RemoveItem(GetItemOfTypeFromUnit(u, 'item2')
call RemoveItem(GetItemOfTypeFromUnit(u, 'item3')
call UnitAddItemById(u, 'new_item')
set sfx = AddSpecialEffect("Effect", GetUnitX(u), GetUnitY(U))
call DestroyEffect(sfx)
set sfx = null
set u = null
endif

//Null Talisman
if(UnitHasItemBJ(u, 'item1') == true and UnitHasItemBJ(u, 'item2') == true and UnitHasItemBJ(u, 'itemy') == true)then
call RemoveItem(GetItemOfTypeFromUnit(u, 'item1')
call RemoveItem(GetItemOfTypeFromUnit(u, 'item2')
call RemoveItem(GetItemOfTypeFromUnit(u, 'item3')
call UnitAddItemById(u, 'new_item')
set sfx = AddSpecialEffect("Effect", GetUnitX(u), GetUnitY(U))
call DestroyEffect(sfx)
set sfx = null
set u = null
endif
endfunction

function InitTrig_Recipe_Item takes nothing reuturns nothing
local trigger t = CreateTRigger()
call TriggerRegisterAnyUnitEventUnitBJ(t, EVENT_PLAYER_UNIT_SPELL_EFFECT)
call TriggerAddActions(t, function Recipe_Actions)
set t = null
endfunction

I mean like this... I will ask it slow system?
and If I should Loop for this system

I want to see example

thanks all guys and sorry for my language...

PS. some code not wrong, becuase I forgot it xD
 
Status
Not open for further replies.
Top