RPG Item System Stuff!

Waaaaagh

I lost all my rep and my title being a jerk
Reaction score
70
Hey all. Just wondering, what do you want in an rpg item system?

Currently planned features for mine-

Items:

1) Bags - Done Completely!!!
2) Stacking Items - Done Completely!!!
3) Item Based Spellbooks
4) Pick Up Anytime Items - Done Completely!!!
5) Equipment System - Done Completely!!!
6) Item Encumbrance
7) Item Durability - Pending...
8) Item Based Merchant with Variable Item Costs
9) Equipment Augmentations

Heroes:

10) Max Level Skill Point Gain
11) On Level Attributer
12) Hero Alignment

If you have any suggestions for things you would like to see, I wanna hear 'em, so I can maybe implement them.



Because I want to show that this is not all just theorizing, here is my WIP code:

JASS:
scope WMI
 
    globals
        private constant integer Nextpage = 'I002'
        private constant integer Cancel = 'I001'
        private constant integer Blank = 'I003'
    endglobals
 
    private function H2I takes handle h returns integer
        return h
        return 0
    endfunction
    
    globals
        private sound aSimError
    endglobals
    
    private function SimError takes player p, string msg returns nothing
		if(aSimError==null)then
            set aSimError=CreateSoundFromLabel( "InterfaceError",false,false,false,10,10)
            call StartSound(aSimError)
        endif
        if(GetLocalPlayer()==p)then
			call ClearTextMessages()
			call DisplayTimedTextToPlayer(p,0.52,-1.00,2.00,"|cffffcc00"+msg+"|r")
			call StartSound(aSimError)
		endif
	endfunction
    
    private function UnitGetItemSlot takes unit u,item i returns integer
        local integer a=0
        loop
            exitwhen a>5
            if(i==UnitItemInSlot(u,a))then //Found it
                return a
            endif
            set a=a+1
        endloop
        return -1 //Not found
    endfunction
 
    //! runtextmacro HASHTABLE("Mitems","private")
    //! runtextmacro HASHTABLE("PUAs","private")
    //! runtextmacro HASHTABLE("A","private")
    
    struct pitem
    
        //The pitem is basically an improved version of the item.
        //It contains information about the item, as well as a
        //group of methods for enhancing the functionality of the
        //pitem. There are two purposes for the pitem in WMI:
        //1) It is passed through methods as its own type
        //2) It allows an item to be picked up at any time, even
        //if inventory is full.
        
        item main
        item PUA
        integer PUAid
        
        method getmain takes nothing returns item
            return .main
        endmethod
        
        method getPUA takes nothing returns item
            return .PUA
        endmethod
        
        static method is takes item i returns boolean
            local real l=GetWidgetLife(i)
            if(l==74.)then //It's a main.
                return HashtableMitems.containsKey(H2I(i))
            elseif(l==73.)then //PUA!!!!!
                return HashtablePUAs.containsKey(H2I(i))
            endif
            return false
        endmethod
        
        static method get takes item i returns pitem
            local real l=GetWidgetLife(i)
            if(l==74.)then //It's a main.
                return HashtableMitems.get(H2I(i))
            elseif(l==73.)then //PUA!!!!!
                return HashtablePUAs.get(H2I(i))
            endif
            return 0
        endmethod
        
        static method TryStack takes hero h, pitem p returns boolean
            local integer a=0
            local item temp
            local integer id=GetItemTypeId(p.main)
            local integer max=GetItemLevel(p.main)
            local integer charges
            local integer tempcharges
            loop
                exitwhen a>5
                set temp=UnitItemInSlot(h.hero,a)
                if(GetItemTypeId(temp)==id)then //Matching types
                    set charges=GetItemCharges(p.main)
                    set tempcharges=GetItemCharges(temp)
                    if(tempcharges+charges>max)then //Too many!
                        if(tempcharges==max)then //Full
                        else //Add remainder
                            set tempcharges=max-tempcharges //The number left to add
                            call SetItemCharges(p.main,charges-tempcharges)
                            call SetItemCharges(temp,max)
                        endif
                    else //Just add them all
                        call SetItemCharges(temp,tempcharges+charges)
                        call p.destroy()
                        return true
                    endif
                endif
                set a=a+1
            endloop
            return false
        endmethod
        
        static method TryAdd takes hero h, pitem p returns boolean
            local integer a=0
            local item temp
            local integer state=h.state
            set h.state=-1
            if(state==0)then //MAIN!!!
                call SetItemVisible(p.main,true)
                if(not UnitAddItem(h.hero,p.main))then //Needs to be hidden again
                    call SetItemVisible(p.main,false)
                else
                    call TriggerSleepAction(0)
                    set h.state=state
                    return true
                endif
            elseif(state==1)then //BAG!!!
                loop
                    exitwhen a>3
                    set temp=UnitItemInSlot(h.hero,a)
                    if(GetItemTypeId(temp)==Blank)then //It's a blank
                        call UnitRemoveItem(h.hero,temp)
                        call RemoveItem(temp)
                        call SetItemVisible(p.main,true)
                        call UnitAddItem(h.hero,p.main)
                        call TriggerSleepAction(0)
                        set h.state=state
                        return true
                    endif
                    set a=a+1
                endloop
            endif
            set h.state=state
            return false
        endmethod
        
        static method TryBag takes hero h, pitem p returns boolean
            local bag b=h.openbag
            return b.addpitem(p)
        endmethod
        
        static method TryMain takes hero h, pitem p returns boolean
            local integer a=1
            local integer id=GetItemTypeId(p.main)
            local integer max=GetItemLevel(p.main)
            local integer charges
            local integer tempcharges
            loop
                exitwhen a>6
                if(GetItemTypeId(h.pitems[a].main)==id)then //Matching types
                    set charges=GetItemCharges(p.main)
                    set tempcharges=GetItemCharges(h.pitems[a].main)
                    if(tempcharges+charges>max)then //Too many!
                        if(tempcharges==max)then //Full
                        else //Add remainder
                            set tempcharges=max-tempcharges //The number left to add
                            call SetItemCharges(p.main,charges-tempcharges)
                            call SetItemCharges(h.pitems[a].main,max)
                        endif
                    else //Just add them all
                        call SetItemCharges(h.pitems[a].main,tempcharges+charges)
                        call p.destroy()
                        return true
                    endif
                endif
                set a=a+1
            endloop
            set a=1
            loop
                exitwhen a>6
                if(h.pitems[a]==0)then //It's empty
                    set h.pitems[a]=p
                endif
                set a=a+1
            endloop
            return false
        endmethod
        
        static method TryBags takes hero h, pitem p returns boolean
            local integer a=1
            loop
                exitwhen a>6
                if(bag.is(h.pitems[a]) and bag.get(h.pitems[a]).addpitem(p))then //It was added to the bag!
                    return true
                endif
                set a=a+1
            endloop
            return false
        endmethod
        
        static method Pickup takes nothing returns nothing
            local pitem p=pitem.get(GetManipulatedItem())
            local hero h=HashtableA.get(H2I(GetTriggeringTrigger()))
            local real x
            local real y
            if(GetManipulatedItem()==p.PUA)then //A PUA was picked
                set x=GetItemX(p.PUA)
                set y=GetItemY(p.PUA)
                call HashtablePUAs.remove(H2I(p.PUA))
                set p.PUA=CreateItem(p.PUAid,x,y)
                call SetWidgetLife(p.PUA,73.)
                call SetItemInvulnerable(p.PUA,true)
                call SetItemVisible(p.PUA,false)
                if(not pitem.TryStack(h,p))then //Try again
                if(not pitem.TryAdd(h,p))then //Try again
                if(h.state==1 and not pitem.TryBag(h,p))then //Try once more
                if(h.state>1 and not pitem.TryMain(h,p))then //One more time
                if(h.state>1 and not pitem.TryBags(h,p))then //FAILURE.
                    call SetItemVisible(p.PUA,true) //Make the PUA visible again.
                endif //Lines up nice xD
                endif //Lines up nice xD
                endif //Lines up nice xD <---- PUA Comments Here
                endif //Lines up nice xD
                endif //Lines up nice xD
            elseif(GetManipulatedItem()==p.main and h.state==0)then //MAIN AHOY!!!
                set h.pitems[UnitGetItemSlot(h.hero,p.main)+1]=p
            endif
        endmethod
        
        static method Drop takes nothing returns nothing
            local pitem p=pitem.get(GetManipulatedItem())
            local hero h=HashtableA.get(H2I(GetTriggeringTrigger()))
            local real x
            local real y
            if(h.state==0 and GetManipulatedItem()==p.main)then //He dropped a main from main!
                call TriggerSleepAction(0)
                set x=GetItemX(p.main)
                set y=GetItemY(p.main)
                call SetItemVisible(p.main,false)
                call SetItemVisible(p.PUA,true)
                call SetItemPosition(p.PUA,x,y)
            endif
        endmethod
        
        static method create takes integer id, integer puaid, real x, real y returns pitem
            local pitem p=pitem.allocate()
            set p.main=CreateItem(id,0.,0.)
            call SetWidgetLife(p.main,74.)
            call SetItemInvulnerable(p.main,true)
            call SetItemVisible(p.main,false)
            call HashtableMitems.put(H2I(p.main),p)
            set p.PUA=CreateItem(puaid,x,y)
            set p.PUAid=puaid
            call SetWidgetLife(p.PUA,73.)
            call SetItemInvulnerable(p.PUA,true)
            call SetItemVisible(p.PUA,false)
            call HashtablePUAs.put(H2I(p.PUA),p)
            return p
        endmethod
        
        method onDestroy takes nothing returns nothing
            call HashtableMitems.remove(H2I(.main))
            call HashtablePUAs.remove(H2I(.PUA))
            call RemoveItem(.main)
            call RemoveItem(.PUA)
        endmethod
    endstruct
 
 
    struct hero
        
        //The hero is the frame upon which WMI is built. 
        //Only heroes can access the advanced features
        //of the system, and creating one is as simple
        //as creating a unit. Just call:
        //
        //hero.create(player p,integer id, real x, real y, real facing)
        //
        //to create a hero with full WMI enhancement.
        
        unit hero
        player owner
        integer state //0=main 1=bag 2=book 3=shop
        integer maxlevel
        integer fakemaxlevel
        integer fakelevel
        trigger pickup
        trigger use
        trigger order
        trigger drop
        trigger levelup
        item nextpage
        item cancel
        bag openbag
        //book openbook
        //shop openshop
        pitem array pitems[6]
        
        
        method clearinv takes nothing returns nothing
            local integer a=0
            local item temp
            local integer state=.state
            set .state=-1
            if(state==0)then //MAIN
                loop
                    exitwhen a==.pitems.size
                    set temp=UnitItemInSlot(.hero,a)
                    if(GetItemTypeId(temp)==Blank)then
                        set .pitems[a]=0
                        call RemoveItem(temp)
                    else
                        set .pitems[a]=pitem.get(temp)
                        call UnitRemoveItem(.hero,temp)
                        call SetItemVisible(temp,false)
                    endif
                    set a=a+1
                endloop
            elseif(state==1)then //BAG
                loop
                    exitwhen a==.pitems.size
                    set temp=UnitItemInSlot(.hero,a)
                    if(GetItemTypeId(temp)==Blank)then
                        set .openbag.pitems[(.openbag.currentpage-1)*4+a]=0
                        call RemoveItem(temp)
                    else
                        if(a<5)then
                            set .openbag.pitems[(.openbag.currentpage-1)*4+a]=pitem.get(temp)
                        endif
                        call UnitRemoveItem(.hero,temp)
                        call SetItemVisible(temp,false)
                    endif
                    set a=a+1
                endloop
            elseif(state>1)then //OTHERS
                loop
                    exitwhen a==.pitems.size
                    set temp=UnitItemInSlot(.hero,a)
                    if(GetItemTypeId(temp)==Blank)then
                        call RemoveItem(temp)
                    else
                        call UnitRemoveItem(.hero,temp)
                        call SetItemVisible(temp,false)
                    endif
                    set a=a+1
                endloop
            endif
            call TriggerSleepAction(0)
            set .state=state
        endmethod
        
        method restoreinv takes nothing returns nothing
            local integer a=0
            set .state=-1
            loop
                exitwhen a==.pitems.size
                call SetItemVisible(.pitems[a].main,true)
                call UnitAddItem(.hero,.pitems[a].main)
                set a=a+1
            endloop
            call TriggerSleepAction(0)
            set .state=0
        endmethod
        
        method setmaxlevel takes integer level, integer fakelevel returns nothing
            if(level>99)then
                set level=99
            elseif(level<1)then
                set level=1
            endif
            if(fakelevel<1)then
                set fakelevel=1
            endif
            if(GetHeroLevel(.hero)>level)then
                call SetHeroLevel(.hero,level,true)
            endif
            set .maxlevel=level
            if(fakelevel<.fakelevel)then
                set .fakelevel=fakelevel
            endif
            set .fakemaxlevel=fakelevel
        endmethod
        
        static method LevelUp takes nothing returns nothing
            local hero h=HashtableA.get(H2I(GetTriggeringTrigger()))
            local integer level=GetHeroLevel(h.hero)
            if(level>h.maxlevel)then //Gonna need to set that back down
                call SetHeroLevel(h.hero,h.maxlevel,false)
                set h.fakelevel=h.fakelevel+1
                if(h.fakelevel>h.fakemaxlevel)then //No points for you. Sorry.
                    set h.fakelevel=h.fakemaxlevel
                else //Add some skill points.
                    call UnitModifySkillPoints(h.hero,1)
                endif
            endif
        endmethod
        
        static method create takes player p, integer id, real x, real y, real face returns hero
            local hero h=hero.allocate()
            set h.hero=CreateUnit(p,id,x,y,face)
            set h.owner=p
            set h.state=0
            set h.maxlevel=10
            set h.fakemaxlevel=10
            set h.fakelevel=1
            set h.pickup=CreateTrigger()
            set h.use=CreateTrigger()
            set h.order=CreateTrigger()
            set h.drop=CreateTrigger()
            set h.levelup=CreateTrigger()
            call HashtableA.put(H2I(h.pickup),h)
            call HashtableA.put(H2I(h.use),h)
            call HashtableA.put(H2I(h.order),h)
            call HashtableA.put(H2I(h.drop),h)
            call HashtableA.put(H2I(h.levelup),h)
            call TriggerRegisterUnitEvent(h.pickup,h.hero,EVENT_UNIT_PICKUP_ITEM)
            call TriggerRegisterUnitEvent(h.use,h.hero,EVENT_UNIT_USE_ITEM)
            call TriggerRegisterUnitEvent(h.order,h.hero,EVENT_UNIT_ISSUED_TARGET_ORDER)
            call TriggerRegisterUnitEvent(h.drop,h.hero,EVENT_UNIT_DROP_ITEM)
            call TriggerRegisterUnitEvent(h.levelup,h.hero,EVENT_UNIT_HERO_LEVEL)
            call TriggerAddAction(h.pickup,function pitem.Pickup)
            call TriggerAddAction(h.pickup,function bag.Pickup)
            call TriggerAddAction(h.use,function bag.Use)
            call TriggerAddAction(h.order,function bag.Order)
            call TriggerAddAction(h.drop,function pitem.Drop)
            call TriggerAddAction(h.levelup,function hero.LevelUp)
            set h.nextpage=CreateItem(Nextpage,0,0)
            set h.cancel=CreateItem(Cancel,0,0)
            set h.openbag=0
            return h
        endmethod
    endstruct
    
    //! runtextmacro HASHTABLE("Bags","private")
    //! runtextmacro HASHTABLE("BagUse","private")
    //! runtextmacro HASHTABLE("BagOrder","private")
    
    struct bag
        pitem bag
        pitem array pitems[20]
        integer index
        integer currentpage
        triggeraction use
        triggeraction order
        hero owner
        
        static method is takes pitem p returns boolean
            return HashtableBags.containsKey(H2I(p.main))
        endmethod
        
        static method get takes pitem p returns bag
            return HashtableBags.get(H2I(p.main))
        endmethod
        
        static method Pickup takes nothing returns nothing
            local hero h=HashtableA.get(H2I(GetTriggeringTrigger()))
            local pitem p=pitem.get(GetManipulatedItem())
            if(bag.is(p))then
                set bag.get(p).owner=h
            endif
        endmethod
        
        static method Use takes nothing returns nothing //Actions for when a hero uses an item.
            local hero h=HashtableA.get(H2I(GetTriggeringTrigger())) //Get the hero from the trigger
            local item it=GetManipulatedItem()
            local pitem p
            local bag b
            if(h.state==1 and it==h.nextpage)then //Nextpage button
                call h.clearinv()
                call h.openbag.nextpage()
            elseif(h.state==1 and it==h.cancel)then //Cancel the bag
                call h.clearinv()
                call h.restoreinv()
            else
                set p=pitem.get(it)
                if(bag.is(p))then //A bag was used
                    set b=bag.get(p)
                    call h.clearinv()
                    call b.showpage(b.currentpage)
                endif
            endif
        endmethod
        
        static method Order takes nothing returns nothing //Actions for when a hero issued an order.
            local hero h=HashtableA.get(H2I(GetTriggeringTrigger()))
            local bag b
            local integer order=GetIssuedOrderId()
            local integer dropslot=order-852002
            local pitem dragged=pitem.get(GetOrderTargetItem())
            local pitem dropped=pitem.get(UnitItemInSlot(h.hero,dropslot))
            local integer dragslot=UnitGetItemSlot(h.hero,dragged.main)
            local integer state=h.state
            set h.state=-1
            if(state==0 or order<852002 or order>852007)then
                return
            endif
            if(bag.is(dragged) and state==0)then //Add it to the bag.
                set b=bag.get(dragged)
                if(not b.addpitem(dropped))then
                    call SimError(h.owner,"That bag is full.")
                else
                    call UnitRemoveItem(h.hero,dropped.main)
                    call SetItemVisible(dropped.main,false)
                    call SetItemCharges(b.bag.main,b.index)
                endif
                call UnitDropItemSlot(h.hero,dragged.main,dropslot)
            elseif(dragged.main==h.cancel and state==1)then
                set b=h.openbag
                if(dragged.main!=dropped.main)then //We needs to be dropping that item out.
                    set dropped=b.removepitem((b.currentpage-1)*4+dragslot)
                    if(UnitDropItemSlot(h.hero,dragged.main,dropslot))then
                        call UnitAddItemById(h.hero,Blank)
                    endif
                else //Double Cancel Drop. Go to last page.
                    call h.clearinv()
                    call b.showpage(100) //Should max out the page. If not, you're crazy.
                endif
            elseif(dragged.main==h.nextpage and state==1)then
                set b=h.openbag
                if(dragged.main!=dropped.main)then //It was dropped on nextpage. WTF do we do?
                    if(b.readdpitem(dropped))then //This should always work
                        call UnitDropItemSlot(h.hero,dragged.main,dropslot)
                        call h.clearinv()
                        call b.showpage(b.currentpage)
                    else
                        call BJDebugMsg("ReAdd Failure")
                    endif
                else //I delcare a double nextpage drop!!! Go to first page.
                    call h.clearinv()
                    call b.showpage(-1) //Should get the first page
                endif
            endif
            
        endmethod
        
        static method create takes integer id, integer puaid, real x, real y returns bag
            local bag b=bag.allocate()
            set b.bag=pitem.create(id,puaid,x,y)
            call HashtableBags.put(H2I(b.bag.main),b)
            set b.index=0
            return b
        endmethod
        
        method addpitem takes pitem p returns boolean
            local integer a=0
            local integer id=GetItemTypeId(p.main)
            local integer max=GetItemLevel(p.main)
            local integer charges
            local integer tempcharges
            set .index=.index+1
            loop //Check for pre-existing pitem.
                exitwhen a>.index
                if(.pitems[a]==p)then //Already there, bitch!
                    if(.index>=.pitems.size)then
                        set .index=.pitems.size-1
                    endif
                    return false
                endif
                set a=a+1
            endloop
            set a=1
            loop
                exitwhen a>.index
                if(GetItemTypeId(.pitems[a].main)==id)then //Same type
                    set charges=GetItemCharges(p.main)
                    set tempcharges=GetItemCharges(.pitems[a].main)
                    if(tempcharges+charges>max)then //Too many!
                        if(tempcharges==max)then //Full
                        else //Add remainder
                            set tempcharges=max-tempcharges //The number left to add
                            call SetItemCharges(p.main,charges-tempcharges)
                            call SetItemCharges(.pitems[a].main,max)
                        endif
                    else //Just add them all
                        call SetItemCharges(.pitems[a].main,tempcharges+charges)
                        call p.destroy()
                        if(.index>=.pitems.size)then
                            set .index=.pitems.size-1
                        endif
                        return true
                    endif
                endif
                set a=a+1
            endloop
            if(.index>=.pitems.size)then
                set .index=.pitems.size-1
                return false
            endif
            //Made it past all the shit. Just add the pitem!
            set .pitems[.index]=p
            return true
        endmethod
        
        method removepitem takes integer index returns pitem
            local pitem p=.pitems[index]
            local integer a=0
            local integer id=GetItemTypeId(p.main)
            local integer max=GetItemLevel(p.main)
            local integer charges
            local integer tempcharges
            if(.index>.pitems.size-1)then
                set .index=.pitems.size-1
            endif
            loop
                exitwhen index==.pitems.size
                if(index<.pitems.size-1)then
                    set .pitems[index]=.pitems[index+1]
                else
                    set .pitems[.pitems.size-1]=0
                endif
                set index=index+1
            endloop
            set .index=.index-1
            loop
                exitwhen a==.owner.pitems.size
                if(GetItemTypeId(.pitems[a].main)==id)then //Same type
                    set charges=GetItemCharges(p.main)
                    set tempcharges=GetItemCharges(.owner.pitems[a].main)
                    if(tempcharges+charges>max)then //Too many!
                        if(tempcharges==max)then //Full
                        else //Add remainder
                            set tempcharges=max-tempcharges //The number left to add
                            call SetItemCharges(p.main,charges-tempcharges)
                            call SetItemCharges(.owner.pitems[a].main,max)
                        endif
                    else //Just add them all
                        call SetItemCharges(.owner.pitems[a].main,tempcharges+charges)
                        call p.destroy()
                        return 0
                    endif
                endif
                set a=a+1
            endloop
            set a=0
            loop
                exitwhen a==.owner.pitems.size
                if(.owner.pitems[a]==0)then //Blank. Add it.
                    set .owner.pitems[a]=p
                    call UnitRemoveItem(.owner.hero,p.main)
                    call SetItemVisible(p.main,false)
                    return p
                endif
                set a=a+1
            endloop
            call UnitRemoveItem(.owner.hero,p.main)
            call SetItemVisible(p.main,false)
            call SetItemVisible(p.PUA,true)
            call SetItemPosition(p.PUA,GetUnitX(.owner.hero),GetUnitY(.owner.hero))
            call SimError(.owner.owner,"No room left in inventory.")
            return p
        endmethod
        
        method readdpitem takes pitem p returns boolean
            local integer a=0
            local boolean bool=false
            loop
                exitwhen a==.pitems.size
                if(.pitems[a]==p)then //Found it.
                    set bool=true
                endif
                if(bool)then
                    if(a<.pitems.size-1)then //Set it to the one above
                        set .pitems[a]=.pitems[a+1]
                    else //Null it
                        set .pitems[a]=0
                    endif
                endif
                set a=a+1
            endloop
            if(bool)then
                return .addpitem(p)
            endif
            return false
        endmethod
        
        method showpage takes integer page returns nothing
            local hero h=.owner
            local integer a=0
            if(h==0)then
                return
            endif
            if(page>5)then
                set page=5
            elseif(page<1)then
                set page=1
            endif
            set h.state=-1
            set .currentpage=page
            set page=(page-1)*4
            loop
                exitwhen a>3
                if(.pitems[page+a]==0)then //It's blank
                    call UnitAddItemById(h.hero,Blank)
                else //pitem is there, so show it!
                    call UnitAddItem(h.hero,.pitems[page+a].main)
                endif
                set a=a+1
            endloop
            call UnitAddItem(h.hero,h.nextpage)
            call SetItemCharges(h.nextpage,.currentpage)
            call UnitAddItem(h.hero,h.cancel)
            call SetItemCharges(h.nextpage,5)
            call TriggerSleepAction(0)
            set h.state=1
        endmethod
        
        method nextpage takes nothing returns nothing
            if(.currentpage<5)then
                call .showpage(.currentpage+1)
            else
                call .showpage(1)
            endif
        endmethod
    endstruct
    
    //===========================================================================
    public function InitTrig takes nothing returns nothing
    endfunction

