Light Jerkin Bug Fix
CoolMike ·
Right now light jerkins are bugged. If you equip one, then put on a robe, and then unequip the robe (or equip pants or armor) the light jerkin and the full (default) shirt will both show up. There are two ways to reset your arms: Unequip and re-equip the jerkin or equip gauntlets. The gauntlet trick is the clue to the solution in my opinion. Gauntlets and robes work correctly. Put on gauntlet and then robe (gauntlets disappear) - then unequip robe (gauntlets reappear). This works because of two snippets of code (one shown below). I’m hoping someone can go over this line-by-line with me and make sure I understand it before I start mucking around on my test server.
Snippet:
NewUnused(what = $)
{
local i, oFound, iPriority;
oFound=$;
for i in send(what,@GetPlayerUsing)
{
iPriority = send(i,@ItemChangesArms);
if iPriority <> 0
{
if oFound <> $
{
if iPriority > send(oFound,@ItemChangesArms)
{
oFound = i;
}
}
else
{
oFound = i;
}
}
}
if oFound <> $
{
send(oFound,@DoPlayerArt);
}
else
{
send(what,@ResetPlayerArms);
}
Discussion 9
Sign in to join the discussion.
Ok - here is my attempt at line-by-line understanding above: NewUnused(what=$) - when something is unused the message gets that item and stores it as $? Then we create 3 variables, a local counting variable i, an integer called iPriority, and the variable oFound (which has some data type? Object?). We set oFound to equal the item being un-used. Then we create a for loop counting up the variable i over all the items the player is using.
Now inside the for loop: this is where I get confused. (Also I may be wrong about the what=$ argument above).
Here are some guesses:
We set iPriority equal to i if the ItemChangesArms method returns true?
Then we check if iPriority is not equal to zero
If that is true we check if oFound does not equal the item that was unusued (this is always false the first loop)
Hmn. I’m lost now! It may be worth considering the case where @itemChangesArms if False first
I’ll wait to see if anyone who works with the scripting language can walk us through the logic!
One last note about the bug: If you are using gauntlets and equip and unequip the robe the jerkin is displayed correctly and the bug is totally gone. This is due to the @ResetPlayerArms message/method that the gauntlets apply to the player
The bug probably should be fixed, but I do enjoy using it to create two-tone shirts.
I was testing this yesterday and regular shirts are also bugged. The problem here is that the player’s arms will have their default shirt color and the players body will have the color of the shirt they are wearing. This is strange because reading the item.kod it clearly seems like shirts should work correctly. I believe there is a way to over-ride this behavior by actually checking if the player is wearing a shirt and then calling in the actual .BGF files for the players arms. This is done in the gauntlet code. The thing is - there is no reason we should have to do this. We are sending messages to re-draw the players art anyhow. I’ll dig in a little more soon but I think the problem lies in the KOD files between item.kod and the shirt.kod. Somewhere in there the message isn’t getting where it needs to go. Part of the confusion comes from sending messages to self which actually go up the chain instead of directly sending the message to the file you want.