Hello,
I tried to use the value npc.ar, which was fixed by Austin (corechanges 10-29). I am talking about NPCs without any armor equipped, so this value reflects the intrinsic armor from the configuration.
But if a script sets npc.ar_mod to any positive value, both npc.ar and npc.ar_mod take on this new value!
If a script sets npc.ar_mod to any negative value, npc.ar takes on the correct value from the configuration, and ar_mod has the negative value just written.
If a script sets npc.ar_mod to zero, the npc.ar is set to the correct value from the configuration and npc.ar_mod is zero.
This is a bug!
With items and player characters it works this way:
Set item.ar_mod to any positive or negative value or to zero, the item.ar_mod has the value just written, and item.ar has the old value plus (or minus) the value in item.ar_mod.
Example: A shield has intrinsic AR = 28. I.e. item.ar = 28, and item.ar_mod = 0 initially.
If i write:
item.ar_mod => 5 then item.ar = (28+5) = 33 and item.ar_mod = 5.
item.ar_mod => -15 then item.ar = (28-5) = 23 and item.ar_mod = -5.
item.ar_mod => 0 then item.ar = 28 again and item.ar_mod = 0.
So the value of npc.ar is lost, if a NPC uses a spell which changes its AR. It ist possible to regain it by writing zero to npc.ar_mod, but while npc.ar_mod is different from zero npc.ar is wrong (i.e. the same value as in npc.ar_mod).
How to repeat:
Create a NPC, without equipment (i.e. no armor or shields):
Then by script do this: (Assume the NPC has intrinsic armor 10 from the configuration)
1) Set npc.ar_mod := 5 (NPC should now have ar=15)
2) Read npc.ar -> it is now 5!
3) Read npc.ar_mod -> it is 5
4) Set npc.ar_mod := 0
5) Read npc.ar -> it is now 10 again!
6) Read npc.ar_mod -> it is 0
7) Set npc.ar_mod := -5
Read npc.ar -> it is still 10
9) Read npc.ar_mod -> it is -5
10) Set npc.ar_mod := 0
11) Read npc.ar -> it is now 10 again!
12) Read npc.ar_mod -> it is 0
So if a NPC uses a protection spell, which sets npc.ar_mod to a positive value, it sets its entire armorto the new value (which actually should be an increment instead).
As it is, npc.ar cannot be used, except with work arounds. It works for items and player characters.
This was found and verified with the pol-core-097.2-2009-01-13-Coregina core, which we are using.
But the same behaviour exists with the newest 0.98 beta core (pol-core-098-2009-02-18).
OWHorus
[Fixed in 097.4] Bug with NPC.ar
Moderator: POL Developer
Re: Bug with NPC.ar
Code: Select all
02-28-2009 MuadDib
Fixed: NPC.ar bug where ar was not reading intrinsic ar correctly when using ar_mod for
the NPC.