Wednesday, May 26, 2010
Bugger the Kraken, Apathy is a greater threat
I have found that players lost interest, builders were not dependable and DM's well did the best they can before they imploded. Apathy ran riot and ruled at the end, regardless of the engery thrown into Aeon.
I learnt a lot about myself, people and how to run a PW effectively. I made a lot of mistakes and learnt from them as well.
So what next? I am not sure, I do enjoy building in NWN1 and I rather enjoy roleplaying. Perhaps I shall fiddle and see if I can get the Kraken chopped up and served to some unsuspecting people, not really sure.
For now, I shall move forward and fiddle, hacking areas and code together, so that my mind remains engaged, until something comes along that catches my eye in the PW arena.
Aeon, goodbye and thankyou for all the joy and tears.
Sporaxis
Tuesday, April 27, 2010
Compiling Errors Twice as fast!
Now I better digress a bit on this and share the joy I currently have in having built myself a new PC, to build, game and do a lot of photographic processing, photography being my new hobby. The specs of the machine were put together by one of my best mates BarryTheHatchet for his own machine and after some research I ran with what he had.
- Intel I7 8608GB Ram, generic stuff but not over clocking
- 2 x 1TB WD Caviar Black Drives
- ASUS P57pP55-DE motherboard (sweetness in a board and it glows blue too)
- Generic ATI 5770 PCI Express Graphics card
- Blue Ray Reader/DVD burner
- Windows 7 Pro 64 Bit OEM
- Antek case and 650W power supply
So what does this all mean in regards to NWN, no much except that now I can get the out of memory error twice as fast and with a nice eerie blue light emanating from the case.
OK enough with the digression about my crashing my machine rapidly instead of slowly. The solution according to one of the designers of SSE is to "Be a high end oracle/unix person, recompile the code replaying constants and integers with Macros and"... Well ummm Iwish but I crossed checked my resume and realised I am a geologist working for an Oil Company in Risk management and the closest I come to UNIX is when I audit someone.
Not giving up easy and overwhelmed by the response, I decided to just break up the mega include, which funny enough works, until that is it wants to touch nw_i0_spells and apps_include, former bioware spells and the latter is part of the Fast French data base system. Screw with either and well the Kraken awakes, wraps my machine, glowing with a nice blue light, in it's code based tentacles and sucks it down into the deep ocean.
So I am at an impasse and being a stubborn person I am not willing to give up, especially when I can sense that I am close to turning the Kraken into Squid Rings, big ones though.
Right, time to go get a harpoon and go hunting!
Monday, November 3, 2008
NWN1 - Visual effects on placeables
This is an image of the basic placebale, viewable in the toolset, hence the red grid and nothing exciting. Due to effects being applied in game, you need to work with the visualeffects.2da and identify an effects that you want to apply. I like to use the glow effects on stones, as they become crystal, or stone on objects that really need to be stone. The stone in the center has the Ghostly Pulse effect, meaning it fades in an out of view. The stones around the center stone, have been reskinned to a basic stone skin. The capped stones, have a Grey Glow applied to them, so that they shine in the dark and are semi transparent.

Sunday, October 12, 2008
Reference - row_inc_functions - Rowell's PW Functions
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
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.
Friday, August 22, 2008
Prefabia Restarted - #5
Taking the above statement as a truth, I think I should begin to thank the people for the contributions that I am directly or indirectly using as part of Prefabia.
Acknowledgements
Prefabs
- ChaunceyBillups1 : G_Mines : http://nwvault.ign.com/View.php?view=NWN2PrefabAreas.Detail&id=352
- ChaunceyBillups1 : G-Wizardlab : http://nwvault.ign.com/View.php?view=NWN2PrefabAreas.Detail&id=353
- Zach le Bon: Generic Interiors From Simaeon : http://nwvault.ign.com/View.php?view=NWN2PrefabAreas.Detail&id=230
- Hellfire : High Pass : http://nwvault.ign.com/View.php?view=NWN2PrefabAreas.Detail&id=334
- Boozehound Blue : Mountain Summit : http://nwvault.ign.com/View.php?view=NWN2PrefabAreas.Detail&id=350
- Lady Lilia/Shimmer : Temples -Evil, Neitral & Good : http://nwvault.ign.com/View.php?view=NWN2PrefabAreas.Detail&id=133
- Briesence : Ships Interiors : http://nwvault.ign.com/View.php?view=NWN2PrefabAreas.Detail&id=284
- NeVerSun : Some Mine : http://nwvault.ign.com/View.php?view=NWN2PrefabAreas.Detail&id=281
- Vordan : Vordan's Shop Wizard :http://nwvault.ign.com/View.php?view=NWN2PlugIns.Detail&id=5
- Sothis B : NWN1 area converter : http://nwvault.ign.com/View.php?view=NWN2PlugIns.Detail&id=60
- Sothis B and Seraldin : NWN2 Mapper (taken up by Sothis B) : http://nwvault.ign.com/View.php?view=NWN2PlugIns.Detail&id=62
- Sunjammer : Sunjammers Tintinator 2 : http://nwvault.ign.com/View.php?view=NWN2PlugIns.Detail&id=50
- Tani : TerraCoppa : http://nwvault.ign.com/View.php?view=NWN2PlugIns.Detail&id=25
Updating Plugins .... Tani and Grinning Fool
On another subject but one that comes about due to a scriptor moving on is updating plugins to the latest NWN2 release. Pplugins make life much easier for builders and has made Prefabia a lot more fun to build, shame NWN2 Atari did not include some of these essential tools.
Tani Provided some instructions on how to recompile the plugins to the latest version of NWN2, main thing you need is the source code.
- Grab visual c# express from m$ (it's free, the 2005 version is enough, don't know if 2008 is different). http://www.microsoft.com/express/2005/
- Grab the source code and unzip it to a folder of your liking.
- Open the project file in visual c#.
- Look for the broken references to nwn2toolset.dll and oeishared.dll, maybe others too (they are marked with an exclamation mark in a yello triangle). remove the references and add new ones to the latest version of these files.
- Compile the project, and move the new dll (found in subfolder bin/release or just bin) to your plugins folder - you should be fine.in case that was to quick take a look at the video at Link . This shows how to fix the references and compile nwn2packer and especially stripease.
Wednesday, August 20, 2008
Prefabia Restarted - #4

