Author Topic: SOS, someone can help a novice scripter with some scripting and some scripting issues?  (Read 395 times)

Legacy_Who said that I

  • Hero Member
  • *****
  • Posts: 931
  • Karma: +0/-0


               I have been off for some time due to some computer issues, but now I am back and almost instantly I crash myself into some problems. I have searched for many solutions but I am at my wits end here.

So here is my request:

Anyone out there who wants to help me with a couple of scripting issues? It would be really appreciated.

at any rate, let out a reply and will hear from ya lot!
'Image'Image
               
               

               


                     Modifié par Who said that I, 09 novembre 2010 - 03:24 .
                     
                  


            

Legacy_TheSpiritedLass

  • Hero Member
  • *****
  • Posts: 1118
  • Karma: +0/-0


               WB.

You might want to be a little more specific. '<img'>
               
               

               
            

Legacy_Who said that I

  • Hero Member
  • *****
  • Posts: 931
  • Karma: +0/-0


               well yeah, like I might have asked before. The thing I REALLY need to fix are the quests, The thing is that the quests on the server seem to be only able to be done once, I have been trying to fix it but it can only be done once, it cannot be done by an other toon or anything. And of course -I- need to fix it and I am almost ready to smash my keyboard out of the window out of frustration!

To be exactly honest I lost all the scripts I tried for it, I know that I have one script to make a dicebag the database for all the quests so it cannot be done by another player....though....that doesnt work as well as I want it to be.

anyone know how to fix it?
               
               

               


                     Modifié par Who said that I, 09 novembre 2010 - 04:17 .
                     
                  


            

Legacy_Baragg

  • Sr. Member
  • ****
  • Posts: 496
  • Karma: +0/-0


               We would need prehaps to see the code for one of your quest. From what I gathered of your postings, you have quest info set to a db. That is probably where in lies your problem. Say a player gets a quest, then finishes it your marking the db as that quest is completed, and thereby not able to be started again by anyone. On the mountain we have a no drop item on the pc that quest info for that particular character is usually saved to. So we could prevent that specific pc from starting the quest again but allow other if they meet the requirements to start it.
               
               

               
            

Legacy_Who said that I

  • Hero Member
  • *****
  • Posts: 931
  • Karma: +0/-0


               //::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::

//:::::::::::::::::::::::: Shayan's Subrace Engine::::::::::::::::::::::::::::::

//:::::::::::::::::File Name: sha_on_cl_enter ::::::::::::::::::::::::::::::::::

//::::::::::::::::::::: OnClientEnter script :::::::::::::::::::::::::::::::::::

//:: Written By: Shayan.

//:: Contact: mail_shayan@yahoo.com

//

// Description: This script is used to check, and load or reload all the subracial

//              properties on the PC entering the Module.

#include "sha_subr_methds"

void main()

{

    SubraceOnClientEnter();

}





//:://////////////////////////////////////

// Persistent Journal Include Script.

//:://////////////////////////////////////

// _pw_journal_inc

//

// This version uses an item token carried by the player for persistent storage of

// the journal variables.

//:://////////////////////////////////////

#include "nw_i0_plot"





const string PERSISTENT_JOURNAL_TOKEN_TAG    = "dmfi_pc_dicebag";

const string PERSISTENT_JOURNAL_TOKEN_RESREF = "dmfi_pc_dicebag";





//:://////////////////////////////////////

// object GetPersistentJournalToken( object oPC)

//     Returns the persistent journal token item carried by the specified player. If the

//     player specified is invalid it returns OBJECT_INVALID. If the player is not carrying

//     a persistent journal token item, one is created on him and it is returned.

//:://////////////////////////////////////

// Parameters:  object oPC - the player to retrieve the token from.

//

// Returns: OBJECT_INVALID if oPC is not a valid PC. Otherwise returns the persistent

//          token item he is carrying or the one created on him if he didn't have one.

//:://////////////////////////////////////

object GetPersistentJournalToken( object oPC);

object GetPersistentJournalToken( object oPC)

{ if( !GetIsPC( oPC)) return OBJECT_INVALID;



 object oPJToken = (HasItem( oPC, PERSISTENT_JOURNAL_TOKEN_TAG) ? GetItemPossessedBy( oPC, PERSISTENT_JOURNAL_TOKEN_TAG) : CreateItemOnObject( PERSISTENT_JOURNAL_TOKEN_RESREF, oPC, 1));

 if( GetIsObjectValid( oPJToken))

 { SetItemCursedFlag( oPJToken, TRUE);

   SetPlotFlag( oPJToken, TRUE);

 }

 return oPJToken;

}





