Author Topic: Events not essential for an hostile npc  (Read 584 times)

Legacy_Cursed Eclipse

  • Full Member
  • ***
  • Posts: 132
  • Karma: +0/-0
Events not essential for an hostile npc
« on: September 13, 2013, 09:30:52 pm »


               Like title says.


for example:
In my PW there are no hostile NPC  that start conversations whit pc.
So,in this case I can remove the default script (<- nw_c2_defaulta) from the rest event of the creature ?  ...But above all ... this brings some advantages in terms of performance?
               
               

               


                     Modifié par Cursed Eclipse, 13 septembre 2013 - 08:31 .
                     
                  


            

Legacy_Lightfoot8

  • Hero Member
  • *****
  • Posts: 4797
  • Karma: +0/-0
Events not essential for an hostile npc
« Reply #1 on: September 13, 2013, 11:28:09 pm »


               

Cursed Eclipse wrote...

Like title says.


for example:
In my PW there are no hostile NPC  that start conversations whit pc.
So,in this case I can remove the default script (<- nw_c2_defaulta) from the rest event of the creature ?  ...But above all ... this brings some advantages in terms of performance?



The OnConversation event is used for a lot more then just starting a conversation with a PC.  In fact starting a conversation is just a very minor part of the event.  It is mainly used in combat,  when ever you hit a creature or do any hostile action towards a creature it sends out a silent shout that is picked up by other creatures in the area, allowing them to react to what is going on.    

I can see no reason to remove this event or any of the events for that matter.  If any of the events are not used they simply will not fire.   removing an event without understanding everything it does can cause you a lot of tough repairs latter on. 
               
               

               
            

Legacy_Cursed Eclipse

  • Full Member
  • ***
  • Posts: 132
  • Karma: +0/-0
Events not essential for an hostile npc
« Reply #2 on: September 14, 2013, 12:24:04 am »


               

Lightfoot8 wrote...

The OnConversation event is used for a lot more then just starting a conversation with a PC.  In fact starting a conversation is just a very minor part of the event.  It is mainly used in combat,  when ever you hit a creature or do any hostile action towards a creature it sends out a silent shout that is picked up by other creatures in the area, allowing them to react to what is going on.    

I can see no reason to remove this event or any of the events for that matter.  If any of the events are not used they simply will not fire.   removing an event without understanding everything it does can cause you a lot of tough repairs latter on. 



Hi Lightfoot8
ty for the quick reply.


Maybe i understand what you mean...but I have already deleted the string "NW_FLAG_SHOUT_ATTACK_MY_TARGET" in those script in which it was present,including that in the event "onConversation" (nw_c2_default4) and I have not encountered any problems.
Hostile NPC continue to attack the target when they see him,all togheter.
So I have found no change in the attitude of AI when he sees an enemy.


However the thing that I wanted to know is that I have highlighted. Thx Lightfoot
               
               

               


                     Modifié par Cursed Eclipse, 13 septembre 2013 - 11:29 .
                     
                  


            

Legacy_FunkySwerve

  • Hero Member
  • *****
  • Posts: 2325
  • Karma: +0/-0
Events not essential for an hostile npc
« Reply #3 on: September 14, 2013, 02:03:31 am »


               What Lightfoot said. Sure, you can gain a substantial benefit to mod performance if you streamline your ai, but you need to understand what you're doing first. We've cut out a LOT of the silent shouts from our mod, but removing scripts altogether, not so much. The performance gain comes not from having blank script slots, which only saves you a few bytes of module size, but from reducing unnecessary and unweildy silent shouts. If you just cut onconversation entirely, you'll do so serious damage to your ai. Sure, creatures will still fire onperception, ondamaged, etc, but they will lose other functionality.

Bottom line: if you don't want to take the time to piece together the ai scripts, your only other option is to experiment - take out the onconv event and see if there are any hits to performance in combat you don't like.

FWIW, unless you're experiencing heavy combat lag already, this is a consummate waste of your time. '<img'> Check my delagging tutorial in the lexicon for simpler things you can do. It's at
Link, under
Home > Lyceum > Tutorial > Toolset > How to Make Your Server Run More Smoothly

Funky
               
               

               


                     Modifié par FunkySwerve, 14 septembre 2013 - 01:04 .
                     
                  


            

Legacy_Cursed Eclipse

  • Full Member
  • ***
  • Posts: 132
  • Karma: +0/-0
Events not essential for an hostile npc
« Reply #4 on: September 16, 2013, 03:31:32 am »


               Thx for the reply.

No, thankfully there is no lag,Funky.'<img'>
I just wondered if there could be improvements by removing the events from the npc.