Image 3: Standing on a dock, looking due North. You can see the Rock in the background.

Image 4: On the centre street in the middle of the buildings, looking East I think.

Image 5: In Stone Port on the West side of town, looking west. Rather pretty if you ask me. Baron or BTH would say too pretty but meh, dank is what they are good at.
Image 6: North West side of the Rock, looking Northwards at one of the High Bridges (walkable).
Image 7: High on the Rock looking down onto the river, no name for that yet.
Image 8: Walking along the spine of the rock, this takes you to one of the lighthouses.

Image 9: Just a pretty image looking Westwards on top of the Rock, ahh stars how you twinkle.

Sunday, August 17, 2008
Prefabia Restarted - #3
Then I read a small note on the Bioware forums, where a person suggested setting the dock placeables to environment, draping the walkmesh helper placeable over the top and baking the area. I tried this and bam! My docks are now walkable and you can stroll out past the ships and look out onto the Sea and dream about where you may go or come from.
Now that docks are walkable, I now need to make the ship decks walkable, so that players can interact with the crew and such. The docks will only have two ships in at a time, one inbound and another outwards bound. Players will start on the dock of the inbound ship, the outbound will not take on players and mainly be there for ore/trade collection.
Some images of the process will be posted up later on today, to give people a feel for how to do
this.
Wednesday, August 13, 2008
Prefabia Restarted - #2
http://nwvault.ign.com/View.php?view=Nwn2plugins.Detail&id=25&comment_page=3
TerraCoppa allows a builder to rapidly replicate an area and the contents. It can rotate, raise/lower the height of the terrain and migrate all the bits and pieces you would find in area, over to your duplicate.

TerraCoppa will be a major part of my workflow, allowing me to grab and move parts of areas from other prefabs across into my own world. Using the tool you can map up areas outside the walkmesh and make them a new area that you can walk in.
Work Flow.
1. Rotate the map by 90 degrees due to the map orientated in the wrong direction.
2. Shift the map backwards by one grid row, so that the docks that were out of the walkable area now fall into it.

Shifted Map, note the green textured sothern part of the map. You get that when TerrCoppa moves things around, texture is default to the map.

3. Shift map one grid to left, so more of the hill is in the walkmesh.
4. Replicated the terrain on the eastern edge and dropped it over the green texture, same with southern. All that remains is to clean up and remove bits that you don't want. You can see the joins in the image below, but a little brush work and gone.
After some quick work and tweaking the water, it is done. This area will form the starting ton for Prefabia. The area will nee some fine touch ups and wameshitig,but is prety well ready to go.