//:://////////////////////////////////////

// void AddPersistentJournalQuestEntry( string sCategoryTag, int nEntryID, object oPC, int bAllPartyMembers = TRUE, int bAllPlayers = FALSE, int bAllowOverrideHigher = FALSE)

//        Add a journal entry to a player using the persistent journal system. Works exactly

//        like AddJournalQuestEntry.

//:://////////////////////////////////////

// Parameters: string sCategoryTag         - the journal category tag.

//             int    nEntryID             - the journal entry ID.

//             object oPC                  - the player to have his journal updated.

//             int    bAllPartyMembers     - TRUE to add the entry to oPC's entire party.

//                                           FALSE to add the entry to oPC only.

//             int    bAllPlayers          - TRUE to add the entry to all PCs in the module.

//                                           FALSE to add the entry to oPC only.

//             int    bAllowOverrideHigher - TRUE overrides restriction that nState must be > current Journal Entry.

//                                           FALSE enforces restriction that nState must be > current Journal Entry.

//

// Returns: None.

//:://////////////////////////////////////

void AddPersistentJournalQuestEntry( string sCategoryTag, int nEntryID, object oPC, int bAllPartyMembers = FALSE, int bAllPlayers = FALSE, int bAllowOverrideHigher = FALSE);

void AddPersistentJournalQuestEntry( string sCategoryTag, int nEntryID, object oPC, int bAllPartyMembers = FALSE, int bAllPlayers = FALSE, int bAllowOverrideHigher = FALSE)

{ if( (sCategoryTag == "") || (nEntryID < 0) || !GetIsPC( oPC)) return;



 object oPJToken = GetPersistentJournalToken( oPC);

 if( !GetIsObjectValid( oPJToken)) return;



 if( bAllPlayers)

 { object oPlayer = GetFirstPC();

   while( GetIsPC( oPlayer))

   { AddPersistentJournalQuestEntry( sCategoryTag, nEntryID, oPlayer, FALSE, FALSE, bAllowOverrideHigher);

     oPlayer = GetNextPC();

   }

 }

 else if( bAllPartyMembers)

 { object oParty = GetFirstFactionMember( oPC);

   while( GetIsObjectValid( oParty ))

   { AddPersistentJournalQuestEntry( sCategoryTag, nEntryID, oParty, FALSE, FALSE, bAllowOverrideHigher);

     oParty = GetNextFactionMember( oPC);

   }

 }

 else

 { AddJournalQuestEntry( sCategoryTag, nEntryID, oPC, bAllPartyMembers, bAllPlayers, bAllowOverrideHigher);



   int iEntry = GetLocalInt( oPC, "NW_JOURNAL_ENTRY" +sCategoryTag);

   if( iEntry)

   { SetLocalInt( oPJToken, "NW_JOURNAL_ENTRY" +sCategoryTag, iEntry);



     string sCategories = GetLocalString( oPJToken, "NW_JOURNAL_CATEGORIES");

     string sSearch     = sCategories;

     while( sSearch != "")

     { int iPos = FindSubString( sSearch, "~#~");

       switch( iPos)

       { case -1: if( sSearch == sCategoryTag) return;

                  sSearch = "";

                  break;



         case  0: sSearch = GetStringRight( sSearch, GetStringLength( sSearch) -3);

                  break;



         default: if( GetStringLeft( sSearch, iPos) == sCategoryTag) return;

                  sSearch = GetStringRight( sSearch, GetStringLength( sSearch) -(iPos +3));

                  break;

       }

     }

     sCategories += ((sCategories == "") ? "" : "~#~") +sCategoryTag;

     SetLocalString( oPJToken, "NW_JOURNAL_CATEGORIES", sCategories);

   }

   else DeleteLocalInt( oPJToken, "NW_JOURNAL_ENTRY" +sCategoryTag);

 }

}





//:://////////////////////////////////////

// void RemovePersistentJournalQuestEntry( string sCategoryTag, object oPC, int bAllPartyMembers = TRUE, int bAllPlayers = FALSE)

//        Removes a journal entry from a player using the persistent journal system. Works

//        exactly like RemoveJournalQuestEntry.

//:://////////////////////////////////////

// Parameters: string sCategoryTag         - the journal category tag.

//             int    nEntryID             - the journal entry ID.

//             object oPC                  - the player to have his journal updated.

//             int    bAllPartyMembers     - TRUE to remove the entry from oPC's entire party.

//                                           FALSE to remove the entry from oPC only.

//             int    bAllPlayers          - TRUE to remove the entry from all PCs in the module.

//                                           FALSE to remove the entry from oPC only.