endscope
 

Attachments

  • BagScrns.jpg
    BagScrns.jpg
    41.9 KB · Views: 181

Ghan

Administrator - Servers are fun
Staff member
Reaction score
888
> 1) Bags

I would like to see some encumberance with that.
If you have say, 10 items in your bags, you should lose a little movement speed carrying that weight....
 

Waaaaagh

I lost all my rep and my title being a jerk
Reaction score
70
Hmmm.... noted.


It would be easy enough to do. However, I wanna try and keep my bags to a small size (20 at most, although any size is possible). I may redesign the item to intercept CreateItem() and give it a real value "encumbrance", thus making items, even not in a bag, encumber your hero with differing rates (even between the same item type). Of course, all information about the item could be viewed with a simple double right click. The coolest part is that I could make bags have an encumbrance value, with a larger value for larger bags. Yay!


More cool ideas I say!
 

Ghan

Administrator - Servers are fun
Staff member
Reaction score
888
Item durability.
Think that leather vest will last forever?
Guess again! :p
 

Psiblade94122

In need of sleep
Reaction score
138
I personaly would enjoy seeing a stat system that works like Ragnorok's stat system, where as you level up you gain more stat points (as in, level 1-10 you gain 3 level 11-20 you gain 5) but as you increse a stat, itll reqire more points to level it up

