Aller au contenu

Photo

LF: help. Problem with Database calling and setting


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

#1
Devling

Devling
  • Members
  • 15 messages

Hello, i have recently starting to use the Database (which i think is the standard one).

 

When i 1st tried using the database with SetCampaignInt() and GetCampaignInt() functions, every thing went fine.

 

But after a few times, the system stopped working as intended.

but before everything screwed up, it managed to create some variables for my pc in the database.

 

 

At the moment whenever i call an integer from my db, like:

GetCampaignInt("MYDB", "whatever", oPC);

 

no matter the value i set manualy in the database, it will always return 0.

 

and if i try to use the SetCampaignInt() function, my nwserver gets a crash or a "stops working" message appears and awaits my action to close it.

 

 

I have added admin rights by default too all my nwn programs. But i still don't have any idea what can cause this,

especialy because it worked the first 1-3 times i tried using these CampaignInts.

 

Did anyone experience anything like this or is aware of a solution for my particular problem?

Thanks in advance



#2
henesua

henesua
  • Members
  • 3 867 messages

Maybe the database file is corrupted or something. Try moving the database files out of the "database/" directory and launching your module. If this solves your problem there was something wrong with your DB files.


  • Devling aime ceci

#3
Shadooow

Shadooow
  • Members
  • 4 470 messages

You cant use oPC parameter, it doesnt work. You need to save datas under PC name or better establish an ID for players and save datas on this ID.

 

See here.


  • Devling aime ceci

#4
henesua

henesua
  • Members
  • 3 867 messages

But why is it crashing when he uses SetCampaignInt?



#5
The Mad Poet

The Mad Poet
  • Members
  • 425 messages

I find just setting simple variables and such for persistence, when PC specific, is easier to do by adding the variables to an item that stays in the players inventory. The variables actually stay on over server resets (for multiplayer), and I believe transfer with a character if the character is exported in a single player module. Not trying to tell you to avoid the database or anything. Sometimes it just isn't necessary. 



#6
Devling

Devling
  • Members
  • 15 messages

Thank you for your answers.

 

I tried moving all my database files within my \database directory.

 

And i removed the oPC object from the CampaignInts, and used GetPCPlayerName to make unique int names.

 

Result: Everything works as intended now. and i succeded in getting values from the database after server restart

 

So thanks alot, everything works fine now.