[Log in / Register]
| News | Chat | Pastebin | Donations | Tutorials | Rules | Forums |
| Maps | Skins | Icons | Models | Spells | Tools | Jass | Packs | Hosted Projects | Starcraft II Modding | Starcraft II Resources | Galaxy Wiki |
(Keeps Hive Alive)
Go Back   The Hive Workshop > Spells


Reply
 
Thread Tools
The Hive Workshop Spells:
Shop System 1.2
by Adiktuz
Images
Highslide JS
Details
Uploaded:13:11, 20th Apr 2012
Last Updated:10:16, 4th Jun 2012
Keywords:adiktuz, scrolls, rpg, systems, shops, items, subshops, categories, vending, sell, buy
Type:System
Category:vJASS

Basically an upgraded version of the system on my sub-shop tutorial

Jass:
library ShopSystem requires Table, RegisterPlayerUnitEvent
/*
    Version 1.2 by Adiktuz
    
    Credits to Bribe and Magtheridon96 for Table and RegisterPlayerUnitEvent
    
    A simple shop system which allows you to have multiple shops/shopping category inside a single shop.
    
        If you've read my tutorial about sub-shops maybe you'll be asking what is the difference of this 
    to the system in the tutorial. Well, this one uses only one shop per player. Also with this one, all 
    items sold should be set via the trigger editor. 
    
        You can create an infinite-level shop with this one.
        
        You can only register 11 items per catergory
    
    Requirements:
        JNGP with the latest jass helper
        knowledge on how to call functions
        knowledge on how to obtain rawcodes
        knowledge on copying object data and adjusting them
     
    Make sure that the shops you will register with this system doesn't have any items sold
    on its object data 
     
    How to use:

    
    1) Copy the dummy shop, the dummy select unit ability and the dummy click ability from the object editor into your map.
    2) Make sure that you adjust the settings of the dummy shop in case it cannot recognize the dummy
        select unit ability.
    3) Copy this system and Bribe's Table library into your map.
    4) Adjust some of the globals to fit your new map.
    4) Start registering your main shops and items. See attached example trigger for better understanding.
    
    Creating category items
    
    1) Make a new item based on power ups
    2) Add the Dummy Click ability
    3) Make sure you set gold cost to 0 and set model used to none
    
    Functions to toggle shop/item availability
    
    shopAvailableForPlayer(player p, boolean what)
    shopAvailableForPlayerId(integer id, boolean what)
    
    --> Enables or disables the shop system for the player p, or the player with
        PlayerId of id, depending on the setting of boolean what
    
    itemAvailableForPlayer(integer itemid, player p, boolean what)
    itemAvailableForPlayerId(integer itemid, player p, boolean what)
    
    --> Enables or disables the item with the rawcode itemid for player p or the player with
        PlayerId of id, depending on the setting of boolean what
        
*/
    
    globals
        private Table ShopTable
        private Table WhichShop
        private Table MainShop
        private unit array DummyShop
        private boolean array CanShop
        // The next constant is required in order to avoid conflict when more than one player
        // is buying from the same shop
        private constant integer DUMMY_SHOP_ID = 'n000' 
        private hashtable ItemHash = InitHashtable()
    endglobals
    
    private module init
        static method onInit takes nothing returns nothing
            local integer i = 0
            set ShopTable = Table.create()
            set WhichShop = Table.create()
            set MainShop = Table.create()
            set thistype.items = Table.create()
            call RegisterPlayerUnitEvent(EVENT_PLAYER_UNIT_SELECTED, function MainShops.selectShop)
            call RegisterPlayerUnitEvent(EVENT_PLAYER_UNIT_SELL_ITEM, function thistype.changeItems)
            loop
                if GetPlayerSlotState(Player(i)) == PLAYER_SLOT_STATE_PLAYING then
                    set DummyShop[i] = CreateUnit(Player(i),DUMMY_SHOP_ID, 0.0, 0.0, 0.0)
                    // I make the player own it because if not and they are not visible to the player
                    // the selection action actually runs before the dummy gets moved so the selection becomes empty
                    set CanShop[i] = true
                endif
                set i = i + 1
                exitwhen i > 11
            endloop
        endmethod
    endmodule
    

    struct Shops extends array
        
        //integer array items [11]
        static Table items
        integer itemnum
        private static integer instanceCount = 0
        private static thistype recycle = 0
        private thistype recycleNext
        
        
        static method clearShop takes integer id returns nothing
            local integer i = 0
            local thistype this = WhichShop[id]
            loop
                call RemoveItemFromStock(DummyShop[id], thistype.items[this*11 + i])
                set i = i + 1
                exitwhen i > this.itemnum
            endloop
        endmethod
        
        static method changeItems takes nothing returns boolean
            local player p = GetOwningPlayer(GetBuyingUnit())
            local integer i = 0
            local thistype this = ShopTable[GetItemTypeId(GetSoldItem())]
            local integer id = GetPlayerId(p)
            if this == 0 then
                set p = null
                return false
            endif
            call thistype.clearShop(id)
            set WhichShop[id] = this
            loop
                if not LoadBoolean(ItemHash, id, thistype.items[this*11 + i]) then
                    call AddItemToStock(DummyShop[id], thistype.items[this*11 + i], 1,1)
                endif
                set i = i + 1
                exitwhen i == this.itemnum
            endloop
            set p = null
            return false
        endmethod
        
        static method forceChangeItems takes integer baseItem, integer id returns boolean
            local integer i = 0
            local thistype this = ShopTable[baseItem]
            call thistype.clearShop(id)
            set WhichShop[id] = this
            loop
                if not LoadBoolean(ItemHash, id, thistype.items[this*11 + i]) then
                    call AddItemToStock(DummyShop[id], thistype.items[this*11 + i], 1,1)
                endif
                set i = i + 1
                exitwhen i == this.itemnum
            endloop
            return false
        endmethod
        
        static method addItemLink takes integer itemBaseId, integer itemAddId returns nothing
            local thistype this = ShopTable[itemBaseId]
            if this.itemnum < 11 then
                set thistype.items[this*11 + this.itemnum] = itemAddId
                set this.itemnum = this.itemnum + 1
            else
                debug BJDebugMsg("Item list already full")
            endif
        endmethod
        
        static method removeItem takes integer baseItemId, integer itemId returns nothing
            local thistype this = ShopTable[baseItemId]
            local integer i = 0
            loop
                if this.items[this*11 + i] == itemId then
                    set this.itemnum = this.itemnum - 1
                    set thistype.items[this*11 + i] = thistype.items[this*11 + this.itemnum]
                    debug BJDebugMsg("REMOVED " + I2S(thistype.items[this*11 + i]))
                    return
                endif
                set i = i + 1
                exitwhen i == this.itemnum
            endloop
        endmethod
        
        static method duplicate takes integer baseItemId, integer itemId returns nothing
            local thistype base = ShopTable[baseItemId]
            local thistype that //= .allocate()
            local integer i = 0
            if (recycle == 0) then
                set instanceCount = instanceCount + 1
                set that = instanceCount
            else
                set that = recycle
                set recycle = recycle.recycleNext
            endif
            set ShopTable[itemId] = that
            set that.itemnum = base.itemnum
            loop
                set thistype.items[that*11 + i] = thistype.items[base*11 + i]
                set i = i + 1
                exitwhen i == base.itemnum
            endloop
        endmethod
        
        static method register takes integer itemId returns nothing
            local thistype this //= .allocate()
            if (recycle == 0) then
                set instanceCount = instanceCount + 1
                set this = instanceCount
            else
                set this = recycle
                set recycle = recycle.recycleNext
            endif
            set ShopTable[itemId] = this
        endmethod
        
        implement init
    endstruct
    
    struct MainShops extends array
        
        private static integer instanceCount = 0
        private static thistype recycle = 0
        private thistype recycleNext
        
        integer baseItem
        
        static method selectShop takes nothing returns boolean
            local unit u = GetTriggerUnit()
            local thistype this = MainShop[GetHandleId(u)]
            local player p = GetTriggerPlayer()
            local integer id = GetPlayerId(p)
            if this == 0 or not CanShop[id] then
                set p = null
                return false
            endif
            // If you click the portait, it will still point your camera towards the main shop
            call SetUnitX(DummyShop[id], GetUnitX(u))
            call SetUnitY(DummyShop[id], GetUnitY(u))
            call Shops.forceChangeItems(this.baseItem, id)
            if GetLocalPlayer() == p then
                call ClearSelection()
                call SelectUnit(DummyShop[id], true)
            endif
            return false
        endmethod
        
        static method register takes unit shop, integer baseItem returns nothing
            local thistype this //= .allocate()
            
            if (recycle == 0) then
                set instanceCount = instanceCount + 1
                set this = instanceCount
            else
                set this = recycle
                set recycle = recycle.recycleNext
            endif
            
            set MainShop[GetHandleId(shop)] = this
            set this.baseItem = baseItem
        endmethod
        
    endstruct
    
    function shopAvailableForPlayer takes player p, boolean what returns nothing
        set CanShop[GetPlayerId(p)] = what
    endfunction
    
    function shopAvailableForPlayerId takes integer id, boolean what returns nothing
        set CanShop[id] = what
    endfunction
    
    function itemAvailableForPlayer takes integer itemid, player p, boolean what returns nothing
        call SaveBoolean(ItemHash, GetPlayerId(p), itemid, not what)
    endfunction
    
    function itemAvailableForPlayerId takes integer itemid, integer id, boolean what returns nothing
        call SaveBoolean(ItemHash, id, itemid, not what)
    endfunction
    
