Aller au contenu

Photo

only the script gods would know


  • Veuillez vous connecter pour répondre
8 réponses à ce sujet

#1
christinetooley

christinetooley
  • Members
  • 58 messages
is there a way to play NPC animations using a slot other than onheartbeat?

#2
Morbane

Morbane
  • Members
  • 1 883 messages
you could do it onperception or onspawn if it is a looping animation -

#3
christinetooley

christinetooley
  • Members
  • 58 messages
so I can use the same script just put it on perception or onspawn? I didn't think that worked

#4
0100010

0100010
  • Members
  • 87 messages
What conditions must be met for you to want the animation to be played? Arrival at a waypoint? In reaction to some other occurance? etc. You can play animations at any time (but obviously should only bother doing so with they are visible by the PC(s) ) Another good candidate is from the user defined event, which you can signal whenever your conditions were met.

Modifié par 0100010, 24 mars 2011 - 01:36 .


#5
christinetooley

christinetooley
  • Members
  • 58 messages
What I want is entertainers in a tavern to dance without using onheartbeat so as to not stress the system if I have them in several areas. Onperception or onspawn would be great but every animation script I've found is onheartbeat. When I assign it to any other slot NPC just stands there...

#6
painofdungeoneternal

painofdungeoneternal
  • Members
  • 1 799 messages
I'd lower your preconditions on that, if it's repeating its a heartbeat. If it's not repeating, they won't be animated. By it's nature the animation system requires forcing of dancing repeatedly, especially as new players who show up after the dancing started won't see the dancing. The other events just don't do the job needed.

However there are better heartbeats you can use. The onheartbeat will do the trick, just keep the code very simple so it runs fast and no impact. There also is a AI heartbeat which you can hook into which already is being abused by the devs. Note this only runs when players are in the area.

Another way to do it is via delay commands, but these add their own overhead, and easily can get out of control. I have a post here showing how to add serials to them, but this should not be for something that runs forever but only for a limited duration.

Still another way is to register them with a central handler. This is probably the best on large servers but it more complex to set up. You put a heartbeat on a placeable, and add the creature you want dancing as a object on the placeable. The placeable heartbeat iterates the number of object variables on itself, if none it does not really do any work, and if a lot it applies it to all with a lot less overhead.

Unless you have 80 players on your server, i would just use what you find on the vault. Then i'd run a stats plugin (xp_profiler ) that you can get for nwnx that profiles your scripts, and then which ever script is the biggest hog you can fix. After you get this going and do real testing i don't think you will be as concerned about "heartbeats" and will notice it's more about how things are done than what is done that causes the real issues.

#7
christinetooley

christinetooley
  • Members
  • 58 messages
Thanks Pain! I wasn't sure how much the heartbeat scripts bogged it down. How can I use this one you described?
" There also is a AI heartbeat which you can hook into which already is being abused by the devs. Note this only runs when players are in the area."

#8
christinetooley

christinetooley
  • Members
  • 58 messages
I was trying uncleFBs NPC control and it seemed to slow the system with only one area running...onheartbeat system.

#9
Kaldor Silverwand

Kaldor Silverwand
  • Members
  • 1 598 messages
You can try my entertainer script here. I use it in King's Festival.

Regards