generated from Jaysyn/ModuleTemplate
	
		
			
				
	
	
		
			35 lines
		
	
	
		
			1.5 KiB
		
	
	
	
		
			Plaintext
		
	
	
	
	
	
			
		
		
	
	
			35 lines
		
	
	
		
			1.5 KiB
		
	
	
	
		
			Plaintext
		
	
	
	
	
	
void Water(object PC, string tag, float time)
 | 
						|
{
 | 
						|
    string atag = GetTag(GetArea(PC));
 | 
						|
    if (atag == tag) {
 | 
						|
        int thirst = GetLocalInt(PC, "thirst");
 | 
						|
        if (thirst > 4) {
 | 
						|
            FloatingTextStringOnCreature("You died of thirst!", PC);
 | 
						|
            ApplyEffectToObject(DURATION_TYPE_INSTANT, EffectDeath(FALSE), PC);
 | 
						|
            thirst = 0;
 | 
						|
        } else if (thirst == 4) {
 | 
						|
            FloatingTextStringOnCreature("You are going to die of thirst soon.", PC);
 | 
						|
            ApplyEffectToObject(DURATION_TYPE_INSTANT, ExtraordinaryEffect(EffectDamage((thirst-1)*40, DAMAGE_TYPE_DIVINE, DAMAGE_POWER_ENERGY)), PC);
 | 
						|
            AssignCommand(PC, ActionPlayAnimation(ANIMATION_LOOPING_DEAD_BACK, 1.0, 20.0));
 | 
						|
        } else if (thirst > 1) {
 | 
						|
            FloatingTextStringOnCreature("You need water.", PC);
 | 
						|
            ApplyEffectToObject(DURATION_TYPE_INSTANT, ExtraordinaryEffect(EffectDamage((thirst-1)*40, DAMAGE_TYPE_DIVINE, DAMAGE_POWER_ENERGY)), PC);
 | 
						|
        } else {
 | 
						|
            FloatingTextStringOnCreature("You feel thirsty.", PC);
 | 
						|
        }
 | 
						|
        SetLocalInt(PC, "thirst", thirst+1);
 | 
						|
        DelayCommand(time, Water(PC, tag, time));
 | 
						|
    }
 | 
						|
}
 | 
						|
 | 
						|
void main()
 | 
						|
{
 | 
						|
    float delay = 60.0;            // time in seconds before player must drink
 | 
						|
    object PC = GetEnteringObject();
 | 
						|
    if (GetIsPC(PC) == TRUE) {
 | 
						|
        FloatingTextStringOnCreature("The heat here is scorching.", PC);
 | 
						|
        SetLocalInt(PC, "thirst", GetLocalInt(PC, "thirst")+1);
 | 
						|
        DelayCommand(20.0, Water(PC, GetTag(OBJECT_SELF), delay));
 | 
						|
    }
 | 
						|
}
 |