endlibrary

VersionWhichUsesCohadarsJassHelper

Jass:
library ShopSystem requires Table, RegisterPlayerUnitEvent
/*
    Version 1.2 by Adiktuz
    
    Credits:
    Bribe for Table 
    Magtheridon96 for RegisterPlayerUnitEvent
    Cohadar for his JassHelper update
    
    
    A simple shop system which allows you to have multiple shops/shopping category inside a single shop.
    
        If you've read my tutorial about sub-shops maybe you'll be asking what is the difference of this 
    to the system in the tutorial. Well, this one uses only one shop per player. Also with this one, all 
    items sold should be set via the trigger editor. 
    
        You can create an infinite-level shop with this one.
        
        You can only register 11 items per catergory
    
    Requirements:
        JNGP with the Cohadar's latest jass helper
        knowledge on how to call functions
        knowledge on how to obtain rawcodes
        knowledge on copying object data and adjusting them
     
    Make sure that the shops you will register with this system doesn't have any items sold
    on its object data 
     
    How to use:

    
    1) Copy the dummy shop, the dummy select unit ability and the dummy click ability from the object editor into your map.
    2) Make sure that you adjust the settings of the dummy shop in case it cannot recognize the dummy
        select unit ability.
    3) Copy this system and Bribe's Table library into your map.
    4) Adjust some of the globals to fit your new map.
    4) Start registering your main shops and items. See attached example trigger for better understanding.
    
    Creating category items
    
    1) Make a new item based on power ups
    2) Add the Dummy Click ability
    3) Make sure you set gold cost to 0 and set model used to none
    
    Functions to toggle shop/item availability
    
    shopAvailableForPlayer(player p, boolean what)
    shopAvailableForPlayerId(integer id, boolean what)
    
    --> Enables or disables the shop system for the player p, or the player with
        PlayerId of id, depending on the setting of boolean what
    
    itemAvailableForPlayer(integer itemid, player p, boolean what)
    itemAvailableForPlayerId(integer itemid, integer id, boolean what)
    
    --> Enables or disables the item with the rawcode itemid for player p or the player with
        PlayerId of id, depending on the setting of boolean what
        
*/
    
    globals
        private Table ShopTable
        private Table WhichShop
        private Table MainShop
        private unit array DummyShop
        private boolean array CanShop
        // The next constant is required in order to avoid conflict when more than one player
        // is buying from the same shop
        private constant integer DUMMY_SHOP_ID = 'n000' 
        private hashtable ItemHash = InitHashtable()
    endglobals
    
    private module init
        static method onInit takes nothing returns nothing
            local integer i = 0
            set ShopTable = Table.create()
            set WhichShop = Table.create()
            set MainShop = Table.create()
            set thistype.items = Table.create()
            call RegisterPlayerUnitEvent(EVENT_PLAYER_UNIT_SELECTED, function MainShops.selectShop)
            call RegisterPlayerUnitEvent(EVENT_PLAYER_UNIT_SELL_ITEM, function thistype.changeItems)
            for i = 0 to 11
                if GetPlayerSlotState(Player(i)) == PLAYER_SLOT_STATE_PLAYING then
                    set DummyShop[i] = CreateUnit(Player(i),DUMMY_SHOP_ID, 0.0, 0.0, 0.0)
                    // I make the player own it because if not and they are not visible to the player
                    // the selection action actually runs before the dummy gets moved so the selection becomes empty
                    set CanShop[i] = true
                endif
            endfor
        endmethod
    endmodule
    

    struct Shops extends array
        
        //integer array items [11]
        static Table items
        integer itemnum
        private static integer instanceCount = 0
        private static thistype recycle = 0
        private thistype recycleNext
        
        
        static method clearShop takes integer id returns nothing
            local integer i = 0
            local thistype this = WhichShop[id]
            for i = 0 to this.itemnum
                call RemoveItemFromStock(DummyShop[id], thistype.items[this*11 + i])
            endfor
        endmethod
        
        static method changeItems takes nothing returns boolean
            local player p = GetOwningPlayer(GetBuyingUnit())
            local integer i = 0
            local thistype this = ShopTable[GetItemTypeId(GetSoldItem())]
            local integer id = GetPlayerId(p)
            if this == 0 then
                set p = null
                return false
            endif
            call thistype.clearShop(id)
            set WhichShop[id] = this
            for i = 0 to this.itemnum
                if not LoadBoolean(ItemHash, id, thistype.items[this*11 + i]) then
                    call AddItemToStock(DummyShop[id], thistype.items[this*11 + i], 1,1)
                endif
            endfor
            set p = null
            return false
        endmethod
        
        static method forceChangeItems takes integer baseItem, integer id returns boolean
            local integer i = 0
            local thistype this = ShopTable[baseItem]
            call thistype.clearShop(id)
            set WhichShop[id] = this
            for i = 0 to (this.itemnum - 1)
                if not LoadBoolean(ItemHash, id, thistype.items[this*11 + i]) then
                    call AddItemToStock(DummyShop[id], thistype.items[this*11 + i], 1,1)
                endif
            endfor
            debug BJDebugMsg(I2S(this.itemnum))
            return false
        endmethod
        
        static method addItemLink takes integer itemBaseId, integer itemAddId returns nothing
            local thistype this = ShopTable[itemBaseId]
            if this.itemnum < 11 then
                set thistype.items[this*11 + this.itemnum] = itemAddId
                set this.itemnum = this.itemnum + 1
            else
                debug BJDebugMsg("Item list already full")
            endif
        endmethod
        
        static method removeItem takes integer baseItemId, integer itemId returns nothing
            local thistype this = ShopTable[baseItemId]
            local integer i = 0
            for i = 0 to (this.itemnum - 1)
                if this.items[this*11 + i] == itemId then
                    set this.itemnum = this.itemnum - 1
                    set thistype.items[this*11 + i] = thistype.items[this*11 + this.itemnum]
                    //debug BJDebugMsg("REMOVED " + I2S(thistype.items[this*11 + i]))
                    return
                endif
            endfor
        endmethod
        
        static method duplicate takes integer baseItemId, integer itemId returns nothing
            local thistype base = ShopTable[baseItemId]
            local thistype that //= .allocate()
            local integer i = 0
            if (recycle == 0) then
                set instanceCount = instanceCount + 1
                set that = instanceCount
            else
                set that = recycle
                set recycle = recycle.recycleNext
            endif
            set ShopTable[itemId] = that
            set that.itemnum = base.itemnum
            for i = 0 to (base.itemnum - 1)
                set thistype.items[that*11 + i] = thistype.items[base*11 + i]
            endfor
        endmethod
        
        static method register takes integer itemId returns nothing
            local thistype this //= .allocate()
            if (recycle == 0) then
                set instanceCount = instanceCount + 1
                set this = instanceCount
            else
                set this = recycle
                set recycle = recycle.recycleNext
            endif
            set ShopTable[itemId] = this
        endmethod
        
        implement init
    endstruct
    
    struct MainShops extends array
        
        private static integer instanceCount = 0
        private static thistype recycle = 0
        private thistype recycleNext
        
        integer baseItem
        
        static method selectShop takes nothing returns boolean
            local unit u = GetTriggerUnit()
            local thistype this = MainShop[GetHandleId(u)]
            local player p = GetTriggerPlayer()
            local integer id = GetPlayerId(p)
            if this == 0 or not CanShop[id] then
                set p = null
                return false
            endif
            // If you click the portait, it will still point your camera towards the main shop
            call SetUnitX(DummyShop[id], GetUnitX(u))
            call SetUnitY(DummyShop[id], GetUnitY(u))
            call Shops.forceChangeItems(this.baseItem, id)
            if GetLocalPlayer() == p then
                call ClearSelection()
                call SelectUnit(DummyShop[id], true)
            endif
            return false
        endmethod
        
        static method register takes unit shop, integer baseItem returns nothing
            local thistype this //= .allocate()
            
            if (recycle == 0) then
                set instanceCount = instanceCount + 1
                set this = instanceCount
            else
                set this = recycle
                set recycle = recycle.recycleNext
            endif
            
            set MainShop[GetHandleId(shop)] = this
            set this.baseItem = baseItem
        endmethod
        
    endstruct
    
    function shopAvailableForPlayer takes player p, boolean what returns nothing
        set CanShop[GetPlayerId(p)] = what
    endfunction
    
    function shopAvailableForPlayerId takes integer id, boolean what returns nothing
        set CanShop[id] = what
    endfunction
    
    function itemAvailableForPlayer takes integer itemid, player p, boolean what returns nothing
        call SaveBoolean(ItemHash, GetPlayerId(p), itemid, not what)
    endfunction
    
    function itemAvailableForPlayerId takes integer itemid, integer id, boolean what returns nothing
        call SaveBoolean(ItemHash, id, itemid, not what)
    endfunction
    