Tuesday, August 12, 2008
Prefabia - Restarted #1
Prefabia - Restarted Post #1 After discssuing some excellent stuff with Sir Elric and BarryTheHatchet, I thought I would dust off my NWN2 PW project and begin work in earnest.
Core concept of my project is to use primarily prefabs that already exist on the web as a core for my world and only build areas where I have to. Not really rocket science and will allow me to rapidly implement interiors, stores and specific areas that fit with world concept. The flavour of the world is present day FR on the North shore of the Moonsea, focussed on RP with PVP as a possible consequence. Main reason for FR is that the NWN2 toolset is FR and items etc are already specific to that world concept. Baron pointed out to me, rightly so, that I can either make a vanilla flavour world or one with true angst and grit. After thinking on this I reckon I shall give the angst and grit a good shot. Will take me time but the darkness will be worth it. One of my previous posts had the docks as the world entry point, this will not change as it is complete now and all areas are connected with prefab interiors. I will put posts and updates here as I move along on this. Decisions so far… Working Title is Prefabia AI - Jasperres NWN2, though for now default will be in place Persistence via some form of database Spawn System from Aeon, may require a minor tweak, unsure On enter/On Exit area - Aeon, tweaked for nwn2 Naming standards - require update for NWN2 Haks - to be decided, though BTH Haks are a must Intention is that I shall track in this blog my efforts Spor2 PW project and begin wrok in earnest. Core concept of my project is to use primarily prefabs that already exist on the web as a core for my world and only build areas where I have to. Not really rocket science and will allow me to rapidly implement interiors, stores and specific areas that fit with world concept.
The flavour of the world is present day FR on the North shore of the Moonsea, focussed on RP with PVP as a possible consequnce. Main reason for FR is that the NWN2 toolset is FR and items etc are already specific to that world concept. Baron pointed out to me, rightly so, that I can either make a vanilla flvour world or one with true angst and grit. After thinking on this I reckon I shall give the angst and grit a good shot. Will take me time but the darkness will be worth it.
One of my previous posts had the docks as the world entry point, this will not change as it is complete now and all areas are connected with prefab interiors. I will put posts and uipdates here as I move along on this.
Decisions so far…
Working Title is Prefabia
AI - Jasperres NWN2, though for now default will be in place
Persistance via some form of database
Spawn System from Aeon, may require a minor tweak, unsure
On enter/On Exit area - Aeon, tweaked for nwn2
Naming standards - require update for NWN2
Haks - to be decided, though BTH Haks are a must
Intention is that I shall track in this blog my efforts
Spor
Monday, January 21, 2008
Building a Persistent World in NWN (1&2) - The Prefabia Project. Part 1
So without getting caught in pointless verbiage, I thought I might as well list the top best practices that are IMHO the are a must for building a PW, or improving one if it is already running. Notes these are my opinion, not much else really but if they save someone else some grief, then they are worth pontificating about.
1. Have a plan.
This seems rather basic, but most people forget to work out the stages and understand what needs to be done first for a world to begin. A plan lays out the steps needed, highlights holes and gives you a good checklist to work to as you achieve milestones. Not hard, but few do it.
A plan to be really effective needs to have critical milestones, resourcing and due dates. Milesstones are stages in your project, where ytou have achived a solid chunk of work. This could easily be core systems decided on, base module built, beta release. The dates tie into these, without dates your project will slip further and further behindand the energy you may have built up with the community is lost. REsources can be hardware and people, get these organised early on, keep your team small.
2. Have an understanding of what your world is going to be and more importantly what it is not.
What your world is, will ultimately determine what systems you add, disable or modify. Hardcore RP worlds have different requirements to Hardcore PVP.
Additionally you need to have a world story of some sort, this is covered later.
3. Identify Base systems and haks for your world
Best to identify these early and select or build what is needed. My preference is source from another builder than craft myself. If you source off the vault, remember to vote as well. Authors respond to requests and queries much more readily if you vote.
Core systems to consider, prior to creating custom classes etc are;
- Death
- XP
- Crafting
- Anti-hacking clientonenter scritps
- Persistant database or not
- Debug scripts
- Playtesting widgets -
- DMFI
- Spawning creatures and placeables
- HCR systems
4. Create a base module
Nice and straight forward, you have your base systems identified, add them to your base module and get it up and running. You can spend some time optimising the systems and ensuring that the base is very stable and error free. This step is rather critical, as this base module becomes the reference module for all your builders to base their work on.
5. World Setting
Take your time and explore what you want your world setting to be and locate your references. You have a choice of writing your own from scrath, using one of the existing settings or using the setting that the nwn engine uses, which is Forgotten Realms. Writing your own is rather exhausting but rewarding at the same time, however you need to consider everthing. Using a a pre-existing setting works a treat, and you can pick and choose what you want your world to be from the parts. Finially the easiest is to use the FR setting for simplicity sake. NWN already has all the items built with FR descriptions, creatures and placeable fit the FR setting, so a large chunk of your work is done.
6. Naming Standards
To ensure consistency in your world, from scripts to areas, I would suggest that naming standards are a must. Listed below are various standards from official to what was used on the Aeon project. Use these as a basis for your own, or as is.
Modified CODI
Placable
* T - Trigger
* D - Door
* R - Trap
* C - Conversation
* E - Encounter
* I - Item - This script is not placed on an item per se, but called by module level scripts.
* X - No Object - Use this for a script that is called by other scripts. Executable scripts.
This character is followed by a two character short for the event it goes in, by category:
* N, M
o CO - onConversation
o DI - onDisturbed
o PA - onPhysicalAttacked
o SP - onSpawn
o UD - onUserDefined
o SC - OnSpellCastAt
o BL - onBlocked
o DM - onDamaged
o HB - onHeartbeat
o DE - onDeath
o CR - onCombatRoundEnd
o PE - onPerception
o RE - onRest
* A
o EN - onEnter
o EX - onExit
o HB - onHeartbeat
o UD - onUserDefined
* O
o CE - onClientEnter
o CL - onClientLeave
o PR - onPlayerRest
o RS - onRespawn
o DY - onPlayerDying
o DE - onPlayerDeath
o LE - onPlayerLevelUp
o IA - onItemActivated
o IQ - onItemAquired
o UI - onUnaquireItem
o ML - onModuleLoad
o HB - onHeartBeat
o UD - onUserDefined
o EI - onEquipItem
* P
o US - onUsed
o HB - onHeartBeat
o DE - onDeath
o AT - onAttacked
o SC - onSpellCastAt
o DM - onDamaged
o OP - onOpen
o OC - onClosed
o DI - onDisturbed
o LO - onLocked
o UL - onUnlocked
o UD - onUserDefined
* T
o CL - onClick
o EN - onEnter
o EX - onExit
o HB - onHeartBeat
o UD - onUserDefined
* D
o AT - onAreaTransitionClick
o OC - onClosed
o DM - onDamaged
o DE - onDeath
o FO - onFailedToOpen
o HB - onHeartBeat
o LO - onLocked
o OP - onOpened
o AT - onAttacked
o SC - onSpellCastAt
o UL - onUnlocked
o UD - onUserDefined
* R
o DI - onDisarmed
o TT - onTrapTriggered
* E
o EN - onEnter
o EX - onExit
o OE - onExhausted
o HB - onHeartBeat
o UD - onUserDefined
* C
o AT - Actions Taken
o AP - Appears When (StartingConditional Script)
o AB - onConversation Aborted
o EN - onConversation end
* I
o US - Called when the item is used.
o AQ - Called when the item is Aquired.
o UA - Called when the item is UnAquired.
Prefix examples
Module OnClientEnter script prefix: OCE_
Area OnEnter script prefix: AEN_
Placeable OnUsed prefix: PUS_
Consider this post a living document, which I will add to over time.
Acknowledgements to BarryTheHatchet and Relexx
Saturday, December 29, 2007
NWN Scripting - Naming an Object Part 1
My first pass at this script is to first get the players name using GetName(oPC) with oPC being the PC. This returns the Firtsname and the Surname of the PC, with a space separating them. I now need to take the leftmost string, as this is what I want to use to name an item.
Easier said than done it seems, when I scan the Name of the PC for the location of a space it returns a 0. Seeing that the name of the PC is 13 characters long and the space is in the middle, well this sucks.
Well spent most of the day on this, back and forth and realised I am truly a sucky coder but I got it to work at least. I can now pull the first name of characters that have a spaces in them.
Only problem now is that names with no spaces have the front character truncated. I am too tired to really stress so I put it up on Bioware, in hope of some answers.
Read it here on Bioware...
http://nwn.bioware.com/forums/viewtopic.html?topic=609475&forum=47&sp=0#5554701
Amazing, the community resonded and suddenly my code has gone from a monster to something that is rather useful.
Below is what a gifted script writer can do. Axe Murderer, took my rather horrific piece of code and made something that is rather elegant. Now I just need to work my way through it to understand it better.
//Put this on action taken in the conversation editor
string GetFirstName( object oCreature) // Function to get the First Name
{ if( !GetIsObjectValid( oCreature)) return ""; // Check to see if it is a PC
string sName = GetName( oCreature);
int iPos = FindSubString( sName, " ");// Find the space in the Full name
if( iPos < 0) return sName; // If there are no spaces the name is made default
// If there are spaces then do this
while( iPos == 0)
{ sName = GetStringRight( sName, GetStringLength( sName) -1);
iPos = FindSubString( sName, " ");
}
// Ternary condition which does an if else sorto of.
return ((iPos < 0) ? sName : GetStringLeft( sName, iPos));
}
void main()
{ object oPC = GetPCSpeaker(); // PC who is speaking to NPC
string sFirstName = GetFirstName( oPC); // Get the PC's first name.
SendMessageToPC( oPC, "DEBUG ks_namer: sFirstName is " + sFirstName );
SpeakString( "My First name is " +sFirstName +" and I am " +IntToString( GetStringLength( sFirstName)) +" characters long");//Spor Debug
}