//

// Returns: None.

//:://////////////////////////////////////

void RemovePersistentJournalQuestEntry( string sCategoryTag, object oPC, int bAllPartyMembers = TRUE, int bAllPlayers = FALSE);

void RemovePersistentJournalQuestEntry( string sCategoryTag, object oPC, int bAllPartyMembers = TRUE, int bAllPlayers = FALSE)

{ if( (sCategoryTag == "") || !GetIsPC( oPC)) return;



 object oPJToken = GetPersistentJournalToken( oPC);

 if( !GetIsObjectValid( oPJToken)) return;



 if( bAllPlayers)

 { object oPlayer = GetFirstPC();

   while( GetIsPC( oPlayer))

   { RemovePersistentJournalQuestEntry( sCategoryTag, oPlayer, FALSE, FALSE);

     oPlayer = GetNextPC();

   }

 }

 else if( bAllPartyMembers)

 { object oParty = GetFirstFactionMember( oPC);

   while( GetIsObjectValid( oParty))

   { RemovePersistentJournalQuestEntry( sCategoryTag, oParty, FALSE, FALSE);

     oParty = GetNextFactionMember( oPC);

   }

 }

 else

 { RemoveJournalQuestEntry( sCategoryTag, oPC, bAllPartyMembers, bAllPlayers);

   DeleteLocalInt( oPC, "NW_JOURNAL_ENTRY" +sCategoryTag);

   DeleteLocalInt( oPJToken, "NW_JOURNAL_ENTRY" +sCategoryTag);



   string sCategories = GetLocalString( oPJToken, "NW_JOURNAL_CATEGORIES");

   int iPos = FindSubString( sCategories, "~#~" +sCategoryTag +"~#~");

   if( iPos == -1)

   { iPos = FindSubString( sCategories, sCategoryTag +"~#~");

     if( iPos == -1)

     { iPos = FindSubString( sCategories, "~#~" +sCategoryTag);

       if( iPos == -1) sCategories = ((sCategories == sCategoryTag) ? "" : sCategories);

       else sCategories = GetStringLeft( sCategories, iPos);

     }

     else sCategories = GetStringRight( sCategories, GetStringLength( sCategories) -(GetStringLength( sCategoryTag) +3));

   }

   else sCategories = GetStringLeft( sCategories, iPos) +GetStringRight( sCategories, GetStringLength( sCategories) -(GetStringLength( sCategoryTag) +3));



   if( sCategories == "") DeleteLocalString( oPJToken, "NW_JOURNAL_CATEGORIES");

   else SetLocalString( oPJToken, "NW_JOURNAL_CATEGORIES", sCategories);

 }

}





//:://////////////////////////////////////

// void RestorePersistentJournal( object oPC)

//        Restores a players journal by adding all his journal entries saved on the

//        persistent journal token.

//:://////////////////////////////////////

// Parameters: object oPC - the player to have his journal updated.

//

// Returns: None.

//:://////////////////////////////////////

void RestorePersistentJournal( object oPC);

void RestorePersistentJournal( object oPC)

{ if( !GetIsPC( oPC)) return;



 object oPJToken = GetPersistentJournalToken( oPC);

 if( !GetIsObjectValid( oPJToken)) return;



 string sCategories = GetLocalString( oPJToken, "NW_JOURNAL_CATEGORIES");

 while( sCategories != "")

 { string sCategory = "";

   int iPos = FindSubString( sCategories, "~#~");

   switch( iPos)

   { case -1: sCategory = sCategories;

              sCategories = "";

              break;



     case  0: sCategories = GetStringRight( sCategories, GetStringLength( sCategories) -3);

              break;



     default: sCategory = GetStringLeft( sCategories, iPos);

              sCategories = GetStringRight( sCategories, GetStringLength( sCategories) -(iPos +3));

              break;

   }



   if( sCategory != "")

   { int nEntry = GetLocalInt( oPJToken, "NW_JOURNAL_ENTRY" +sCategory);

     AddJournalQuestEntry( sCategory, nEntry, oPC, FALSE, FALSE, TRUE);

   }

 }

}







// OnClientEnter

//#include "_pw_journal_inc"

//

//void main()

//{ object oEntering = GetEnteringObject();

//  if( !GetIsObjectValid( oEntering)) return;

//

//  RestorePersistentJournal( oEntering);

//}





void DisableAllPrestigeclasses(object oPC, int bExistingToo=FALSE)