endlibrary


Jass:
library Sample initializer init requires ShopSystem
    
    /*
            In this example, we will be making shop which is both a two-level and a three-level shop.
        Here you will be familiarized to the method of registering main shops and linking items to the
        system. We will also make another shop which sells directly what the second level of the other
        shop sells. We will also make a return to upper category dummy item. This was made so that you'll have a better grasp on how to use the system. 
        
            Theoretically, you can create an infinite-level shop using the ShopSystem.
    */
    
    private function create takes nothing returns nothing
        // Create the shop on top
        local unit shop = CreateUnit(Player(15), 'n001', 983.0, -892.0, 270.0)
        /* Register the created shop as a main shop
         I000 is the rawcode of the dummy item which we will use in order to determine
         which items should the shop initialy have
        */
        call MainShops.register(shop, 'I000')
        /* We register I000 to the shop system so that we can now link items to be sold when I000 is sold.
            and since our shop is linked with I000, whenever we click the shop, it will show the items linked
            to I000
        */
        call Shops.register('I000')
        /* Now we will link items to I000, take note that this items will also be used as categories
            so  we will register them to the system too
        */
        call Shops.addItemLink('I000', 'I001') // Equipments
        call Shops.addItemLink('I000', 'I002') // Potions
        // Now it's time to register those two items too
        call Shops.register('I001') //Equipments
        call Shops.register('I002') //Potions
        // Now we will register items to I002 first since we will no longer have any category below potions
        call Shops.addItemLink('I002', 'pgma') //Potion of Mana
        call Shops.addItemLink('I002', 'pghe') //Potion of Health
        // Now we setup another set of links with the equipments category
        call Shops.addItemLink('I001', 'I003') //Weapons
        call Shops.addItemLink('I001', 'I004') //Armor
        call Shops.register('I003') //Weapons
        call Shops.register('I004') //Armor
        // Now we link items to the weapons category
        call Shops.addItemLink('I003', 'ratf') //Blades of attack + 15
        call Shops.addItemLink('I003', 'ofro') //Orb of Frost
        call Shops.addItemLink('I003', 'ssil') //Staff of silence
        call Shops.addItemLink('I003', 'stel') //Staff of teleportation
        call Shops.addItemLink('I003', 'rat6') //Blades of attack + 6
        call Shops.addItemLink('I003', 'rat9') //Blades of attack + 9
        call Shops.addItemLink('I003', 'desc') //Dagger of escape
        call Shops.addItemLink('I003', 'frgd') //Frostgard
        call Shops.addItemLink('I003', 'klmm') //Kilmaim
        call Shops.addItemLink('I003', 'ofir') //Orb of Fire
        call itemAvailableForPlayerId('ofir', 0, false) //we disable selling og Orb of fire for Player Red
        // Now we link items to the armor category
        call Shops.addItemLink('I004', 'ckng') //Crown of kings
        call Shops.addItemLink('I004', 'modt') //Mask of Death
        call Shops.addItemLink('I004', 'rde3') //Ring of protection
        // Now we will create a return to upper category button for the weapons category
        call Shops.duplicate('I001', 'I005') 
        // the .duplicate method automatically registers the new item so no need to call .register
        // Upper category of weapons is equipments so we duplicate its instance into the upper category dummy
        call Shops.addItemLink('I003', 'I005') // Don't forget to link it to the weapons dummy
        // Now we will create another shop at the left which sells the items in the weapons category of our
        // previous shop.
        set shop = CreateUnit(Player(15), 'n001', 93.4, -1430.0, 270.0)
        call MainShops.register(shop, 'I006') 
        // We actually created a new dummy item since this shop cannot have the return to upper
        // category option since it sells the items from the weapons category directly
        // to easily do this:
        call Shops.duplicate('I003', 'I006')  // we duplicate the weapons category
        call Shops.removeItem('I006', 'I005') // but remove the return to upper category item from the duplicated instance.
    endfunction
    
    private function init takes nothing returns nothing
        call TimerStart(CreateTimer(), 2.00, false, function create)
    endfunction
    
