Author Topic: non-aggro mobs  (Read 864 times)

Legacy_Werkaldegim

  • Newbie
  • *
  • Posts: 38
  • Karma: +0/-0
non-aggro mobs
« on: December 01, 2010, 10:32:30 pm »


               Hi everyone,
I have a question, is it possible to make an passive monsters by scripting. I would like to make the monster hostile but passive until we don't attack/cst spell at mob. I tried many compilations but it always fails, if the mod doesn't attack, he doesn't do that at all, in other case he attacks only if we continue battle.

ps.
sorry for my bad english '<img'>
               
               

               
            

Legacy_FunkySwerve

  • Hero Member
  • *****
  • Posts: 2325
  • Karma: +0/-0
non-aggro mobs
« Reply #1 on: December 02, 2010, 03:45:40 am »


               Yes, but it'd be somewhat complicated, requiring edits to the ai scripts. It might be simplest to use a second copy of the monster with the scripts removed, and swap em out as needed.



Funky
               
               

               
            

Legacy_Xenovant

  • Full Member
  • ***
  • Posts: 182
  • Karma: +0/-0
non-aggro mobs
« Reply #2 on: December 02, 2010, 02:47:30 pm »


               If you remove the "on perception" script, the creature won't see/hear you when you are near  but if you attack it, it will counterattack
               
               

               


                     Modifié par Xenovant, 02 décembre 2010 - 02:49 .
                     
                  


            

Legacy_Mudeye

  • Full Member
  • ***
  • Posts: 238
  • Karma: +0/-0
non-aggro mobs
« Reply #3 on: December 02, 2010, 09:54:21 pm »


               I know this isn't exactly what you said, but, you can also change their faction in a script so they start non-hostile and you change the faction to hostile.  Or make a faction that will not normally attack but will fight back it you attack it.
               
               

               
            

Legacy_Lightfoot8

  • Hero Member
  • *****
  • Posts: 4797
  • Karma: +0/-0
non-aggro mobs
« Reply #4 on: December 03, 2010, 06:12:29 am »


               

Xenovant wrote...

If you remove the "on perception" script, the creature won't see/hear you when you are near  but if you attack it, it will counterattack


Good Idea,

Going with Xenovant's thought I cam up with this.

 #include "nw_i0_generic"
void main()
{
  int bRiotState =GetLocalInt(GetArea(OBJECT_SELF),"RIOT_STATE");
  int bMyState = GetLocalInt(OBJECT_SELF,"MY_STATE");
  // Check to see if there has been a change in the mobs state.
  if ( bMyState != bRiotState )
  {
    // There has been a change check to see wich one.
    if (bMyState)
    {
       //MyState was true so the I was rioting and the riot is now over.
       //Stop fighting and clear my state.
       ClearAllActions(TRUE);
       SetLocalInt(OBJECT_SELF,"MY_STATE",0);
    }
    else
    {
       //MyState was false so a riot has just started.
       //Set MyState to true and make sure I start fighting enemys in the area.
       SetLocalInt(OBJECT_SELF,"MY_STATE",1);
       DetermineCombatRound();
    }
  }
  // If we are in riot open our eyes, If not keep them closed.
  if( bRiotState ) ExecuteScript("nw_c2_default2",OBJECT_SELF);
}


Place it in the OnPerception event of your Mob.  Then inorder to start/stop the riot all you have to do is change the  LocalInt "RIOT_STATE" on the area..  Set it to true and they will fight.  Set it to false and the will close there eyes to enemys around them.
               
               

               
            

Legacy_Werkaldegim

  • Newbie
  • *
  • Posts: 38
  • Karma: +0/-0
non-aggro mobs
« Reply #5 on: December 03, 2010, 04:36:11 pm »


               Well, it works but I have already tried this way and this is not exactly what I expected. If you ever played mmo (I bet you do) there are many passive mobs, which attack only if we provoke them. Of course it is not possible to make in nwn use only factions, just because if we set faction at neutral, we can't attack the target until we use this crappy "circle attack manu" (I hope you understand what I mean '<img'>).



So.. if you guys have any other ideas, i'll be waiting '<img'>
               
               

               
            

Legacy_CheeseshireCat

  • Jr. Member
  • **
  • Posts: 79
  • Karma: +0/-0
