Back to index

freedink-data  1.08.20080920
S4-HEALP.c
Go to the documentation of this file.
00001 //script for store manager, actually attached to the bench
00002 
00003 void main( void )
00004 {
00005 
00006  int &crap = create_sprite(185,150, 0, 0, 0);
00007  &temphold = &crap;
00008  int &amount = 0;
00009 
00010 preload_seq(251);
00011 preload_seq(253);
00012 int &myrand;
00013 sp_brain(&temphold, 0);
00014 sp_base_walk(&temphold, 250);
00015 sp_speed(&temphold, 0);
00016 
00017 //set starting pic
00018 
00019 sp_pseq(&temphold, 253);
00020 sp_pframe(&temphold, 1);
00021 
00022 mainloop:
00023 wait(500);
00024 &myrand = random(8, 1);
00025 
00026   if (&myrand == 1)
00027   {
00028   sp_pseq(&temphold, 253);
00029   }
00030 
00031   if (&myrand == 2)
00032   {
00033   sp_pseq(&temphold, 251);
00034   }
00035 
00036 &myrand = random(20, 1);
00037 goto mainloop;
00038 }
00039 
00040 void buybottle( void)
00041 {
00042 int &junk = free_items();
00043 
00044 
00045 if (&junk < 1)
00046  {
00047          choice_start()
00048         set_y 240
00049         title_start();
00050 You are carrying too much.
00051         title_end();
00052          "Ok"
00053          choice_end()
00054  return;
00055  }
00056 
00057 
00058 if (&gold < 100)
00059  {
00060          choice_start()
00061         set_y 240
00062         title_start();
00063 You don't have enough gold to buy elixer.
00064         title_end();
00065          "Ok"
00066          choice_end()
00067  return;
00068  }
00069 
00070 &gold -= 100;
00071 add_item("item-eli",438, 9);
00072 
00073 }
00074 
00075 
00076 void hit( void )
00077 {
00078 sp_speed(&current_sprite, 0);
00079 wait(400);
00080 say_stop("`%Please don't wreck the place, thanks.", &temphold);
00081 wait(800);
00082 goto mainloop;
00083 }
00084 
00085 void talk( void )
00086 {
00087 
00088  freeze(1);
00089 startok:
00090 
00091 if (&life >= &lifemax)
00092 {
00093  choice_start();
00094         set_y 240
00095         set_title_color 15
00096         title_start();
00097 "You are the perfect picture of health, sir."
00098         title_end();
00099          "Buy a bottle of elixer for $100"
00100          "Leave"
00101  choice_end();
00102 
00103   if (&result == 1)
00104   {
00105   buybottle();
00106   }
00107    unfreeze(1);
00108    goto mainloop;
00109    return;
00110 }
00111 
00112 
00113 }
00114 startchoice:
00115 &amount = &lifemax;
00116 &amount -= &life;
00117 
00118          choice_start()
00119         set_y 240
00120         set_title_color 15
00121         title_start();
00122 "You are injured!  It will cost $&amount gold to heal you."
00123         title_end();
00124          "Get healed"
00125          "Buy a bottle of elixer for $100"
00126          "Leave"
00127          choice_end()
00128 
00129 if (&result == 1)
00130   {
00131    if (&gold < &amount)
00132    {
00133          choice_start()
00134         set_y 240
00135         title_start();
00136 You don't have enough gold.
00137         title_end();
00138          "Ok"
00139          choice_end()
00140    goto startchoice;    
00141    }
00142 &life = &lifemax;
00143 &gold -= &amount;
00144 Playsound(22,22050,0,0,0);
00145 say("I am healed.", 1);
00146  unfreeze(1);
00147  goto mainloop;
00148   }
00149 
00150   if (&result == 2)
00151   {
00152    buybottle();
00153   }
00154 
00155    unfreeze(1);
00156    goto mainloop;
00157    return;
00158 
00159 }
00160