News:

Welcome to the new Sinister Design forums!

Main Menu

Equipment switcheroo bug

Started by Zetor, May 17, 2015, 05:09:20 AM

Previous topic - Next topic

Zetor

After the Rescuing Sarn Kamina mission (in which Siripent died due to acute Rambo-itis and Louise died due to acute ambush-itis), the gear allocated to my characters got all messed up... basically they were swapped in pairs between most of the party, forcing me to deequip / dump all gear in the stash and re-equip everyone again. Some switches were: Hee'la <-> Emma (I attached a screenshot of this one), Des Serret <-> Gavrielle, Silithis Predat <-> Madeleine. SOME party members kept their gear.

I attached two logs, because I'm not sure which one coincides with the bug.

I'm playing the latest steam version (v1.03). If it matters, one of the characters (Zimmer) had an empty inventory before this.

e: this is probably a dup of http://sinisterdesign.net/forum/index.php?topic=1451.15 -- feel free to close as needed!

captainjack101

I found another item switching bug, but it's one that you can control, allowing you to equip any item on any character and is easily reproduced.

First you need at least 3 items and at least 1 that the character can equip. This happened at the second the second merchant and may or may not work at the item management screen or subsequent merchants. Next you arrange the items in this order: At least one item to be dropped --- any item that can be equipped --- the desired item to be equipped (ax on a psy user). Then you simply drop the first item which leaves the second item (now the desired item) still equipped instead of the equipable item.

Zetor

Yeah, I think that other issue is related to the bug where you can't equip a piece of gear when it's the last item in your inventory list -- you can click 'equip' on the drop-down list, but nothing happens:

997 | TypeError 1010: Error #1010
998 | TypeError: Error #1010
at InventoryScreen/unEquipItem()
at InventoryScreen/equipItem()
at InventoryScreen/clickedItemDropList()
999 | ---------> running saveLog() within LogHandler!


It was driving me crazy ("why can't I equip the sprinting shoes on Maddy?!"). Worse yet, if I dropped an item from the middle of someone's inventory, the currently equipped items would shift, and s/he would be left with an apple and some focus pills equipped instead of, say, a sword and leather armor. The solution to that was to click on every item in inventory, and unequip consumables + make sure to reequip weapons/armor as needed.

Kletian999

I suffered from inability to equip last item because consumables were in the middle for the first time tonight.  It also made it so, from using just 1 usage of a bandage (not even removing stuff from inv), there were times where it said I had no sword equipped, yet still had all my sword moves.

ifulmen

QuoteUp till now, it's saved character inventories based upon character position within the saved character info array as it existed on first loading up the battle.
dude really? how did you manage to get rpg and arena relatively bug free?

okay, first of all, people do instinctively learn orders, positions, relations and all kinds of patterns. Letting the framework decide how to order the characters basically fucks up people's mind. NEVER do that nor let that happen. You can let the gamer decide how to order the game items, but you are never allowed to mess up with the order of skills or any controls (like the hover thing).

if you want to finally get rid of this random swapping bug, you will have to restart with an adequate design.

Use defines or constants (or what ever this adobe thingy got) to assign unique ids to all characters. Implement the character list in a way that all characters have one definite position and NEVER change it. Like really NEVER. Use black squares or red crosses or what ever to mark the dead characters or the ones that are already on the field. But do not mix the order in any arrays or lists.

Use single ton pattern to assign unique ids to all items. If you don't know how to implement the single ton, run throw all items and find unused id to be assigned to new item. Do not store in the item itself whether it is equipped or not and who carries it. Rather add two array to all characters, store in one of these the equipped items and in another array the rest of items. Each time the user equips/unequips/drops/whatever the item run throw both array, do what ever is necessary to ensure consistency and redraw the item window.

Do not rely on the framework. All frameworks have bugs and you don't have time to find these bugs and work arounds. Assume the framework tries to trick you and build in means to get everything right.
Store into the save file the id of a character together with its data. When you load the file identify the character depending on the id, not on the position. Assign then a designated position in the array of characters to the loaded one.

As for the items, store the id of the character, who carries it, together with the item. Once the item is loaded, use the character's id to decide where to put the item, do NOT use any array indices.

Do not add the bonuses or debuffs to the current health variable or current resist. There are a lot of other minor bugs coming from this mistake, e.g. bonus hp from static shield goes lost, if you unequip a shield or an orb.
You need to implement this stuff functionally (instead of imperatively). Write a function that runs through all items and sums up all bonuses and debuffs, but do not store the value. Call this method each time you need to draw the hp bar or calculate the current hp for some actions, but do not store the calculated result. You will have to call this function each time you need the value.

Make it easy for yourself and implement all buffs and debuffs like these are items, items that cannot be traded and that do expire. In the class of a character add an additional array for these buff-items and debuff-items. Do NOT ever store any sums or current values. Implement a function for each property (like hp or resist) that always runs over all constants and items and calculates the current value or the sum, but never store it!

And stop using byte data types or anything below int. WTF you are trying to create? A game that would fit on a 3.5" disk?
Let's say you got 100 units on the field, everyone carries 10 items and has 10 buffs and debuffs. That makes no more than 3000 entities. Even if you have 10 properties, you would quasi-save 90000 bytes by using byte instead of int. WTF dude?? 100 KB is not worth the headache. Use int for all game object properties! And since you keep mixing singed and unsigned types, use always signed. Your values are not gonna get that high to blow up an int.

This might sound rough, but when did you release the game? Like two months ago? And you still have a project stopper in the product. Forget all the minor bugs, which you can fix in 5 minutes. It does no matter whether you got 100 minor bugs or not, but it does matter if you have 1 project stopper. Ignore all the other stuff until you sort out this item mess.