Jump to content

[Share][GuIdE]MaKiNg ReCipEs-ItEmS + [JASS Function] (OTRS) Recipe Items


Recommended Posts

                            ALL CREDITS FOR THIS GOES TO : ORC_TAMER

 

recipetutorialdr5pp3.png

 

Here a basic script using structs and methods to combine items into 1.

 

Changelog:

Version: 2.0 (Added New Function Arguments and Optimized Coding)

Version: 1.0 (Fixed minor bug)

 

Jass:

 

//===========================================================================
//  OTRS (Orc_Tamer's Recipe System)
//  Recipe System that allows you to make recipe items for you easier.
//  Author: Orc_Tamer
//  Date: 01.December.2007
//
//  How to implement:
//  Requires JASS NewGen World Editor
//  Just copy this trigger to your map.
//===========================================================================
library RecipeFunction

struct RecipeItems
    integer item0_id  
    integer item1_id  
    integer item2_id 
    integer item3_id  
    integer item4_id
    integer item5_id
    integer item6_id
    integer item7_id
    unit u
    item item1 = null
    item item2 = null 
    item item3 = null 
    item item4 = null
    item item5 = null
    item item6 = null
    
    method CheckItems2 takes nothing returns nothing
        local integer this_id
        local integer i = 0 
        loop
        set this_id = GetItemTypeId(UnitItemInSlot(.u, i)) 
        if this_id == .item0_id then 
            set .item1 = UnitItemInSlot(.u, i) 
        elseif this_id == .item1_id then 
            set .item2 = UnitItemInSlot(.u, i) 
        endif
        set i = i + 1
        exitwhen i >= bj_MAX_INVENTORY
        endloop
        if .item1 != null and .item2 != null then 
            call RemoveItem(.item1)
            call RemoveItem(.item2) 
            call DestroyEffect(AddSpecialEffectTarget("Abilities\\Spells\\Items\\AIem\\AIemTarget.mdl",.u,"overhead"))
            call UnitAddItemById(.u, .item2_id)
            set .item1 = null 
            set .item2 = null
            set .u = null
        endif
    endmethod
    
    method CheckItems3 takes nothing returns nothing
        local integer this_id 
        local integer i = 0 
        loop
        set this_id = GetItemTypeId(UnitItemInSlot(.u, i)) 
        if this_id == .item0_id then 
            set .item1 = UnitItemInSlot(.u, i)
        elseif this_id == .item1_id then 
            set .item2 = UnitItemInSlot(.u, i) 
        elseif this_id == .item2_id then 
            set .item3 = UnitItemInSlot(.u, i) 
        endif
        set i = i + 1 
        exitwhen i >= bj_MAX_INVENTORY 
        endloop
        if .item1 != null and .item2 != null and .item3 != null then
            call RemoveItem(.item1) 
            call RemoveItem(.item2)
            call RemoveItem(.item3) 
            call DestroyEffect(AddSpecialEffectTarget("Abilities\\Spells\\Items\\AIem\\AIemTarget.mdl",.u,"overhead")) //adds a special effect
            call UnitAddItemById(.u, .item3_id)
            set .item1 = null 
            set .item2 = null 
            set .item3 = null 
            set .u = null
        endif
    endmethod
    
    method CheckItems4 takes nothing returns nothing
        local integer this_id 
        local integer i = 0
        loop
        set this_id = GetItemTypeId(UnitItemInSlot(.u, i))
        if this_id == .item0_id then 
            set .item1 = UnitItemInSlot(.u, i)
        elseif this_id == .item1_id then 
            set .item2 = UnitItemInSlot(.u, i)
        elseif this_id == .item2_id then 
            set .item3 = UnitItemInSlot(.u, i)
        elseif this_id == .item3_id then
            set .item4 = UnitItemInSlot(.u, i)
        endif
        set i = i + 1 
        exitwhen i >= bj_MAX_INVENTORY 
        endloop
        if .item1 != null and .item2 != null and .item3 != null and .item4 != null then 
            call RemoveItem(.item1) 
            call RemoveItem(.item2) 
            call RemoveItem(.item3)
            call RemoveItem(.item4)
            call DestroyEffect(AddSpecialEffectTarget("Abilities\\Spells\\Items\\AIem\\AIemTarget.mdl",.u,"overhead")) 
            call UnitAddItemById(.u, .item4_id)
            set .item1 = null 
            set .item2 = null 
            set .item3 = null 
            set .item4 = null
            set .u = null 
        endif
    endmethod
    
    method CheckItems5 takes nothing returns nothing
        local integer this_id 
        local integer i = 0
        loop
        set this_id = GetItemTypeId(UnitItemInSlot(.u, i))
        if this_id == .item0_id then 
            set .item1 = UnitItemInSlot(.u, i)
        elseif this_id == .item1_id then 
            set .item2 = UnitItemInSlot(.u, i)
        elseif this_id == .item2_id then 
            set .item3 = UnitItemInSlot(.u, i)
        elseif this_id == .item3_id then
            set .item4 = UnitItemInSlot(.u, i)
        elseif this_id == .item4_id then
            set .item5 = UnitItemInSlot(.u, i)
        endif
        set i = i + 1 
        exitwhen i >= bj_MAX_INVENTORY 
        endloop
        if .item1 != null and .item2 != null and .item3 != null and .item4 != null and .item5 != null then 
            call RemoveItem(.item1) 
            call RemoveItem(.item2) 
            call RemoveItem(.item3)
            call RemoveItem(.item4)
            call RemoveItem(.item5)
            call DestroyEffect(AddSpecialEffectTarget("Abilities\\Spells\\Items\\AIem\\AIemTarget.mdl",.u,"overhead")) 
            call UnitAddItemById(.u, .item5_id)
            set .item1 = null 
            set .item2 = null 
            set .item3 = null 
            set .item4 = null
            set .item5 = null
            set .u = null 
        endif
    endmethod
    
    method CheckItems6 takes nothing returns nothing
        local integer this_id 
        local integer i = 0
        loop
        set this_id = GetItemTypeId(UnitItemInSlot(.u, i))
        if this_id == .item0_id then 
            set .item1 = UnitItemInSlot(.u, i)
        elseif this_id == .item1_id then 
            set .item2 = UnitItemInSlot(.u, i)
        elseif this_id == .item2_id then 
            set .item3 = UnitItemInSlot(.u, i)
        elseif this_id == .item3_id then
            set .item4 = UnitItemInSlot(.u, i)
        elseif this_id == .item4_id then
            set .item5 = UnitItemInSlot(.u, i)
        elseif this_id == .item5_id then
            set .item6 = UnitItemInSlot(.u, i)
        endif
        set i = i + 1 
        exitwhen i >= bj_MAX_INVENTORY 
        endloop
        if .item1 != null and .item2 != null and .item3 != null and .item4 != null and .item5 != null and .item6 != null then 
            call RemoveItem(.item1) 
            call RemoveItem(.item2) 
            call RemoveItem(.item3)
            call RemoveItem(.item4)
            call RemoveItem(.item5)
            call RemoveItem(.item6)
            call DestroyEffect(AddSpecialEffectTarget("Abilities\\Spells\\Items\\AIem\\AIemTarget.mdl",.u,"overhead")) 
            call UnitAddItemById(.u, .item6_id)
            set .item1 = null 
            set .item2 = null 
            set .item3 = null 
            set .item4 = null
            set .item5 = null
            set .item6 = null
            set .u = null 
        endif
    endmethod