endlibrary

Changelog

Version 1.1 - turned the structs into array structs
Version 1.1b - replaced the static integer array with Table
Version 1.1c - fixed the possible cause of the desync when selecting shops
Version 1.1d - ensured that the system won't let more than 11 items per category due to some weird wc3 function...
Version 1.2 - Added functionality to disable the whole shop system or specific items for a player
- Added a version which requires Cohadar's Jass helper update [I changed the loops to use the for i = x to y keyword]


Credits to Bribe and Magtheridon96 for Table and RegisterPlayerUnitEvent
Rating - 0.00 (0 votes)
(Hover and click)
Moderator Comments
Highly Recommended
4th Jun 2012
Bribe: This is well-coded and useful. I would like to use this for when I get back to working on my WarChasers II update as it looks like it's going to save me a lot of time (I hate doing this stuff in object editor and my time is very limited lately). I'll give it 5/5 for now as I can't find any faults myself.

This spell is approved and works properly.


Download ShopSystem 1.2.w3x
(47.24 KB, 289 Downloads)

Old 04-20-2012, 04:17 PM   #2 (permalink)
Registered User Luorax
Invasion in Duskwood
 
Luorax's Avatar
 
Join Date: Aug 2009
Posts: 1,116
Luorax is just really nice (375)Luorax is just really nice (375)Luorax is just really nice (375)Luorax is just really nice (375)
A few quick & small tips:

