Increased HP of Practice Dummy. Added instanced player room with persistent storage in Inn. Full compile. Updated release archive.
171 lines
7.1 KiB
Plaintext
171 lines
7.1 KiB
Plaintext
void main()
|
|
{
|
|
object oPC = GetLastPCRested();
|
|
|
|
if (GetLastRestEventType()==REST_EVENTTYPE_REST_STARTED)
|
|
{
|
|
int nWM = d100(1);
|
|
string sLevel = IntToString(GetHitDice(oPC));
|
|
string sResref = "wm_" + sLevel;
|
|
object oWP = GetNearestObjectByTag("wmwp");
|
|
location lWP = GetLocation(oWP);
|
|
if (nWM<=10)
|
|
{
|
|
object oSpawn = CreateObject(OBJECT_TYPE_CREATURE,sResref,lWP);
|
|
AssignCommand(oSpawn,ActionAttack(oPC));
|
|
}
|
|
}
|
|
else if (GetLastRestEventType()==REST_EVENTTYPE_REST_FINISHED||REST_EVENTTYPE_REST_CANCELLED)
|
|
{
|
|
int nHour = GetTimeHour();
|
|
int nMinute = GetTimeMinute();
|
|
int nSecond = GetTimeSecond();
|
|
int nMillisecond = GetTimeMillisecond();
|
|
// Advance the time 8 hours.
|
|
nHour += 8;
|
|
|
|
// Set the new time
|
|
int iPW = GetLocalInt(GetModule(), "PW_MODE");
|
|
|
|
//:: Skip if running as a Persistant World MP module
|
|
if (!iPW)
|
|
{
|
|
SetTime(nHour, nMinute, nSecond, nMillisecond);
|
|
}
|
|
|
|
// See how hungry and thirsty PC is
|
|
int ibHungry = GetLocalInt(oPC,"ate");
|
|
int ibThirsty = GetLocalInt(oPC,"drank");
|
|
|
|
// Make them wake up hungrier and thirstier
|
|
SetLocalInt(oPC,"ate",ibHungry-1);
|
|
SetLocalInt(oPC,"drank",ibThirsty-1);
|
|
|
|
|
|
//get new values
|
|
int iHungry = GetLocalInt(oPC,"ate");
|
|
int iThirsty = GetLocalInt(oPC,"drank");
|
|
//apply hunger and thirst penalties
|
|
switch (iHungry)
|
|
{
|
|
case -1:
|
|
{
|
|
effect eEffect = EffectAbilityDecrease(ABILITY_CONSTITUTION, 2);
|
|
eEffect = ExtraordinaryEffect(eEffect);
|
|
ApplyEffectToObject(DURATION_TYPE_PERMANENT, eEffect, oPC);
|
|
SendMessageToPC(oPC,"You rest well, but you awaken hungry.");
|
|
break;
|
|
}
|
|
case -2:
|
|
{
|
|
effect eEffect = EffectAbilityDecrease(ABILITY_CONSTITUTION, 4);
|
|
eEffect = ExtraordinaryEffect(eEffect);
|
|
ApplyEffectToObject(DURATION_TYPE_PERMANENT, eEffect, oPC);
|
|
SendMessageToPC(oPC,"You rest well, but you awaken quite hungry.");
|
|
break;
|
|
}
|
|
case -3:
|
|
{
|
|
effect eEffect = EffectAbilityDecrease(ABILITY_CONSTITUTION, 5);
|
|
eEffect = ExtraordinaryEffect(eEffect);
|
|
ApplyEffectToObject(DURATION_TYPE_PERMANENT, eEffect, oPC);
|
|
SendMessageToPC(oPC,"You rest well, but you awaken really hungry.");
|
|
break;
|
|
}
|
|
case -4:
|
|
{
|
|
effect eEffect = EffectAbilityDecrease(ABILITY_CONSTITUTION, 6);
|
|
eEffect = ExtraordinaryEffect(eEffect);
|
|
ApplyEffectToObject(DURATION_TYPE_PERMANENT, eEffect, oPC);
|
|
SendMessageToPC(oPC,"You rest well, but you awaken very hungry.");
|
|
break;
|
|
}
|
|
case -5:
|
|
{
|
|
effect eEffect = EffectAbilityDecrease(ABILITY_CONSTITUTION, 7);
|
|
eEffect = ExtraordinaryEffect(eEffect);
|
|
ApplyEffectToObject(DURATION_TYPE_PERMANENT, eEffect, oPC);
|
|
SendMessageToPC(oPC,"You rest well, but you awaken painfully hungry.");
|
|
break;
|
|
}
|
|
case -6:
|
|
{
|
|
effect eEffect = EffectAbilityDecrease(ABILITY_CONSTITUTION, 8);
|
|
eEffect = ExtraordinaryEffect(eEffect);
|
|
ApplyEffectToObject(DURATION_TYPE_PERMANENT, eEffect, oPC);
|
|
SendMessageToPC(oPC,"You rest well, but you awaken extremely hungry.");
|
|
break;
|
|
}
|
|
case -7:
|
|
{
|
|
effect eEffect = EffectAbilityDecrease(ABILITY_CONSTITUTION, 10);
|
|
eEffect = ExtraordinaryEffect(eEffect);
|
|
ApplyEffectToObject(DURATION_TYPE_PERMANENT, eEffect, oPC);
|
|
SendMessageToPC(oPC,"You rest well, but you are starving to death.");
|
|
break;
|
|
}
|
|
case -8:
|
|
{
|
|
effect eEffect = EffectAbilityDecrease(ABILITY_CONSTITUTION, 12);
|
|
eEffect = ExtraordinaryEffect(eEffect);
|
|
ApplyEffectToObject(DURATION_TYPE_PERMANENT, eEffect, oPC);
|
|
SendMessageToPC(oPC,"You will die soon if you don't eat.");
|
|
break;
|
|
}
|
|
case -9:
|
|
{
|
|
effect eEffect = EffectDeath();
|
|
ApplyEffectToObject(DURATION_TYPE_PERMANENT, eEffect, oPC);
|
|
SendMessageToPC(oPC,"You have starved to death.");
|
|
break;
|
|
}
|
|
}
|
|
switch (iThirsty)
|
|
{
|
|
case -1:
|
|
{
|
|
effect eEffect = EffectNegativeLevel(1,FALSE);
|
|
eEffect = ExtraordinaryEffect(eEffect);
|
|
ApplyEffectToObject(DURATION_TYPE_PERMANENT, eEffect, oPC);
|
|
SendMessageToPC(oPC,"You awaken and are quite thirsty.");
|
|
break;
|
|
}
|
|
case -2:
|
|
{
|
|
effect eEffect = EffectNegativeLevel(2,FALSE);
|
|
eEffect = ExtraordinaryEffect(eEffect);
|
|
ApplyEffectToObject(DURATION_TYPE_PERMANENT, eEffect, oPC);
|
|
SendMessageToPC(oPC,"You awaken and are extremely thirsty.");
|
|
break;
|
|
}
|
|
case -3:
|
|
{
|
|
effect eEffect = EffectNegativeLevel(3,FALSE);
|
|
eEffect = ExtraordinaryEffect(eEffect);
|
|
ApplyEffectToObject(DURATION_TYPE_PERMANENT, eEffect, oPC);
|
|
SendMessageToPC(oPC,"You awaken and are dreadfully thirsty.");
|
|
break;
|
|
}
|
|
case -4:
|
|
{
|
|
effect eEffect = EffectNegativeLevel(4,FALSE);
|
|
eEffect = ExtraordinaryEffect(eEffect);
|
|
ApplyEffectToObject(DURATION_TYPE_PERMANENT, eEffect, oPC);
|
|
SendMessageToPC(oPC,"You are dying of thirst, you need to find something to drink.");
|
|
break;
|
|
}
|
|
case -5:
|
|
{
|
|
effect eEffect = EffectDeath();
|
|
ApplyEffectToObject(DURATION_TYPE_PERMANENT, eEffect, oPC);
|
|
SendMessageToPC(oPC,"You have died of thirst.");
|
|
break;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
}
|