home *** CD-ROM | disk | FTP | other *** search
/ The Best of Select: Games 3 / cd.iso / games / dcg303xa / quester.scr < prev    next >
Text File  |  1993-06-27  |  5KB  |  194 lines

  1. !
  2. ! Default quester script..
  3. !
  4. ! (c) DC Software, 1992
  5. !
  6.  
  7. !------------------------------------------------------------------------!
  8. :@TALK ! Talk to the character !
  9. !------------------------------------------------------------------------!
  10.  
  11.   if player.hp = 0 then
  12.     writeln( player.name, " is dead!" );
  13.     STOP;
  14.   endif;
  15.  
  16.   if npc.picture >= 0 then
  17.     viewpcx(npc);
  18.   endif;
  19.  
  20. ! No more quests?
  21.   if npc.v1 = 16 GOTO NOMORE;
  22.  
  23. ! Always talk to the leader of the pack..
  24.   group.current = 0;
  25.  
  26. ! Initialize the first time through..
  27.   if npc.v0 = 0 then
  28.     npc.v0 = 1;  ! We've talked, but no quest is pending..
  29.     npc.v1 = 0;  ! Do quest 0 first.
  30.   else
  31.     if npc.v0 = 2 goto QUEST; ! We already have a quest..
  32.   endif;
  33.  
  34. ! Select the item to be quested..
  35. :LOOP
  36.   setbp( npc, npc.v1 );
  37.   if npc.bp.count = 0 then
  38.     inc( npc.v1 );       ! The slot is empty, check the next one !
  39.     if npc.v1 = 16 
  40.        goto NOMORE;      ! We've got no more quests !
  41.     goto LOOP;
  42.   endif;
  43.  
  44. :START
  45.   writeln( "Are you in need of a quest?" );
  46.  
  47.   L1 = select( "Yes", "No", "Talk", "Bye" );
  48.   ON L1 GOTO QYES, QNO, CHAT, CSTOP;
  49.  
  50. :QYES
  51.   writeln( "I'll pay you ", $npc.bp.value, " if you bring me the ", npc.bp.name );
  52.   writeln( "Good luck.." );
  53.   npc.v0 = 2; ! Quest Given
  54.   goto XSTOP;
  55.  
  56. :QNO
  57.   writeln( "Then be on your way please.." );
  58.   goto XSTOP;
  59.  
  60. !
  61. ! We HAVE a quest
  62. !
  63. :QUEST
  64.   setbp( npc, npc.v1 ); ! Select the quest that was given.. !
  65.   writeln( player.name, "! Have you brought me the ", npc.bp.name, "?" );
  66.   voice( "Quest" );
  67.  
  68.   L1 = select( "Yes", "No", "Talk", "Bye" );
  69.   on L1 goto CYES, CNO, CHAT;
  70.   goto CSTOP;
  71.  
  72. :CYES
  73.  
  74. ! Find out WHO has the item
  75.   L2 = find( player, npc.bp.name );
  76.   if L2 < 0 then 
  77.     ! No one, so find out if the object is a person..
  78.     L2 = find( group, npc.bp.name );
  79.     if L2 < 0 goto NOTHERE;
  80.   endif;
  81.  
  82.   group.current = L2;
  83. ! If the player's name matches the backpack name, its a RESCUE !
  84.   if player.name = npc.bp.name then
  85.     writeln( player.name, "! I almost didn't recognize you.." );
  86.     ! 
  87.     ! When the rescued person leaves the party, take the following actions
  88.     !
  89.     player.v1 = 2;              ! 1 when I join the party.  2 on delivery! 
  90.     if( player.text >= 0 ) then
  91.       inc( player.text );       ! Change text block (if any)
  92.     endif;
  93.     if( player.voice >= 0 ) then
  94.       inc( player.voice );      ! Change voice file (if any)
  95.     endif;
  96.     if( player.picture >= 0 ) then
  97.       inc( player.picture );    ! Change picture file (if any)
  98.     endif;
  99.     player.type = CIVILIAN;     ! No longer a prisoner !
  100.     ! Place the player at next to the NPC (quester)
  101.     leave( player.index, npc.x+1, npc.y ); ! Remove from the party
  102.     group.current = 0;
  103.   else
  104.     ! Otherwise, the quested item is in the player's backpack.
  105.     L2 = find( player.bp, npc.bp.name, npc.bp.type );
  106.     if L2 < 0 GOTO NOTHERE;
  107.     vanish( player.bp );
  108.   endif;
  109.  
  110.   npc.v0 = 1;     ! No quest pending, but we already met
  111.   inc(npc.v1);    ! Increment backpack index for next quest (if any)
  112.  
  113.   ! Now give a reward..
  114.   inc( group.gold, npc.bp.value );               ! Pay for it !
  115.   writeln( $npc.bp.value, " is the reward.  Here it is." );
  116.  
  117.   if npc.bp.weight > 0 then
  118.     L4 = npc.bp.weight;                          ! Experience is given here !
  119.   else
  120.     L4 = npc.bp.value / 10 * (random(3)+1) + 1;  ! Give random experience !
  121.   endif;
  122.  
  123. ! Do the whole party..
  124.   foreach player do
  125.     inc( player.exp, L4 );    ! Level promotions are automatic !
  126.   endfor;
  127.  
  128.   if npc.bp.endgame = END_ON_GIVE then
  129.     if npc.bp.endtext > 0 then
  130.       readtext( npc.bp.endtext );
  131.     endif;
  132.     ENDGAME;
  133.   endif;
  134.  
  135. :CSTOP
  136.   writeln( "May the force be with you." );
  137.   goto XSTOP;
  138.  
  139. :CNO
  140.   writeln( "Why are you back then?" );
  141.   GOTO CHAT1;
  142.  
  143. !
  144. ! Conversation is optional for a quester, but this one likes to chat..
  145. !
  146. :CHAT
  147.   writeln( "What would you like to talk about?" );
  148.  
  149. :CHAT1
  150.   L3 = getstr("Name","Where","Quest","Bye");
  151.  
  152. ! First, see if the keyword typed is in the character's text block !
  153.   if dotext( S0 ) then
  154.     if L3 = 3 goto XSTOP;
  155.     goto CHAT1;
  156.   endif;
  157.  
  158. ! It didn't, so try the predefined ones..
  159.   on L3 goto CName, WHERE, START, CSTOP;
  160.  
  161. ! Nope, try a 'DEFAULT' line
  162.   if not dotext( "DEFAULT" ) then
  163.     writeln( "I don't know anything about that!" );
  164.   endif;
  165.   goto CHAT1;
  166.  
  167. :CName
  168.   writeln( "My name is ", npc.name, "."        );
  169.   GOTO CHAT1;
  170.  
  171. :WHERE
  172.   writeln( "If I knew where, I wouldn't need your services!" );
  173.   GOTO CHAT1;
  174.  
  175. :NOMORE
  176.   writeln( "Sorry, I have no more quests." );
  177.   goto XSTOP;
  178.  
  179. :NOTHERE
  180.   writeln( "You don't have the ", npc.bp.name, " with you." );
  181.   writeln( "Are you sure you found it?" );
  182.   L3 = select( "Yes", "No", "Maybe", "What", "Who", "Ugh..", "Bye" );
  183.   writeln( "Hmm..  Come back when you find it.." );
  184.   goto XSTOP;
  185.  
  186. !-----------------------------------------------------------------!
  187. ! All STOPs now lead here so the screen can be restored if needed !
  188. !-----------------------------------------------------------------!
  189. :XSTOP
  190.   if npc.picture >= 0 then
  191.     paint(window); ! Assumes the picture fits in the window !
  192.   endif;
  193.   STOP;
  194.