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)));
}
}