logo logo

 Back to main page

The NWNX Community Forum

 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
 
Character deletion plugin
Goto page Previous  1, 2, 3
 
Post new topic   Reply to topic    nwnx.org Forum Index -> Windows technical support
View previous topic :: View next topic  
Author Message
Zunath



Joined: 06 Jul 2006
Posts: 183

PostPosted: Thu Sep 28, 2006 4:02    Post subject: Reply with quote

Sure, but I am calling it from a conversation that a PC brings up when they use a server book.

Ex.

1.) PC uses Server Information Book
2.) Conversation pops up
3.) PC selects "Delete Character"
4.) PC's character is deleted and PC is booted.

Right now, only the PC is booted. The character file isn't going anywhere.
Back to top
View user's profile Send private message
Xildjian



Joined: 08 Jan 2005
Posts: 100

PostPosted: Thu Sep 28, 2006 14:56    Post subject: Reply with quote

Zunath wrote:
Sure, but I am calling it from a conversation that a PC brings up when they use a server book.

Ex.

1.) PC uses Server Information Book
2.) Conversation pops up
3.) PC selects "Delete Character"
4.) PC's character is deleted and PC is booted.

Right now, only the PC is booted. The character file isn't going anywhere.


If this is the order of events then it looks like the server is resaving the character file. You need to make sure the PC is booted first and then delete then character file. When a character leaves the server it's character file is rewritten (saved).
_________________
Member Shadow of Iniquity development team
Back to top
View user's profile Send private message
Zunath



Joined: 06 Jul 2006
Posts: 183

PostPosted: Thu Sep 28, 2006 21:38    Post subject: Reply with quote

00_delete_char
Quote:
// This script will delete a player's character. Checks have been made to prevent non-PCs from attempting to delete
// their character.
#include "delchar_include"

void main()
{
object oPC = GetPCSpeaker();

if (GetIsPossessedFamiliar(oPC)) {
SendMessageToPC(oPC,"You may only delete yourself when you are not possessing your familiar!");
return;
}

if (GetIsDM(oPC) || GetIsDMPossessed(oPC)) {
SendMessageToPC(oPC,"DMs are not servervault characters, and therefore may not be deleted!");
return;
}

string pname = GetPCPlayerName(oPC);
string cname = GetName(oPC);
FloatingTextStringOnCreature("DELETING!",oPC);
DelayCommand(1.0,BootPC(oPC));
DelayCommand(2.0,deletechar(pname, cname));
}


This is the script on "Actions Taken" of the conversation node of the Server Information book.

Did I set something up wrong?

Thanks for taking the time to help me.
Back to top
View user's profile Send private message
FunkySwerve



Joined: 02 Jun 2005
Posts: 377

PostPosted: Fri Sep 29, 2006 0:09    Post subject: Reply with quote

Ive never used the plugin before so I can't give you any advice there, but if you want an easy way to delete characters install letoscript 24 and put the following script onused of a placeable:

Code:

string LetoScript(string script) {
    // Stores a var in the module which NWNX LETO then takes and works with.
    SetLocalString(GetModule(), "NWNX!LETO!SCRIPT", script);
    // Gets the var now changed by NWNX LETO back from the module and returns it.
    return GetLocalString(GetModule(), "NWNX!LETO!SCRIPT");
}
string GetBicPath(object PC) {
    string VaultPath = "C:/NeverwinterNights/NWN/servervault/";
    string Player = GetPCPlayerName(PC);
    string BicPath = VaultPath + Player + "/";

    return LetoScript(
        "print q<" + BicPath + "> + " +
        "FindNewestBic q<" + BicPath + ">;"
    );

}
void DeleteFile(string file) {
    PrintString("File to delete: "+file);
    PrintString(LetoScript("FileDelete q<" + file + ">"));
}
void DoBootDeletePC(object oPC)
{
    if (GetIsObjectValid(oPC))
    {
        BootPC(oPC);
    }
}
void DoDelete(object oPlayer)
{
    string BicFile = GetBicPath(oPlayer);
    DelayCommand(2.0, DoBootDeletePC(oPlayer));
    DelayCommand(2.5, DeleteFile(BicFile));
}
void main()
{
    object oPC = GetLastUsedBy();
    ExportSingleCharacter(oPC);
    FloatingTextStringOnCreature("Deleting character, please wait.", oPC);
    SetCommandable(FALSE, oPC);
    DelayCommand(6.0, DoDelete(oPC));
}


You just have to change the VaultPath in the GetBicPath function to match your servervaiult path, though the one there is the default path for Windows.
Funky
Back to top
View user's profile Send private message
Zunath



Joined: 06 Jul 2006
Posts: 183

PostPosted: Fri Sep 29, 2006 2:15    Post subject: Reply with quote

That's great and I really appreciate the help but I really need players to be able to delete their characters via conversation.

The world I am creating would be sort of ruined if I put an NPC specifically for deleting characters or a placeable that does the same thing unfortunately. Smile

I'll find a way, thanks for the help.
Back to top
View user's profile Send private message
FunkySwerve