{

if(bExistingToo || GetLevelByclass(class_TYPE_SHADOWDANCER,oPC) < 1)

{

SetLocalInt(oPC,"X1_AllowShadow",1);

}

if(bExistingToo || GetLevelByclass(class_TYPE_HARPER,oPC) < 1)

{

SetLocalInt(oPC,"X1_AllowHarper",1);

}

if(bExistingToo || GetLevelByclass(class_TYPE_ARCANE_ARCHER,oPC) < 1)

{

SetLocalInt(oPC,"X1_AllowArcher",1);

}

if(bExistingToo || GetLevelByclass(class_TYPE_ASSASSIN,oPC) < 1)

{

SetLocalInt(oPC,"X1_AllowAsasin",1);

}

if(bExistingToo || GetLevelByclass(class_TYPE_BLACKGUARD,oPC) < 1)

{

SetLocalInt(oPC,"X1_AllowBlkGrd",1);

}

if(bExistingToo || GetLevelByclass(class_TYPE_DIVINE_CHAMPION,oPC) < 1)

{

SetLocalInt(oPC,"X2_AllowDivcha",1);

}

if(bExistingToo || GetLevelByclass(class_TYPE_WEAPON_MASTER,oPC) < 1)

{

SetLocalInt(oPC,"X2_AllowWM",1);

}

if(bExistingToo || GetLevelByclass(class_TYPE_PALE_MASTER,oPC) < 1)

{

SetLocalInt(oPC,"X2_AllowPalema",1);

}

if(bExistingToo || GetLevelByclass(class_TYPE_SHIFTER,oPC) < 1)

{

SetLocalInt(oPC,"X2_AllowShiftr",1);

}

if(bExistingToo || GetLevelByclass(class_TYPE_DWARVEN_DEFENDER,oPC) < 1)

{

SetLocalInt(oPC,"X1_AllowDwDef",1);

}

if(bExistingToo || GetLevelByclass(class_TYPE_DRAGON_DISCIPLE,oPC) < 1)

{

SetLocalInt(oPC,"X1_AllowDrDis",1);

}

if(bExistingToo || GetLevelByclass(class_TYPE_PURPLE_DRAGON_KNIGHT,oPC) < 1)

{

SetLocalInt(oPC,"DLA_AllowPDK",1);

}

}

void main()

{

ExecuteScript ("cnr_module_oce", OBJECT_SELF);

object oPC = GetEnteringObject();



if (!GetIsPC(oPC)) return;



}



This above is my on client enter script (using CEP 2.2)



I am using plot wizard in order to create the quests
               
               

               
            

Legacy_Mudeye

  • Full Member
  • ***
  • Posts: 238
  • Karma: +0/-0


               The code you posted is designed to handle party quests and server wide quests as well as individual quests.

An example is shown below:
void AddPersistentJournalQuestEntry( string sCategoryTag, int nEntryID,
object oPC, int bAllPartyMembers = FALSE, int bAllPlayers = FALSE, int
bAllowOverrideHigher = FALSE);

In this function, bAllPartyMembers tells it whether to do the operation for all party members and bAllPlayers tells it whether to do it for all players on the server.  They default to FALSE if not set, but you don't show where the functions are called from. 

It sounds like one or both are set to TRUE when the function is called which would cause the function to apply for all players instead of just the one.



I personally never use the Plot Wizard but I've heard that it doesn't work that well.  But then I never write quests that are done as a group instead of individually.':unsure:'
               
               

               
            

Legacy_GhostOfGod

  • Hero Member
  • *****
  • Posts: 1490
  • Karma: +0/-0


               Hmm...having some deja vu here. Oh well. guess we could start from scratch.

First of all you can only have 1 "void main()" in any script. looks like you got three here.

It looks like you shoved a few on client enter scripts together and mashed an include or two in with it.

Ultimately you could condense this to look something more like so:

//::::::::::::::::::::: OnClientEnter script :::::::::::::::::::::::::::::::::::

#include "sha_subr_methds"
#include "_pw_journal_inc"

void DisableAllPrestigeclasses(object oPC, int bExistingToo=FALSE);

void main()
{
object oPC = GetEnteringObject();
if (!GetIsPC(oPC)) return;
DisableAllPrestigeclasses(oPC, FALSE);
SubraceOnClientEnter();
RestorePersistentJournal(oPC);
ExecuteScript ("cnr_module_oce", oPC);
}

