Aller au contenu

Photo

Bleed system script advice


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

#1
Aikidoka23

Aikidoka23
  • Members
  • 24 messages
Hiya, I am have trouble with the (CRAP) bleed system script in Mannast basemodule. Once the PC is dying and recovers, it takes a while for the creature to attack him again. Leading to the crazy thing of it standing there while the PC gets up and walks away.

I have tried lowering the value (66.0) of the line below, and this helps a little

SetIsTemporaryNeutral(oDying, oEnemy, TRUE, 66.0);

I've also tried adding

ActionMoveAwayFromObject(oEnemy);

or

ActionMoveAwayFromObject(oDying);

so the creature moves away from the PC it thinks it has killed, since losing line of sight seems to sometimes restore hostility. And it makes sense, but I can't work out where to put the line for it to work, and if oEnemy or oDying is right. 

Script is below, any advice much appreciated. 


#include "crp_inc_ddr"

void main()
{

    AssignCommand(oDying, ClearAllActions());

    //Stop enemies from attacking...
    int nNth = 1;
    object oEnemy = GetNearestObject(OBJECT_TYPE_CREATURE, oDying, nNth);
    while(GetIsObjectValid(oEnemy) && nNth <= 15)
    {
        if(GetReputation(oEnemy, oDying) <= 10)
        {
            //SendMessageToPC(oDying, GetName(oEnemy));
            AssignCommand(oEnemy, ClearAllActions());
            SetIsTemporaryNeutral(oDying, oEnemy, TRUE, 66.0);
            DelayCommand(1.0, AssignCommand(oEnemy, DetermineCombatRound()));
          
                    }
        nNth++;
        oEnemy = GetNearestObject(OBJECT_TYPE_CREATURE, oDying, nNth);

    }

      //Give the PC at least a few rounds to bleed
    int nHP = GetCurrentHitPoints(oDying);
    if(nHP < -3)
    {
        effect eSet = EffectHeal((nHP * -1) -3);
        ApplyEffectToObject(DURATION_TYPE_INSTANT, eSet, oDying);
    }

    //Determine the bleed delay
    object oPartyMember = GetFirstFactionMember(oDying);
    while (GetIsObjectValid(oPartyMember))
    {
        if(oPartyMember != oDying)
        {
            fBleedDelay = CRP_NORMAL_BLEED_DELAY;
            break;
        }
        oPartyMember = GetNextFactionMember(oDying);
    }

    //Start Bleeding
    AssignCommand(oDying, PlayVoiceChat(VOICE_CHAT_DEATH));
    DelayCommand(fBleedDelay, AssignCommand(oDying, Bleed()));
}

#2
Failed.Bard

Failed.Bard
  • Members
  • 774 messages
Essentially you need to force the creatures to run their OnPerception event again. You could likely do it simply by making the PC invisible for 0.01 seconds when they recover.

#3
Aikidoka23

Aikidoka23
  • Members
  • 24 messages
Ended up with this so far, but the

float fMoveAwayRange = 05.0f;

is wrong. It does however look like the creature perceives and attacks again when the PC recovers. Ideally I would like them to move away a short distance, and look for another enemy (I can't test with several PCs). Any ideas?

#include "crp_inc_ddr"

void main()
{

AssignCommand(oDying, ClearAllActions());

//Stop enemies from attacking...
int nNth = 1;
object oEnemy = GetNearestObject(OBJECT_TYPE_CREATURE, oDying, nNth);
effect eEffect;
eEffect = EffectInvisibility(INVISIBILITY_TYPE_NORMAL);
while(GetIsObjectValid(oEnemy) && nNth <= 15)
{
if(GetReputation(oEnemy, oDying) <= 10)
{
//SendMessageToPC(oDying, GetName(oEnemy));
AssignCommand(oEnemy, ClearAllActions());
SetIsTemporaryNeutral(oDying, oEnemy, TRUE, 33.0);
AssignCommand(oEnemy, ActionMoveAwayFromObject(oDying));
float fMoveAwayRange = 05.0f;

DelayCommand(1.0, AssignCommand(oEnemy, DetermineCombatRound()));

}
nNth++;
oEnemy = GetNearestObject(OBJECT_TYPE_CREATURE, oDying, nNth);

}

//Give the PC at least a few rounds to bleed
int nHP = GetCurrentHitPoints(oDying);
if(nHP < -3)
{
effect eSet = EffectHeal((nHP * -1) -3);
ApplyEffectToObject(DURATION_TYPE_INSTANT, eSet, oDying);
}

//Determine the bleed delay
object oPartyMember = GetFirstFactionMember(oDying);
while (GetIsObjectValid(oPartyMember))
{
if(oPartyMember != oDying)
{
fBleedDelay = CRP_NORMAL_BLEED_DELAY;
break;
}
oPartyMember = GetNextFactionMember(oDying);
}

//Start Bleeding
AssignCommand(oDying, PlayVoiceChat(VOICE_CHAT_DEATH));
DelayCommand(fBleedDelay, AssignCommand(oDying, Bleed()));
ApplyEffectToObject(DURATION_TYPE_TEMPORARY, eEffect, oDying, 0.01f);
}

#4
Aikidoka23

Aikidoka23
  • Members
  • 24 messages
Mmm right, I put the float in the right place now. Below:
object oEnemy = GetNearestObject(OBJECT_TYPE_CREATURE, oDying, nNth);

Have I done the temporary invisibility right though?

#5
Aikidoka23

Aikidoka23
  • Members
  • 24 messages
MMm no its still not right...

#6
ffbj

ffbj
  • Members
  • 593 messages
oDying is never defined, unless it's in the include, which you have not included.  I might put something like a line or two on combat rd end. if GetNearestCreature == oDying, move away from object set to True so they run away. As I agree it seems more natural. One thing I do in these sorts of situations is to give the npc a switch where they may move away, or even pick up something off the pc, or drink a potion, go into stealth...etc....

Modifié par ffbj, 09 mars 2013 - 06:31 .


#7
Pstemarie

Pstemarie
  • Members
  • 2 745 messages
Use this - http://nwvault.ign.c....Detail&id=2610. It has everything you are looking for and is easy to integrate into any existing code.

Modifié par Pstemarie, 10 mars 2013 - 08:31 .


#8
Aikidoka23

Aikidoka23
  • Members
  • 24 messages
Pstemarie - thanks I've used that bleed system now. Very nice :)