Joined: 02 Jun 2005
Posts: 377

PostPosted: Fri Sep 29, 2006 3:54    Post subject: Reply with quote

Then just change the hook you use and this line accordingly:
object oPC = GetLastUsedBy();

Razz

For a Convo you'd prolly want GetPCSpeaker();
Back to top
View user's profile Send private message
Xildjian



Joined: 08 Jan 2005
Posts: 100

PostPosted: Fri Sep 29, 2006 4:16    Post subject: Reply with quote

Zunath wrote:
00_delete_char
Quote:
// This script will delete a player's character. Checks have been made to prevent non-PCs from attempting to delete
// their character.
#include "delchar_include"

void main()
{
object oPC = GetPCSpeaker();

if (GetIsPossessedFamiliar(oPC)) {
SendMessageToPC(oPC,"You may only delete yourself when you are not possessing your familiar!");
return;
}

if (GetIsDM(oPC) || GetIsDMPossessed(oPC)) {
SendMessageToPC(oPC,"DMs are not servervault characters, and therefore may not be deleted!");
return;
}

string pname = GetPCPlayerName(oPC);
string cname = GetName(oPC);
FloatingTextStringOnCreature("DELETING!",oPC);
DelayCommand(1.0,BootPC(oPC));
DelayCommand(2.0,deletechar(pname, cname));
}


This is the script on "Actions Taken" of the conversation node of the Server Information book.

Did I set something up wrong?

Thanks for taking the time to help me.


The events of everything seem to be in the right order. Perhaps try increasing the delay to the deletechar function. If they are to close together that might cause an issue. Also, you should turn on the debug logging, and double check that the delete plugin .dll is getting loaded by nwnx2.
_________________
Member Shadow of Iniquity development team
Back to top
View user's profile Send private message
ShaDoOoW



Joined: 20 Aug 2005
Posts: 584

PostPosted: Fri Mar 30, 2007 21:38    Post subject: Reply with quote

Funky, have you same problem as me when using letoscript filedelete command - first character is deleted, but second character isn't (i don't try it from various account, that I hope working Very Happy ). My script is a little different but there is no syntax error in letoscript script.
_________________
Community Patch / NWNX Patch / NWNX Files / NWNX Connect
Back to top
View user's profile Send private message
FunkySwerve



Joined: 02 Jun 2005
Posts: 377

PostPosted: Sun Apr 01, 2007 20:32    Post subject: Reply with quote

There's a thread in the leto forums where I talk about that issue at length. It boils down to a timing issue. You cannot export the bic onclienter, which is when a lot of leto scripts I've seen try it. Instead, so the export onenter the first area, and FindNewest bic no sooner than 3 seconds after that (Export doesn't block like most of nwscript). Here's an example onareaenter - it needs to go in the first are of the mod in which they spend at least a few seconds (you cannot export while switching areas either, the bic file needs a valid location):

Code:
    if(!GetIsDM(oPC))
        {
        ExportSingleCharacter(oPC);
        DelayCommand(6.0f, OnSubraceEnter(oPC));
        }

OnSubraceEnter calls FindNewestBic in my mod. I then use it to set a local on the pc so I don't have to worry about it erroring later, and run a compare against the first fifteen letters of the filename to assure its the right one, and freeze and reattampt if it is not (happens once in a blue moon, usually due to a fileserver error on our servers).
Funky
Back to top
View user's profile Send private message
Xildjian



Joined: 08 Jan 2005
Posts: 100

PostPosted: Wed Jun 20, 2007 8:52    Post subject: Reply with quote

Hi All,

My deletechar plugin is at the following URL:

http://myweb.cableone.net/sanaya/Deletechar.zip

I had to switch ISP's when I moved.

Enjoy!
Back to top
View user's profile Send private message
Xildjian



Joined: 08 Jan 2005
Posts: 100

PostPosted: Thu Oct 11, 2007 7:31    Post subject: Reply with quote

Anyone still using this plugin?

I have acquired a machine I can use as a test server to look at some of these past issues. If there is no interest then I won't bother.
_________________
Member Shadow of Iniquity development team
Back to top
View user's profile Send private message
ShaDoOoW



Joined: 20 Aug 2005
Posts: 584

PostPosted: Thu Oct 11, 2007 20:34    Post subject: Reply with quote

well, using leto for this now, but it is not so good as special plugin, that could do it better, what are those issues btw?
_________________
Community Patch / NWNX Patch / NWNX Files / NWNX Connect
Back to top
View user's profile Send private message
Energia



Joined: 05 Jun 2006
Posts: 19

PostPosted: Sun Sep 20, 2009 8:41    Post subject: Reply with quote

Xildjian wrote:
Hi All,

My deletechar plugin is at the following URL:

http://myweb.cableone.net/sanaya/Deletechar.zip


DLL is not avaiable: Page not found.

Howewer, DLL causes a crash when there are more of 50 .bin in the folder.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    nwnx.org Forum Index -> Windows technical support All times are GMT + 2 Hours
Goto page Previous  1, 2, 3
Page 3 of 3

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group