Yes, yes I know this has been done several
times, but the scripts I have seen up to now only let you rest next to
the Bedroll or Throw Rug, so here comes…
Script name: Improved Bedroll Rest v1.0 and Bedroll Sleep beta v0.9
Improved Bedroll Rest v1.0:
Designed for: Useable Bedrolls(Placeables) -> Event OnUsed
What it does (visually): Lets Player run up to Bedroll. Sit down on the
middle of the Bedroll right way round and then Rest.
What it does (technically): OnUsed Player runs to Bedroll then
ForcesMoves to approximated middle off bedroll (done by looking in which
Quadrant (Q1, Q2, Q3, Q4) of the coordinate system the Player is
relative to the Bedroll. Then increasing the direction Location from
which the Player is coming). This may sound complicated but is quite
simple see code. Then Player gets aligned with bedroll so he can feel
more comfortable when resting .
Then Rests.
Improved Bedroll Rest v1.0:
NWScript:
void main()
{
object oPC = GetLastUsedBy();
object oTarget = GetArea(OBJECT_SELF);
location lTarget = GetLocation(OBJECT_SELF);
location lSource = GetLocation(oPC);
vector vTarget = GetPositionFromLocation(lTarget);
vector vSource = GetPositionFromLocation(lSource);
float fFacing = GetFacingFromLocation(lTarget);
if (vSource.x < vTarget.x)
{vTarget.x += 0.1f;}
else
{vTarget.x -= 0.1f;}
if (vSource.y < vTarget.y)
{vTarget.y += 0.1f;}
else
{vTarget.y -= 0.1f;}
lTarget = Location(oTarget,vTarget,fFacing);
AssignCommand(oPC,ActionForceMoveToLocation(lTarget));
DelayCommand(1.4f,AssignCommand(oPC, SetFacing(fFacing+180.0f)));
DelayCommand(1.3f,AssignCommand(oPC,ActionRest()));
}
Bedroll Sleep beta v0.9
Designed for: Useable Bedrolls(Placeables) -> Event OnUsed
What it does (visually): Lets Player run up to Bedroll. Sit down on the
middle of the Bedroll right way round and then play the sleep animation.
And elf and Co. meditate instead off sleep as they should.
What it does (technically): Its based on the above Improved Bedroll Rest
v1.0.
I am not totally satisfied with this script therefore the v0.9. It is
because of the following 3 things I couldn’t find out till now. MAYBE
SOME KNOWS SOME ADVICE ON THIS
- Cant find a way to instant Rest e.g. (RESTORE SPELLS or SPECIAL
ABILLITIES) without ACTIONREST(). Neither have I found a way to
replace the ACTIONREST() animation by script.
- Has anyone a LOOP script up his sleeve that is not dependant on
the OnHeartBeat Event nor is CPU dependant?
- Has anyone some advice how I could play the EffectVisualEffect (VFX_IMP_SLEEP)
continuously as long as the sleeps without the OnHeartBeat event?
NWScript:
void main()
{
object oPC = GetLastUsedBy();
object oTarget = GetArea(OBJECT_SELF);
location lTarget = GetLocation(OBJECT_SELF);
location lSource = GetLocation(oPC);
vector vTarget = GetPositionFromLocation(lTarget);
vector vSource = GetPositionFromLocation(lSource);
float fFacing = GetFacingFromLocation(lTarget);
int nDuration = 2;
effect eSleep = EffectSleep();
effect eVis = EffectVisualEffect(VFX_IMP_SLEEP);
if (vSource.x < vTarget.x)
{vTarget.x += 0.1f;}
else
{vTarget.x -= 0.1f;}
if (vSource.y < vTarget.y)
{vTarget.y += 0.1f;}
else
{vTarget.y -= 0.1f;}
lTarget = Location(oTarget,vTarget,fFacing);
AssignCommand(oPC,ActionForceMoveToLocation(lTarget));
DelayCommand(1.4f,AssignCommand(oPC, SetFacing(fFacing)));
if (GetIsImmune(oPC,FEAT_IMMUNITY_TO_SLEEP) == TRUE || GetHasFeat(FEAT_IMMUNITY_TO_SLEEP,oPC) == TRUE)
{
FloatingTextStringOnCreature("",oPC);
FloatingTextStringOnCreature("*Meditating*",oPC);
DelayCommand(1.3f,AssignCommand(oPC, ActionPlayAnimation(ANIMATION_LOOPING_SIT_CROSS,1.0f,300.0f)));
}
else
{
DelayCommand(2.0f,ApplyEffectToObject(DURATION_TYPE_TEMPORARY, eSleep, oPC, RoundsToSeconds(nDuration)));
DelayCommand(4.6f,ApplyEffectToObject(DURATION_TYPE_TEMPORARY, eVis, oPC, RoundsToSeconds(nDuration)));
}
}
Insperations very welcome!ˇ!
|