| 06-15-2004, 03:55 PM | #1 |
I have this problem in my map (it's an RPG), What I want is for different %'s of chance to get different items, I've separated the items into these catagories: Charged, Normal, Magical, Rare, Set, And Unique. Charged 27% Normal 45% Magical 20% Rare 5% Set 2% Unique 1% and then each one of these catagories is separated into 3 different levels or rarity: low, medium, high. Low 50% Medium 35% High 15% The only way i have been able to get this to work is with creating one item from a random set of items and removing item it, but as you can kinda tell it creates a lag spike. Event: Map initialization Conditions: None Actions: Set ItemClass(27,1) to Charged Set ItemClass(27,1) to Charged Set ItemClass(72,28) to Normal Set ItemClass(72,28) to Normal Set ItemClass(92,73) to Magical Set ItemClass(92,73) to Magical Set ItemClass(97,93) to Rare Set ItemClass(97,93) to Rare Set ItemClass(98) to Set Set ItemClass(99) to Set Set ItemClass(100) to Unqiue Set ItemLevel(10,1) to LowCharged Set ItemLevel(10,1) to LowCharged Set ItemLevel(17,11) to MediumCharged Set ItemLevel(17,11) to MediumCharged Set ItemLevel(20,17) to HighCharged Set ItemLevel(20,17) to HighCharged Set ItemLevel(10,1) to LowNormal Set ItemLevel(10,1) to LowNormal Set ItemLevel(17,11) to MediumNormal Set ItemLevel(17,11) to MediumNormal Set ItemLevel(20,17) to HighNormal Set ItemLevel(20,17) to HighNormal Set ItemLevel(10,1) to LowMagical Set ItemLevel(10,1) to LowMagical Set ItemLevel(17,11) to MediumMagical Set ItemLevel(17,11) to MediumMagical Set ItemLevel(20,17) to HighMagical Set ItemLevel(20,17) to HighMagical Set LCharged(1) to Small HP Potion Set LCharged(2) to Small MP Potion Set LCharged(3) to Small Potion of Speed ^ you get the picture ^ Event: a unit owned by player 12 dies Conditions: none Actions: Create 1 ItemClass(random number 1 to 100) at position of dying unit Remove last created Item If/Then/Else: If: Last created Item is equal to Charged Then: Create 1 ItemLevel(random number 1 to 20) If/Then/Else: If: last created item is equal to lowcharged Then: Create 1 LCharged(random number 1 to 20) <-- this is the final item. Now this goes on for each class and level, my problem is that it creates a lag spike and that I need the %'s to change when your hero get's to a higher level, with this system the only way to imporve your chances in to increase the number of items dropped. could anyone help me out to find a better system? |
| 06-15-2004, 03:58 PM | #2 |
Ok, this one is a bit easier. What I want is when you pick up an item like a small hp potion to stack with another small hp potion you have in your inventory already. Ok thanks guys! |
| 06-15-2004, 05:08 PM | #3 |
The first one could be done with the itempool api. As far as the second one I say you steal aiursrage code: function HasItemtype takes unit whichUnit, item this returns item local integer i = 0 local item whichItem = null local integer itemType = GetItemTypeId(this) if whichUnit != null then loop exitwhen i > 6 set whichItem = UnitItemInSlot(whichUnit, i) if GetItemTypeId(whichItem) == itemType and whichItem != this then return whichItem endif set i = i + 1 endloop endif return null endfunction function StackItem takes unit whichHero, item whichItem returns nothing local item stack = HasItemtype(whichHero,whichItem) local integer itemCharges = GetItemCharges(stack) if stack != null and stack != whichItem and itemCharges > 0 then call SetItemCharges( stack, itemCharges+ GetItemCharges(whichItem)) call RemoveItem( whichItem) endif endfunction To use it you'd do event-Unit Aquires an Item Action Custom script: call StackItem(GetTriggerUnit(), GetManipulatedItem()) |
| 06-16-2004, 09:19 PM | #4 |
Ok, i have a question about the itempool, how do you add itesm 2 it? |
| 06-16-2004, 09:23 PM | #5 |
Ok, one more thing, how do I add items to the item pool, its says ID but nowhere under it does it say like item type. |
| 06-16-2004, 09:35 PM | #6 |
itemid==itemtype, yes worldedit has a strange naming scheme. |
| 06-16-2004, 10:47 PM | #7 | |
Quote:
i understand that, what i don't know is how to take an item like claws of attack and give it 10% chance 2 be dropped, when i click on ID it doesn't have anything that says item type, it says custom item value and Item level and remaining charges in item but no item type. does every item have a number ID and do i have 2 use that? and if so where can i find out hte ID's of each item? |
| 06-17-2004, 07:54 PM | #8 |
hit ctrl-d and you should see some like I004 or whatever put that in single quotes (') and that'll do. |
| 06-18-2004, 01:34 AM | #9 | |
Quote:
ok, i got that, i have the code for the items, but i don't know what thing to use it with under ID, it isn't string length or the string conversion so what do i use? |
