Legacy of the North

Game Related => Bug Reports => Topic started by: Twi'lek_Dancer on August 07, 2013, 01:18:48 PM

Title: Streaking is punishable by death!
Post by: Twi'lek_Dancer on August 07, 2013, 01:18:48 PM
So, I got lost yesterday (hey, it's been a while!), and while wandering around and clearing normal spawns a naked NPC came charging at me. Her hood was on, and she did have a staff, but that was about it. She soon bit the dust like the group of orcs I was fighting, and upon looting her I got the head, which made me realize she was probably posted on the bounty hunter board. My monk kept going while she pondered about poor wardrobe choices. Not long after that she took yet another wrong turn, and ended up at Luskan (the side entrance, not the main one). Once more, a man in nothing but his tighty whities and a helm run into my monk's fist. To my surprise, he was also on the bounty hunter list. At any rate, it was a valuable lesson, since now my elf is less inclined to run around naked (not that she would, but still).

TL;DR: You may have an armor feat / level restriction issues with the bounty hunter NPCS.
Title: Re: Streaking is punishable by death!
Post by: NWoutcast on August 07, 2013, 02:22:19 PM
Oh the current lament of the bounty system. Last I knew Sakes was working on the matter but I don't know when it will be resolved. I can take a look at the code but it'd likely be greek to me, sadly.
Title: Re: Streaking is punishable by death!
Post by: Twi'lek_Dancer on August 07, 2013, 02:47:53 PM
I think it may be the NPCs not meeting the requirements for the loot they have been assigned, and thus are unable to use it.  Just a wild guess, since they seem to spawn correctly and use other items.
Title: Re: Streaking is punishable by death!
Post by: Tails1879_ on August 07, 2013, 05:20:34 PM
I had taken a look at the bounties that spawned without wearing their armor some time ago. If anything, there's an issue with spawning the armors, not the requirements. They do have the feats for all armors and weapons. Instead, the bare bounties had no armor spawned at all, not even in their inventories.

In short: Yup, we know about the issue, but it's still unresolved unfortunately.

I can take a look at the code possibly, if someone points me in the right direction. Unfortunately, I'm not much of a programmer and may (most likely) not find the solution.
Title: Re: Streaking is punishable by death!
Post by: fealhach2008 on August 07, 2013, 05:58:04 PM
It used to be a somewhat rare occurrence, but it seems almost all of them are now 'skyclad'.
Title: Re: Streaking is punishable by death!
Post by: Sakes on August 08, 2013, 02:01:13 AM
The problem isn't a lack of armor proficiencies, I'd have squashed the problem long ago if it was.

For awhile the problem was that the equip armor script always ignored base AC 0 items, even if magically enchanted.  I thought this was fixed.

The current problem?  I don't know what's causing it.  AI is notoriously finicy, and there is no way to directly spawn armor onto an NPC's back, it has to be spawned into inventory and then told to equip it, and often NPCs will ignore orders.  I *think* that's what the current problem is.

Title: Re: Streaking is punishable by death!
Post by: Tails1879_ on August 08, 2013, 07:08:04 AM
The current problem?  I don't know what's causing it.  AI is notoriously finicy, and there is no way to directly spawn armor onto an NPC's back, it has to be spawned into inventory and then told to equip it, and often NPCs will ignore orders.  I *think* that's what the current problem is.

Wouldn't the armor be found in the inventory of the NPC if that were the case?
Title: Re: Streaking is punishable by death!
Post by: Sakes on August 08, 2013, 07:08:58 AM
The current problem?  I don't know what's causing it.  AI is notoriously finicy, and there is no way to directly spawn armor onto an NPC's back, it has to be spawned into inventory and then told to equip it, and often NPCs will ignore orders.  I *think* that's what the current problem is.

Wouldn't the armor be found in the inventory of the NPC if that were the case?

Yup.  Has anyone logged on as a DM and checked to see if the armor is in their inventory?
Title: Re: Streaking is punishable by death!
Post by: Neutral_Zone on August 08, 2013, 07:59:57 AM
Yeah, Tails has. Naked bounties had no clothes in their inventories. As far as I know, all the 0 AC armors were removed from the spawn list, so they shouldn't have that issue. It worked once upon a time. I don't know what changed, but suddenly, they stopped caring about clothes at one point. Maybe since they know they're going to die anyway, they've decided to go out in style.

Bloody emergent behavior. I swear we've got the start of some sort of rogue AI in the works here.
Title: Re: Streaking is punishable by death!
Post by: NWoutcast on August 08, 2013, 09:29:10 AM
"I will go out, as I came in."
Title: Re: Streaking is punishable by death!
Post by: TheMadPoet on August 08, 2013, 02:07:09 PM
Sometimes if too many processes go on at once NWN hiccups. Maybe some kind of delay on their spawns for adding clothes and equipping them? It's worked in the past for me. You could even go as far as 10 seconds or so. It's not like people are around when the bounties spawn, right?
Title: Re: Streaking is punishable by death!
Post by: Kattze on August 10, 2013, 12:09:31 AM
Try checking the script for any body armors that have since been deleted from the palette?
Title: Re: Streaking is punishable by death!
Post by: Neutral_Zone on August 11, 2013, 12:22:41 AM
Sometimes if too many processes go on at once NWN hiccups. Maybe some kind of delay on their spawns for adding clothes and equipping them? It's worked in the past for me. You could even go as far as 10 seconds or so. It's not like people are around when the bounties spawn, right?

Not sure. In some cases the delays actually make things worse, since they cause NWN to queue commands. At any rate, the bounties spawn only when someone reads the sign. So if nobody reads the bounty board, there's no criminals! (Next thing you know, reading is outlawed.) I think it's more likely that someone deleted something from the palette that's common as their armor, like Kattze said.
Title: Re: Streaking is punishable by death!
Post by: Sakes on August 11, 2013, 07:40:38 AM
Sometimes if too many processes go on at once NWN hiccups. Maybe some kind of delay on their spawns for adding clothes and equipping them? It's worked in the past for me. You could even go as far as 10 seconds or so. It's not like people are around when the bounties spawn, right?

Not sure. In some cases the delays actually make things worse, since they cause NWN to queue commands. At any rate, the bounties spawn only when someone reads the sign. So if nobody reads the bounty board, there's no criminals! (Next thing you know, reading is outlawed.) I think it's more likely that someone deleted something from the palette that's common as their armor, like Kattze said.

This is the most likely explination.  If the scripts just randomly skipped firing we'd have a lot of problems with pretty much every script, but even if it was somehow isolated to the bounty system, then the odds of weaponless or nameless or unleveled bounties should be the same since the script does all those steps in a row.  Instead, the only thing consistently missed is spawning armor, so it's most likely an error in the armor spawn table.
Title: Re: Streaking is punishable by death!
Post by: TheMadPoet on August 11, 2013, 02:35:28 PM

  Instead, the only thing consistently missed is spawning armor, so it's most likely an error in the armor spawn table.

Good point.
Title: Re: Streaking is punishable by death!
Post by: Sakes on August 11, 2013, 05:30:44 PM
Alright.  Here's the current code:

Code: [Select]
//Give the bounty a random armor
    n = Random(nMaxArmr)+ 1;
    switch (n)
    {
    case 1: sArmor = "nw_aarcl011"; break; //light armors
    case 2: sArmor = "nw_maarcl046"; break;
    case 3: sArmor = "x0_maarcl010"; break;
    case 4: sArmor = "nw_maarcl083"; break;
    case 5: sArmor = "x2_maarcl027"; break;
    case 6: sArmor = "nw_maarcl084"; break;
    case 7: sArmor = "x2_maarcl025"; break;
    case 8: sArmor = "nw_maarcl087"; break;
    case 9: sArmor = "x2_maarcl029"; break;
    case 10: sArmor = "x2_mduerar008"; break;
    }
//SendMessageToPC(oPC, "Using Case "+IntToString(n)+" For Armor");
return sArmor;
}

