//Script made by Drakaden //iAreaZoneType1 = 1; Rural zone //iAreaZoneType1 = 2; Cave zone //iAreaZoneType1 = 3; Crypt zone //iAreaZoneType1 = 4; Rest zone //iAreaZoneType1 = 5; Reward zone //iAreaZoneType1 = 6; Frozen wastes zone void main() { object oPC = GetEnteringObject(); object oPCCheck1; object oNPC = OBJECT_SELF; object oOrb; object oOrb2; object oArea; object oAreaChoose1; object oDestination1; int iRoll1; int iRoll2; int iAreaZoneType1; int iAreaTag1; int iNumber1; int iTagCollide1; string sAreaTag1; string sAreaZone1; string sLocalAreaString1; location lSpawnpoint1; SetLocalString(oNPC, "RandomArea1", ""); iNumber1 = 0; oAreaChoose1 = OBJECT_INVALID; oArea = GetArea(oNPC); sAreaTag1 = GetTag(oArea); if (GetLocalInt(oNPC, "RequirementMet1") >= 1) { FloatingTextStringOnCreature("You need to defeat " + IntToString(GetLocalInt(oNPC, "RequirementMet1")) + " more creatures before you may proceed.", oPC, TRUE); return; } do { iTagCollide1 = 0; GetLocalString(oNPC, "RandomArea1") == ""; if (!GetIsObjectValid(oAreaChoose1) || GetLocalString(oNPC, "RandomArea1") == "" || GetLocalString(oNPC, "RandomArea1") == sAreaTag1) { iAreaTag1 = FindSubString(sAreaTag1, "quest1_office1_"); if (iAreaTag1 >= 0) { iAreaZoneType1 = 1; } else { iAreaTag1 = FindSubString(sAreaTag1, "quest1_office2_"); if (iAreaTag1 >= 0) { iAreaZoneType1 = 2; } else { iAreaTag1 = FindSubString(sAreaTag1, "quest1_office1_"); if (iAreaTag1 >= 0) { iAreaZoneType1 = 3; } else { iAreaTag1 = FindSubString(sAreaTag1, "quest1_rest1_"); if (iAreaTag1 >= 0) { iAreaZoneType1 = 4; } else { iAreaTag1 = FindSubString(sAreaTag1, "quest1_office2_"); if (iAreaTag1 >= 0) { iAreaZoneType1 = 6; } } } } } iRoll2 = Random(10) + 1; //Random number for instances, make it higher if it exceed the wrote number. if (iAreaZoneType1 == 1) { iRoll1 = Random(6) + 1; switch (iRoll1) { case 1: sAreaZone1 = "quest1_office1_" + IntToString(iRoll2) + ""; break; case 2: sAreaZone1 = "quest1_office2_" + IntToString(iRoll2) + ""; break; case 3: sAreaZone1 = "quest1_rest2_" + IntToString(iRoll2) + ""; break; case 4: sAreaZone1 = "quest1_rest1_" + IntToString(iRoll2) + ""; break; case 5: sAreaZone1 = "quest1_rew1_" + IntToString(iRoll2) + ""; break; case 6: sAreaZone1 = "quest1_rew2_" + IntToString(iRoll2) + ""; break; } } if (iAreaZoneType1 == 2) { iRoll1 = Random(6) + 1; switch (iRoll1) { case 1: sAreaZone1 = "quest1_office1_" + IntToString(iRoll2) + ""; break; case 2: sAreaZone1 = "quest1_office2_" + IntToString(iRoll2) + ""; break; case 3: sAreaZone1 = "quest1_rest2_" + IntToString(iRoll2) + ""; break; case 4: sAreaZone1 = "quest1_rest1_" + IntToString(iRoll2) + ""; break; case 5: sAreaZone1 = "quest1_rew1_" + IntToString(iRoll2) + ""; break; case 6: sAreaZone1 = "quest1_rew2_" + IntToString(iRoll2) + ""; break; } } if (iAreaZoneType1 == 3) { iRoll1 = Random(6) + 1; switch (iRoll1) { case 1: sAreaZone1 = "quest1_office1_" + IntToString(iRoll2) + ""; break; case 2: sAreaZone1 = "quest1_office2_" + IntToString(iRoll2) + ""; break; case 3: sAreaZone1 = "quest1_rest2_" + IntToString(iRoll2) + ""; break; case 4: sAreaZone1 = "quest1_rest1_" + IntToString(iRoll2) + ""; break; case 5: sAreaZone1 = "quest1_rew1_" + IntToString(iRoll2) + ""; break; case 6: sAreaZone1 = "quest1_rew2_" + IntToString(iRoll2) + ""; break; } } if (iAreaZoneType1 == 4) { iRoll1 = Random(5) + 1; switch (iRoll1) { case 1: sAreaZone1 = "quest1_office1_" + IntToString(iRoll2) + ""; break; case 2: sAreaZone1 = "quest1_office2_" + IntToString(iRoll2) + ""; break; case 3: sAreaZone1 = "quest1_rest2_" + IntToString(iRoll2) + ""; break; case 4: sAreaZone1 = "quest1_rest1_" + IntToString(iRoll2) + ""; break; case 5: sAreaZone1 = "quest1_rew1_" + IntToString(iRoll2) + ""; break; case 6: sAreaZone1 = "quest1_rew2_" + IntToString(iRoll2) + ""; break; } } /*if (iAreaZoneType1 == 5) //Not used, reward zone { iRoll1 = Random(1) + 1; switch (iRoll1) { case 1: break; } }*/ if (iAreaZoneType1 == 6) { iRoll1 = Random(5) + 1; switch (iRoll1) { case 1: sAreaZone1 = "quest1_office1_" + IntToString(iRoll2) + ""; break; case 2: sAreaZone1 = "quest1_office2_" + IntToString(iRoll2) + ""; break; case 3: sAreaZone1 = "quest1_rest2_" + IntToString(iRoll2) + ""; break; case 4: sAreaZone1 = "quest1_rest1_" + IntToString(iRoll2) + ""; break; case 5: sAreaZone1 = "quest1_rew1_" + IntToString(iRoll2) + ""; break; case 6: sAreaZone1 = "quest1_rew2_" + IntToString(iRoll2) + ""; break; } } } SetLocalString(oNPC, "RandomArea1", sAreaZone1); sLocalAreaString1 = GetLocalString(oNPC, "RandomArea1"); oAreaChoose1 = GetObjectByTag(sLocalAreaString1); oPCCheck1 = GetFirstPC(); while (GetIsObjectValid(oPCCheck1)) { oOrb = GetItemPossessedBy(oPCCheck1, "database"); oOrb2 = GetItemPossessedBy(oPC, "database"); if (GetTag(GetArea(oPCCheck1)) == GetTag(oAreaChoose1) && GetLocalInt(oOrb, "Quest1Tag1") != GetLocalInt(oOrb2, "Quest1Tag1") && oPCCheck1 != oPC) { iTagCollide1 = 1; } oPCCheck1 = GetNextPC(); } }while(iTagCollide1 == 1 || !GetIsObjectValid(oAreaChoose1) || GetLocalString(oNPC, "RandomArea1") == sAreaTag1); oOrb = GetItemPossessedBy(GetFactionLeader(oPC), "database"); oOrb2 = GetItemPossessedBy(oPC, "database"); if (GetArea(GetFactionLeader(oPC)) != GetArea(oPC) && GetFactionLeader(oPC) != oPC && GetLocalInt(oOrb, "Quest1Tag1") == GetLocalInt(oOrb2, "Quest1Tag1") && FindSubString(GetTag(GetArea(GetFactionLeader(oPC))), "quest1") >= 0) { oAreaChoose1 = GetObjectByTag(GetTag(GetArea(GetFactionLeader(oPC)))); } if (GetFactionLeader(oPC) != oPC) { oAreaChoose1 = GetObjectByTag(GetTag(GetArea(GetFactionLeader(oPC)))); if (FindSubString(GetTag(GetArea(GetFactionLeader(oPC))), "quest1") < 0 || GetArea(GetFactionLeader(oPC)) == GetArea(oPC) || GetLocalInt(oOrb, "Quest1Tag1") != GetLocalInt(oOrb2, "Quest1Tag1")) { FloatingTextStringOnCreature("Your party leader isn't ahead of you yet.", oPC, FALSE); return; } if (FindSubString(GetTag(GetArea(GetFactionLeader(oPC))), "quest1") >= 0 && GetLocalInt(oOrb, "Quest1Tag1") == GetLocalInt(oOrb2, "Quest1Tag1")) { oDestination1 = GetFirstObjectInArea(oAreaChoose1); while (GetIsObjectValid(oDestination1) && iNumber1 == 0) { if (GetTag(oDestination1) == "quest1_spawnpoint1") { AssignCommand(oPC, JumpToObject(oDestination1)); iNumber1 = 1; } if (iNumber1 != 1) { oDestination1 = GetNextObjectInArea(oAreaChoose1); } } } } if (GetFactionLeader(oPC) == oPC) { oDestination1 = GetFirstObjectInArea(oAreaChoose1); while (GetIsObjectValid(oDestination1) && iNumber1 == 0) { if (GetTag(oDestination1) == "quest1_spawnpoint1") { AssignCommand(oPC, JumpToObject(oDestination1)); iAreaTag1 = FindSubString(GetTag(oAreaChoose1), "quest1_rest1_"); if (iAreaTag1 >= 0) { SetLocalInt(GetNearestObjectByTag("quest1_nextzone1", oDestination1), "RequirementMet1", 0); DelayCommand(10.0, FloatingTextStringOnCreature("You will need to defeat " + IntToString(GetLocalInt(GetNearestObjectByTag("quest1_nextzone1", oDestination1), "RequirementMet1")) + " creatures in this area.", oPC, TRUE)); } else { iAreaTag1 = FindSubString(GetTag(oAreaChoose1), "quest1_rew1_"); if (iAreaTag1 >= 0) { SetLocalInt(GetNearestObjectByTag("quest1_nextzone1", oDestination1), "RequirementMet1", 0); DelayCommand(10.0, FloatingTextStringOnCreature("You will need to defeat " + IntToString(GetLocalInt(GetNearestObjectByTag("quest1_nextzone1", oDestination1), "RequirementMet1")) + " creatures in this area.", oPC, TRUE)); } else { SetLocalInt(GetNearestObjectByTag("quest1_nextzone1", oDestination1), "RequirementMet1", Random(8) + 3); DelayCommand(10.0, FloatingTextStringOnCreature("You will need to defeat " + IntToString(GetLocalInt(GetNearestObjectByTag("quest1_nextzone1", oDestination1), "RequirementMet1")) + " creatures in this area.", oPC, TRUE)); } } iNumber1 = 1; } if (iNumber1 != 1) { oDestination1 = GetNextObjectInArea(oAreaChoose1); } } } }