-Use array structs with 2D array members
- FALSE --> false
-Use this, it's hella useful.
__________________
Luorax is offline   Reply With Quote
Old 04-20-2012, 07:06 PM   #3 (permalink)
Kas
Banned
 
Join Date: Nov 2011
Posts: 370
Kas is on a distinguished road (69)Kas is on a distinguished road (69)
it reminds me of LoL. I think the DotA map makers could use this.
Kas is offline   Reply With Quote
Old 04-20-2012, 07:22 PM   #4 (permalink)
Registered User redkiller
User
 
Join Date: Apr 2012
Posts: 64
redkiller is an unknown quantity at this point (0)
added to my map and when i compile............ tried compiling the your map alone it had no problem.... any ideia?
redkiller is offline   Reply With Quote
Old 04-20-2012, 10:38 PM   #5 (permalink)
Registered User Adiktuz
BusyWithSchool
 
Adiktuz's Avatar
 
Join Date: Oct 2008
Posts: 8,613
Adiktuz has much of which to be proud (1110)Adiktuz has much of which to be proud (1110)Adiktuz has much of which to be proud (1110)Adiktuz has much of which to be proud (1110)Adiktuz has much of which to be proud (1110)Adiktuz has much of which to be proud (1110)
@Luorax

What do you mean about using array struct with 2D array member?...