void DisableAllPrestigeclasses(object oPC, int bExistingToo=FALSE)
{
    if(bExistingToo || GetLevelByclass(class_TYPE_SHADOWDANCER,oPC) < 1)
    SetLocalInt(oPC,"X1_AllowShadow",1);
    if(bExistingToo || GetLevelByclass(class_TYPE_HARPER,oPC) < 1)
    SetLocalInt(oPC,"X1_AllowHarper",1);
    if(bExistingToo || GetLevelByclass(class_TYPE_ARCANE_ARCHER,oPC) < 1)
    SetLocalInt(oPC,"X1_AllowArcher",1);
    if(bExistingToo || GetLevelByclass(class_TYPE_ASSASSIN,oPC) < 1)
    SetLocalInt(oPC,"X1_AllowAsasin",1);
    if(bExistingToo || GetLevelByclass(class_TYPE_BLACKGUARD,oPC) < 1)
    SetLocalInt(oPC,"X1_AllowBlkGrd",1);
    if(bExistingToo || GetLevelByclass(class_TYPE_DIVINE_CHAMPION,oPC) < 1)
    SetLocalInt(oPC,"X2_AllowDivcha",1);
    if(bExistingToo || GetLevelByclass(class_TYPE_WEAPON_MASTER,oPC) < 1)
    SetLocalInt(oPC,"X2_AllowWM",1);
    if(bExistingToo || GetLevelByclass(class_TYPE_PALE_MASTER,oPC) < 1)
    SetLocalInt(oPC,"X2_AllowPalema",1);
    if(bExistingToo || GetLevelByclass(class_TYPE_SHIFTER,oPC) < 1)
    SetLocalInt(oPC,"X2_AllowShiftr",1);
    if(bExistingToo || GetLevelByclass(class_TYPE_DWARVEN_DEFENDER,oPC) < 1)
    SetLocalInt(oPC,"X1_AllowDwDef",1);
    if(bExistingToo || GetLevelByclass(class_TYPE_DRAGON_DISCIPLE,oPC) < 1)
    SetLocalInt(oPC,"X1_AllowDrDis",1);
    if(bExistingToo || GetLevelByclass(class_TYPE_PURPLE_DRAGON_KNIGHT,oPC) < 1)
    SetLocalInt(oPC,"DLA_AllowPDK",1);
}


All of the "_pw_journal_inc" stuff should be in it's own script and not in here at all.

EDIT: Here is the "_pw_journal_inc" script again by itself:

//:://////////////////////////////////////
// Persistent Journal Include Script.
//:://////////////////////////////////////
// _pw_journal_inc
//
// This version uses an item token carried by the player for persistent storage of
// the journal variables.
//:://////////////////////////////////////
#include "nw_i0_plot"


const string PERSISTENT_JOURNAL_TOKEN_TAG    = "dmfi_pc_dicebag";
const string PERSISTENT_JOURNAL_TOKEN_RESREF = "dmfi_pc_dicebag";


//:://////////////////////////////////////
// object GetPersistentJournalToken( object oPC)
//     Returns the persistent journal token item carried by the specified player. If the
//     player specified is invalid it returns OBJECT_INVALID. If the player is not carrying
//     a persistent journal token item, one is created on him and it is returned.
//:://////////////////////////////////////
// Parameters:  object oPC - the player to retrieve the token from.
//
// Returns: OBJECT_INVALID if oPC is not a valid PC. Otherwise returns the persistent
//          token item he is carrying or the one created on him if he didn't have one.
//:://////////////////////////////////////
object GetPersistentJournalToken( object oPC);
object GetPersistentJournalToken( object oPC)
{ if( !GetIsPC( oPC)) return OBJECT_INVALID;

  object oPJToken = (HasItem( oPC, PERSISTENT_JOURNAL_TOKEN_TAG) ? GetItemPossessedBy( oPC, PERSISTENT_JOURNAL_TOKEN_TAG) : CreateItemOnObject( PERSISTENT_JOURNAL_TOKEN_RESREF, oPC, 1));
  if( GetIsObjectValid( oPJToken))
  { SetItemCursedFlag( oPJToken, TRUE);
    SetPlotFlag( oPJToken, TRUE);
  }
  return oPJToken;
}


