Author Topic: No fight, just run -- Wild Animal script.  (Read 564 times)

Legacy_3RavensMore

  • Hero Member
  • *****
  • Posts: 1153
  • Karma: +0/-0
No fight, just run -- Wild Animal script.
« on: June 05, 2012, 07:45:31 pm »


               I'm setting up a wild animal / hunting system, however I've run into a issue that's stumped me.  My wild animals flee when they are supposed to, except when they are attacked.  On being attacked, every other creature in my Wild Animal faction turns hostile in the area.  What I want to do, is not have them turn hostile (including the animal I attack) and simply continue to flee when they're suposed to.  I want them to be killable, but react like a real-world animal would; that being, I see a foe or am attacked and all I want to do is get the hell out of Dodge.  They shouldn't warn others animals to attack; they won't fight back, they should just run away.  Hunting should be difficult - one or two shots at that fleet of foot deer and it's is out of sight. 

This is probably a matter of setting a few flags on spawn, but...':blush:'
               
               

               
            

Legacy_ehye_khandee

  • Hero Member
  • *****
  • Posts: 1415
  • Karma: +0/-0
No fight, just run -- Wild Animal script.
« Reply #1 on: June 05, 2012, 08:24:43 pm »


               Look for the creature's  on_attacked and on_damaged scripts, you may need to make a special copy of those for 'herbivores' which, unless cornered, should behave as you describe. It is almost certain that the default scripts in those slots are setup to return an attack if attacked/damaged... change that feature on your 'herbie' versions.

Be well. Game on.
GM_ODA
http://playnwn.com
               
               

               
            

Legacy_Fester Pot

  • Hero Member
  • *****
  • Posts: 1698
  • Karma: +0/-0
No fight, just run -- Wild Animal script.
« Reply #2 on: June 05, 2012, 08:28:29 pm »


               Make sure your Wild Animal faction has the GLOBAL box UNCHECKED for starters.

FP!
               
               

               
            

Legacy_Lightfoot8

  • Hero Member
  • *****
  • Posts: 4797
  • Karma: +0/-0
No fight, just run -- Wild Animal script.
« Reply #3 on: June 05, 2012, 09:25:31 pm »


               Also make sure they are not listening.  Would help if they did not shout at all, But that is harder to track down.   SetListening( oObject, FALSE); Towards the bottom of the OnSpawn script should stop a lot of there reactions from others.
               
               

               
            

Legacy_kalbaern

  • Hero Member
  • *****
  • Posts: 1531
  • Karma: +0/-0
No fight, just run -- Wild Animal script.
« Reply #4 on: June 05, 2012, 09:38:17 pm »


               I'm fairly certain that if you just delete the OnConversation Event in your hunted creatures it'll keep them from attacking as they'll nolonger respond to shouts. Was what I did at least. '<img'>
               
               

               
            

Legacy_henesua

  • Hero Member
  • *****
  • Posts: 6519
  • Karma: +0/-0
No fight, just run -- Wild Animal script.
« Reply #5 on: June 06, 2012, 12:33:58 am »


                And just to make things more complicated with another option '<img'>
Have you tried working with Special Behavior? There is behavior for Carnivores, Herbivores, and Omnivores. I heavily modified this and it is working nicely for me.

Here's some work by LoCash

If you are curious about my work on this I can dig it up and post it for you.

And another option:
since the call to fight is often DetermineCombatRound, you can change what happens in that function with setting a local var on the creature, X2_SPECIAL_COMBAT_AI_SCRIPT, which is the name of a script that you call in place of the rest of DetermineCombatRound. So with that special ai script you could tell the creature to keep fleeing rather than attack.
               
               

               


                     Modifié par henesua, 05 juin 2012 - 11:38 .
                     
                  


            

Legacy_3RavensMore

  • Hero Member
  • *****
  • Posts: 1153
  • Karma: +0/-0
No fight, just run -- Wild Animal script.
« Reply #6 on: June 06, 2012, 01:51:50 am »


               As always, thanks for your fantastic help.  I have it working now.