Author Topic: Nw_c2_Herbivore  (Read 361 times)

Legacy_YeOlde

  • Jr. Member
  • **
  • Posts: 66
  • Karma: +0/-0
Nw_c2_Herbivore
« on: November 26, 2011, 08:32:25 pm »


               Hello!

I am trying to figure out how to get the NW_c2_Herbivore script to function properly. Inside the script, there is a line that says:

 SetBehaviorState(NW_FLAG_BEHAVIOR_HERBIVORE); //Creature will flee those that close within 7m if they are not friends.

This doesn't seem to work, or I may misunderstand the function of the script. Does it mean that if a (as a non hostile PC character) comes closer than 7m, the creature will flee?

Edit: I figure the animal will flee only if I attack it. I tried NW_c2_omnivore on another creature, and the Omnivore creature seem to use the nw_flag_ambient_animations, while nw_c2_herbivore does not.

Thanks!
               
               

               


                     Modifié par YeOlde, 26 novembre 2011 - 08:43 .
                     
                  


            

Legacy_Lightfoot8

  • Hero Member
  • *****
  • Posts: 4797
  • Karma: +0/-0
Nw_c2_Herbivore
« Reply #1 on: November 26, 2011, 09:06:40 pm »


               The way it is written you would have to be an enemy and not attacking the target.  It is handled by DetermineSpecialBehavior(); in nw_i0_generic.
 
The code snipet of the herberbor is.

else if(GetBehaviorState(NW_FLAG_BEHAVIOR_HERBIVORE))
    {
        if(!GetIsObjectValid(GetAttemptedAttackTarget()) &&
           !GetIsObjectValid(GetAttemptedSpellTarget()) &&
           !GetIsObjectValid(GetAttackTarget()))
        {
            if(GetIsObjectValid(oTarget) && GetDistanceToObject(oTarget) <= 6.0)
            {
                if(!GetIsFriend(oTarget))
                {
                    if(GetLevelByclass(class_TYPE_DRUID, oTarget) == 0 && GetLevelByclass(class_TYPE_RANGER, oTarget) == 0)
                    {
                        TalentFlee(oTarget);
                    }
                }
            }
        }
        else if(!IsInConversation(OBJECT_SELF))
        {
            ClearActions(CLEAR_NW_I0_GENERIC_DetermineSpecialBehavior2);
            ActionRandomWalk();
            return;
        }
    }
               
               

               
            

Legacy_YeOlde

  • Jr. Member
  • **
  • Posts: 66
  • Karma: +0/-0
Nw_c2_Herbivore
« Reply #2 on: November 26, 2011, 09:14:15 pm »


               Hey and yeah, I figured that one out. But I can't figure out why the Herbivore doesn't use the random walk when the Omnivore does :/
               
               

               
            

Legacy_henesua

  • Hero Member
  • *****
  • Posts: 6519
  • Karma: +0/-0
Nw_c2_Herbivore
« Reply #3 on: November 26, 2011, 09:31:47 pm »


               Depends on the situation for the herbivore. Usually the herbivore runs away.

BTW - I use similar behavior for Commoners. Rather than attack their enemies, they are likely to run away. I think its a good way to go. I'm tired of seeing defenseless children running to attack the trolls that enter town.
               
               

               
            

Legacy_Rolo Kipp

  • Hero Member
  • *****
  • Posts: 4349
  • Karma: +0/-0
Nw_c2_Herbivore
« Reply #4 on: November 26, 2011, 09:37:27 pm »


               <trying to...>

But, if I read that correctly, *any* levels in druid or ranger (regardless off animal empathy skill) would prevent the herbivore from running...

And it is <= 6.0 meters, not less than 7 (minor point, but it bugs me)

<...stay neutral>
               
               

               
            

Legacy_henesua

  • Hero Member
  • *****
  • Posts: 6519
  • Karma: +0/-0
Nw_c2_Herbivore
« Reply #5 on: November 27, 2011, 12:06:37 am »


               Rolo, Its very easy to make those adjustments. I changed the scripts on Vives to use the animal empathy skill. And I think someone prior to me had done that as well. Although by the time I got my hands on teh code the herbivore scripts had been wiped. Anyway... the point is that it is easy to do.
               
               

               
            

Legacy_Rolo Kipp

  • Hero Member
  • *****
  • Posts: 4349
  • Karma: +0/-0
Nw_c2_Herbivore
« Reply #6 on: November 27, 2011, 01:24:59 am »


               <feeling a bit...>

henesua wrote...
Rolo, Its very easy to make those adjustments. I changed the scripts on Vives to use the animal empathy skill. And I think someone prior to me had done that as well. Although by the time I got my hands on teh code the herbivore scripts had been wiped. Anyway... the point is that it is easy to do.

Understood. I'm just wondering if I'm the only one who thinks the bioware include was... sloppy :-P

<...crochety>
               
               

               
            

Legacy_Lightfoot8

  • Hero Member
  • *****
  • Posts: 4797
  • Karma: +0/-0
Nw_c2_Herbivore
« Reply #7 on: November 27, 2011, 01:30:14 am »


               

Rolo Kipp wrote...

<feeling a bit...>

henesua wrote...
Rolo, Its very easy to make those adjustments. I changed the scripts on Vives to use the animal empathy skill. And I think someone prior to me had done that as well. Although by the time I got my hands on teh code the herbivore scripts had been wiped. Anyway... the point is that it is easy to do.

Understood. I'm just wondering if I'm the only one who thinks the bioware include was... sloppy :-P

<...crochety>


Just a copy paste error, In my opinion.  The OMNIVORE has a <8.0   on the range.   So they just grabed the wrong number from the script.   
               
               

               
            

Legacy_wyldhunt1

  • Sr. Member
  • ****
  • Posts: 443
  • Karma: +0/-0
Nw_c2_Herbivore
« Reply #8 on: November 27, 2011, 01:31:53 am »


               Years ago, one of the first things I did was replace the entire script. I still refuse to use it to this day. The entire thing is a cheap kludge full of bad and half finished code... At least, I hope it was half finished. If that was the finished product, some programmer must have been very new when they made it.