Sunday, October 12, 2008

Reference - row_inc_functions - Rowell's PW Functions

Reference to functions called in Rowell's PW Toolkit.

row_inc_functions

GLOBAL FUNCTIONS

GetCDKeyID(object oPC)
Returns the Database Record ID of the CDKey for the Playerint

GetPlayerID(object oPC)
Returns the Database Record ID of the Playerint

GetCharacterID(object oPC)
Returns the Database Record ID of the Characterint

GetItemID(object oItem)
Returns the Database Record ID of the Itemint

GetItemOwner(object oItem)
Passes the Database Character ID of the Owner of the Itemint

GetIsPlayerDM(object oPC)
Returns from the Database whether or not this Player Account belongs to a Server DMint

FormatID(int iID)
Returns a (gIDsize) character string based on the integer passed, with leading zeros// Example: 159 is converted to "00000159"

GetRace(object oPC)
Returns the String Value of the Race of the Objectstring

GetRaceSub(object oPC)
Returns the String Value of the Sub Race of the Objectstring

Get PCGender(object oPC)
Returns the String Value of the Gender of the Objectstring

GetAlignment(object oPC)
Returns the String Value of the Alignment of the Objectstring

GetClass(int iPos, object oPC)
Returns the String Value of the Class of the Object, given the position (1-3)

GetLevel(object oPC)
Returns the true level of the object, combining the levels of up to all 3 classes

GetGameDate()
Returns the Current Game Date in the string form of "YYYYMMDD"

GetGameDate()
Returns the Current Game Date and Time in the string form of "YYYYMMDDHHMM"

StringZero(int iNum, int iSize)
Given a number (iNum), converts it to a String and adds leading zeros to make the string iSize long
Example: StringZero(10,5) would return "00010"

GetItemTag(object oItem)
Given an Item Object, returns the Tag of the Item. If the Database Item Tracking Setting is turned on, the function will return the True Tag (not the modified DB Tag).

GetTrackedItemPossessedBy(object oPC, string sTag);
This function returns the object in the Character's (oPC) inventory, given a particular Tag (sTag). This function should be used when Item Tracking is Enabled (gEnableItemTracking = TRUE) in the place of the GetItemPossessedBy() function. Otherwise, this Function acts exactly like the built-in GetItemPossessedBy(object oPC, string sTag)

Row_ModuleStart()
Use in the Module's OnModuleStart Event

Row_ModuleEnter(object oPC=OBJECT_INVALID)
Use in the Modules's OnClientEnter Event

