Aller au contenu

Photo

Need help with a food script


  • Veuillez vous connecter pour répondre
2 réponses à ce sujet

#1
Leoamros1

Leoamros1
  • Members
  • 2 messages
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)));
  }
}



#2
Lightfoot8

Lightfoot8
  • Members
  • 2 535 messages
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 ;

#3
Leoamros1

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