! Toll-Collector ! Copyright (c)1997 AbyssWare ! By: AbyssDragon ! abyssdragon@juno.com http://www.geocities.com/TimesSquare/2795 ! Modified from civilian.scr by DCSoftware ! ! This will create people that don't let you past without paying. The ! amount of money you owe them is equal to their value. When creating ! Toll-Collectors, remember that if their strength is more than 0, you ! will be given the option to fight them, if their strength is 0, then ! you won't have that option. ! Npc.value is the cost to pass. ! BUG: If you hit Cancel and move very quickly, you can get out of paying the ! toll. I can't think of a way to fix this right now. If anyone does, tell ! me, and I'll use your suggestion, if it's any good. ! -----------------------------------------------------------------------! ! INSERT THE FOLLOWING PART IN CONTROL.SCR, WHERE IT SAYS THINGS TO DO ! EVERY MINUTE ! -----------------------------------------------------------------------! foreach npc do if npc.type = TOLL then if abs(npc.x - player.x) < 2 or abs(npc.y - player.y) < 2 then if npc.v1 < 1 then runscript( npc.script, "OBJECT", TALK ); endif; endif; endif; endfor; ! -----------------------------------------------------------------------! ! END CONTROL SECTION ! -----------------------------------------------------------------------! !------------------------------------------------------------------------! :@TALK ! Talk to the character ! !------------------------------------------------------------------------! if npc.v1 = 1 then L0 = msgbox( EXCLAMATION, 1, "Okay", "You've already paid. Go away."); STOP; endif; 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; ! Now, set some variables.. NPC.V0 = 1; ! From know on, remember we've been here S1 = swriteln( "Halt! To go on, you must pay my fee of ", npc.value, " gold."); if npc.str > 0 then L0 = msgbox( EXCLAMATION, 3, "Pay", "Cancel", "Fight", S1); else L0 = msgbox( EXCLAMATION, 2, "Pay", "Cancel", S1); endif; on L0 goto PAY, XSTOP, BATTLE; goto XSTOP; :PAY if group.gold < npc.value then L0 = msgbox( EXCLAMATION, 1, "Okay", "You can't go through until you pay my fee."); else dec( group.gold, npc.value); L0 = msgbox( EXCLAMATION, 1, "Okay", "Nice doing business with you..."); npc.v1 = 1; endif; goto XSTOP; :BATTLE FIGHT; 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;