endstruct

function Recipe2 takes unit hero, integer i1, integer i2, integer ni returns nothing
    local RecipeItems IS=RecipeItems.create() 
    set IS.item0_id = i1 
    set IS.item1_id = i2 
    set IS.item2_id = ni 
    set IS.u = hero 
    call IS.CheckItems2() 
    call IS.destroy() 
endfunction

function Recipe3 takes unit hero, integer i1, integer i2, integer i3, integer ni returns nothing
    local RecipeItems IS=RecipeItems.create()
    set IS.item0_id = i1 
    set IS.item1_id = i2 
    set IS.item2_id = i3 
    set IS.item3_id = ni 
    set IS.u = hero 
    call IS.CheckItems3() 
    call IS.destroy()
endfunction

function Recipe4 takes unit hero, integer i1, integer i2, integer i3, integer i4, integer ni returns nothing
    local RecipeItems IS=RecipeItems.create()
    set IS.item0_id = i1 
    set IS.item1_id = i2 
    set IS.item2_id = i3 
    set IS.item3_id = i4 
    set IS.item4_id = ni
    set IS.u = hero 
    call IS.CheckItems4() 
    call IS.destroy()
endfunction

function Recipe5 takes unit hero, integer i1, integer i2, integer i3, integer i4, integer i5, integer ni returns nothing
    local RecipeItems IS=RecipeItems.create()
    set IS.item0_id = i1 
    set IS.item1_id = i2 
    set IS.item2_id = i3 
    set IS.item3_id = i4
    set IS.item4_id = i5
    set IS.item5_id = ni
    set IS.u = hero 
    call IS.CheckItems5() 
    call IS.destroy()
endfunction

function Recipe6 takes unit hero, integer i1, integer i2, integer i3, integer i4, integer i5, integer i6, integer ni returns nothing
    local RecipeItems IS=RecipeItems.create()
    set IS.item0_id = i1 
    set IS.item1_id = i2 
    set IS.item2_id = i3 
    set IS.item3_id = i4
    set IS.item4_id = i5
    set IS.item5_id = i6
    set IS.item6_id = ni
    set IS.u = hero 
    call IS.CheckItems6() 
    call IS.destroy()
endfunction

endlibrary

 

 

This is an example you can use:

GUI:

 

