I have a file called magic_weapon.dfn which includes:
Code: Select all
[accurateaxe]
{
get=0x0f49
//name=a magic axe
name=an accurate axe
value=60 30
lodamage=6
hidamage=33
hp=31 100
race=
script=6005
}
[accuratekryss]
{
get=0x1401
//name=a magic kryss
name=an accurate kryss
value=54 27
lodamage=3
hidamage=28
hp=31 90
race=
script=6005
}
Code: Select all
//Mike's Script for Magic Items of Accuracy
function onEquip(mChar, ourObj)
{
if (mChar.online == true)
{
if (ourObj.id == accurateaxe || ourObj.id == accuratekryss)
{mChar.skills.tactics = (mChar.skills.tactics + 50);}
}
}
function onUnequip(mChar, ourObj)
{
if (ourObj.id == accurateaxe || ourObj.id == accuratekryss)
{mChar.skills.tactics = (mChar.skills.tactics - 50);}
}
Code: Select all
...
5017=item/spyglass.js
5018=item/magicscroll.js
5019=item/bola.js
6005=custom/accurate.js
}
'add item accuratekryss
...the item is created as expected. But when he hands it to my player character, and the player character equips it, nothing happens. No tactics gain, no error message in UOX3, nothing.
Any ideas?
EDIT: I solved the problem. It seems I was referencing the name of the item in brackets, for example accuratekryss, as the ourObj.id. I thought the bracketed name was the id of the item, but apparently it is literally the id= field.
This tuns out to not be a problem, since I can have a normal kryss of id=0x1401 and an accurate kryss with id=0x1401, and only the accurate kryss will get the tactics bonus because only it will have the "script=6005" as a line in its item info.