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 
 
NWNX4 USES? need information and help. thanks.

 
Post new topic   Reply to topic    nwnx.org Forum Index -> General Discussion
View previous topic :: View next topic  
Author Message
terrybougard



Joined: 10 Mar 2009
Posts: 3

PostPosted: Tue Mar 10, 2009 5:13    Post subject: NWNX4 USES? need information and help. thanks. Reply with quote

I am a no scripter nor knowledgable in scripting. I am using Lilac's script generator to help me in building my pw mod.

I am so attracted on the feature of NWNX4, i have successfully installed it, run the test module to see if its working and it works fine like the text using the lever and chest on sqlite.mod.

When I change it to my module from nwnx.ini, pw module load. Now my question is, I just dunno how to use nwnx inside my module.


The things I needed to see in my module are the following:
1.) If a player drops an item in the ground, and the server restarts, the item in the ground should be still there.
2.) Player will spawn where they last logoff after server restart.
2.) If I buy or sell something on the merchant, and the server restarts, the items bought and sold still there and no reset.


These are the few things i need in my module using NWNX.

I hope someone can help me configure this further. Because I am so noobish.

Thanks


Also currently, without any configuration, what persistency feature can nwnx4 do in my module? thanks.
Back to top
View user's profile Send private message
Zebranky



Joined: 04 Jun 2006
Posts: 415

PostPosted: Tue Mar 10, 2009 16:13    Post subject: Re: NWNX4 USES? need information and help. thanks. Reply with quote

terrybougard wrote:
The things I needed to see in my module are the following:
1.) If a player drops an item in the ground, and the server restarts, the item in the ground should be still there.
2.) Player will spawn where they last logoff after server restart.
2.) If I buy or sell something on the merchant, and the server restarts, the items bought and sold still there and no reset.

All of these will require some coding -- NWNX does not create any sort of persistence on its own. #2 is pretty easy if you know how to code, but #1 and #3 are considerably more difficult. I can describe how you'd do #2 and possibly #1, but they're complicated if you have no scripting/database experience. I recommend you find a scripter with NWNX experience to join your PW team.
_________________
Win32 SVN builds: http://www.mercuric.net/nwn/nwnx/

<Fluffy-Kooshy> NWNx plugin is to this as nuclear warheads are to getting rid of fire ants.

<ThriWork> whenever I hear nwn extender, I think what does NWN need a penis extender for?
Back to top
View user's profile Send private message Visit poster's website
Zunath



Joined: 06 Jul 2006
Posts: 183

PostPosted: Tue Mar 10, 2009 16:28    Post subject: Reply with quote

Do your players have an item that stores variables in their inventory? For example, for our server every character has an "ID Card" that is undroppable.

If so, let me know what the tag of it is and I'll write up a persistent locations script for ya. Smile
Back to top
View user's profile Send private message
Zebranky



Joined: 04 Jun 2006
Posts: 415

PostPosted: Tue Mar 10, 2009 16:42    Post subject: Reply with quote

Zunath wrote:
Do your players have an item that stores variables in their inventory? For example, for our server every character has an "ID Card" that is undroppable.

If so, let me know what the tag of it is and I'll write up a persistent locations script for ya. Smile

Why would you use that rather than an external database? Just curious, seems unnecessary to me.
_________________
Win32 SVN builds: http://www.mercuric.net/nwn/nwnx/

<Fluffy-Kooshy> NWNx plugin is to this as nuclear warheads are to getting rid of fire ants.

<ThriWork> whenever I hear nwn extender, I think what does NWN need a penis extender for?
Back to top
View user's profile Send private message Visit poster's website
Zunath



Joined: 06 Jul 2006
Posts: 183

PostPosted: Tue Mar 10, 2009 16:43    Post subject: Reply with quote

This script will save the location of a PC every time they enter an area. Due to the way NWN works, we can't store their location when they leave the module.

Place this on every area's OnEnter event (aside from the initial area players start at)

Code:


#include "aps_include"