RecipeGUI
    Events
        Unit - A unit Acquires an item
    Conditions
    Actions
        Custom script:   call Recipe2(GetTriggerUnit(),'rde1','rde2','rde3')
        Custom script:   call Recipe3(GetTriggerUnit(),'afac','spsh','ajen','bgst')
        Custom script:   call Recipe4(GetTriggerUnit(),'ratc','rat6','rat9','bspd','modt')
        Custom script:   call Recipe5(GetTriggerUnit(),'ofro','olig','oven','ocor','oslo','sor9')
        Custom script:   call Recipe6(GetTriggerUnit(),'pghe','pgma','pdiv','pomn','pres','pnvu','infs')

 

JASS:

function Trig_RecipeChecking_Actions takes nothing returns nothing
    call Recipe2(GetTriggerUnit(),'rde1','rde2','rde3')
    call Recipe3(GetTriggerUnit(),'afac','spsh','ajen','bgst')
    call Recipe4(GetTriggerUnit(),'ratc','rat6','rat9','bspd','modt')
    call Recipe5(GetTriggerUnit(),'ofro','olig','oven','ocor','oslo','sor9')
    call Recipe6(GetTriggerUnit(),'pghe','pgma','pdiv','pomn','pres','pnvu','infs')
endfunction

function InitTrig_RecipeJASS takes nothing returns nothing
    local trigger t = CreateTrigger()
    call TriggerRegisterAnyUnitEventBJ( t, EVENT_PLAYER_UNIT_PICKUP_ITEM )
    call TriggerAddAction( t, function Trig_RecipeChecking_Actions )
endfunction

 

 

EnJoY. cOmMeNtT pLLeAzEe :-)

Some DeMo MapS :)

Recipe System.w3x + Recipe System2.w3x

Link to comment
Share on other sites

  • 3 weeks later...
  • 1 year later...
Guest
This topic is now closed to further replies.


  • Posts

    • Hello everyone! We are selling a unique High Five server that has been developed for years and is still being finalized and has not been launched anywhere except our projects. We guarantee you that all backdoors, critical bugs and errors have been fixed and all minor errors that have been found to this day have also been fixed.   The server has full working locations, working quests, instance zones, a full working community board, bots that cannot be distinguished from real players, multilingual mode (ru and en), various services and other mechanisms, absolutely with full finished configs, custom services, antibot protection on the server side and on the client side, in a word, you take it and launch your project. Many new things have also been added to the server, armor, weapons, that you can run both the classic server and the server with the additions.   One of the unique developments of this server is bots that are 99.9% created and developed like real players. On this build we kept 800+ live players (350+ from them unique players, the rest their dualboxes) and 2000 bots, almost 3000 players without any problems and errors. Features of these bots: 1. Write in chats, all chats: general chat, shout, trade, clan. You can change, add, delete the chat text at any time 2. Walk, go to npcs, kill / attack mobs, attack players, attack pvp / pk. 3. Can pvp, pk, participate in Events. 4. Invite in clans. 5. Can teleport, use items, walk in the towns. 6. Can show in the statistics. 7. Can equip / unequip items weapons, accessories, armors. 8. In a word, these bots are 100% implemented as real players. And the most important thing is that you can control them and control them the way you control real players. We will also teach you how to operate it the way you want. Soon I will show you in a video some of the abilities of these bots!   When purchasing, we sell you the files that are currently running on our live projects, that is, a completely ready-made server that you will buy and launch your project. Prices: 1. Build. A completely ready Build for launching your project, with configured, community board design, rates x10,x25,x50,x75,x100,x1200, various bot files that were created throughout the life of the server and all other files that we have developed and modified to this days Also: 1 month free technical support, free learning bot management, free learning server details that you don't understand. Without IP binding, without online restrictions and also without restrictions on the number of bot launches. Price: 990$   2. Source. We are ready to share with you the latest version and revision of the server source, with all the files and changes that have occurred until today. Price and your conditions: Negotiable.   Besides this we have Remastered - High Five and Reworked - High Five build/sources, which are also unique in their kind and were developed through many sleepless nights and launched only in our project, you can come and test by going to our project, the link will be at the end of the topic.   We also present you with a service about creating your unique project from scratch (using our servers) and will help you realize your long-time dream for little money, but a high-quality project! Price and your conditions: Negotiable.   Test servers are not available to everyone, but we give you a link to a live project so that you can go and check everything without any interference or doubts. For real buyers, of course we will run test servers with all administrator rights! Link for testing observations: http://global-game.su/ or https://global-game.su/ For purchasing contact me: Telegram: t.me/magellanjg Discrod: jacob.gudkov                
    • its pretty obvious that you already say whats wrong and it is indeed the wrong but , you do not see it.. when the error is super clear!  as the friend above said, you are not parsing the html so it gives you "empty" or "faulty" html as main 🙂 cause it doesnt even exist!
    • Skype: Live:LargeSells   Discord: LargeSeLLs#7167 DiscUniqueID: 321388776200994816
    • hi friend, you need learn 3 language. 1. assembler for x64 2. ida pro disassembler 3. c++ for write own extender sorry for my english
    • - Accessing technical issues support (checkpoint, restricted advertising, etc)
  • Topics

×
×
  • Create New...