Author Topic: Bleed system script advice  (Read 265 times)

Legacy_Aikidoka23

  • Newbie
  • *
  • Posts: 47
  • Karma: +0/-0
Bleed system script advice
« on: March 07, 2013, 12:33:02 pm »


               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()));
}
               
               

               
            

Legacy_Failed.Bard

  • Hero Member
  • *****
  • Posts: 1409
  • Karma: +0/-0
Bleed system script advice
« Reply #1 on: March 07, 2013, 01:51:00 pm »


               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.
               
               

               
            

Legacy_Aikidoka23

  • Newbie
  • *
  • Posts: 47
  • Karma: +0/-0
Bleed system script advice
« Reply #2 on: March 08, 2013, 08:19:03 am »


               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);
}
               
               

               
            

Legacy_Aikidoka23

  • Newbie
  • *
  • Posts: 47
  • Karma: +0/-0
Bleed system script advice
« Reply #3 on: March 08, 2013, 08:40:21 am »


               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?
               
               

               
            

Legacy_Aikidoka23

  • Newbie
  • *
  • Posts: 47
  • Karma: +0/-0
Bleed system script advice
« Reply #4 on: March 08, 2013, 11:28:34 am »


               MMm no its still not right...
               
               

               
            

Legacy_ffbj

  • Hero Member
  • *****
  • Posts: 1097
  • Karma: +0/-0
Bleed system script advice
« Reply #5 on: March 09, 2013, 06:26:03 pm »


               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 .
                     
                  


            

Legacy_Pstemarie

  • Hero Member
  • *****
  • Posts: 4368
  • Karma: +0/-0
Bleed system script advice
« Reply #6 on: March 10, 2013, 08:31:14 am »


               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 .
                     
                  


            

Legacy_Aikidoka23

  • Newbie
  • *
  • Posts: 47
  • Karma: +0/-0
Bleed system script advice
« Reply #7 on: March 11, 2013, 04:15:14 pm »


               Pstemarie - thanks I've used that bleed system now. Very nice '<img'>