Author Topic: Need help with a food script  (Read 413 times)

Legacy_Leoamros1

  • Newbie
  • *
  • Posts: 4
  • Karma: +0/-0
Need help with a food script
« on: August 25, 2010, 05:35:43 am »


               I'm just about ready to pull my hair out with this one, everything seems to work up to the part where it needs to apply an effect. Can any of you please help?

void HungerLoop(object oPC, int iHCount)
{
   int iTime = 15; //How often?

   object oFood = GetItemPossessedBy(oPC, "LMA_Food");

   if ( GetIsObjectValid(oFood))
   {
       DestroyObject(oFood, 0.0);
       iHCount = 0;
   }
   else
   {
       iHCount +1;
       SendMessageToPC(oPC,"You are hungry!");
   }
   int iHunger = (2 * iHCount);
   effect eCon = EffectAbilityDecrease(ABILITY_CONSTITUTION, iHunger);
   ApplyEffectToObject(1, eCon, oPC, IntToFloat(iTime));
   if ( GetAbilityScore(oPC, 2, 0) < 4 )
   {
       ApplyEffectToObject(0, EffectDeath(0, 1), oPC);
   }
   DelayCommand(IntToFloat(iTime), HungerLoop(oPC, iHCount));
}

void main()
{
  object oPC = GetEnteringObject();
  int iHCount = 0;
  if ( GetAge(oPC) > 0 )
  {
      DelayCommand(10.0, AssignCommand(oPC, HungerLoop(oPC, iHCount)));
  }
}


               
               

               
            

Legacy_Lightfoot8

  • Hero Member
  • *****
  • Posts: 4797
  • Karma: +0/-0
Need help with a food script
« Reply #1 on: August 25, 2010, 06:39:55 am »


               lol,  I cant believe how much testing I had to do to find this myself. 
iHCount +1;

Is an expression only,  You need an asingment. 


iHCount = iHCount+1 ;

or

++iHCount ;
               
               

               
            

Legacy_Leoamros1

  • Newbie
  • *
  • Posts: 4
  • Karma: +0/-0
Need help with a food script
« Reply #2 on: August 25, 2010, 07:22:06 am »


               I'm a fool, thanks sometimes you just need an extra set of eyes for the smallest of things.