| 03-30-2005, 07:10 PM | #1 |
I have been looking around for a hero save/load system and allows you to save as many possible items even if you had say 500 items in your game, but haven't had much luck finding such a save/load system. If anyone can help me out, please do. I gonna use it in my RPG map. |
| 03-30-2005, 09:02 PM | #2 |
500 items... thats a lot... well i don't think you'll find one to save 500 items, cause i doubt anyone has bothered to find an algorithm to compress any kind of save-code down that much if its even possible to compress it to less than 80 characters long |
| 03-30-2005, 09:09 PM | #3 |
Well, if you used a save code that's case sensitive and uses all letters and numbers, you can get a bse of 62 using the english alphabet and all the numbers. If we remove from these any letters that look too similar, like 0 and O and maybe there are others too (since the player must read the password and write it down correctly), we get to a base of about 50, maybe a bit more. With a base of 50, you can store an item in two characters if you have up to 2500 different items, or, with up to 678 items, you could store three items in five characters. You can store a hero's inventory in 12 (10) characters this way. For your purpose, up to 500 different items, a case non-sensitive save code would also be enough, more than 20 letters + 10 numbers gives you at least a 30 base, which means 900 possible items with 2 characters. |
| 03-31-2005, 12:02 AM | #4 |
i thought he wanted to save 500 separate instances of items, not an inventory with 500 different types of items :S |
| 03-31-2005, 02:55 AM | #5 |
Guest | If you mean 500 types of items then here it is: Heres the code anyways: You will need a Item-Type variable array (of however many items you have in mind) called 'SaveItemTypes' This sets up the item variable Set SaveItemTypes[0] = Item #0 Set SaveItemTypes[1] = Item #1 Set SaveItemTypes[2] = Item #2 Set SaveItemTypes[3] = Item #3 JASS script to find out the item: (the 5000 is an error case in which the item is not on the array list Code:
function Item2SaveId takes integer itemId returns integer
local integer i = 0
loop
exitwhen i == 12 //Change this number to however many type of saveable items
if (itemId == udg_SaveItemTypes[i]) then
return i
endif
set i = i + 1
endloop
return 5000
endfunctionIf you mean 500 different items, then that will require AT LEAST 500 letters... |
| 03-31-2005, 04:50 AM | #6 |
i was playing around with the item codes, and i made a little poor guy save code that could save ANY and EVERY item... although it was 10 characters for 1 item, so it would be long as hell... my best advice is use arrays like said before. because each item would represent 3 characters (### - about 1296 possible items, using base 36, 0-9 and a-z) |
| 04-03-2005, 01:55 AM | #7 |
Guest | You could just use an iteger for each item; Broad Sword= {n + (6/[2 * g])} - 5 Bam if n = 50 and g = 12 The final code is 51 Bam you can have like 3000 different codes under 3 letters |