So I went and looked up all the codes and all are for default items.  Unless we deleted the following standard armors from the palette, that isn't the problem:

nw_aarcl011 - banded mail
x0_maarcl010 - Chain shirt +5
nw_maarcl083 - Leather +3
x2_maarcl027 - Leather +6
nw_maarcl084 - Padded + 3
x2_maarcl025 - Padded + 6
nw_maarcl087 - Studded + 3
x2_maarcl029 - Studded + 6
x2_mduerar008 - Dreguar studded + 4

Just a quick note, after it spawns the armor it wipes the stats and reapplies an enhancement bonus based on the level of the bounty.  Either it does that before the order to equip the armor, or NPCs don't have level restrictions because +6 stuff is working.

Now, I did notice that the script is using tags instead of ResRefs, which is interesting.  I checked NWNLexicon and it states you can use either or, but I'm wonder if maybe that's the problem?

I'm going to look into this more later today.  I'm going to take an inventory of the spawned bounties.  We spawn 25 at a time and we have 10 possible armors so if we find 1 or 2 that no bounty is ever being spawned with, that might narrow things down.  I'm going ahead assuming using tags instead of resrefs is the problem since I have nothing else to go on.  This will help me confirm it because if I'm right, only the armors whos resrefs and tags are the same will spawn, and any with differences will never spawn. 

