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

[Trigger] Custom Script doesn't work on my map

Status
Not open for further replies.
Level 6
Joined
Dec 6, 2009
Messages
168
Hi! this trigger is made by Dark_Dragon. But whenever I try to start the map it says: (Line 117: Expected a funtion name) and it shows
  • call NewItemGroup()
Here is the whole trigger:
  • Load Items
    • Events
      • Map initialization
    • Conditions
    • Actions
      • -------- --- --------
      • -------- Item Group 1 --------
      • Set CItemType[1] = |CFFFFD700Red Plate Armor|r
      • Set CItemType[2] = |CFFFFD700Red Plate Boots|r
      • Set CItemType[3] = |CFFFFD700Red Plate Helmet|r
      • Set CItemType[0] = |CFFFF0000Red Plate Armor Set|r
      • Custom script: call NewItemGroup()
      • -------- Item Group 2 --------
      • Set CItemType[1] = |CFF540081Bronze Armor|r
      • Set CItemType[2] = |CFF540081Bronze Boots|r
      • Set CItemType[3] = |CFF540081Bronze Helmet|r
      • Set CItemType[0] = |CFFFF0000Bronze Armor Set|r
      • Custom script: call NewItemGroup()
      • -------- Item Group 3 --------
      • Set CItemType[1] = Claws of Attack +15
      • Set CItemType[2] = Crown of Kings +5
      • Set CItemType[0] = Kelen's Dagger of Escape
      • Custom script: call NewItemGroup()
      • -------- Item Group 4 --------
      • Set CItemType[1] = Mask of Death
      • Set CItemType[2] = Tome of Power
      • Set CItemType[0] = Blood Key
      • Custom script: call NewItemGroup()
      • -------- ======= --------
      • Custom script: call DestroyTrigger( GetTriggeringTrigger() )
I have aswell coppied this to my map.
//TESH.scrollpos=0
//TESH.alwaysfold=0

The original trigger can be found here: http://www.hiveworkshop.com/forums/...103353/?prev=search=item%20recipe&d=list&r=20

Thx Drealordh!
 
Level 28
Joined
Jan 26, 2007
Messages
4,789
So... did you copy the entire trigger "Item Combine Core" or not?
drealordh said:
I have aswell coppied this to my map.
//TESH.scrollpos=0
//TESH.alwaysfold=0
Because those are comments. The equivalent of this:
  • -------- TESH.scrollpos=0 --------
  • -------- TESH.alwaysfold=0 --------
And as you may know, that does absolutely nothing.
Also, if you can see those, it means that you're not using the right editor (it would crash anyway).

The entire trigger looks more like this:

JASS:
library DDItemCombineBasic initializer Init

    globals
        // *** Edit to your own will ***
		private constant string ITEM_COMBINE_EFFECT = "Abilities\\Spells\\Items\\AIlm\\AIlmTarget.mdl"
		private constant string ATTACH_POINT		= "origin"
        // *** End edit ***
	
        private sound ItemCombineSound = null
        private integer array CType[8191]
		private integer ItemN = 0
    endglobals

    function NewItemGroup takes nothing returns nothing
        local integer i = ItemN*6 + 7
        local integer h = 1
        set ItemN = ItemN + 1

        loop
        exitwhen (h == 7)
            set udg_CItemType[i] = udg_CItemType[h]
            set udg_CItemType[h] = 0
            set h = h + 1
            set i = i + 1
        endloop
        set CType[ItemN-1] = udg_CItemType[0]
        set udg_CItemType[0] = 0
    endfunction

    private function UnitRemoveItemById takes unit whichUnit, integer itemId returns nothing
        local integer i = 0
        local item it
        
        loop
        exitwhen (i >= bj_MAX_INVENTORY)
            set it = UnitItemInSlot(whichUnit, i)
            if GetItemTypeId(it) == itemId then
                call RemoveItem(it)
                exitwhen (true)
            endif
            set i = i + 1
        endloop
        set it = null
    endfunction

    private function Actions takes nothing returns nothing
        local integer n = 0
        local integer array it
        local integer i = 7
        local integer h = 0
        local integer x = 0
        local unit u = GetTriggerUnit()
        local boolean b = true
        local integer y = 0
        local integer z = 0
        local integer array hero_item_type

        // Get hero items
        loop
        exitwhen (x >= bj_MAX_INVENTORY)
            set hero_item_type[x] = GetItemTypeId(UnitItemInSlot(u, x))
            set x = x + 1
        endloop

        loop
        exitwhen (n >= ItemN)
            set h = i + 6
            
            set x = 0
            set it[x] = hero_item_type[x]
            set x = x + 1
            set it[x] = hero_item_type[x]
            set x = x + 1
            set it[x] = hero_item_type[x]
            set x = x + 1
            set it[x] = hero_item_type[x]
            set x = x + 1
            set it[x] = hero_item_type[x]
            set x = x + 1
            set it[x] = hero_item_type[x]
            set x = x + 1
            
            set y = 0 // N of items that hero has ()
            set z = 0 // N of items needed ()
            loop
            exitwhen (i >= h or udg_CItemType[i] == 0)
                set z = z + 1
                // Does unit contain item n
                set x = 0
                loop
                exitwhen (x >= bj_MAX_INVENTORY)
                    if (it[x] == udg_CItemType[i]) then
                        // Kick out the item
                        set it[x] = 0
                        set y = y + 1
                        // And increase by 1
                        exitwhen (true)
                    endif
                    set x = x + 1
                endloop
                
                set i = i + 1
            endloop
            set i = h
            
            if (y == z) then
                set h = i
                set i = i-6
                loop
                exitwhen (i > h or udg_CItemType[i] == 0)
                    call UnitRemoveItemById(u, udg_CItemType[i])
                    set i = i + 1
                endloop
                call UnitAddItemById(u, CType[n])
                call SetSoundPosition(ItemCombineSound, GetUnitX(u), GetUnitY(u), 0.)
                call StartSound(ItemCombineSound)
                call DestroyEffect(AddSpecialEffectTarget(ITEM_COMBINE_EFFECT, u, ATTACH_POINT))
                set u = null
                return
            endif
            
            set n = n + 1
        endloop
    endfunction

    //===========================================================================
    private function Init takes nothing returns nothing
        local trigger t = CreateTrigger()
        call TriggerRegisterAnyUnitEventBJ( t, EVENT_PLAYER_UNIT_PICKUP_ITEM )
        call TriggerAddAction( t, function Actions )

        call Preload(ITEM_COMBINE_EFFECT)

        set ItemCombineSound = CreateSound( "Abilities\\Spells\\Orc\\MirrorImage\\MirrorImage.wav", false, true, true, 10, 10, "" )
        call SetSoundParamsFromLabel( ItemCombineSound, "MirrorImage" )
        call SetSoundDuration( ItemCombineSound, 1756 )
        call SetSoundPitch(ItemCombineSound, 1.2)
        call SetSoundVolume(ItemCombineSound, 100)
    endfunction

endlibrary
 
Last edited:
Status
Not open for further replies.
Top