void main()
{
    object oPC = GetEnteringObject();
    // Won't fire for DMs or NPCs.
    if(!GetIsPC(oPC)){return;}

    object oDatabase = GetItemPossessedBy(oPC, "database");
    location lLocation = GetLocation(oPC);

    // Originally I stored the raw location of the PC on the database but each time we
    // updated the module with a new area, for some reason the stored location wouldn't send the
    // PC back to where they were. To remedy that, we convert the location to a string first
    // Using a function included with NWNX, we can convert a location to a string
    string sStoredLocation = APSLocationToString(lLocation);

    SetLocalString(oDatabase, "PC_LOCATION", sStoredLocation);
}



Now place this script on the OnEnter event of the starter area (and no where else!):

Code:


#include "aps_include"

void main()
{
    object oPC = GetEnteringObject();
    // Won't fire for anyone that's not a PC
    if(!GetIsPC(oPC)){return;}

    object oDatabase = GetItemPossessedBy(oPC, "database");
    string sStoredLocation = GetLocalString(oDatabase, "PC_LOCATION");

    // Now convert the string back to a location.
    location lLocation = APSStringToLocation(sStoredLocation);

    // Finally, jump the PC to the stored location.
    AssignCommand(oPC, ActionJumpToLocation(lLocation));
}



The only changes you will need to make is on line 9 of each script. In the quotations you'll see "database". Replace this with the TAG of the item to store the PC's location on.

If you have any questions let me know.


Last edited by Zunath on Tue Mar 10, 2009 16:45; edited 1 time in total
Back to top
View user's profile Send private message
Zunath



Joined: 06 Jul 2006
Posts: 183

PostPosted: Tue Mar 10, 2009 16:44    Post subject: Reply with quote

Zebranky wrote:
Zunath wrote:
Do your players have an item that stores variables in their inventory? For example, for our server every character has an "ID Card" that is undroppable.

If so, let me know what the tag of it is and I'll write up a persistent locations script for ya. Smile

Why would you use that rather than an external database? Just curious, seems unnecessary to me.


No reason to add unnecessary information to the database Smile

We store all character information on their inventory item (location, custom skills, whatever) and all server wide information in MySQL (market info, guilds, etc.)

Sure you can store both in the database but it seems pointless to have all that extra bloat in MySQL for no real gain.
Back to top
View user's profile Send private message
PlasmaJohn



Joined: 04 Mar 2005
Posts: 70
Location: The Garage

PostPosted: Tue Mar 10, 2009 17:41    Post subject: Reply with quote

Zunath wrote:
Sure you can store both in the database but it seems pointless to have all that extra bloat in MySQL for no real gain.

Disk is cheap.

Knowing who was where and when is invaluable when performing cheating/griefing investigations.
Back to top
View user's profile Send private message
ShaDoOoW



Joined: 20 Aug 2005
Posts: 584

PostPosted: Wed Mar 11, 2009 2:10    Post subject: Reply with quote

Zunath wrote:
Zebranky wrote:
Zunath wrote:
Do your players have an item that stores variables in their inventory? For example, for our server every character has an "ID Card" that is undroppable.

If so, let me know what the tag of it is and I'll write up a persistent locations script for ya. Smile

Why would you use that rather than an external database? Just curious, seems unnecessary to me.


No reason to add unnecessary information to the database Smile

We store all character information on their inventory item (location, custom skills, whatever) and all server wide information in MySQL (market info, guilds, etc.)

Sure you can store both in the database but it seems pointless to have all that extra bloat in MySQL for no real gain.

I storing these thing to player item, but I don't like those ID cards, so Im using player skin as that item. Player skin is invisible so, I spare the database and player don't got aditional system item in inventory.

In fact, I don't use any such system item as the saving pen or whatever.
_________________
Community Patch / NWNX Patch / NWNX Files / NWNX Connect
Back to top
View user's profile Send private message
Zunath



Joined: 06 Jul 2006
Posts: 183

PostPosted: Wed Mar 11, 2009 3:13    Post subject: Reply with quote

It's all a matter of preference anyhow. Do whatever works best for ya. Smile
Back to top
View user's profile Send private message
terrybougard



Joined: 10 Mar 2009
Posts: 3

PostPosted: Wed Mar 11, 2009 4:52    Post subject: I'll try this. Reply with quote

Zunath wrote:
This script will save the location of a PC every time they enter an area. Due to the way NWN works, we can't store their location when they leave the module.

Place this on every area's OnEnter event (aside from the initial area players start at)

Code:


#include "aps_include"