//:://////////////////////////////////////
// void AddPersistentJournalQuestEntry( string sCategoryTag, int nEntryID, object oPC, int bAllPartyMembers = TRUE, int bAllPlayers = FALSE, int bAllowOverrideHigher = FALSE)
//        Add a journal entry to a player using the persistent journal system. Works exactly
//        like AddJournalQuestEntry.
//:://////////////////////////////////////
// Parameters: string sCategoryTag         - the journal category tag.
//             int    nEntryID             - the journal entry ID.
//             object oPC                  - the player to have his journal updated.
//             int    bAllPartyMembers     - TRUE to add the entry to oPC's entire party.
//                                           FALSE to add the entry to oPC only.
//             int    bAllPlayers          - TRUE to add the entry to all PCs in the module.
//                                           FALSE to add the entry to oPC only.
//             int    bAllowOverrideHigher - TRUE overrides restriction that nState must be > current Journal Entry.
//                                           FALSE enforces restriction that nState must be > current Journal Entry.
//
// Returns: None.
//:://////////////////////////////////////
void AddPersistentJournalQuestEntry( string sCategoryTag, int nEntryID, object oPC, int bAllPartyMembers = FALSE, int bAllPlayers = FALSE, int bAllowOverrideHigher = FALSE);
void AddPersistentJournalQuestEntry( string sCategoryTag, int nEntryID, object oPC, int bAllPartyMembers = FALSE, int bAllPlayers = FALSE, int bAllowOverrideHigher = FALSE)
{ if( (sCategoryTag == "") || (nEntryID < 0) || !GetIsPC( oPC)) return;

  object oPJToken = GetPersistentJournalToken( oPC);
  if( !GetIsObjectValid( oPJToken)) return;

  if( bAllPlayers)
  { object oPlayer = GetFirstPC();
    while( GetIsPC( oPlayer))
    { AddPersistentJournalQuestEntry( sCategoryTag, nEntryID, oPlayer, FALSE, FALSE, bAllowOverrideHigher);
      oPlayer = GetNextPC();
    }
  }
  else if( bAllPartyMembers)
  { object oParty = GetFirstFactionMember( oPC);
    while( GetIsObjectValid( oParty ))
    { AddPersistentJournalQuestEntry( sCategoryTag, nEntryID, oParty, FALSE, FALSE, bAllowOverrideHigher);
      oParty = GetNextFactionMember( oPC);
    }
  }
  else
  { AddJournalQuestEntry( sCategoryTag, nEntryID, oPC, bAllPartyMembers, bAllPlayers, bAllowOverrideHigher);

    int iEntry = GetLocalInt( oPC, "NW_JOURNAL_ENTRY" +sCategoryTag);
    if( iEntry)
    { SetLocalInt( oPJToken, "NW_JOURNAL_ENTRY" +sCategoryTag, iEntry);

      string sCategories = GetLocalString( oPJToken, "NW_JOURNAL_CATEGORIES");
      string sSearch     = sCategories;
      while( sSearch != "")
      { int iPos = FindSubString( sSearch, "~#~");
        switch( iPos)
        { case -1: if( sSearch == sCategoryTag) return;
                   sSearch = "";
                   break;

          case  0: sSearch = GetStringRight( sSearch, GetStringLength( sSearch) -3);
                   break;

          default: if( GetStringLeft( sSearch, iPos) == sCategoryTag) return;
                   sSearch = GetStringRight( sSearch, GetStringLength( sSearch) -(iPos +3));
                   break;
        }
      }
      sCategories += ((sCategories == "") ? "" : "~#~") +sCategoryTag;
      SetLocalString( oPJToken, "NW_JOURNAL_CATEGORIES", sCategories);
    }
    else DeleteLocalInt( oPJToken, "NW_JOURNAL_ENTRY" +sCategoryTag);
  }
}


