#include "nw_i0_tool" #include "rd_treasure" #include "rd_misc" void SetPartyVariables(object oPC); void GivePartyMagicItem(object oPC); void GivePartyQuestPoints(object oPC, int iQuestPoints); void GivePartyMinorMagicItem(object oPC); void GivePartyCharSpecific(object oPC); void GivePartyEvilPoints(object oPC, int iDifficulty); void main() { int iDifficulty; int iGold; int iXP; int iChance; int iRandom; int iMod; int iLevel; int iQuestPoints; int iMaxLevel; object oPC; oPC = GetPCSpeaker(); if (GetLocalInt(oPC,"QuestType") == 1) AddJournalQuestEntry("jCamp",12,oPC); else if (GetLocalInt(oPC,"QuestType") == 2) AddJournalQuestEntry("jDelivery",2,oPC); else if (GetLocalInt(oPC,"QuestType") == 3) AddJournalQuestEntry("jSpecial",2,oPC); if (GetLocalInt(oPC,"QuestAdventureZone") > 0) { SetLocalInt(GetModule(),"AdventureZone",0); SetLocalInt(GetModule(),"AdvZones",0); } iDifficulty = GetLocalInt(oPC,"QuestDifficulty"); SetPartyVariables(oPC); iLevel = GetHitDice(oPC); iLevel = ZoneLevel(GetArea(oPC),iLevel); if (iLevel < 20) iMod = iLevel/5 + 1; else iMod = (iLevel-20)/8 + 5; iGold = 100 * iDifficulty * iMod; iXP = 150 * iDifficulty * iMod; iChance = iDifficulty + iLevel/3 + 2; if (iGold == 0) iGold = 25; if (iXP == 0) iXP = 50; iMaxLevel = GetLocalInt(GetArea(oPC),"MaximumLevel"); if (GetLocalInt(oPC,"PCHardCorePNP") == 1) { if (iMaxLevel < 11) iMaxLevel = iMaxLevel + 2; else if (iMaxLevel < 21) iMaxLevel = iMaxLevel + 5; else iMaxLevel = iMaxLevel + 10; } //Corrections for higher level PC's completing low lvl quests if (GetHitDice(oPC) > iMaxLevel + 3 && iMaxLevel < 11) { iXP = 50; iGold = 25; iChance = 0; iDifficulty = 0; } else if (GetHitDice(oPC) > iMaxLevel + 5 && iMaxLevel < 21) { iXP = iXP/2; iGold = iGold/2; iChance = 0; iDifficulty = 0; } else if (GetHitDice(oPC) > iMaxLevel + 10) { iXP = 50; iGold = 25; iChance = 0; iDifficulty = 0; } iRandom = Random(100); if (GetSkillRank(SKILL_PERSUADE,oPC)>4) { if (GetIsSkillSuccessful(oPC,SKILL_PERSUADE,25)) { SendMessageToPC(oPC,"You are very persuading..."); iGold=iGold*3/2; iChance = iChance + 5; } } if (GetSkillRank(SKILL_INTIMIDATE,oPC)>4) { if (GetIsSkillSuccessful(oPC,SKILL_INTIMIDATE,25)) { SendMessageToPC(oPC,"You are very intimidating..."); iGold=iGold*3/2; iChance = iChance + 5; } } if (GetSkillRank(SKILL_BLUFF,oPC)>4) { if (GetIsSkillSuccessful(oPC,SKILL_BLUFF,25)) { SendMessageToPC(oPC,"You have successfully blown your exploits out of proportion..."); iGold=iGold*3/2; iChance = iChance + 5; } } if (GetLocalInt(oPC,"Lucky") == 1) iChance = iChance + 5; if (GetLocalInt(oPC,"Charming") == 1 && iDifficulty>0) iChance = iChance + 3; if (iDifficulty < 1) iChance = 0; RewardPartyXP(iXP, GetPCSpeaker()); RewardPartyGP(iGold, GetPCSpeaker()); iRandom = Random(100); if (iRandom < iChance) { if (iLevel < 4) GivePartyMinorMagicItem(oPC); else if (iRandom < iChance/2) GivePartyMagicItem(oPC); else GivePartyMinorMagicItem(oPC); } else if (iRandom < (iChance + iLevel/5 + 1) && iLevel < 20) GivePartyCharSpecific(oPC); else if (iRandom < (iChance + 5) && iLevel > 19) GivePartyCharSpecific(oPC); GivePartyEvilPoints(oPC,iDifficulty); } void GivePartyEvilPoints(object oPC, int iDifficulty) { int iQuest; object oPartyMember = GetFirstFactionMember(oPC, TRUE); while (GetIsObjectValid(oPartyMember) == TRUE) { AdjustAlignment(oPartyMember,ALIGNMENT_EVIL,iDifficulty); oPartyMember = GetNextFactionMember(oPC, TRUE); } } void GivePartyQuestPoints(object oPC, int iQuestPoints) { int iQuest; object oPartyMember = GetFirstFactionMember(oPC, TRUE); while (GetIsObjectValid(oPartyMember) == TRUE) { iQuest = GetLocalInt(oPartyMember,"QuestPoints"); iQuest = iQuest + iQuestPoints; SetLocalInt(oPartyMember,"QuestPoints",iQuest); SendMessageToPC(oPartyMember,"You have been given " + IntToString(iQuestPoints) + " quest points. You now have " + IntToString(iQuest) + "."); oPartyMember = GetNextFactionMember(oPC, TRUE); } } void GivePartyMagicItem(object oPC) { object oPartyMember = GetFirstFactionMember(oPC, TRUE); while (GetIsObjectValid(oPartyMember) == TRUE) { GetMagicItem(oPartyMember,TRUE,TRUE); oPartyMember = GetNextFactionMember(oPC, TRUE); } } void GivePartyMinorMagicItem(object oPC) { object oPartyMember = GetFirstFactionMember(oPC, TRUE); while (GetIsObjectValid(oPartyMember) == TRUE) { GetMinorMagicItem(oPartyMember); oPartyMember = GetNextFactionMember(oPC, TRUE); } } void GivePartyCharSpecific(object oPC) { object oPartyMember = GetFirstFactionMember(oPC, TRUE); while (GetIsObjectValid(oPartyMember) == TRUE) { if (Random(2)==0) GetEnchantedItem(oPartyMember); else DTSGenerateCharSpecificTreasure(oPartyMember,oPartyMember); oPartyMember = GetNextFactionMember(oPC, TRUE); } } void SetPartyVariables(object oPC) { int iDeaths; int iLastQuest; int iNPCQuests; int iIndex; int iCount; int iQuests; string sZone; string sQuestStep; object oGiver; object oPartyMember = GetFirstFactionMember(oPC, TRUE); while (GetIsObjectValid(oPartyMember) == TRUE) { oGiver = GetObjectByTag(GetLocalString(oPartyMember,"QuestGiver")); iLastQuest =GetLocalInt(oPartyMember,"Quest"); SetLocalInt(oPartyMember,"LastQuest",iLastQuest); iQuests = GetLocalInt(oPartyMember,GetTag(oGiver)); SetLocalInt(oPartyMember,GetTag(oGiver),iQuests+1); SetLocalInt(oPartyMember,"Quest",0); SetLocalInt(oPartyMember,"QuestStep",0); SetLocalInt(oPartyMember,"QuestType",0); SetLocalInt(oPartyMember,"QuestDifficulty",0); SetLocalInt(oPartyMember,"QuestDone",0); SetLocalInt(oPartyMember,"QuestItemUnknown",0); SetLocalInt(oPartyMember,"SpecialQuestType",0); SetLocalInt(oPartyMember,"QuestLevel",0); SetLocalInt(oPartyMember,"QuestAdventureZone",0); iCount = GetLocalInt(oPartyMember,"QuestSteps"); iIndex = 1; while (iIndex <= iCount) { sQuestStep = "QuestStep" + IntToString(iIndex); SetLocalInt(oPartyMember,sQuestStep,0); SetLocalString(oPartyMember,sQuestStep + "Mob",""); SetLocalString(oPartyMember,sQuestStep + "Item",""); SetLocalString(oPartyMember,sQuestStep + "Token111",""); SetLocalString(oPartyMember,sQuestStep + "Token112",""); SetLocalString(oPartyMember,sQuestStep + "Token113",""); SetLocalString(oPartyMember,sQuestStep + "Response",""); SetLocalString(oPartyMember,sQuestStep + "Reply",""); SetLocalString(oPartyMember,sQuestStep + "Escort",""); SetLocalInt(oPartyMember,sQuestStep + "ItemUnknown",0); iIndex++; } SetLocalInt(oPartyMember,"QuestSteps",0); SetLocalString(oPartyMember,"QuestTargetNPC",""); SetLocalString(oPartyMember,"QuestItemTag",""); SetLocalString(oPartyMember,"QuestAttackers",""); SetLocalString(oPartyMember,"QuestGiver",""); SetLocalString(oPartyMember,"QuestTargetMob",""); SetLocalString(oPartyMember,"QuestCampType",""); SetLocalString(oPartyMember,"QuestEscort",""); sZone = GetLocalString(oPartyMember,"QuestZone"); SetLocalInt(GetModule(),sZone,0); SetLocalString(oPartyMember,"QuestZone",""); object oGood; oGood = GetObjectByTag("en3_good"); AdjustReputation(oPartyMember,oGood,-1); //AdjustAlignment(oPartyMember,ALIGNMENT_EVIL,1); //SendMessageToPC(GetFirstPC(),"Giver = " + GetName(oGiver)); iNPCQuests = GetLocalInt(oGiver,"QuestsCompleted"); iNPCQuests++; SetLocalInt(oGiver,"QuestsCompleted",iNPCQuests); //SendMessageToPC(GetFirstPC(),"Quests Completed = " + IntToString(iNPCQuests)); SetLocalString(oGiver,"QUEST_PC" + IntToString(iNPCQuests),GetName(oPartyMember)); //SendMessageToPC(GetFirstPC(),"QUEST_PC" + IntToString(iNPCQuests) + " on " + GetName(oGiver) + " set to " + GetName(oPartyMember)); //SetLocalInt(OBJECT_SELF,"Quest",0); oPartyMember = GetNextFactionMember(oPC, TRUE); } }