a system like that would encourage diffrent biulds instead of just pure biulding
 

Xapphire

Liberty, Simply said; a lie.
Reaction score
45
What I would love, like these are suggestions so, don't take them the wrong way :).

1.) Neat Color Coded, Stat and Name, and Effect system, like A Wizards Wand
Wizard's Wand
Damage: 15-20
Type: Ranged
Element: Magic

Effect: On use this wand will fire a magical beam, dealing (...) to the enemy.

*Uses* 5/10

Classes: Mage, Monk, Priest, Warlock, Necromancer
And perhaps have a simple way of adding new items... perhaps not even including the items in the triggers, but the triggers implementing the effect, damage, by what the ability of the item is ^.^

2.) A System of item material, like wood wont penetrate metal, but sharp steel wont penetrate mithril.. etc..

3.) Magic Enhancements..

4.) Weights, Durability, size limits.. Realistic stuff.

5.) real corpse looting..

6.) Class system, as well as melee and ranged type, like wand make attack ranged.. etc..

7.) a different inventory counting as the belt for potions, bags..

8.) And last, a unique system of money, as in, you loot money, it is in your inventory, lets say you die, you loose all your money, but when you retrieve your bag, it comes back, random money spills, type of money, like screw the gold... ^.^..

These are ideas, if you can do these, in the actual map system, be sure to include a simple way of implementing items, so far, none of the systems Ive seen, had simple enough implements, xcept for like 2 %.%
 