and oh, I'll replace that false... and yeah, maybe I'll just use Registerblahblah...

@Redkiller

Make sure you have the latest wc3, and JNGP with the latest jass helper...
Adiktuz is offline   Reply With Quote
Old 04-20-2012, 10:51 PM   #6 (permalink)
Registered User redkiller
User
 
Join Date: Apr 2012
Posts: 64
redkiller is an unknown quantity at this point (0)
0.A.2.B.jasshelper.7z

i downloaded that and still gave the same error

Only gives error "ON MY MAP" i can compile your example with no problem

pp say its a jass helper fail..... i have the lastest FOR SURE!

can anyone pass me their jass helper so i can test? or the hole editor
redkiller is offline   Reply With Quote
Old 04-20-2012, 10:53 PM   #7 (permalink)
Registered User Adiktuz
BusyWithSchool
 
Adiktuz's Avatar
 
Join Date: Oct 2008
Posts: 8,613
Adiktuz has much of which to be proud (1110)Adiktuz has much of which to be proud (1110)Adiktuz has much of which to be proud (1110)Adiktuz has much of which to be proud (1110)Adiktuz has much of which to be proud (1110)Adiktuz has much of which to be proud (1110)
Don't post here if you're gonna send me a PM too... or don't PM me if you're gonna post here too... it makes it harder to communicate...

