Aller au contenu

Photo

npc's during sleep get up


  • Veuillez vous connecter pour répondre
7 réponses à ce sujet

#1
psiiijay

psiiijay
  • Members
  • 258 messages

Sleep spells put npc's to sleep for pretty long time (1 rnd per lvl) but for some reason the sleepers get up while sleeping (they keep the sleeping status fine but stand instead of lie down) - nothing wrong with the script so hard to find a solution - went so far as to add knockdown status to every sleeping creature for the duration - but then only SOME of the creatures affected stay on the ground and some get up after about 1 round.. Are sleep and knockdown hardcoded broken? Is there a way to fix this? (a way that would apply for all creatures)  



#2
kevL

kevL
  • Members
  • 4 056 messages
i remember 'fixing' this, but only for the single spellscript Tasha's Hideous Laughter.

I believe it involved a knockdown, along with using SetCommandable(FALSE) for a duration
 
if (!iSave)
{
    int bCommandable = GetCommandable(oTarget);
    if (!bCommandable) SetCommandable(TRUE, oTarget);

    int iDur = GetCasterLevel(OBJECT_SELF);
    float fDur = RoundsToSeconds(iDur);
    fDur = ApplyMetamagicDurationMods(fDur);

    AssignCommand(oTarget, ClearAllActions(TRUE));
    AssignCommand(oTarget, PlayVoiceChat(VOICE_CHAT_LAUGH));
    AssignCommand(oTarget, ActionSpeakString("I never heard THAT one !! hahahahah", TALKVOLUME_TALK));
    AssignCommand(oTarget, ActionPlayAnimation(ANIMATION_LOOPING_TALK_LAUGHING));


    effect eVis = EffectVisualEffect(VFX_HIT_SPELL_ENCHANTMENT);
    ApplyEffectToObject(DURATION_TYPE_INSTANT, eVis, oTarget);

    effect eDur = EffectVisualEffect(VFX_DUR_SPELL_TASHA_LAUGHTER);
    effect eLaugh = EffectKnockdown();
    eLaugh = EffectLinkEffects(eLaugh, eDur);


    DelayCommand(0.1f, SetCommandable(FALSE, oTarget));

    if (iDur > 1)
        DelayCommand(6.f, ApplyEffectToObject(DURATION_TYPE_TEMPORARY, eLaugh, oTarget, fDur - 6.f));

    if (bCommandable)
        DelayCommand(fDur, SetCommandable(TRUE, oTarget));
}
i believe that keeps target down, which was tested by running my PC back and forth over target. I guess something similiar'd need to be done in the Sleep spellscript ...

#3
psiiijay

psiiijay
  • Members
  • 258 messages

Yeah, I'm petty sure that function did the trick :) 



#4
Lance Botelle

Lance Botelle
  • Members
  • 1 480 messages

if (!iSave)
{
    if (iDur > 1)
        DelayCommand(6.f, ApplyEffectToObject(DURATION_TYPE_TEMPORARY, eLaugh, oTarget, fDur - 6.f));

    if (bCommandable)
        DelayCommand(fDur, SetCommandable(TRUE, oTarget));
}


Hi KevL,

What does the 6.f mean?

Is it the same thing as 6.0?

Cheers,
Lance.

#5
kevL

kevL
  • Members
  • 4 056 messages
yep, just helps me keep me head on straight (the .f always stands out).

#6
Lance Botelle

Lance Botelle
  • Members
  • 1 480 messages

yep, just helps me keep me head on straight (the .f always stands out).


Phew! ;)

Cheers, Lance.

#7
Tchos

Tchos
  • Members
  • 5 042 messages

Additional info...  It stands for "float" and it can be used to write an integer without a decimal point that the compiler knows to interpret as a float.  Alternatively, you can just add a ".0" to your number.  So for any float, you can write it as 6f, 6.f, 6.0f, or 6.0, but not as 6 with no decimal point.  Maybe you can write it as "6." and leave off the 0, I don't know.



#8
kevL

kevL
  • Members
  • 4 056 messages
yep, 6. works