Waaaaagh

I lost all my rep and my title being a jerk
Reaction score
70
Maaargh. Yikes. Well, I guess that would go with equipment, right? No worries then. That could also be done. I would intercept equipment.create() and add in a max durability (integer). It would be rather basic, however. Each time an item is used (a weapon is used when a successful attack is made, armour is used when you are hit, and, of course, if you cast a spell attached to your 'enchanted' equipment, that uses a durability point). The issue here comes in displaying durability.

Current plan:

Double right click an item. It is transfered to slot 1 (top left). In slot 2 (top right), there is an item with the "Load Unit" icon, for "equip", or an "Unload Unit" icon if the item is already equipped. If the item is not equippable, there is a "Disabled" equip button. In Slot 3, there is a "stack" button, which opens up the stack screen. In Slot 4, there is a "View Stats" button. Slot 5 has room for another option. Slot 6 is a cancel button which reverts to wherever your were.

If you click view stats, then your item stays in Slot 1, and Cancel moves to Slot 2 (clicking it will exit to the "Item Options" page).Slot 3 has a generic "Durability Points" icon, which show your item's current durability (with charges). Slot 4 has a generic "Max Durability Points" icon (also uses charges). Slot 5 has room. Slot six shows "encumbrance" (with charges).


EDIT: Simple Item implementations? Well... Jass is required, but, you can do:


