The top portion of this script heals a pc 1 hp every 5 seconds,but it does it in combat and doesnt do it to hechmen.It was written by axe murder so its a good step in your direction.Maybe throw a call in there to see if the pc is in combat and then somehow hook it to the henchmen.Figure its a start.
#include "gs_inc_encounter"
#include "gs_inc_flag"
#include "gs_inc_worship"
#include "gs_inc_xp"
void HealOneHP( object oPC)
{ if( GetIsDead( oPC))
{ DeleteLocalInt( oPC, "Dying");
SetLocalInt( oPC, "HealCounter", 5);
return;
}
if( GetLocalInt( oPC, "Dying"))
{ SetLocalInt( oPC, "HealCounter", 14);
return;
}
SetLocalInt( oPC, "HealCounter", GetLocalInt( oPC, "HealCounter") -1);
if( GetLocalInt( oPC, "HealCounter") > 0) return;
SetLocalInt( oPC, "HealCounter", 5);
ApplyEffectToObject( DURATION_TYPE_INSTANT, EffectHeal( 1), oPC);
}
void main()
{
object oPC = OBJECT_INVALID;
object oArea = OBJECT_INVALID;
object oTarget = OBJECT_INVALID;
location lLocation;
int nPreviousDay = GetLocalInt(OBJECT_SELF, "GS_DAY");
int nCurrentDay = GetCalendarDay();
int nPreviousHour = GetLocalInt(OBJECT_SELF, "GS_HOUR");
int nCurrentHour = GetTimeHour();
int nRound = GetLocalInt(OBJECT_SELF, "GS_ROUND") + 1;
int nTimestamp = gsTIGetActualTimestamp();
ExecuteScript("x3_mod_def_hb",OBJECT_SELF);
ExecuteScript("pgs_mod_heartbea",OBJECT_SELF);//player guild system
//per day
if (nPreviousDay != nCurrentDay)
{
//process deities presence
gsWOProcessPresence();
SetLocalInt(OBJECT_SELF, "GS_DAY", nCurrentDay);
}
//per hour
if (nPreviousHour != nCurrentHour)
{
//process deities power
gsWOProcessPower();
oPC = GetFirstPC();
while (GetIsObjectValid(oPC))
{
if (! GetIsDM(oPC) &&
GetLocalInt(oPC, "GS_ENABLED") &&
! gsFLGetAreaFlag("OVERRIDE_STATE", oPC))
{
if (GetLocalInt(oPC, "GS_ACTIVE"))
{
//experience bonus
if (! gsFLGetAreaFlag("OVERRIDE_DEATH", oPC))
gsXPApply(oPC, gsPCGetRolePlay(oPC));
DeleteLocalInt(oPC, "GS_ACTIVE");
}
else
{
AssignCommand(oPC, PlayAnimation(ANIMATION_LOOPING_PAUSE_TIRED, 1.0, 3600.0));
}
//state
AssignCommand(oPC, gsSTProcessState());
}
oPC = GetNextPC();
}
SetCampaignInt("GS_SYSTEM", "TIMESTAMP", nTimestamp);
SetLocalInt(OBJECT_SELF, "GS_HOUR", nCurrentHour);
}
//per 5 rounds
if (nRound > 4)
{
oPC = GetFirstPC();
nRound = 0;
while (GetIsObjectValid(oPC))
{
if (! GetIsDM(oPC) &&
GetLocalInt(oPC, "GS_ENABLED"))
{
//encounter
oArea = GetArea(oPC);
if (GetIsObjectValid(oArea) &&
! GetLocalInt(oArea, "GS_ENCOUNTER"))
{
gsENSpawnByChance(oArea);
SetLocalInt(oArea, "GS_ENCOUNTER", TRUE);
}
}
oPC = GetNextPC();
}
}
SetLocalInt(OBJECT_SELF, "GS_ROUND", nRound);
SetLocalInt(OBJECT_SELF, "GS_TIMESTAMP", nTimestamp);
//per round
oPC = GetFirstPC();
while (GetIsObjectValid(oPC))
{
HealOneHP( oPC);
oArea = GetArea(oPC);
if (GetIsObjectValid(oArea))
{
SetLocalInt(oArea, "GS_TIMESTAMP", nTimestamp);
DeleteLocalInt(oArea, "GS_ENCOUNTER");
}
if (! GetIsDM(oPC) &&
GetLocalInt(oPC, "GS_ENABLED") == TRUE)
{
//state animation
AssignCommand(oPC, gsSTPlayAnimation());
}
//activity
lLocation = GetLocation(oPC);
if (GetLocalLocation(oPC, "GS_LOCATION") != lLocation)
{
SetLocalLocation(oPC, "GS_LOCATION", lLocation);
SetLocalInt(oPC, "GS_ACTIVE", TRUE);
}
oPC = GetNextPC();
}
}
Modifié par Builder_Anthony, 20 octobre 2010 - 03:25 .