Author Topic: Module Clock Not Working Correctly  (Read 653 times)

Legacy_Sadira of Tyr

  • Sr. Member
  • ****
  • Posts: 299
  • Karma: +0/-0
Module Clock Not Working Correctly
« on: August 02, 2012, 12:29:07 pm »


               In our module, we have the time set at 5 minutes per hour. However when playing the module on our server, the time goes much slower, and sometimes it just stops. I recall playing over an hour yesterday, and the time did not change at all. Our players have noticed this as well. I have checked the toolset, and I could find nothing wrong with the module settings.

Is there anything that could cause the module time to stop? Any help would be appreciated.

Thank you.
               
               

               
            

Legacy_Knight_Shield

  • Hero Member
  • *****
  • Posts: 812
  • Karma: +0/-0
Module Clock Not Working Correctly
« Reply #1 on: August 02, 2012, 12:50:22 pm »


               I think you need a persistent clock script for your mod.I use this one that was reccommended to me.


http://nwvault.ign.c....Detail&id=2721
               
               

               
            

Legacy_Sadira of Tyr

  • Sr. Member
  • ****
  • Posts: 299
  • Karma: +0/-0
Module Clock Not Working Correctly
« Reply #2 on: August 02, 2012, 01:46:27 pm »


               Thank you, but the link is not working.
               
               

               
            

Legacy_Sadira of Tyr

  • Sr. Member
  • ****
  • Posts: 299
  • Karma: +0/-0
Module Clock Not Working Correctly
« Reply #3 on: August 02, 2012, 01:56:36 pm »


               Well, I got the link to work. Thank you. 'Posted

I'm not sure if this will help, but I will try it in the module.
               
               

               
            

Legacy_Fester Pot

  • Hero Member
  • *****
  • Posts: 1698
  • Karma: +0/-0
Module Clock Not Working Correctly
« Reply #4 on: August 02, 2012, 02:21:28 pm »


               Clock stoppage in a module is due to too much going on, that the module resorts the clock resources as unimportant, taking up that resource to keep up with the demand of the server.

Poorly written scripts that eat lots of resources is normally the problem. Scripts that are left running when no players are present in an area, to NPCs AI being set to LOW so they continue to cross ATs or move about if no players are present in an area. Two small examples, of course that chew up resources.

You can get around it by updating the clock in your module's heartbeat, but this is only a short fix for a more serious problem.

int iHour = GetTimeHour ();
int iMinute = GetTimeMinute ();
int iSecond = GetTimeSecond ();
int iMillisecond = GetTimeMillisecond();

SetTime(iHour, iMinute, iSecond, iMillisecond);


FP!
               
               

               
            

Legacy_Sadira of Tyr

  • Sr. Member
  • ****
  • Posts: 299
  • Karma: +0/-0
Module Clock Not Working Correctly
« Reply #5 on: August 02, 2012, 05:59:12 pm »


               Thank you for helping.

That could be the heartbeat scripts I put in outdoor areas for vampire sun damage. The scripts must be still running when people leave the areas. That would explain the server crashing more often lately.

I'm not great at scripting, but I usually get what I need with the script generator. I put the scripts in the heartbeat section of each of the outdoor areas. They check for subrace vampire, and give damage if needed. Would these scripts keep running after the area is empty? It is about when I added those scripts, that the clock problems started.
               
               

               
            

Legacy_Knight_Shield

  • Hero Member
  • *****
  • Posts: 812
  • Karma: +0/-0
Module Clock Not Working Correctly
« Reply #6 on: August 02, 2012, 06:02:37 pm »


                @Fester Pot

Ok so let me try to get tis straight.

1)Doesnt matter module size as long as scripts are working correctly?

2)The link I posted keeps time persistent and advances?http://nwvault.ign.c....Detail&id=2721

3)Your script only advances but is not persitent?

int iHour = GetTimeHour ();
int iMinute = GetTimeMinute ();
int iSecond = GetTimeSecond ();
int iMillisecond = GetTimeMillisecond();
SetTime(iHour, iMinute, iSecond, iMillisecond);

So I need both scripts?
               
               

               


                     Modifié par Knight_Shield, 02 août 2012 - 05:04 .
                     
                  


            

Legacy_Thayan

  • Sr. Member
  • ****
  • Posts: 435
  • Karma: +0/-0
Module Clock Not Working Correctly
« Reply #7 on: August 02, 2012, 07:45:11 pm »


               A word of warning about using the SetTime(iHour, iMinute, iSecond, iMillisecond) workaround though - if the unmodified, module-wide version of Time Stop is cast at just the right moment when that function is called, the Time Stop spell will last indefinitely, necessitating a module reboot since no one other than DMs will be able to do anything.
               
               

               


                     Modifié par Thayan, 02 août 2012 - 06:48 .
                     
                  


            

Legacy_Sadira of Tyr

  • Sr. Member
  • ****
  • Posts: 299
  • Karma: +0/-0
Module Clock Not Working Correctly
« Reply #8 on: August 02, 2012, 09:54:54 pm »


               Thanks guys. 'Posted

I've disabled the heartbeat scripts for now, to see if the problem persists. If it continues, then I will add the scripts you posted.
               
               

               
            

Legacy_Groove Widdit

  • Sr. Member
  • ****
  • Posts: 293
  • Karma: +0/-0
Module Clock Not Working Correctly
« Reply #9 on: August 10, 2012, 11:15:41 pm »


               Fester, I have the same issue - time stopping at midnight. I used your script to fix it. Are you saying that the scripts are running in all areas all the time? How do you fix that?
               
               

               
            

Legacy_virusman

  • Sr. Member
  • ****
  • Posts: 448
  • Karma: +0/-0
Module Clock Not Working Correctly
« Reply #10 on: August 11, 2012, 01:33:54 pm »


               If your server is running on Linux, you can use NWNX Fixes to get rid of this bug.
               
               

               


                     Modifié par virusman, 11 août 2012 - 12:34 .
                     
                  


            

Legacy_ehye_khandee

  • Hero Member
  • *****
  • Posts: 1415
  • Karma: +0/-0
Module Clock Not Working Correctly
« Reply #11 on: August 11, 2012, 04:11:12 pm »


               Lean clean scripting is the cure and best solution. Find the cause and clear that up, you will find your game runs better all around for the effort. Size is not really much of an issue. We run a server with 1337+ Areas, feature rich, with no lag, no clock issues, no crashes and generally no restarts needed (DM's events can sometimes leave artifacts that merit a restart, but still, under general play, we've left it run for months without a restart). Linux server too.

Be well. Game on.
GM_ODA

http://playnwn.com
               
               

               
            

Legacy_Sadira of Tyr

  • Sr. Member
  • ****
  • Posts: 299
  • Karma: +0/-0
Module Clock Not Working Correctly
« Reply #12 on: August 13, 2012, 12:37:11 am »


               Well, I've been trying to find the cause, but no luck so far. Is there a way to check which scripts are running?
               
               

               
            

Legacy_ehye_khandee

  • Hero Member
  • *****
  • Posts: 1415
  • Karma: +0/-0
Module Clock Not Working Correctly
« Reply #13 on: August 13, 2012, 01:12:26 am »


               Check your messages.

G
               
               

               
            

Legacy_Sadira of Tyr

  • Sr. Member
  • ****
  • Posts: 299
  • Karma: +0/-0
Module Clock Not Working Correctly
« Reply #14 on: August 16, 2012, 12:48:48 am »


               Thank you ehye_khandee, for helping with my script troubles. 'Posted 
               
               

               


                     Modifié par Sadira of Tyr, 15 août 2012 - 11:49 .