Graal Forums

Graal Forums (https://forums.graalonline.com/forums/index.php)
-   NPC Scripting (https://forums.graalonline.com/forums/forumdisplay.php?f=8)
-   -   Unique ID (https://forums.graalonline.com/forums/showthread.php?t=86635)

[email protected] 06-30-2009 08:07 PM

Unique ID
 
So, I'm creating an item system with unique id's, the problem? Well, it's fairly simple, the dropping of items that're the same but with a unique ID.

I'm thinking a loop is the only way to avoid this, however what if a player is dropping more than one of the same item? So, let's say I had

999 Wooden Bows

If I were to lay 999 Wooden Bows (each of the 999 wooden bows being a unique ID for the item) how would I assign each individual ID to the 'Wooden Bow' about to be dropped without a loop?

Can anyone think of a solution? Thank you

fowlplay4 06-30-2009 08:20 PM

Well depending on the way you store your items, just have a item counter and add one to it after or before you drop the item.

If you use SQL, delete / alter the row of the item that dropped then the insert statement of the item being added will just pick the next available row number.

[email protected] 06-30-2009 08:26 PM

Quote:

Originally Posted by fowlplay4 (Post 1503087)
Well depending on the way you store your items, just have a item counter and add one to it after or before you drop the item.

If you use SQL, delete / alter the row of the item that dropped then the insert statement of the item being added will just pick the next available row number.

Ah, I see what you're saying. However, it's generally for tracking the item (easier for logs etc)

If you can think of a better way to do log trades, feel free to say. thanks

Stephen 06-30-2009 08:30 PM

You may want to limit your UIDs to specific items - so that it's optional rather than mandatory.

Arrows are a good example of items which do not necessitate UIDs.

[email protected] 06-30-2009 08:45 PM

Quote:

Originally Posted by Stephen (Post 1503094)
You may want to limit your UIDs to specific items - so that it's optional rather than mandatory.

Arrows are a good example of items which do not necessitate UIDs.

Oh, that's a great idea actually. Thank you :)

Any other ideas?

xXziroXx 06-30-2009 08:58 PM

Quote:

Originally Posted by Stephen (Post 1503094)
You may want to limit your UIDs to specific items - so that it's optional rather than mandatory.

Arrows are a good example of items which do not necessitate UIDs.

Agreed.

I only use unique ID's for stuff that needs it - weapons/rare items/etc, and everything else gets their item name as ID. Unique ID's are purposely not stackable in my system either.

[email protected] 07-01-2009 09:31 PM

Quote:

Originally Posted by xXziroXx (Post 1503109)
Agreed.

I only use unique ID's for stuff that needs it - weapons/rare items/etc, and everything else gets their item name as ID. Unique ID's are purposely not stackable in my system either.

Ahh- right. How would you go about dropping though? (Do you have an inventory that doesn't stack items that way)

xXziroXx 07-01-2009 09:57 PM

Quote:

Originally Posted by [email protected] (Post 1503375)
Ahh- right. How would you go about dropping though? (Do you have an inventory that doesn't stack items that way)

Can you be a bit more specific?

[email protected] 07-02-2009 08:20 PM

Quote:

Originally Posted by xXziroXx (Post 1503381)
Can you be a bit more specific?

When your items are in the inventory, how are they stacked.
Say you had two of the exact same item, are they stacked together (x2) or individual icons (x1)?


All times are GMT +2. The time now is 03:56 AM.

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2026, vBulletin Solutions Inc.
Copyright (C) 1998-2019 Toonslab All Rights Reserved.