If I'm wrong, at least I'll have narrowed the problem down.



Title: Re: Streaking is punishable by death!
Post by: Sakes on August 12, 2013, 02:13:55 AM
Okay well now I'm even more confused.

Here are the results on about 20 or so bounties:

nw_aarcl011 - banded mail x 1
x0_maarcl010 - Chain shirt +5 x 0
nw_maarcl083 - Leather +3 x 2
x2_maarcl027 - Leather +6 x 3
nw_maarcl084 - Padded + 3 x 2
x2_maarcl025 - Padded + 6 x 1
nw_maarcl087 - Studded + 3 x 1
x2_maarcl029 - Studded + 6 x 2
x2_mduerar008 - Dreguar studded + 4 X 3

Naked! x 7

Chain shirt + 1? x 2


The chain shirts are particularly puzzling.  The tag used is for Chain Shirts +5.  This is according to NWN lexicon and confirmed by me.  However the item that spawns is named Chain Shirt +1.  Oh, and it's gold colored.  For the record, we don't have any gold colored chain shirts on the default palette.  +1 shirts are short sleeved and silver, +5 shirts are silver/gray and long sleeved. 

In any case, every type of armor on the palette is capable of spawning, so it's not a certain armor type.  Maybe the reason it's wonky is because it's using tags and not resefs.  I don't really know.  I'm at a loss for now.
Title: Re: Streaking is punishable by death!
Post by: TheMadPoet on August 12, 2013, 02:23:34 AM
Couldn't you just use the standard palette, unenchanted armors resrefs? Then you could just reapply the enhancement bonus after it is already spawned in the inventory. I don't see why you would need to spawn +6 versions of stuff, wipe them, and then add enhancement. Seems like an extra step for nothing.
Title: Re: Streaking is punishable by death!
Post by: Kattze on August 12, 2013, 02:24:19 AM
Sakes,

It could be there are custom items created with the same tag as the original chain shirt (someone forgot to change). Scripts do look for tags instead of resrefs from my experience.  Also from your results case 2: sArmor = "nw_maarcl046"; is not working as there are 9 results instead of 10!
Title: Re: Streaking is punishable by death!
Post by: Sakes on August 12, 2013, 08:48:28 AM
Couldn't you just use the standard palette, unenchanted armors resrefs? Then you could just reapply the enhancement bonus after it is already spawned in the inventory. I don't see why you would need to spawn +6 versions of stuff, wipe them, and then add enhancement. Seems like an extra step for nothing.