Function Comments

  • GATHER THE EVENT TRIGGERING OBJECT IF IT IS NOT PASSED
  • ABORT IF THE OBJECT IS NOT A PLAYER OR DM
  • DEBUG CODE
  • ABORT IF THERE IS NO DATABASE ACCESS
  • STORE THE PLAYER'S DATABASE VALUES ONTO THE PLAYER OBJECT
  • iPID = GetPlayerID(oPC);
  • iCID = GetCharacterID(oPC);
  • iIsDM = GetIsPlayerDM(oPC);
  • UPDATE THE PLAYER'S TIME STATISTICS
  • UPDATE THE CHARACTER'S TIME STATISTICS
  • UPDATE THE IP ADDRESS TABLE
  • INITALIZE THE PLAYER'S CHARACTER ONLINE STATUS
  • SISPLAY LOGIN TO DM'S AND TO LOG FILECHECK IF THE USER IS BANNED
  • CHECK IF THE USER IS SIGNED ON AS A DM, BUT THEIR PLAYER ACCOUNT IS NOT DMACTIVE (EXTRA SECURITY AGAINST FAKE DM'S / HACKERS)
  • SET THE PLAYER FLAG THAT THEY ARE ONLINE TO TRUE

Row_ModulePlayerLoaded(object oPC=OBJECT_INVALID)
Use in the Module's OnPlayerLoaded Event

Function Comments

  • DEBUG CODE
  • GATHER THE EVENT TRIGGERING OBJECT IF IT IS NOT PASSED
  • ABORT IF THE OBJECT IS NOT A PLAYER OR DM
  • ABORT IF THE PLAYER IS NOT READY TO BE TELEPORTED YET
  • STORE THE PLAYER'S DATABASE VALUES ONTO THE PLAYER OBJECT
  • ABORT IF THE PLAYER IS LOGGING BACK ON (BEFORE THE SERVER WAS RESET)
  • CHECK / SET THE CHARACTER'S HIT POINTS
  • IF THE CHARACTER IS DEAD IN THE DATABASE, MAKE THE CHARACTER DEAD
  • SET FEATS / SPELLS TO NO USES LEFT
  • JUMP THE CHARACTER TO THE LAST SAVED LOCATION


Row_ModuleExit(object oPC=OBJECT_INVALID)
Use in the Module's OnClientExit Event Function Comments

Function Comments

  • GATHER THE EVENT TRIGGERING OBJECT IF IT IS NOT PASSED
  • ABORT IF THE OBJECT IS NOT A PLAYER OR DM
  • DEBUG CODE
  • SET THE PLAYER FLAG THAT THEY ARE ONLINE TO TRUE
  • SET THE CHARACTER'S CURRENT HIT POINTS
  • SET THE CHARACTER'S DEATH STATUS
  • UPDATE TIME SPENT ONLINE
  • UPDATE THE CHARACTER TIME STATISTICS
  • SET THE PLAYER/CHARACTER AS OFFLINE

Row_AreaEnter(object oPC=OBJECT_INVALID)
Use in all Areas' OnEnter Event

Row_AreaExit(object oPC=OBJECT_INVALID)
Use in all Areas' OnExit Event

Row_PlayerUpdate(object oPC=OBJECT_INVALID)
Use to store the Character information from the object (oPC) into the Database

Row_PlayerRest(object oPC=OBJECT_INVALID)
Use in the Module's OnPlayerRest

Row_PlayerDead(object oPC=OBJECT_INVALID, object oNPC=OBJECT_INVALID)
Use in the Module's OnPlayerDeath Script

Row_PlayerRaise(int bPortToBind, object oPC=OBJECT_INVALID)
Use in the Module's OnPlayerRespawn Script with bPortToBind set to TRUE
Use in Raise Dead and Ressurrect Spells Scripts, with bPortToBind set to FALSE

Row_AddToLootTable(object oItem)
Use to add an item to the Database, to catalog the items drop, and how many times each item has dropped in the game.

Row_ItemCreate(string strResRef, sting strTag="", object oOwner=OBJECT_INVALID)
Used internally and should not be used.

Row_ItemGain(object oItem=OBJECT_INVALID)
Use in the Module's OnAcquire

Row_ItemLose(object oItem=OBJECT_INVALID)
Use in the Module's OnUnacquire Script

GetNPCID(object oNPC);
Returns the NPC ID for the given NPC (oNPC)

IncreaseNPCkills(object oNPC);
Increases the Total Number of Kills that an NPC type has inflicted upon Player

IncreaseNPCdeaths(object oNPC);
Increases the Total Number of Deaths that the NPC type has suffered.

Row_ResetCharacter(object oPC);
Used to set the character's (oPC) Feats and Spells to all used. This stops people from logging off and back on to get all their spells back.

Row_DiscoverLocation(object oPC, object oPlace=OBJECT_SELF);
Used to reward the character (oPC) when they step into a trigger (oPlace) and discover a new location.

RemoveEffects(object oPC)
Use to remove all negative affects from a character. This function is a direct copy from the NWN script in nw_i0_plot

Saturday, October 11, 2008

Prefabia Restarted - #8

The night is late but I feel a sense of renewed excitement when working within the NWN toolset. The loss of my previous work, left ashes in my mouth and a sense of futility at ever producing a module in NWN2. With time I have found the loss has turned into a win, much like the regrowth of plants through the ashes of a proceeding fire.

My module slate is clean and so this time I have focussed on getting the core systems and haks installed and working. MYSQL and NWNX4 1.08 is installed and persistance is working as it should, and after some poking around under the hood I actually understand it a lot better than before.

I took them time to install BTH's Module Testing Toolkit, an excellent piece of work if you want to debug a module using nothing more than a slick UI. I seriously recommend this to anyone who is building or is considering building. Highly configuraable and easy to use, just ensure you read the documentation.

DMFI has crept into the module as well and seems to compile without issue. I am still working out the DMFI component as I am unsure if it comes with languages like NWN1 DMFI or not. Still to be discovered I suppose, ahh the joy of building.


Some excellent content I added as well seeing as I really like it and have been discussing these packs with BTH for a while now. It is fantastic to see him release some awesome content and if you are curious you can always have a look at his blog to get a feel for what he is working on.

So that wraps up my little update and looking at the clock, I reckon it is time I hit the sack. Before I shoot off I noted Relexx, one of the orginal Aeon NWN1 PW leadership team, has started to host a NWN1 PW called Cocoon. You can find it under Multiplayer - Role Play. As soon as I get a chance, I will have to head on over and have a run around, though it is currently alpha and prone to changes on a daily basis.