Back to index

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