| 07-11-2008, 10:39 PM | #1 |
I've been working on and off for a few days on an idea I've had for quite some time. It took so long to start because I was scared to use extends/interfaces (sorry vex). Anyways, here's a sample of what the system is all about. The system is completely built around objects (both item and inventory). Within each object you can specify special parameters and values. For example: You can create an inventory for a hero and allow it to equip items: JASS:struct HeroInventory extends Inventory Item helmet Item weapon Item armor Item belt ... endstruct You are then able to specify numerous event methods that you can change and apply stuff to the Inventory. The same thing works with Items: JASS:library Potions requires ItemSystem struct LightHealingPotion extends Item string name // all items need this string info // all items need this integer size integer maxsize = 10 method onPickup takes nothing returns nothing local Inventory inv = .GetTriggerInventory() // methods to get event objects local unit u = .GetTriggerUnit() local LightHealingPotion p = inv.GetNextItemOfType(this, 0) // checks inventory for the same type of item loop if p.size + .size <= .maxsize then // combine the potions set p.size = p.size + .size set .size = 0 elseif p.size != .maxsize then // combine all that will fit, and keep searching set .size = .size - (.maxsize - p.size) set p.size = .maxsize endif // none left to combine if .size == 0 then call .destroy() return endif set p = inv.GetNextItemOfType(this, p) exitwhen p == 0 // no more items to combine with endloop if inv.AddItem(this) then // add the remaining potions to the inventory, but if it doesn't fit, drop it. // force to drop the item here (NYI) endif endmethod endstruct endlibrary You can even specify sub-classes: JASS:struct Armor extends Item string name string info integer def method onEquip // Equip the item if it fits // Apply the def bonus to the unit endmethod method onDequip // place item in inventory // remove def bonus from unit endmethod endstruct struct Helmet extends Armor // gains all properties of armor ... endstruct struct Legs extends Armor ... endstruct As you can see, it is very open and customizable. The idea is that the user can create any itemtype they want and apply any effects/bonuses/script they want to the item and then let the system control it. So a potion will combine in stacks with other potions in the inventory, armor can be auto-equipped if the unit doesn't have any already equipped, quest items can trigger quest log updated when received, etc. No more being limited to only 2 mods per item, or unable to specify custom classes easily. It is all built outside the system! A idea of all method events for items: JASS:method onPickup takes nothing returns nothing defaults nothing method onDrop takes nothing returns nothing defaults nothing method onCreate takes nothing returns nothing defaults nothing method onEquip takes nothing returns nothing defaults nothing method onDequip takes nothing returns nothing defaults nothing method onUse takes nothing returns nothing defaults nothing method onMove takes nothing returns nothing defaults nothing method onMouse takes nothing returns nothing defaults nothing method onSelect takes nothing returns nothing defaults nothing The sytem itself will be extremely modular. You can either use dummy items to pickup items like the default warcraft 3 item system, or you can incorporate your own item pickup methods for say a Final Fantasy turn-based system, but just replacing the external item library. The user interface will be excluded from the library as well, so you can use anything you can image. A fullscreen item system like ToadCop's, a multiboard item system (maybe Final Fantasy), an Inventory item system or even an ability item system (uses abilities on the command card). Of course, all these variations would require the user to program, but it would just become a template over top of the item system. I am still changing a lot of stuff and adding stuff and writing code, so if anyone has any suggestions, do say. If you don't like how the system looks, tell me. If you think it should include something, I want to hear it. If you love it and want it to stay, post below. Ill keep everyone updated as I go. |
| 07-11-2008, 11:06 PM | #2 |
Kind of like my system I developed but seems to be more cool :) JASS:struct Staff static integer ID = 'I004' static integer IntelectBonus = 8 static string Slot = "Weapon" static method Pickup takes integer i returns nothing set PlayerFighter[i].inteligence = PlayerFighter[i].inteligence + .IntelectBonus set PlayerFighter[i].mana = PlayerFighter[i].mana + (.IntelectBonus * MANA_PER_INT) endmethod static method Drop takes integer i returns nothing set PlayerFighter[i].inteligence = PlayerFighter[i].inteligence - .IntelectBonus set PlayerFighter[i].mana = PlayerFighter[i].mana - (.IntelectBonus * MANA_PER_INT) endmethod endstruct All items are setup in one library, then there's two triggers setup to run when an item is dropped and pickedup, and runs the methods. JASS:
if GetItemTypeId(Item) == PoisonedBlade.ID then
if PlayerFighter[i].type == "Rogue" then
call PoisonedBlade.Pickup(i)
else
call PoisonedBlade.Pickup(i)
call UnitRemoveItemSwapped( Item, Unit )
call ShowText("Can't use that item.",Unit,100,0,0,5,0)
set Continue = false
endif
endif
Then there's some checking after that to loop through the hero's inventory and check if they have more then the alloted slots filled. JASS:globals //SET THE ITEMS HP TO ONE OF THE INTEGERS FOR CLASSIFICATION constant integer G_HEAD = 1 constant integer G_WEAPON = 2 constant integer G_ACCESSORY = 3 constant integer G_CHEST = 4 constant integer G_FOOT = 5 //MAX ITEM SLOTS constant integer Head_Max = 1 constant integer Weapon_Max = 1 constant integer Accessory_Max = 2 constant integer Chest_Max = 1 constant integer Foot_Max = 1 endglobals So ya your system is alot more flexible and efficient I'm sure :D |
| 07-12-2008, 11:43 AM | #3 |
TRS II have 3 modules =) 1) Item Managment Core with out visual in game interface (it does the all stuff with items) 2) Display Module it does display item stats at the Multiboard. 3) FSI module it's provide a visual in game interface to manipulate with items etc. TRS can work fine with out that 2 modules =) so in fact TRSII is a powerful item managment system (which isn't slot orientaited or what ever) you have simply an virtual item you can equip it on unit or unequip. add bonus to it or remove bonus etc. also include sockets and insertable gems, item sets. |
| 07-12-2008, 04:30 PM | #4 |
I love the idea of TRS II but I can't stand looking at the code. I know you don't feel the same way as it's your code, but it looks over-complicated to me. I want to be able to see where things are coming from and how they work. Although this system will be similar in appearance and look, It will be scripted in an entirely different method. Yes, both systems are split up but mine will be more external object based; and I feel yours is more internally driven than mine. As for sockets and the like. With the way the system will run, any user with a brain would be able to code sockets and item sets. They would add event methods to the items in question and control the socketing/sets. And who knows, maybe once I finish the system, I'll write some templates for all of these, so people just have to copy them into their items and then modify a few things. |
