Author Topic: Killer's Town Crier Help  (Read 282 times)

Legacy_WoC_Builder

  • Sr. Member
  • ****
  • Posts: 425
  • Karma: +0/-0
Killer's Town Crier Help
« on: May 16, 2011, 04:03:50 am »


               Hello all.  I am running into an issue while trying to utilize Killer Town Crier v1.0 by Axe

It has a persistent version, which is fine, but all the Town Criers use the same database.  My attempt to rename it to a local variable failed, so I thought I would ask here to see if my logic is off.

Here is the default code, where it sets the DB name.

// Town Crier Library Script
//:://///////////////////////////////////////////////////
// _town_crier_inc
//:://///////////////////////////////////////////////////
// Contains several functions which can be used to change the Town
// Criers behavior from a script during play.
//:://///////////////////////////////////////////////////
const string DEFAULT_TOWN_CRIER_DATABASE_NAME = "TownCrier";


//:://///////////////////////////////////////////////////////////////
// GetTownCrierDatabaseName()
//    Returns the database name used by the persistent system to store
//    the town crier's persistent information.
//:://///////////////////////////////////////////////////////////////
string GetTownCrierDatabaseName()
{ return (DEFAULT_TOWN_CRIER_DATABASE_NAME +"_" +GetModuleName());
}

string TOWN_CRIER_DATABASE_NAME = GetTownCrierDatabaseName();

And here are my edits.  Where i placed my localstring is on the individual TownCriers that i had placed in my test mod; three in total, each with a different localstring for the name of each town in which we need to place them.


string GetTownCrierDatabaseName()
{ return (DEFAULT_TOWN_CRIER_DATABASE_NAME +"_" +GetLocalString(OBJECT_SELF,"TownName"));
}

string TOWN_CRIER_DATABASE_NAME = GetTownCrierDatabaseName();

What I ended up with in my data folder was named "TOWNCRIER_ORIGINAL-BLANK", and each Town Crier cries news placed on other criers.

All I can figure is is that since the GetLocalString is called in an include file, perhaps the include is not really "on" the crier, and so it cannot read a local string placed on the crier?

Any ideas?

Everything else about this system works wonderfully, and I really hope we can work around the single DB for the criers.  '<img'>

Thanks all, Russ '<img'>
               
               

               
            

Legacy_WoC_Builder

  • Sr. Member
  • ****
  • Posts: 425
  • Karma: +0/-0
Killer's Town Crier Help
« Reply #1 on: May 16, 2011, 04:11:00 am »


               LOL

And found a fix on the vault, looking at comments from the original post.  A link was posted to the old boards, suggesting a fix here.
               
               

               
            

Legacy_WoC_Builder

  • Sr. Member
  • ****
  • Posts: 425
  • Karma: +0/-0
Killer's Town Crier Help
« Reply #2 on: November 19, 2011, 07:00:44 am »


               Well heck.  somehow it got broke, but now, thanks to the old boards being down, I cannot find the OP.

Does anyone have a working copy of that script, so we can get our individual criers back?

Please?
               
               

               
            

Legacy_Fester Pot

  • Hero Member
  • *****
  • Posts: 1698
  • Karma: +0/-0
Killer's Town Crier Help
« Reply #3 on: November 19, 2011, 01:39:16 pm »


               

By Axe Murderer on 09/14/09 20:45
Yeah you can do that but there's gonna be a little busy work to do...

1. Edit _town_crier_inc script and up near the top you see this bit:

NWScript:
//::///////////////////////////////////////////////////////////////////
GetTownCrierDatabaseName()
// Returns the database name used by the persistent system to store
// the town crier's persistent information.
//:://///////////////////////////////////////////////////////////////

string GetTownCrierDatabaseName()
{
 return (DEFAULT_TOWN_CRIER_DATABASE_NAME +"_" +GetModuleName());
}

string TOWN_CRIER_DATABASE_NAME = GetTownCrierDatabaseName();

Change it to look like this:

NWScript:

//::///////////////////////////////////////////////////////////////////
GetTownCrierDatabaseName( string sTownCrier = "")
// string sTownCrier - the tag of the town crier to get the database name for.
// Returns the database name used by the persistent system to store
// the town crier's persistent information.
//:://///////////////////////////////////////////////////////////////

string GetTownCrierDatabaseName( string sTownCrierTag == "")
{

 if( sTownCrierTag == "") return
 
 (DEFAULT_TOWN_CRIER_DATABASE_NAME +"_" +GetModuleName());
 
 return (DEFAULT_TOWN_CRIER_DATABASE_NAME +"_" +sTownCrierTag);
 
}

string TOWN_CRIER_DATABASE_NAME = GetTownCrierDatabaseName();

2. Go thru the rest of the script and everywhere you see the constant

TOWN_CRIER_DATABASE_NAME

change it to say

GetTownCrierDatabaseName( GetTag( oTownCrier))

except for in the last function called SetPCNewsworthy, leave that one as it is.

3. Next edit all the scripts that start with crier_at1a1 (there are 8 of them a-h). Everywhere in those where you see the constant

TOWN_CRIER_DATABASE_NAME

change it to say

GetTownCrierDatabaseName( GetTag( OBJECT_SELF))

4. Edit crier_at1c1a, crier_at1d1a, crier_at1e1a, crier_at1e1b, crier_at1e1c, crier_heartbeat, and crier_spawn. Do the same thing...

TOWN_CRIER_DATABASE_NAME

change it to say

GetTownCrierDatabaseName( GetTag( OBJECT_SELF))

5. Edit crier_taw1a and do the same thing

TOWN_CRIER_DATABASE_NAME

change it to say

GetTownCrierDatabaseName( GetTag( OBJECT_SELF))

except in this one only change the one for the "Crying" variable. There are two in there, one for the PC called "TownCrierNewsworthy" and one for the NPC called "Crying"...just change the "Crying" one only. Leave the PC one alone.

Repeat this step for the script named crier_taw1b.

6. Rebuild the module make sure you get no errors.

That should do it. Now each crier will store his stuff in a different database named based on his TAG. If you give two of them the same TAG they will share the same database, give them different TAGs and they will use different databases. Note that setting a PC to be newsworthy will allow him to give news to any town crier, you won't be able to control that per area.
Didn't test this at all...


FP!
               
               

               
            

Legacy_WoC_Builder

  • Sr. Member
  • ****
  • Posts: 425
  • Karma: +0/-0
Killer's Town Crier Help
« Reply #4 on: November 20, 2011, 03:35:06 am »


               You, Sir, are very much appreciated!