non-aggro mobs
« Reply #6 on: December 03, 2010, 07:06:36 pm »


               Actually, you can put the "crappy attack menu" icon onto your quickbar and then it's just two clicks (or a keypress and a click).
               
               

               
            

Legacy_FunkySwerve

  • Hero Member
  • *****
  • Posts: 2325
  • Karma: +0/-0
non-aggro mobs
« Reply #7 on: December 03, 2010, 07:30:48 pm »


               Oh, I think I understand now. Just make a custom faction, non-global, that is non-hostile to players. They won't attack unless players attack them.



Funky
               
               

               
            

Legacy_Werkaldegim

  • Newbie
  • *
  • Posts: 38
  • Karma: +0/-0
non-aggro mobs
« Reply #8 on: December 03, 2010, 10:05:05 pm »


               It was my first thought Funky, but even non-global faction after attack changes all mobs with that faction to hostile. As you can see it is not possible to use. i've been trying to change all default scripts with DetermineCombatRound(); function but it still not working.

This defaults are:

OnCombatRoundEnd - nw_c2_default3

OnDamaged - nw_c2_default6

OnDisturbed - nw_c2_default8

OnPerception - nw_c2_default2

OnPhysicalAttacked - nw_c2_default5

OnSpellCastAt - nw_c2_defaultb

In case  removal/change OnDisturbed/OnPerception script the effect is correct but still global(when I attack one monster all response). After OnCombatRoundEnd removal/change mob is only hostile by one round. In all other cases mobs don't attack in general ;/
               
               

               
            

Legacy_Xenovant

  • Full Member
  • ***
  • Posts: 182
  • Karma: +0/-0
non-aggro mobs
« Reply #9 on: December 03, 2010, 10:19:29 pm »


               look in the onphysical and onspell scripts for this string: "SetSummonHelpIfAttacked();" and delete/comment it


EDIT: I mean to resolve that  "all creatures attack" issue
               
               

               


                     Modifié par Xenovant, 03 décembre 2010 - 10:20 .
                     
                  


            

Legacy_FunkySwerve

  • Hero Member
  • *****
  • Posts: 2325
  • Karma: +0/-0
non-aggro mobs
« Reply #10 on: December 03, 2010, 10:44:08 pm »


               

Werkaldegim wrote...

It was my first thought Funky, but even non-global faction after attack changes all mobs with that faction to hostile.

Only in the same area - that's what non-global denotes. If that's not good enough, just reset the party's faction reputation ondeath (default7).

Funky
               
               

               
            

Legacy_Werkaldegim

  • Newbie
  • *
  • Posts: 38
  • Karma: +0/-0
non-aggro mobs
« Reply #11 on: December 04, 2010, 03:38:07 pm »


               Well it works fine, but when I kill one mob all others become peaceful. Slowly I begin to think, this cannot be done... (finally nwn is not wow)
               
               

               
            

Legacy_NorthWolf

  • Full Member
  • ***
  • Posts: 143
  • Karma: +0/-0
non-aggro mobs
« Reply #12 on: December 04, 2010, 04:27:48 pm »


               I'm confused. Don't you want other mobs to become non-hostile after you've dispatched whatever particular mob you enraged...? Or do they become non-hostile even if they were previously in active combat with you?
               
               

               
            

Legacy_Werkaldegim

  • Newbie
  • *
  • Posts: 38
  • Karma: +0/-0
non-aggro mobs
« Reply #13 on: December 06, 2010, 05:23:09 am »


               

NorthWolf wrote...

they become non-hostile even if they were previously in active combat with you

Yes, that's the problem. Actually, I would like for the other mobs do not attack even if I'm in a fight with the other. This cannot be done on factions, because after attack all mobs are going "red". So, I think the only option is to make them hostile but change scripts... yeah, how to do that ? '<img'>
               
               

               
            

Legacy_kalbaern

  • Hero Member
  • *****
  • Posts: 1531
  • Karma: +0/-0
non-aggro mobs
« Reply #14 on: December 06, 2010, 06:58:10 am »


               Or just make several custom factions that are neutral to each other as well as to PCs. Making them "Local" and not "Global" is key as well. Or are you building an areas with for example all orcs and you want only those in the nearest group attacked to become hostile and not others?