I have another question.
I am using the default bioware encounter,i have set respawn every 5 minutes,activable only by players.

I was wondering, is this not also a delay? ... and it is not better to reduce the number of delays?

What do you think of disable all encounters when the area is empty?
Perhaps through a script,placed on the event "OnExit" of the area...Then reactivate them when someone enters,always through a script of course (onEnter).

What do you think of this idea? is achievable? it is convenient? it is useless?
               
               

               


                     Modifié par Cursed Eclipse, 16 septembre 2013 - 02:35 .
                     
                  


            

Legacy_Shadooow

  • Hero Member
  • *****
  • Posts: 7698
  • Karma: +0/-0
Events not essential for an hostile npc
« Reply #5 on: September 16, 2013, 07:37:45 am »


               

Cursed Eclipse wrote...

I just wondered if there could be improvements by removing the events from the npc.

yes can be, but in most times NPCs needs them, the only NPCs I remove them are stationary plot merchants/nonhostileNPC in my module where it really helps + some really stupid monsters where I use my low AI which has only few events, also I had to remove OnSpellCastAt entirely from few monsters in a PW I was admin of due to the easy possibility to spawn this NPC in hordes and mass it via AOE spells. When you hit more than 50 monsters with one spell you encounter the "cross-shout issue" which is that every npc will tell all others to attack you. My unofficial patch helps with this a bit but still this bug is not fixed and if you cannot avoid such big spawns then the only choice is to remove SpellCastAt event. But its not worth to remove it for any regular npc since they would lose certain features, so use this only when you encounter lag spikes at first.

I have another question.
I am using the default bioware encounter,i have set respawn every 5 minutes,activable only by players.

I was wondering, is this not also a delay? ... and it is not better to reduce the number of delays?

What do you think of disable all encounters when the area is empty?
Perhaps through a script,placed on the event "OnExit" of the area...Then reactivate them when someone enters,always through a script of course (onEnter).

What do you think of this idea? is achievable? it is convenient? it is useless?

it is a delay but safe - you could probably replace the built in delay with a timestamp checks but I dont think it has a lot of sense in this case. Probably not even possible to enable for a standard encounter so you would have to replace them with custom spawn trigger. Delay are actually quite reliable as engine gives them really high priority and even after runnning a week in my module they are still very precise (I use them a lot, dont have a timestamp checks). Its perhaps good idea to replace with timestamps where its possible, but you cant really use that for all situations.
               
               

               
            

Legacy_Shadooow

  • Hero Member
  • *****
  • Posts: 7698
  • Karma: +0/-0
Events not essential for an hostile npc
« Reply #6 on: September 16, 2013, 08:05:39 am »


               Few more notes related to the CP since it seems you probably uses it:

1) there is a new mechanism allowing to clean stores automatically from items, its a module switch named "70_OVERFILLED_STORES_ISSUE_FIX" read more here: http://gt.neverwinte...71.html#toolset

2) remember that in case you encountered AOE hearbeat issue and you enabled CP fix for it, CP solves this via delaycommands! However this is a place where you really cannot replace it with timestamps. I also used this on a PW I was admin of and its still in use and works fine and reliable. It might be a good idea to restrict number of AOE applications, also recommended from a metagaming reasons, its quite stupid to spam 30 blade barriers/acid fogs and lure npc into them (quite a abuse of AI anyway).


Also for my personal test PW/module I uses two more mechanisms that Funky didnt mentioned in his tutorial.

1) automatic timestop when there is no PC in module. A little problem might be that time is not advanced so any spawns/treasures will not respawn which can be problematic in certain situations (but more likely a plus).

2) killing NPCs in areas where there is no PC
- this is harder to setup so its not visible to PC, you have to resurrect npcs even before PC enters area (and OnEnter event is activated) to do that you have to do that before you assign PC to jump to your area (when used portal/area transition/OnClientEnter in case of relog). Advantage is that dead NPC runs absolutely no scripts at all.

               
               

               


                     Modifié par ShaDoOoW, 16 septembre 2013 - 07:05 .
                     
                  


            

Legacy_Cursed Eclipse

  • Full Member
  • ***
  • Posts: 132
  • Karma: +0/-0
Events not essential for an hostile npc
« Reply #7 on: October 14, 2013, 09:44:15 am »


               

ShaDoOoW wrote...

Also for my personal test PW/module I uses two more mechanisms that Funky didnt mentioned in his tutorial.

1)
automatic timestop when there is no PC in module. A little problem
might be that time is not advanced so any spawns/treasures will not
respawn which can be problematic in certain situations (but more likely a
plus).

sry for delay,but just yesterday I'm back to work on my module.


how do you do this?