void main()
{
    object oPC = GetEnteringObject();
    // Won't fire for DMs or NPCs.
    if(!GetIsPC(oPC)){return;}

    object oDatabase = GetItemPossessedBy(oPC, "database");
    location lLocation = GetLocation(oPC);

    // Originally I stored the raw location of the PC on the database but each time we
    // updated the module with a new area, for some reason the stored location wouldn't send the
    // PC back to where they were. To remedy that, we convert the location to a string first
    // Using a function included with NWNX, we can convert a location to a string
    string sStoredLocation = APSLocationToString(lLocation);

    SetLocalString(oDatabase, "PC_LOCATION", sStoredLocation);
}



Now place this script on the OnEnter event of the starter area (and no where else!):

Code:


#include "aps_include"

void main()
{
    object oPC = GetEnteringObject();
    // Won't fire for anyone that's not a PC
    if(!GetIsPC(oPC)){return;}

    object oDatabase = GetItemPossessedBy(oPC, "database");
    string sStoredLocation = GetLocalString(oDatabase, "PC_LOCATION");

    // Now convert the string back to a location.
    location lLocation = APSStringToLocation(sStoredLocation);

    // Finally, jump the PC to the stored location.
    AssignCommand(oPC, ActionJumpToLocation(lLocation));
}



The only changes you will need to make is on line 9 of each script. In the quotations you'll see "database". Replace this with the TAG of the item to store the PC's location on.

If you have any questions let me know.




I'll try this precious code. Thank you very much.

anyways, so far this nwnx4 i had installed its current usage is somewhat like an autorestarter or server monitor only? for what I see without any coding and plugins yet...

sigh... i need to study further how to code things for nwnx4.
Back to top
View user's profile Send private message
terrybougard



Joined: 10 Mar 2009
Posts: 3

PostPosted: Wed Mar 11, 2009 4:59    Post subject: nwnx erf Reply with quote

what do i do with the erf's included with the nwnx4 installation package?

nwnx_include.erf: Include file with generic NWNX functions
nwnx_sql.erf: Include file for working with SQL databases
nwnx_time.erf: Include file with functions for timing stuff

it describes what it is for, i can import it to my module, but i just don't know where exactly i need to put it.

Do i need to put all of this on the module load script?

I need further help with this if this erf's are important.

Thanks.
Back to top
View user's profile Send private message
Zunath



Joined: 06 Jul 2006
Posts: 183

PostPosted: Wed Mar 11, 2009 5:37    Post subject: Reply with quote

Ruh roh!

I figured you were using NWNX2 (for Neverwinter Nights 1). If you're working with NWN2 then I can't promise that code will work for you but it's still worth a shot.
Back to top
View user's profile Send private message
Fireboar



Joined: 17 Feb 2008
Posts: 323

PostPosted: Wed Mar 11, 2009 12:04    Post subject: Re: nwnx erf Reply with quote

terrybougard wrote:
what do i do with the erf's included with the nwnx4 installation package?

nwnx_include.erf: Include file with generic NWNX functions
nwnx_sql.erf: Include file for working with SQL databases
nwnx_time.erf: Include file with functions for timing stuff

it describes what it is for, i can import it to my module, but i just don't know where exactly i need to put it.

Do i need to put all of this on the module load script?

I need further help with this if this erf's are important.

Thanks.


No, just import it and leave it there. Include files (i.e. files without a main() function) aren't put on anything. They are included in other scripts by the line:

#include "the_file"

Where the_file is the name of the file included. Include files are basically function libraries that provide additional functions to what is available by default.
Back to top
View user's profile Send private message
Immune2u



Joined: 05 Sep 2009
Posts: 2

PostPosted: Sat Sep 05, 2009 11:48    Post subject: Reply with quote

I'm also looking for some info to get started on my world. I'm useing NESS system and I'm going to try using NWNX4 with it. I like the player skin idea, and I have a little bit of scripting ability. Not the same as the C++ I took in school. I've thrown my hat in to make a NWN2 PW latly and I've got alot of the same questions as the OP. If anyone can post some links for quick start on NWNX4 database useage that would help alot. Thanks!
_________________
I play NWN2!!! Want to make my own world.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    nwnx.org Forum Index -> General Discussion All times are GMT + 2 Hours
Page 1 of 1

 
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