(Keeps Hive Alive)
Go Back   The Hive Workshop - A Warcraft III Modding Site > Warcraft III Resources > Submissions > "Graveyard"

"Graveyard" Resources which were not approved are moved to this section.

 
 
LinkBack Thread Tools Display Modes
Old 12-30-2007, 07:08 AM   #1 (permalink)
 
Orc_Tamer's Avatar

Old and Wise Member......
 
Join Date: Jan 2007
Posts: 41

Orc_Tamer has little to show at this moment (52)


[vjass] ORTS - Orc_Tamer's Recipe System 2.0

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)

//===========================================================================
// 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 :)

Demo Map Added! Check It Out!
Attached Files
File Type: w3x RecipeSystem-V2.w3x (20.4 KB, 22 views)
__________________


Read the Rules
Use Search

Ahoy! Me Hardies
Orc_Tamer is offline  
Old 01-02-2008, 10:57 PM   #2 (permalink)

User
 
Join Date: Oct 2006
Posts: 51

Oninuva has little to show at this moment (1)


Nice. Me Likey.
__________________
-Oninuva
Gamerz-Forum Admin
Oninuva is offline  
Old 01-08-2008, 09:24 AM   #3 (permalink)
 
WildField's Avatar

Pro Jasser (Really pro)
 
Join Date: Dec 2007
Posts: 48

WildField has little to show at this moment (6)


Too complex system.....
__________________
call ExecuteFunc("Destroy your brains")
WildField is offline  
Old 01-18-2008, 09:14 PM   #4 (permalink)

iRawr
 
Join Date: Dec 2005
Posts: 8,349

PurplePoot is a splendid one to behold (807)PurplePoot is a splendid one to behold (807)PurplePoot is a splendid one to behold (807)

Paired Mapping Contest #4 Winner: Fallen Angel - Lucifer's Keep Respected User: This user has been given the respected user award. Map Development Mini-Contest #1 Winner: Stand of the Elements 

There's no advantage to use structs here, and it will force people to get JassNewGen. (Maybe that last bit isn't so bad :P)

Also, you could do this easily with an item array, and always having 6 item-id parameters for the recipe function; let people leave unused ones as 0. (And write some wrappers if you're concerned newbs may not get it)
PurplePoot is offline  
Old 02-06-2008, 11:10 PM   #5 (permalink)

iRawr
 
Join Date: Dec 2005
Posts: 8,349

PurplePoot is a splendid one to behold (807)PurplePoot is a splendid one to behold (807)PurplePoot is a splendid one to behold (807)

Paired Mapping Contest #4 Winner: Fallen Angel - Lucifer's Keep Respected User: This user has been given the respected user award. Map Development Mini-Contest #1 Winner: Stand of the Elements 

Bump .
PurplePoot is offline  
Old 03-11-2008, 01:55 PM   #6 (permalink)
 
Matrix's Avatar

User
 
Join Date: Jan 2007
Posts: 59

Matrix has little to show at this moment (2)


Quote:
Originally Posted by WildField View Post
Too complex system.....
+1

I just dont get why u use vjass if it can be done without it.
And i think it not worth to get it unless u have less then 50 recipe items.

But still gj
__________________

Download Roshan Wars v0.4b
Download Simple Recipe System v1.02 New**
Download DamageUnitOverTime
Download Simple Filter System v1.0
I stand for the Light..
The Light is my strength!
Matrix is offline  
Old 03-13-2008, 11:55 PM   #7 (permalink)
Spell and Map Moderator
 
Dr Super Good's Avatar

The Helpful Personage
 
Join Date: Jan 2005
Posts: 4,261

Dr Super Good is a name known to all (690)Dr Super Good is a name known to all (690)Dr Super Good is a name known to all (690)Dr Super Good is a name known to all (690)


This system is horriadly unefficent.
The ammount of opperations it runs is past exesive to do something which is simple enough to make oneself.

Basically, it will probably be more efficent (and so better) to use a simple if tree system as this might even hit the opt limate if used improperly.

I can not deny that it is a nice script, just it is not the most efficent for its task.
Dr Super Good is offline  
Old 08-01-2008, 07:09 AM   #8 (permalink)

iRawr
 
Join Date: Dec 2005
Posts: 8,349

PurplePoot is a splendid one to behold (807)PurplePoot is a splendid one to behold (807)PurplePoot is a splendid one to behold (807)

Paired Mapping Contest #4 Winner: Fallen Angel - Lucifer's Keep Respected User: This user has been given the respected user award. Map Development Mini-Contest #1 Winner: Stand of the Elements 

Graveyarded due to lack of activity on the part of the author.
PurplePoot is offline  
 

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
[vJass]VoteKick System Venks "Graveyard" 2 08-08-2008 08:37 AM
[vJASS] CG's Transmission System Captain Griffen JASS Functions 6 04-05-2008 05:14 PM
[vJASS] CG's Music System Captain Griffen JASS Functions 2 03-22-2008 10:57 PM
Recipe System need serius help Tan World Editor Help Zone 9 10-02-2007 06:11 PM
[JASS] Recipe System Help August Triggers & Scripts 1 01-20-2006 01:52 AM

All times are GMT. The time now is 09:30 AM.






Your link here 
Loans | Debt Consolidation | Mortgage Calculator | Cell Phone | Industrial Noise Control
Powered by vBulletin®
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.2.0
Copyright©Ralle