so just choose one...

well, make sure you placed it at the right location... and make sure that JNGP is closed when you update it...

and oh, is that the JH from moyack's site? because there are two .B versions actually... one is from the cJASS project and is older and the other one was the latest JH which is currently being developed by Cohadar which is downloadable from moyack's site...
Adiktuz is offline   Reply With Quote
Old 04-20-2012, 11:22 PM   #8 (permalink)
Registered User redkiller
User
 
Join Date: Apr 2012
Posts: 64
redkiller is an unknown quantity at this point (0)
well i managed to fixed but i gotta a question
player 1 to 10 can build academy=shop

well i tried when player builds it this finds it and regists on the script. can u guys give me a hand?
image 1:
http://i42.tinypic.com/2pt5m69.png
image 2:
http://i40.tinypic.com/292viac.png

Last edited by redkiller; 04-21-2012 at 02:05 AM.
redkiller is offline   Reply With Quote
Old 04-20-2012, 11:24 PM   #9 (permalink)
Registered User Adiktuz
BusyWithSchool
 
Adiktuz's Avatar
 
Join Date: Oct 2008
Posts: 8,613
Adiktuz has much of which to be proud (1110)Adiktuz has much of which to be proud (1110)Adiktuz has much of which to be proud (1110)Adiktuz has much of which to be proud (1110)Adiktuz has much of which to be proud (1110)Adiktuz has much of which to be proud (1110)
rawcodes should be written within ''

sample

'I000'

and put them in hidden tags plese...

and oh, the rawcode that should be placed on the MainShop.register is the rawcode of an item which you will be registering with the system... you will link what you want the acedemy to sell via that item...

and oh, the trigger I sent you will register any Academy that finishes building no matter who made it...

about the second pic, what's the prob?

and oh, I might not be able to answer within one hour...
Adiktuz is offline   Reply With Quote
Old 04-20-2012, 11:35 PM   #10 (permalink)
Registered User redkiller
User
 
Join Date: Apr 2012
Posts: 64
redkiller is an unknown quantity at this point (0)
Quote:
Originally Posted by Adiktuz View Post
rawcodes should be written within ''

sample

'I000'

and put them in hidden tags plese...

and oh, the rawcode that should be placed on the MainShop.register is the rawcode of an item which you will be registering with the system... you will link what you want the acedemy to sell via that item...

and oh, the trigger I sent you will register any Academy that finishes building no matter who made it...

about the second pic, what's the prob?

and oh, I might not be able to answer within one hour...
well what about now?
pic1
http://i42.tinypic.com/359cln6.png
pic2
http://i41.tinypic.com/dolyxy.png

Last edited by redkiller; 04-21-2012 at 02:05 AM.
redkiller is offline   Reply With Quote
Old 04-21-2012, 01:33 AM   #11 (permalink)
Registered User Adiktuz
BusyWithSchool
 
Adiktuz's Avatar
 
Join Date: Oct 2008
Posts: 8,613
Adiktuz has much of which to be proud (1110)Adiktuz has much of which to be proud (1110)Adiktuz has much of which to be proud (1110)Adiktuz has much of which to be proud (1110)Adiktuz has much of which to be proud (1110)Adiktuz has much of which to be proud (1110)
First, I already told you, put those image in HIDDEN TAGS...

for the second one, it should be debug BJDebug something... you seem to have lost it...

look at this, this was the original code...

Jass:
static method addItemLink takes integer itemBaseId, integer itemAddId returns nothing
            local thistype this = ShopTable[itemBaseId]
            if this.itemnum < 11 then
                set this.items[this.itemnum] = itemAddId
                set this.itemnum = this.itemnum + 1
            else
                debug BJDebugMsg("Item list already full")
            endif
        endmethod