//:://////////////////////////////////////
// void RemovePersistentJournalQuestEntry( string sCategoryTag, object oPC, int bAllPartyMembers = TRUE, int bAllPlayers = FALSE)
//        Removes a journal entry from a player using the persistent journal system. Works
//        exactly like RemoveJournalQuestEntry.
//:://////////////////////////////////////
// Parameters: string sCategoryTag         - the journal category tag.
//             int    nEntryID             - the journal entry ID.
//             object oPC                  - the player to have his journal updated.
//             int    bAllPartyMembers     - TRUE to remove the entry from oPC's entire party.
//                                           FALSE to remove the entry from oPC only.
//             int    bAllPlayers          - TRUE to remove the entry from all PCs in the module.
//                                           FALSE to remove the entry from oPC only.
//
// Returns: None.
//:://////////////////////////////////////
void RemovePersistentJournalQuestEntry( string sCategoryTag, object oPC, int bAllPartyMembers = TRUE, int bAllPlayers = FALSE);
void RemovePersistentJournalQuestEntry( string sCategoryTag, object oPC, int bAllPartyMembers = TRUE, int bAllPlayers = FALSE)
{ if( (sCategoryTag == "") || !GetIsPC( oPC)) return;

  object oPJToken = GetPersistentJournalToken( oPC);
  if( !GetIsObjectValid( oPJToken)) return;

  if( bAllPlayers)
  { object oPlayer = GetFirstPC();
    while( GetIsPC( oPlayer))
    { RemovePersistentJournalQuestEntry( sCategoryTag, oPlayer, FALSE, FALSE);
      oPlayer = GetNextPC();
    }
  }
  else if( bAllPartyMembers)
  { object oParty = GetFirstFactionMember( oPC);
    while( GetIsObjectValid( oParty))
    { RemovePersistentJournalQuestEntry( sCategoryTag, oParty, FALSE, FALSE);
      oParty = GetNextFactionMember( oPC);
    }
  }
  else
  { RemoveJournalQuestEntry( sCategoryTag, oPC, bAllPartyMembers, bAllPlayers);
    DeleteLocalInt( oPC, "NW_JOURNAL_ENTRY" +sCategoryTag);
    DeleteLocalInt( oPJToken, "NW_JOURNAL_ENTRY" +sCategoryTag);

    string sCategories = GetLocalString( oPJToken, "NW_JOURNAL_CATEGORIES");
    int iPos = FindSubString( sCategories, "~#~" +sCategoryTag +"~#~");
    if( iPos == -1)
    { iPos = FindSubString( sCategories, sCategoryTag +"~#~");
      if( iPos == -1)
      { iPos = FindSubString( sCategories, "~#~" +sCategoryTag);
        if( iPos == -1) sCategories = ((sCategories == sCategoryTag) ? "" : sCategories);
        else sCategories = GetStringLeft( sCategories, iPos);
      }
      else sCategories = GetStringRight( sCategories, GetStringLength( sCategories) -(GetStringLength( sCategoryTag) +3));
    }
    else sCategories = GetStringLeft( sCategories, iPos) +GetStringRight( sCategories, GetStringLength( sCategories) -(GetStringLength( sCategoryTag) +3));

    if( sCategories == "") DeleteLocalString( oPJToken, "NW_JOURNAL_CATEGORIES");
    else SetLocalString( oPJToken, "NW_JOURNAL_CATEGORIES", sCategories);
  }
}


//:://////////////////////////////////////
// void RestorePersistentJournal( object oPC)
//        Restores a players journal by adding all his journal entries saved on the
//        persistent journal token.
//:://////////////////////////////////////
// Parameters: object oPC - the player to have his journal updated.
//
// Returns: None.
//:://////////////////////////////////////
void RestorePersistentJournal( object oPC);
void RestorePersistentJournal( object oPC)
{ if( !GetIsPC( oPC)) return;

  object oPJToken = GetPersistentJournalToken( oPC);
  if( !GetIsObjectValid( oPJToken)) return;

  string sCategories = GetLocalString( oPJToken, "NW_JOURNAL_CATEGORIES");
  while( sCategories != "")
  { string sCategory = "";
    int iPos = FindSubString( sCategories, "~#~");
    switch( iPos)
    { case -1: sCategory = sCategories;
               sCategories = "";
               break;

      case  0: sCategories = GetStringRight( sCategories, GetStringLength( sCategories) -3);
               break;

      default: sCategory = GetStringLeft( sCategories, iPos);
               sCategories = GetStringRight( sCategories, GetStringLength( sCategories) -(iPos +3));
               break;
    }

    if( sCategory != "")
    { int nEntry = GetLocalInt( oPJToken, "NW_JOURNAL_ENTRY" +sCategory);
      AddJournalQuestEntry( sCategory, nEntry, oPC, FALSE, FALSE, TRUE);
    }
  }
}



And I'm not even sure if the " DisableAllPrestigeclasses(object oPC, int bExistingToo=FALSE)" function is even a part of one of the other includes or the executed script. So you might even be able to cut that out so long as you put and #include line for it at the top.

Hope this helps get things moving in the right direction for you.
               
               

               


                     Modifié par GhostOfGod, 09 novembre 2010 - 08:44 .
                     
                  


            

Legacy_Who said that I

  • Hero Member
  • *****
  • Posts: 931
  • Karma: +0/-0


               and thats why I need help with this, since sometimes I find it rather difficult to compile something with includes, that or I simply don't get it XD



I -do- want to make it an individual quest, BUT I don't want that when Toon A done the quest, Toon B wont be able to do the quest then.



That is basically the issue we are having right now
               
               

               
            

Legacy_Who said that I

  • Hero Member
  • *****
  • Posts: 931
  • Karma: +0/-0


               okay guess someone needs to help me with that script, since I tried it myself and I lost half the stuff the player is supposed to get during entering...



can someone just give me a simple solution or just help me with this since I am almost really about to cry about this....
               
               

               
            

