Part of the script:
effect eRegenerate = EffectRegenerate(1, 5.0);
if (GetIsNight() || (GetWeather(oArea) == WEATHER_RAIN))
{
DelayCommand (2.0, ActionForceMoveToLocation(lWP1,TRUE));
DelayCommand (12.0,ActionPlayAnimation(ANIMATION_LOOPING_DEAD_FRONT, 4.0f, 200.0f));
DelayCommand (14.0, ApplyEffectToObject(DURATION_TYPE_TEMPORARY, eRegenerate, oSpawn, 15.0));
return;
}
The WP1 is a dog house since I use this script for my dogs too, but you could make it anything you want, like their lair or the entrance to it. Then in certain conditions they will move there lay down and sleep. I could post the entire thing and it would make more sense but I think you get the idea.
At the botom of the above on perception script, just part of it I have a % chance to execute chasepc, which is below:
#include "x0_i0_position"
void main()
{
object oPC = GetNearestCreature(CREATURE_TYPE_PLAYER_CHAR, PLAYER_CHAR_IS_PC, OBJECT_SELF, 1, CREATURE_TYPE_PERCEPTION, PERCEPTION_SEEN);
int iHd = GetHitDice (oPC);
int iHd1 = GetHitDice (OBJECT_SELF);
int iHdd = iHd - iHd1;
effect eSpeed = EffectMovementSpeedIncrease(125);
//change number to change speed. added for possible temporary speed increase.
ClearAllActions(TRUE);
// you probably want to use the TRUE parameter here as this is likely to occur
// in combat otherwise the ClearAllActions call will have no effect.
if ((GetDistanceToObject(oPC) >= 3.0f) && (GetDistanceToObject(oPC) <= 10.0f))
// do this the chase stuff, else do something else. Condition not met PC is not
// between 3.0 and 8.0 meters, changed to or equal too.
{
ActionMoveToLocation(GetAheadLocation(oPC), TRUE);
//not sure that you need to keep repeating this.
//maybe use a delay command of a few seconds if the chasing
//npc seems to be losing it's target
}
if (GetDistanceToObject(oPC) < 3.0f)
// added this in so no point attacking unless you are actually there in contact
ApplyEffectToObject(DURATION_TYPE_TEMPORARY, eSpeed, OBJECT_SELF, 6.0);
if (GetIsEnemy (oPC) && (iHdd < 3))
//if you are too tough they just try to get in the way.
{
ActionAttack(oPC);
}
else ActionMoveToLocation(GetAheadLocation(oPC), TRUE);
}
Of course this is just the general idea there is other stuff in the ondamaged, but thought you might want to take a look. This was and idea I worked on from the vault which I tried to improve upon. Can't remember who wrote it.
Thus some of the comments. I looked it up it was uther1978:
http://nwvault.ign.c....Detail&id=3761
Oh and to briefly get on my soapbox and say that sometimes people have great ideas, but don't really have the technical expertise to implement them. Mostly people here encourage them but there are times when it seems that only certain technically adept indivduals are really taken seriously. Be that as it may, not really whining but just pointing this out, as regards the poor vote someone gave this script. Truely it did not work that well but I thought the idea was fine. The result can be that someone gets their feelings hurt and just quits trying. I used to try to help some people with their writing and man people can be really sesnitive. So we all need encouragement, not derision. Picks up his sopabox and leaves.
Modifié par ffbj, 22 août 2011 - 03:28 .