JASS:
pitem.create(integer id, integer PUAid, integer encumbrance, real x, real y)
bag.create(integer id, integer PUAid, integer encumbrance, real x, real y)
spellbook.create(integer id, integer PUAid, integer encumbrance, real x, real y)
equipment.create(integer id, integer PUAid, integer kind, integer encumbrance, integer durabilitymax, real x, real y)


In equipment, the kind of equipment it is takes an integer, but I will have globals like damage type, so you can put:

JASS:
EQUIPTYPE_WEAPON_SINGLE
EQUIPTYPE_WEAPON_DOUBLE
EQUIPTYPE_HANDS
EQUIPTYPE_WRISTS

EQUIPTYPE_HELM
EQUIPTYPE_ARMOR
EQUIPTYPE_PANTS
EQUIPTYPE_BOOTS

EQUIPTYPE_CHARM


As you can maybe see, equipment will be shown in 4 item pages.

Page 1:
Hand Left, Hand Right, Wrists, Hands

Page 2:
Helm, Armor, Pants, Boots

Page 3:
Charm, Charm, Charm, Charm
 

Xapphire

Liberty, Simply said; a lie.
Reaction score
45
Can't wait ^.^.. make sure you give us Screenies of your WIP
 

Waaaaagh

I lost all my rep and my title being a jerk
Reaction score
70
Right now all you'd see is structs xD. I could, of course, "pretend" that the shit is working, and just add items to a hero dude to "replicate" stuff that works. As far as I know, none of this will work until all of it works, if you understand. Except maybe the bag and stack screen.

