Trying to set up my first bool

Started by jamesreg, Tue 29/09/2009 22:19:36

Previous topic - Next topic

jamesreg

Im still trying to learn if and else statments and using bools


This is working right except the way I want it exception of

it repeats all three dialogs when using the medscanner
and it repeats all the dialogs when its supposed to justr say hes healed

Its turning on and off the bool and working with my other scripts I have set up to interact with it

I am sure I am missing some else statements or to declare something somewhere of have brackets messed up.

I have been working on it trying to figure out what it is I have done wrong once I do I am pretty sure it will click and be
like everything else ill me like oh man that was simple lol.

also I plan to replace the say commands in this script with ddialog scripts but useing it this way to test it till i have it working right then will replace




function csick_UseInv()
{
if (player.ActiveInventory == ihypo)
{
 
  PlaySound(15);
  player.Say("I cant heal him unless I know whats wrong with him");

  if (Scanned)
  player.Say("hes' healed Jim");
  Healed = true;
   
   if (Scanned && Healed)
   player.Say("there is nothing else i can do for him hypo");
}

if (player.ActiveInventory == iMedscanner)

{
PlaySound(11);
player.Say("I am scanning him the first time");
Scanned = true;

if (Scanned)
player.Say("hes already been scanned");

if (Scanned && Healed)
player.Say("there is nothing else I can do for him Medscanner");

}
}

Gilbert

Try this (not checked for errors, etc.):
Code: ags
function csick_UseInv()
{
  if (player.ActiveInventory == ihypo) {
   PlaySound(15);
   if (Scanned){
       if (Healed) player.Say("there is nothing else i can do for him hypo");
       else {
           player.Say("hes' healed Jim");
           Healed = true;
       }
    } else player.Say("I cant heal him unless I know whats wrong with him");

 }

 if (player.ActiveInventory == iMedscanner) { 
   PlaySound(11);
   if (Scanned) {
      if (Healed) player.Say("there is nothing else I can do for him Medscanner");
      else player.Say("hes already been scanned");
   } else {
      player.Say("I am scanning him the first time");
      Scanned = true;
   }
 }
}

SMF spam blocked by CleanTalk