Author Topic: Streaking is punishable by death!  (Read 16827 times)

Sakes

  • Probably my fault.
  • Administrator
  • Posts: 1264
    • View Profile
Re: Streaking is punishable by death!
« Reply #15 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.



« Last Edit: August 11, 2013, 05:35:42 PM by Sakes »
DM Cat is watching you roleplay.

Sakes

  • Probably my fault.
  • Administrator
  • Posts: 1264
    • View Profile
Re: Streaking is punishable by death!
« Reply #16 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.
DM Cat is watching you roleplay.

TheMadPoet

  • Dungeon Master
  • Posts: 99
    • View Profile
Re: Streaking is punishable by death!
« Reply #17 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.

Kattze

  • Administrator
  • Posts: 1747
  • No! Not the bees!
    • View Profile
Re: Streaking is punishable by death!
« Reply #18 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!
THOSE ARE MY SHOES
GIVE THEM BACK
YOU ARE A DOG
THEY DON'T EVEN FIT

Sakes

  • Probably my fault.
  • Administrator
  • Posts: 1264
    • View Profile
Re: Streaking is punishable by death!
« Reply #19 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.
DM Cat is watching you roleplay.

machmoth

  • Administrator
  • Posts: 1222
    • View Profile
Re: Streaking is punishable by death!
« Reply #20 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 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.
« Last Edit: August 12, 2013, 07:52:01 PM by machmoth »

Sakes

  • Probably my fault.
  • Administrator
  • Posts: 1264
    • View Profile
Re: Streaking is punishable by death!
« Reply #21 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 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.
DM Cat is watching you roleplay.

machmoth

  • Administrator
  • Posts: 1222
    • View Profile
Re: Streaking is punishable by death!
« Reply #22 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.
« Last Edit: August 13, 2013, 02:21:06 AM by machmoth »

Sakes

  • Probably my fault.
  • Administrator
  • Posts: 1264
    • View Profile
Re: Streaking is punishable by death!
« Reply #23 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.
DM Cat is watching you roleplay.

 

Powered by EzPortal
anything