NPC armour

Bug reports and feature requests. New features can only be added to the current development version. Bug-fixes may be back-ported.

Current release: 099 / Current development: 100
Post Reply
garyglitter
New User
Posts: 13
Joined: Wed May 16, 2012 5:19 pm

NPC armour

Post by garyglitter »

I'm using the release of the 099 core from the main webpage.

First I'll say that armour on players works perfectly.

I can't get the npc.ar to set correctly at all. I see in the core-changes.txt that the intrinsic value is used IF the npc isn't wearing any armour correct? It appears that the intrinsic value is being used regardless for me. Manually equipping armour to an npc doesn't alter the npc.ar at all, the equip script runs fine for the item on the npc.

So my problem is that ONLY the intrinsic value is being read, which as you can imagine is far from ideal.

One final question. Is the the OnEquipScript meant to run for each equipped item on the npc CREATION? I see it doesn't, but it runs fine when i manually equip the item on the npc.

I don't think I had this problem at all in 097/098, and I havn't changed anything at all. I'm recompiling with 098 now to see if it makes a difference. Any help is appreciated!
garyglitter
New User
Posts: 13
Joined: Wed May 16, 2012 5:19 pm

Re: NPC armour

Post by garyglitter »

Recompiled my scripts with the 098 core. It works perfectly on that. spawned npcs ARE getting their armour gain from the items they are equipped with.

So what has changed since 098 and 099 that does not set armor on npcs properly?

All I saw in the core docs about npc.armor was PRE 098, so what in the world is wrong?

From a 096 change
Changed : If npc.ar is used and the NPC has no armor equipped, it will give its intrinsic armor value
(NPCDESC.CFG AR entry). If it has armor equipped, it will work as it did before.
From a 097 change
Fixed: NPC.ar bug where ar was not reading intrinsic ar correctly when using ar_mod for
the NPC.
garyglitter
New User
Posts: 13
Joined: Wed May 16, 2012 5:19 pm

Re: NPC armour

Post by garyglitter »

sooo. anyone else noticed this at all?
garyglitter
New User
Posts: 13
Joined: Wed May 16, 2012 5:19 pm

Re: NPC armour

Post by garyglitter »

I don't suppose someone could at least test this to tell me if i'm crazy or not :P
Yukiko
Distro Developer
Posts: 2825
Joined: Thu Feb 02, 2006 1:41 pm

Re: NPC armour

Post by Yukiko »

The one bug I found with armour was that the armour object reference wasn't being passed to my combat hit scripts. According to the POL Docs in script types POL is supposed to pass the following parameters to the hitScript upon a successful hit: attacker, defender, weapon, armor, basedamage, rawdamage. The first 4 are object references. My mainHitScript was not causing any damage in melee combat but the archery hit script was working just fine. The mainHitScript was trying to read the AR member of the armor object reference to use in calculating damage but it kept coming up with 0 damage done by any weapons. So whilst tracking down the issue I found that the armor parameter being passed to the mainHitScript was an uninitialized object.

The reason the archery hit script was working fine was because it picked a random armour layer rather than using the armor object reference that POL is supposed to pass to the hit scripts. If there's something equipped it reads the AR of that item. So I just copied that code to my mainHitScript and eberything seems to be working now.

It sounds like this is the same issue you are having, just seen from a different angle. I don't know when this bug was introduced. I'm pretty sure that POL 0.97 worked just fine and I believe even the first couple releases of POL 0.98 beta did too but my shard was offline for a while and I didn't get it back-up until after pol 0.99 beta was released.

What surprises me is that until I saw your post, no one has reported this issue. I hadn't noticed any trouble until one of my players reported that melee was doing no damage. That was before your post. Then when I found out what was happening I didn't want to respond until I tracked down the problem on my end because I wanted to make sure of a couple things. First, that the issue I was having wasn't because of something I was doing wrong. Second, once I was satisfied I hadn't messed-up (as far as I can tell anyway) I wanted to make sure I could work around it. I just got done reworking my hit script and decided to post my response confirming that there is a bug with POL passing armor objrefs.
garyglitter
New User
Posts: 13
Joined: Wed May 16, 2012 5:19 pm

Re: NPC armour

Post by garyglitter »

Thanks Yukiko! I was wondering if it was just my end. Maybe no-one uses armour on npcs and just go for the intrinsic value?
Yukiko
Distro Developer
Posts: 2825
Joined: Thu Feb 02, 2006 1:41 pm

Re: NPC armour

Post by Yukiko »

Maybe. It certainly would make an easy kill for the criminal player characters when a town guard tries to "arrest" them or an easy kill by players when attacking a dreadlord in full platemail. Then again it is probably just fine for "today's UO" since all it seems to be anymore is a "how high can I get my murder count?/hack and slash fest anyway".

Hopefully, one of the devs will have a chance to drop by the forums and see this and your other thread and might have the time to look into these bugs.
Post Reply