Author Topic: Explorer's XP?  (Read 648 times)

Legacy_LoA_Tristan

  • Jr. Member
  • **
  • Posts: 64
  • Karma: +0/-0
Explorer's XP?
« Reply #15 on: December 02, 2015, 10:42:24 pm »


               

A travel book could store database variables, but why the heck not change its description instead, to reflect exploration.


 


Area OnEnter:



void main()
{
    object oPC = GetEnteringObject();
    if (!GetIsPC(oPC)) return; // kill script if entering object is not a player
    object oJournal = GetItemPossessedBy(oPC, "TRAVEL_DB_BOOK");  // Get the travel guide object
    if (oJournal != OBJECT_INVALID)
    {
        string sDescription = GetDescription(oJournal); // Get its full description
        if (FindSubString(sDescription, "Neverwinter City Dump") == -1)
        { // Search description and append more text to it, if it doesn't have that text already
            GiveXPToCreature(oPC, 25);
            SetDescription(oJournal, sDescription + "\nThe next entry describes your exciting journey to the Neverwinter City Dump.\n");
        }
    }
}


               
               

               
            

Legacy_kalbaern

  • Hero Member
  • *****
  • Posts: 1531
  • Karma: +0/-0
Explorer's XP?
« Reply #16 on: December 03, 2015, 03:41:53 am »


               

Here's a version that should work from either a trigger covering the entire map (or even a specific portion of it) or used in the area itself. Set into the OnEnter event in either case. It does require that each Area have a unique TAG though. I always match an Area's ResRef and TAGs to ensure no duplicates.


//Exploration XP Script by Kalbaern 12/02/15

void main()

{

object oPC = GetEnteringObject();

object oArea = GetArea(OBJECT_SELF);

object oItem = GetItemPossessedBy(oPC,"REPLACE_WITH_TAG_OF_UNDROPPABLE_DB_ITEM");

string sArea = GetTag(oArea);

int nExplore = GetLocalInt(oItem,sArea);


if (oItem == OBJECT_INVALID) return;

if (nExplore == 1) return;


else

{

SetLocalInt(oItem,sArea, 1);

SendMessageToPC(oPC, "Exploration XP Reward Earned");

GiveXPToCreature(oPC, 25);//Set XP as desired

}

return;

}



               
               

               
            

Legacy_Who said that I

  • Hero Member
  • *****
  • Posts: 931
  • Karma: +0/-0
Explorer's XP?
« Reply #17 on: December 03, 2015, 07:08:05 am »


               


Here's a version that should work from either a trigger covering the entire map (or even a specific portion of it) or used in the area itself. Set into the OnEnter event in either case. It does require that each Area have a unique TAG though. I always match an Area's ResRef and TAGs to ensure no duplicates.


//Exploration XP Script by Kalbaern 12/02/15

void main()

{

object oPC = GetEnteringObject();

object oArea = GetArea(OBJECT_SELF);

object oItem = GetItemPossessedBy(oPC,"REPLACE_WITH_TAG_OF_UNDROPPABLE_DB_ITEM");

string sArea = GetTag(oArea);

int nExplore = GetLocalInt(oItem,sArea);


if (oItem == OBJECT_INVALID) return;

if (nExplore == 1) return;


else

{

SetLocalInt(oItem,sArea, 1);

SendMessageToPC(oPC, "Exploration XP Reward Earned");

GiveXPToCreature(oPC, 25);//Set XP as desired

}

return;

}




 


thanks kal! this one works like a charm!!