EDIT: I had an idea for a pocketshop like weaaddar's, with variable item costs which are displayed to you. Masters of merchanting will be able to buy items at full price (instead of mark-up) and sell at full price (instead of at lowered rates). In fact, it may be possible to get a GREAT rate, and buy at reduced price or sell high. It depends on supply and demand.

JASS:
call shop.create(integer id, integer PUAid, integer encumbrance, real x, real y)
call shop.addpitem(pitem p, integer id, integer dummyid, integer maxstock, real restocktime)


So, you have to create a pitem before you can add it to the shop, but, after that, you put it in just like an item, and the shop registers it and all that vJass.
 

waaaks!

Zinctified
Reaction score
255
1. for bags, use inventory system from vexorian
2. its great to have stacking items, so that a unit can hold 1 of a kind item only


I suggest..
1. item upgrades
2. runes for items
 

Waaaaagh

I lost all my rep and my title being a jerk
Reaction score
70
1. for bags, use inventory system from vexorian

It doesn't have the right feel for me. Vex isn't the master of interface, after all. A bag looks and acts nicer, and it has a cap (which I actually want), AND you can keep it closed and just mess with your main inventory, if you REALLY hate it. InvX doesn't have those options.

Runes and upgrades sound doable, but, if I use them, I will need to cap some things. I will think about it.
 

