! Pickpocket Script
! Copyright (c)1997 AbyssWare
! By: AbyssDragon
! abyssdragon@juno.com http://www.geocities.com/TimesSquare/2795
! Modified from civilian.scr by DCSoftware
!
! Version 3! Fixed some bugs. Thanks goes to Imi (ImiKing@aol.com) for
! pointing them out.
! Version 2! The Thief will now grab objects that are laying around him,
! and the amount of money gained/lost is a little less.
!
! This creates thieves that will actually steal from the player. It also
! simulates them stealing from other NPCs by them randomly gaining money
! just by standing there. Under normal circumstances, they won't gain
! much money, but if the random numbers turn up lucky, they can gain
! quite a bit of money. But, why, you ask, would an NPC want money?
! The player, if he catches the thief, gains the money, giving him another
! way to gain money, besides fighting monsters.
! Basically, the higher the dexterity of the thief, the harder it will be
! for the player to catch him, but the more money he will have.
! The theif dissapears out of site upon being caught, but you could easily
! modify that so he just moves to another section of town.
! There's not much different than the normal civilian.scr
! -----------------------------------------------------------------------!
! INSERT THE FOLLOWING PART IN CONTROL.SCR, WHERE IT SAYS THINGS TO DO
! EVERY MINUTE
! -----------------------------------------------------------------------!
foreach npc do
if npc.type = PICKPOCKET then
if npc.value < 0 then
npc.value = 0;
endif;
foreach object do
if abs(npc.x - object.x) + abs(npc.y - object.y) < 3 then
if abs(npc.x - player.x) > 20 or abs(npc.y - player.y) > 20 then
vanish(object);
endif;
endif;
endfor;
if abs(npc.x - player.x) + abs(npc.y - player.y) = 1 then
L20 = random(3 + 1);
dec( group.gold, L20);
inc( npc.value, L20);
endif;
L0 = random(60);
if L0 = 1 then
inc(npc.value,random(20));
elsif L0 = 2 then
dec(npc.value,random(20));
if npc.value < 0 then
npc.value = 0;
endif;
endif;
endif;
endfor;
! -----------------------------------------------------------------------!
! END CONTROL SECTION
! -----------------------------------------------------------------------!
!------------------------------------------------------------------------!
:@TALK ! Talk to the character !
!------------------------------------------------------------------------!
if player.hp = 0 then
writeln( player.name, " is dead!" );
STOP;
endif;
if npc.count = 0 then
L0 = msgbox( ERROR, 1, "Ok", "ERROR: NPC Script called with no NPC selected!" );
STOP;
endif;
if npc.picture >= 0 then
viewpcx(npc);
endif;
loadtext( npc.text ); ! Get the NPC's text block !
loadvfl( npc.voice ); ! Get the NPC's voice block !
! Now, set some variables..
NPC.V0 = 1; ! From know on, remember we've been here
L1 = random(10) + 1;
L2 = random(2);
L0 = group.gold / L1;
if L0 > npc.dex then
L0 = npc.dex;
endif;
if npc.dex > player.dex and L2 = 0 then
if random(10) = 0 goto CATCH;
:STEAL
dec(group.gold, L0);
inc(npc.value, L0);
elsif npc.dex < player.dex and L2 = 0 then
if random(10) = 0 goto STEAL;
:CATCH
S1 = swriteln("You caught ", npc.name, " trying to steal from you!");
L0 = msgbox(EXCLAMATION,1,"Okay",S1);
inc(group.gold, npc.value);
npc.count = 0;
L0 = msgbox(EXCLAMATION,1,"Okay", "He gives you the money he has and runs off.");
goto XSTOP;
endif;
readtext( npc.text );
pause;
paint(window);
L0 = msgbox(EXCLAMATION, 1, "Okay", "I hope to see you agan." );
goto XSTOP;
! Feel free to expand on this list.. !
!-----------------------------------------------------------------!
! All STOPs now lead here so the screen can be restored if needed !
!-----------------------------------------------------------------!
:XSTOP
if npc.picture >= 0 then
paint(window); ! Assumes the picture fits in the window !
endif;
stats(-1); ! Refresh Statistics !
STOP;
               (
geocities.com/timessquare)