View previous topic :: View next topic |
Author |
Message |
Asmodae
Joined: 07 Jan 2005 Posts: 55
|
Posted: Sun Jun 25, 2006 16:41 Post subject: |
|
|
Hrm.. NWscript is a generic name for any script written for Neverwinter Nights. It isn't a specific file.
For instance, if you go into a simple mod (with NWNX setup and functioning properly) put down a placeable, then edit its properties...
Make sure the 'useable' checkbox is checked. Goto the scripts tab, then click edit fot the OnUsed event. This will open up a script editor window. Paste in the single line of code from the instructions.. like this:
Code: |
main
{
SetLocalString(GetModule(),"NWNX!RESETPLUGIN!SHUTDOWN","1")
}
|
Save the script (the name doesn't matter, choose something you like or think is suitable). Now build the mod... and you have a placeable that will reset your server. Extrapolate from this how to get the server to reset in other circumstances. If you need extra help with specific scripting issues, or how NWN events work, bioware has a lot of great guys on their forums that can help you out.
Good Luck!
- Asmodae _________________ Nepenthe - An NWN2 Persistant World, coming to a planet near you. http://www.nepentheonline.com |
|
Back to top |
|
|
Zunath
Joined: 06 Jul 2006 Posts: 183
|
Posted: Sat Jul 08, 2006 17:32 Post subject: |
|
|
I have this system installed into my server, but whenever the server crashes and restarts I lose data.
How can I prevent this? Also, how can I make it so that the restart goes off at a designated time of day? (such as 4am, 12pm, and 8pm)
Sorry if this is a lot to ask, but this seems very useful. |
|
Back to top |
|
|
DarkstarsDad
Joined: 17 Jan 2005 Posts: 59 Location: Overland Park, Kansas USA
|
Posted: Tue Jul 11, 2006 5:28 Post subject: Save before you reset |
|
|
You will need to add save char line to the script then reset. _________________ Just because you think you can't. Is the best reason to try it anyway. |
|
Back to top |
|
|
Asmodae
Joined: 07 Jan 2005 Posts: 55
|
|
Back to top |
|
|
Zunath
Joined: 06 Jul 2006 Posts: 183
|
Posted: Fri Jul 14, 2006 3:49 Post subject: |
|
|
I'm sorry I wasn't specific enough... Will ExportAllCharacters(); also save all of the data into my SQLite database? Such as items in the bank?
Thanks! |
|
Back to top |
|
|
Acrodania
Joined: 02 Jan 2005 Posts: 208
|
Posted: Fri Jul 14, 2006 4:47 Post subject: |
|
|
Zunath wrote: | I'm sorry I wasn't specific enough... Will ExportAllCharacters(); also save all of the data into my SQLite database? Such as items in the bank?
Thanks! |
No, exporting characters only makes sure that the character file is saved correctly in the server vault. It has nothing at all to do with NWNX or any database access |
|
Back to top |
|
|
Rami_Ahmed
Joined: 07 Dec 2005 Posts: 37 Location: Denmark
|
Posted: Fri Jul 14, 2006 10:20 Post subject: |
|
|
Wouldn't the best be like this:
Code: | #include "aps_include"
void main()
{object oPC = GetFirstPC();
while (GetIsObjectValid(oPC))
{ if (!GetIsDM(oPC))
{ BootPC(oPC);
}
oPC = GetNextPC();
}
DelayCommand(0.1, SQLExecDirect("COMMIT TRANSACTION")); // Not sure if this only works for SQLite
DelayCommand(0.2, SQLExecDirect("BEGIN TRANSACTION")); // Not sure if it's needed to start it up again
AssignCommand(GetModule(), DelayCommand(5.0, SetLocalString(GetModule(),"NWNX!RESETPLUGIN!SHUTDOWN","1")));
} |
We use something like that anyway. We have SQLite. I don't know if the transaction things work for anything else. |
|
Back to top |
|
|
Asmodae
Joined: 07 Jan 2005 Posts: 55
|
Posted: Tue Jul 18, 2006 6:23 Post subject: |
|
|
I'm happy to see that people are using the plugin, yay!
Yes, Rami, I like your solution as it gives the players a disconnect notice before shutting down, thanks for posting it. I may include a version of that in a later release as an example script, is this ok with you?
As for Non-SQLite, we use MyISAM tables in MySQL and there's no need for committing transactions.
In response to Zunath: As for saving your data, it really depends on what needs to be saved and where you want to store it in your database. If you use Rami's example code you should be able to cycle through every player and save what is needed right before booting them and resetting the server.
To get the server to reset at a specific time you will have to setup some kind of timer, probably in the module heartbeat event. Make it very simple so that it doesn't use much cpu time. Reset the server when so much time has passed, you can warn players with shouts or server messages when getting close to a reset.
- Asmodae _________________ Nepenthe - An NWN2 Persistant World, coming to a planet near you. http://www.nepentheonline.com |
|
Back to top |
|
|
Rami_Ahmed
Joined: 07 Dec 2005 Posts: 37 Location: Denmark
|
Posted: Fri Jul 28, 2006 21:58 Post subject: |
|
|
Asmodae wrote: | is this ok with you? |
Of course. Feel free to do so. |
|
Back to top |
|
|
Asmodae
Joined: 07 Jan 2005 Posts: 55
|
Posted: Wed Aug 02, 2006 19:08 Post subject: |
|
|
Rami_Ahmed wrote: | Asmodae wrote: | is this ok with you? |
Of course. Feel free to do so. |
Great, thanks!
- Asmodae _________________ Nepenthe - An NWN2 Persistant World, coming to a planet near you. http://www.nepentheonline.com |
|
Back to top |
|
|
virusman
Joined: 30 Jan 2005 Posts: 1020 Location: Russia
|
Posted: Wed Aug 02, 2006 21:05 Post subject: |
|
|
Hmm, does EndGame("") work? |
|
Back to top |
|
|
Asmodae
Joined: 07 Jan 2005 Posts: 55
|
|
Back to top |
|
|
Gorgonzola
Joined: 21 Jun 2006 Posts: 6
|
Posted: Fri Aug 11, 2006 18:24 Post subject: |
|
|
any chance of getting a linux port of the reset plugin?
i could seriously use one... |
|
Back to top |
|
|
virusman
Joined: 30 Jan 2005 Posts: 1020 Location: Russia
|
|
Back to top |
|
|
Asmodae
Joined: 07 Jan 2005 Posts: 55
|
Posted: Fri Aug 18, 2006 18:59 Post subject: |
|
|
Nice work Virusman.
- Asmodae _________________ Nepenthe - An NWN2 Persistant World, coming to a planet near you. http://www.nepentheonline.com |
|
Back to top |
|
|
|