#include "nw_i0_tool" #include "rd_treasure" void SetPartyVariables(object oPC); void GivePartyMagicItem(object oPC); void GivePartyQuestPoints(object oPC, int iQuestPoints); void main() { int iDifficulty; int iGold; int iXP; int iChance; int iRandom; int iMod; int iLevel; int iQuestPoints; object oPC; oPC = GetPCSpeaker(); iDifficulty = GetLocalInt(oPC,"QuestDifficulty"); SetPartyVariables(oPC); iLevel = GetHitDice(oPC); if (iLevel < 20) iMod = iLevel/5 + 1; else iMod = (iLevel-20)/8 + 5; iGold = 50 * iDifficulty * iMod; iXP = 150 * iDifficulty * iMod; iChance = 3 * iDifficulty + iLevel/2 + 2; if (iGold == 0) iGold = 25; if (iXP == 0) iXP = 50; if (GetSkillRank(SKILL_PERSUADE,oPC)>4) { if (GetIsSkillSuccessful(oPC,SKILL_PERSUADE,25)) { SendMessageToPC(oPC,"You are very persuading..."); iGold=iGold*3/2; iChance = iChance + 10; } } 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 + 8; } } if (GetLocalInt(oPC,"Lucky") == 1) iChance = iChance + 5; if (GetLocalInt(oPC,"Lucky") == 2) iChance = iChance * 2; iRandom = Random(100); RewardPartyXP(iXP, GetPCSpeaker()); RewardPartyGP(iGold, GetPCSpeaker()); if (iRandom < iChance) GivePartyMagicItem(GetPCSpeaker()); iQuestPoints = (iDifficulty+1)/2; if (GetLocalInt(oPC,"Charming") == 1) iDifficulty++; if (iQuestPoints > 0) GivePartyQuestPoints(oPC,iQuestPoints); } 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 SetPartyVariables(object oPC) { int iDeaths; int iLastQuest; object oPartyMember = GetFirstFactionMember(oPC, TRUE); while (GetIsObjectValid(oPartyMember) == TRUE) { iLastQuest =GetLocalInt(oPartyMember,"Quest"); SetLocalInt(oPartyMember,"LastQuest",iLastQuest); SetLocalInt(oPartyMember,"Quest",0); SetLocalInt(oPartyMember,"QuestStep",0); SetLocalInt(oPartyMember,"QuestType",0); SetLocalInt(oPartyMember,"QuestCamp",0); SetLocalString(oPartyMember,"QuestCampzone",""); SetLocalInt(oPartyMember,"QuestDifficulty",0); SetLocalString(oPartyMember,"QuestTargetNPC",""); SetLocalString(oPartyMember,"QuestItemTag",""); SetLocalString(oPartyMember,"QuestCreatureTag",""); SetLocalString(oPartyMember,"QuestAttackers",""); SetLocalString(oPartyMember,"QuestCampType",""); SetLocalInt(oPartyMember,"QuestAttacked",0); SetLocalInt(oPartyMember,"QuestVariance",0); if (GetLocalInt(oPartyMember,"Elf") == 1) SetLocalInt(oPartyMember,"Elf",2); if (GetLocalInt(oPartyMember,"Dwarf") == 1) SetLocalInt(oPartyMember,"Dwarf",2); SetLocalString(oPartyMember,"QuestSendingNPC",""); SetLocalInt(oPartyMember,"EvilWait",1); SetLocalInt(oPartyMember,"EvilQuest",0); AdjustAlignment(oPartyMember,ALIGNMENT_EVIL,2); RemoveJournalQuestEntry("jDelivery",oPartyMember,TRUE); RemoveJournalQuestEntry("jCreatures",oPartyMember,TRUE); RemoveJournalQuestEntry("jCreatures2",oPartyMember,TRUE); RemoveJournalQuestEntry("jStaff",oPartyMember,TRUE); RemoveJournalQuestEntry("jSpecial",oPartyMember,TRUE); RemoveJournalQuestEntry("jFirst",oPartyMember,TRUE); oPartyMember = GetNextFactionMember(oPC, TRUE); } }