View previous topic :: View next topic |
Author |
Message |
Mergon
Joined: 30 Jan 2005 Posts: 3 Location: Ottawa, Canada
|
Posted: Sat Feb 05, 2005 23:37 Post subject: Persistent Object spawning |
|
|
I'm trying to immitate the Bioware RetrieveCampaignObject function for use with concerting an existing script from the Bioware database to NWNX2. My question is this; how to I get a retrieved Persistent Object to spawn at a given location?
This is the wrapper I'm trying as poart of my include script. aps_include is at the top of said script. The ConvertNameTag function simply removes any spaces a tag and sets it to all uppercase.
object RetreiveNWNX2Object(string sDatabaseName,string sVarName, location lLoc)
{
sDatabaseName=ConvertNameTag(sDatabaseName);
object oValue = GetPersistentObject(GetModule(),sVarName,OBJECT_INVALID,sDatabaseName+"_obj");
oValue = CopyObject(oValue,lLoc);
return oValue;
}
My StoreNWNX2Object wrapper seems to be working, the object is being stored in the database, so its there for retrieval. I just can't get the retrieved object to spawn in. for testing I'm respawning to a waypoint location and the vfx I'm spawning at the same location is appearing, just not the object. (in this case I'm storing the PC, and recalling him as a clone). _________________ Watch your back, conserver your ammo, and never cut a deal with a dragon |
|
Back to top |
|
|
NoMercy
Joined: 03 Jan 2005 Posts: 123 Location: UK
|
Posted: Sun Feb 06, 2005 2:09 Post subject: |
|
|
I recomend you look at the GetPresistentObject() function in aps_include, you'll notice at the bottom the object is pulled from the database using GetCampaignObject() so just copy the whole function, rename it, and modify the parameter list to pass a destination location.
Not done it myself though it should work, if it does I suspect at some point a function to store/retrieve creatures will be included in aps. |
|
Back to top |
|
|
Mergon
Joined: 30 Jan 2005 Posts: 3 Location: Ottawa, Canada
|
Posted: Sun Feb 06, 2005 4:39 Post subject: |
|
|
I recomend you look at the GetPresistentObject() function in aps_include, you'll notice at the bottom the object is pulled from the database using GetCampaignObject() so just copy the whole function, rename it, and modify the parameter list to pass a destination location.
Not done it myself though it should work, if it does I suspect at some point a function to store/retrieve creatures will be included in aps.
That did the trick.
object RetrievePersistentObject(object oObject, string sVarName, location lLoc, object oOwner = OBJECT_INVALID, string sTable = "pwobjdata")
{
string sPlayer;
string sTag;
object oModule;
if (GetIsPC(oObject))
{
sPlayer = SQLEncodeSpecialChars(GetPCPlayerName(oObject));
sTag = SQLEncodeSpecialChars(GetName(oObject));
}
else
{
sPlayer = "~";
sTag = GetTag(oObject);
}
sVarName = SQLEncodeSpecialChars(sVarName);
string sSQL = "SELECT val FROM " + sTable + " WHERE player='" + sPlayer +
"' AND tag='" + sTag + "' AND name='" + sVarName + "'";
SetLocalString(GetModule(), "NWNX!ODBC!SETSCORCOSQL", sSQL);
return RetrieveCampaignObject ("NWNX", "-", lLoc, oOwner);
}
Then I made a wrapper to make it match the RetreiveCampaignObject function. It works, so now on to other issues.
I'm basically trying to make it possible to use OldMansBeard's PC Henchman System with NWNX2 instead of the Bioware DB. _________________ Watch your back, conserver your ammo, and never cut a deal with a dragon |
|
Back to top |
|
|
|
|
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
|