You could, but then all their armor would look the same.  The reason for doing it that way is to have a lot of different armor types.  Originally there were a lot more armor options on the bounties but we removed everything but light armor because it was creating possible imbalance on low level bounties.

Sakes,

It could be there are custom items created with the same tag as the original chain shirt (someone forgot to change). Scripts do look for tags instead of resrefs from my experience.  Also from your results case 2: sArmor = "nw_maarcl046"; is not working as there are 9 results instead of 10!

Hmm I missed it when I was checking the resrefs.   I think it just happened that Chain shirts +5 didn't spawn on the bounties I tested.  If that one item was the problem then only 10% of bounties should be naked.  From experimentation as well as what we've noticed the percentage seems to be much higher.
Title: Re: Streaking is punishable by death!
Post by: machmoth on August 12, 2013, 07:47:21 PM
I ran into similar issues with Niccolo when I was programming him.  Because no players are in the area when he spawns, the default NWN thing to do is to lower his process priority into the dirt.  Without enough processing power dedicated to him, he would very reliably do very stupid things.

Because Nic is constantly doing things, I handled it with the very naughty method of permanently setting his priority to a higher level.  This wouldn't be a good idea for bounties, as enough of them hungrily chomping away will have a meaningful impact on server performance.  However, temporarily buffing their priority while they handle their business could solve the problem.

Check out Nic for reference material, but you're going to be interested in the SetAILevel (http://www.nwnlexicon.com/index.php?title=SetAILevel) function.

Alternatively, you could try altering the AI to spawn and equip items when players are present.  Having a player in the same area is generally enough for NWN to give AI priority to a creature.
Title: Re: Streaking is punishable by death!
Post by: Sakes on August 13, 2013, 02:10:35 AM
I ran into similar issues with Niccolo when I was programming him.  Because no players are in the area when he spawns, the default NWN thing to do is to lower his process priority into the dirt.  Without enough processing power dedicated to him, he would very reliably do very stupid things.

Because Nic is constantly doing things, I handled it with the very naughty method of permanently setting his priority to a higher level.  This wouldn't be a good idea for bounties, as enough of them hungrily chomping away will have a meaningful impact on server performance.  However, temporarily buffing their priority while they handle their business could solve the problem.

Check out Nic for reference material, but you're going to be interested in the SetAILevel (http://www.nwnlexicon.com/index.php?title=SetAILevel) function.

Alternatively, you could try altering the AI to spawn and equip items when players are present.  Having a player in the same area is generally enough for NWN to give AI priority to a creature.

I can give it a look.  It's interesting the AI would ignore equip armor calls but not equip weapon calls, but then equip armor calls check for combat so maybe they are more resource intensive or something.
Title: Re: Streaking is punishable by death!
Post by: machmoth on August 13, 2013, 02:17:42 AM
If it's a matter of equipping, I believe the default AI is smart enough to equip weapons it finds in its inventory on its own.  Though it sounded like the problem was spawning the items in the first place.

However, the AI thing is just a pot shot guess, because it sounded familiar.  Armor could be more complex than weapons, though I wouldn't even begin to guess how the game prioritizes dropped code.  (I know it has a deep fondness for dropping delayed actions though.)

Another thing to try would be adding a line that sets a string variable on the character equal to the resref of the item you're trying to spawn.  If you get a naked character in the wild, check that variable to see what it was it tried (and failed) to spawn.  If you get an odd resref, that might be an answer.  Or worse, if the variable doesn't get set, that can narrow down what's getting dropped.
Title: Re: Streaking is punishable by death!
Post by: Sakes on August 13, 2013, 05:47:16 AM
Yea, what I said makes no sense, it's not just a matter of equipping because the armor isn't spawning at all.  Which makes the whole thing more perplexing.

That's what I get for trying to think after a 9 hour shift right before passing out.