for the first one, it has a typo... it should be GetConstructedStructure()

seriously, if you looked at the Trig_Academy_Conditions a few lines above, you would have noticed that there is a typo...

Lastly, I already told you, put those image in HIDDEN TAGS...
Adiktuz is offline   Reply With Quote
Old 04-21-2012, 01:44 AM   #12 (permalink)
Registered User Ruke
( > *_*)>
 
Ruke's Avatar
 
Join Date: Sep 2011
Posts: 171
Ruke has little to show at this moment (35)Ruke has little to show at this moment (35)Ruke has little to show at this moment (35)Ruke has little to show at this moment (35)
Interesting system that you have here :D.

Maybe you can read this tutorial to avoid the traditional ".allocate" method (apparently it makes a lot of trash code).

Nice work :D.

Greetings.

EDIT:

Jass:
local trigger shoptrig = CreateTrigger()
local trigger selectmain = CreateTrigger()

Remove this lines xD.
Ruke is offline   Reply With Quote
Old 04-21-2012, 01:49 AM   #13 (permalink)
Registered User Adiktuz
BusyWithSchool
 
Adiktuz's Avatar
 
Join Date: Oct 2008
Posts: 8,613
Adiktuz has much of which to be proud (1110)Adiktuz has much of which to be proud (1110)Adiktuz has much of which to be proud (1110)Adiktuz has much of which to be proud (1110)Adiktuz has much of which to be proud (1110)Adiktuz has much of which to be proud (1110)
I know... but JH won't let me use array structs because they cannot have array members yet...

Jass:
struct A extends array
      integer array b [10]
endstruct

/*
    JASS helper throws an error saying array structs cannot have array members
*/

I also tried using the custom allocation for non-array structs but it didn't work fine... the system got messed up...

oh, forgot to remove those... thanks

edit: updated...
Adiktuz is offline   Reply With Quote
Old 04-21-2012, 02:14 AM   #14 (permalink)
Registered User redkiller
User
 
Join Date: Apr 2012
Posts: 64
redkiller is an unknown quantity at this point (0)
Quote:
Originally Posted by Adiktuz View Post
First, I already told you, put those image in HIDDEN TAGS...

for the second one, it should be debug BJDebug something... you seem to have lost it...

look at this, this was the original code...

Jass:
static method addItemLink takes integer itemBaseId, integer itemAddId returns nothing
            local thistype this = ShopTable[itemBaseId]
            if this.itemnum < 11 then
                set this.items[this.itemnum] = itemAddId
                set this.itemnum = this.itemnum + 1
            else
                debug BJDebugMsg("Item list already full")
            endif
        endmethod

for the first one, it has a typo... it should be GetConstructedStructure()

seriously, if you looked at the Trig_Academy_Conditions a few lines above, you would have noticed that there is a typo...

Lastly, I already told you, put those image in HIDDEN TAGS...
srry i dk how to put in hidden tags second i didn't lost it cuz its a copy paste of ur code i still get the second error.... its a 100% copy paste

and i copyed thisone it gives the same error (pic2-syntax error)

about the first error srry i had it spelled wrong
redkiller is offline   Reply With Quote
Old 04-21-2012, 02:23 AM   #15 (permalink)
Registered User Ruke
( > *_*)>
 
Ruke's Avatar
 
Join Date: Sep 2011
Posts: 171
Ruke has little to show at this moment (35)Ruke has little to show at this moment (35)Ruke has little to show at this moment (35)Ruke has little to show at this moment (35)
Quote:
Originally Posted by Adiktuz View Post
I know... but JH won't let me use array structs because they cannot have array members yet...

Jass:
struct A extends array
      integer array b [10]
endstruct

/*
    JASS helper throws an error saying array structs cannot have array members
*/

I also tried using the custom allocation for non-array structs but it didn't work fine... the system got messed up...

oh, forgot to remove those... thanks

edit: updated...
Ah... you right, I forgot the item array that you have inside the struct e__e

Last edited by Ruke; 04-21-2012 at 03:17 AM.
Ruke is offline   Reply With Quote
Reply

Bookmarks

Thread Tools

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 Off
Pingbacks are Off
Refbacks are Off


All times are GMT. The time now is 10:23 AM.





Powered by vBulletin
Copyright 2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.5.1 PL2
Copyright © Ralle