Xapphire

Liberty, Simply said; a lie.
Reaction score
45
Because V = Vexorian Duhhh :p
I didn't notice that b4, you are rly smart, you should try out for HoggWarts ^.^
 

Waaaaagh

I lost all my rep and my title being a jerk
Reaction score
70
Equipment Augmentations are now planned (Gems and Sockets). This is getting complicated xD.

EDIT: Will this be okay?:

JASS:
call augmentation.create(integer id, integer PUAid, integer encumbrance, real x, real y)
call augmentation.setbonus(integer kind, integer abilid)


Kind would be stuff like EQUIPTYPE_HELM, and abilid would be 'A000' or whatever ability you want added to a hero when they equip the item kind.


First reply wins.

I win.

Added Hero Alignment to list.
 

neckface

terrain contest winner! :) dance contest loser. :(
Reaction score
34
a point system on level up (or bought from a trainer). you can put additional points into all attributes: Str Agi Int, Armor, Attack, HP and Mana to further customize your hero.
since ability scores have more value, you would gain less bonus hp if you spent a point upgrading Str as opposed to upgrading HP, and less armor if you upgrade Agi as opposed to Armor, etc.
 

Waaaaagh

I lost all my rep and my title being a jerk
Reaction score
70
a point system on level up (or bought from a trainer). you can put additional points into all attributes: Str Agi Int, Armor, Attack, HP and Mana to further customize your hero.
since ability scores have more value, you would gain less bonus hp if you spent a point upgrading Str as opposed to upgrading HP, and less armor if you upgrade Agi as opposed to Armor, etc.

Probably not. The idea of the 3 stats is that:

A) They create an RPS dynamic
B) They group a bunch of stuff, logically, into 3 categories.

I WILL, however, allow you to choose from these 3 stats on level-up. You can set how many stats a hero gets on levelup, but I don't know what to call the function:

hero.blah(integer points)


Suggestions?

A revival of this thread :O.


I am wondering how I should do encumbrance... a tornado slow aura? My issue is that there are varied encumbrances... SetUnitMoveSpeed would work, except that there may be spells which affect this... My current thought is to make each point of encumbrance directly correlate to one point of movement speed. Will that work? e.g., a unit has 230 base movement speed. It is carrying 210 encumbrance of items. It moves at 20.

* Should encumbrance fall down to 0? (Unable to move)
* If so... should rotation be possible? Spell casting? Attacking?
* If anyone can come up with an easy to read way of displaying encumbrance...
 

0zaru

Learning vJASS ;)
Reaction score
60
but..a if it has a base of 150 movespeeds and it carries 210 then it will be -60 ms ? =/ I should say no,or at least set a base of 0 for all of those that carries more than they can.

I think that it's better to not let them even cast anything.. if they can't move then you can't even cast a thing
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Members online

      No members online now.

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top