First edit the malehumans.dfn and femalehumans.dfn, there go to the m_thief and f_thief sections, remove the "NPCAI=2" line, so that the thiefs won't attack you from the beginning. Also change the "SCRIPT=3000" line into "SCRIPT=3001".
Now open jse_fileassociations.scp, search for this line:
Code: Select all
3000=npc/speech/speech_001.jsCode: Select all
3001=custom/thief.jsCode: Select all
var i = 0, currObj = 0; var mItem;
var trySteal = RandomNumber( 0, 1 );
var stealItem = null;
var goldFound = 0;
if( trySteal == 1 ) {
for( mItem = myPlayer.pack.FirstItem(); !myPlayer.pack.FinishedItems(); mItem = myPlayer.pack.NextItem() )
{
if( mItem != null )
{
if( mItem.id == 0x0eed )
{
var stealAmount = RandomNumber( 10, 50 );
if(mItem.amount < stealAmount)
{
mItem.container = myNPC.pack;
} else {
var itemMade = CreateDFNItem( myNPC.socket, myNPC, "0x0eed", stealAmount, "ITEM", true );
mItem.amount = mItem.amount - stealAmount;
}
goldFound = 1;
}
else if( stealItem == null && (RandomNumber( 0, 1 )) == 1 )
{
stealItem = mItem;
}
}
}
if( goldFound == 0 && stealItem != null )
{
stealItem.container = myNPC.pack;
}
}
var trySteal = RandomNumber( 0, 1 );
var stealItem = null;
var goldFound = 0;
if( trySteal == 1 ) {
for( mItem = myPlayer.pack.FirstItem(); !myPlayer.pack.FinishedItems(); mItem = myPlayer.pack.NextItem() )
{
if( mItem != null )
{
if( mItem.id == 0x0eed )
{
var stealAmount = RandomNumber( 10, 50 );
if(mItem.amount < stealAmount)
{
mItem.container = myNPC.pack;
} else {
var itemMade = CreateDFNItem( myNPC.socket, myNPC, "0x0eed", stealAmount, "ITEM", true );
mItem.amount = mItem.amount - stealAmount;
}
goldFound = 1;
}
else if( stealItem == null && (RandomNumber( 0, 1 )) == 1 )
{
stealItem = mItem;
}
}
}
if( goldFound == 0 && stealItem != null )
{
stealItem.container = myNPC.pack;
}
}
This script is still in a very early stage, what is needed to make it better:
- Inlcude a possibility that a player with higher skills detects the steal attempt (I'm still looking for a skill that might fit that purpose), and turn the thief into a criminal if he got detected (is this even possible with a jscript?).
- Let thiefs try to steal when they collide with a player (can't do that until onCollide works again).