Legacy_GhostOfGod

  • Hero Member
  • *****
  • Posts: 1490
  • Karma: +0/-0


               There really is no simple solution. It completely depends on what systems you are using in your module and what you need to add to your OnEnter script to make these systems work correctly.

To do this you need to understand how an include script works.

So here is a basic module OnEnter script with nothing added yet. All we do so far is just declare the entering object of the module as oPC. And we also add a second line that is just checking to make sure that the entering object is a player. If it is not a player then the script ends:

void main()
{
object oPC = GetEnteringObject();
if (!GetIsPC(oPC)) return;

}


Now most systems, like Shayan's, use a major include script that has all kinds of functions in it that relate to that system. And some of these systems require you to add a line or two to your OnEnter script to make the system work correclty. You do NOT add the include script to the OnEnter script. You only reference it and use the correct OnEnter function. And in the case of Shayan's you would do this to your OnEnter script:

#include "sha_subr_methds"          <----reference Shayan's include script
void main()
{
object oPC = GetEnteringObject();
if (!GetIsPC(oPC)) return;

SubraceOnClientEnter();                  <----the function from Shayan's include script
}

When we just reference an include script at the top of another script we can use all the functions from that include script in our new one without having to rewrite or copy and paste everything in it.
So what the top line is saying is simply that we are going to include this script("sha_subr_methds") so that we can pull stuff from it that we need for our new script.

Now lets take our new OnEnter and add what we need from "_pw_journal_inc" to make it so that players journals are updated when they enter the mod.

#include "sha_subr_methds"          <----reference Shayan's include script
#include "_pw_journal_inc"             <----reference Persistent Journal include script
void main()
{
object oPC = GetEnteringObject();
if (!GetIsPC(oPC)) return;

SubraceOnClientEnter();                  <----the function from Shayan's include script
RestorePersistentJournal( oPC);   <----the function from the Persistent Journal include script
                                                                       You will also notice that some of the functions require you to fill in some parameters. In this case you need to pass the entering object into it. And since we already declared and defined the entering object os "oPC" then we just plug that in.
}


Understanding this and making sure that you add stuff from includes correctly to your other scripts will fix the first part of your problem.

The second part of your problem also has to do with includes.
You are using the plot wizard to pump out the quests. I know we already talked about this before and I won't attempt to deter you from doing that again. Instead we'll just work with that.
What the plot wizard scripts do, when a player finishes a quest, is update the journal of all the party members by default. If you open up one of the scripts that the wizard makes to accomplish this, you might see a line in it that looks something like so:

AddJournalQuestEntry("Quest1", 10, oPC, TRUE, FALSE, FALSE);

or maybe just:

AddJournalQuestEntry("Quest1", 10, oPC);

If you see something like the first line then you need to change that TRUE to FALSE.
If you see something like the second line then you need only add the other parameter. So the new lines should look like so:

AddJournalQuestEntry("Quest1", 10, oPC, FALSE, FALSE, FALSE);

or

AddJournalQuestEntry("Quest1", 10, oPC, FALSE);

Doing this will make it so that the different quest states only changes for the one player and NOT his party members.
However. This will not fix your persistent journal. When a player leaves and the module is reset, the journal inforamation is also reset. So when the player comes back into the game they will be able to do the quests all over again.
The "_pw_journal_inc" script has different functions in it that replace the above functions with ones that update the journal AND store the information to an item. Then when a player enters the module, the information is retrieved from the item and their journal is rebuilt.
So you will have to go into everyone of your plotwizard scripts that update the journal and replace the lines you see above with a script that looks more like this:

#include "_pw_journal_inc"                       <----reference to include script
void main()
{
//stuff
AddPersistentJournalQuestEntry("quest1", 10, oPC, FALSE);   <----function from include script
//maybe more stuff
}


Probably not what you wanted to hear. But as I said. There really is no simple solution.

Hopefully this helps. Good luck.':crying:'
               
               

               


                     Modifié par GhostOfGod, 10 novembre 2010 - 06:25 .
                     
                  


            

Legacy_Who said that I

  • Hero Member
  • *****
  • Posts: 931
  • Karma: +0/-0


               okay thanks! I already fixed that solution so thanks for everything guys!



Just one other thing about the quests what I would like to know, how do you make it so that the quest counts for only the toon that started it So the second toon needs to talk to the quest giver in order to recieve the quest too.

Since I couldn't find it myself does anyone know?



need help with stupid questies....pwease?



-Who said that I
               
               

               
            

Legacy_Who said that I

  • Hero Member
  • *****
  • Posts: 931
  • Karma: +0/-0


               welll....it doesnt do the questentry line at all with me!



Thats the confusing part here....other than that it all works like a charm....