Added CCOH and missing areas Changed some areas to be craftable, Fixed some on death issues, Fixed the Gaurd
478 lines
16 KiB
Plaintext
478 lines
16 KiB
Plaintext
//#include "_persist_01a"
|
|
|
|
void CreatePlaceable(object oPC, string sObject, location lPlace, float fDuration);
|
|
void CreateAMonster(string sMonster, object oPC, int iNumberOfMonsters);
|
|
void CreateAnObject(string sResource, object oPC, int iStackSize);
|
|
void CancelFishing(object oPC, location lCurrent);
|
|
void DelayText(object oPC, string sMessage);
|
|
void DelaySkill(object oPC, int iFishingSkill, string sOldSkill);
|
|
|
|
void main()
|
|
{
|
|
|
|
int iFishingSkill = 0;
|
|
int iFishingChance = 0;
|
|
object oPC = OBJECT_SELF;
|
|
if (GetResRef(oPC) == "fishinghole") oPC = GetClickingObject();
|
|
|
|
if (GetLocalInt(oPC,"iAmFishing") != 0) return;
|
|
if (GetLocalInt(oPC,"iCancelFishing") != 0)
|
|
{
|
|
SetLocalInt(oPC,"iCancelFishing",0);
|
|
return;
|
|
}
|
|
object oPole = GetItemInSlot(INVENTORY_SLOT_RIGHTHAND,oPC);
|
|
string sPoleTag = "ITEM_FISHINGPOLE";
|
|
|
|
if (GetRacialType(oPC) == RACIAL_TYPE_HALFLING) sPoleTag = "ITEM_FISHINGROD";
|
|
if (GetRacialType(oPC) == RACIAL_TYPE_GNOME) sPoleTag = "ITEM_FISHINGROD";
|
|
if (GetRacialType(oPC) == RACIAL_TYPE_DWARF) sPoleTag = "ITEM_FISHINGROD";
|
|
if (GetStringLeft(GetTag(oPole),16) != sPoleTag)
|
|
{
|
|
oPole = GetItemPossessedBy(oPC,sPoleTag);
|
|
if (oPole == OBJECT_INVALID)
|
|
{
|
|
if (sPoleTag =="ITEM_FISHINGPOLE")
|
|
{
|
|
FloatingTextStringOnCreature("You must have a fishing pole in order to catch fish",oPC,FALSE);
|
|
}
|
|
else
|
|
{
|
|
FloatingTextStringOnCreature("You must have a fishing rod in order to catch fish",oPC,FALSE);
|
|
}
|
|
return;
|
|
}
|
|
AssignCommand(oPC,ActionEquipItem(oPole,INVENTORY_SLOT_RIGHTHAND));
|
|
}
|
|
SetLocalInt(oPC,"iAmFishing",99);
|
|
AssignCommand(oPC,DelayCommand(12.0,SetLocalInt(oPC,"iAmFishing",0)));
|
|
DelayCommand(1.0,FloatingTextStringOnCreature("You cast your pole into the water...",oPC,FALSE));
|
|
SetLocalLocation(oPC,"lIWasHere",GetLocation(oPC));
|
|
AssignCommand(oPC,DelayCommand(13.0,CancelFishing(oPC,GetLocation(OBJECT_SELF))));
|
|
AssignCommand(oPC,DelayCommand(1.0,ActionPlayAnimation(ANIMATION_FIREFORGET_SALUTE,1.0,1.0)));
|
|
AssignCommand(oPC,DelayCommand(4.0,ActionPlayAnimation(ANIMATION_LOOPING_TALK_PLEADING,1.0,6.0)));
|
|
AssignCommand(oPC,DelayCommand(10.0,ActionPlayAnimation(ANIMATION_LOOPING_GET_LOW,1.0,2.0)));
|
|
switch (Random(3))
|
|
{
|
|
case 1:{AssignCommand(oPC,DelayCommand(1.5,PlaySound("as_na_drip4")));break;}
|
|
case 2:{AssignCommand(oPC,DelayCommand(1.5,PlaySound("as_na_drip5")));break;}
|
|
default:{AssignCommand(oPC,DelayCommand(1.5,PlaySound("as_na_drip4")));break;}
|
|
}
|
|
|
|
//iFishingSkill = GetTokenPair(oPC,14,13);
|
|
iFishingSkill = GetCampaignInt("UOACraft","iFishingSkill",oPC);
|
|
iFishingChance = iFishingSkill;
|
|
if (iFishingChance <350)
|
|
{
|
|
iFishingChance = GetAbilityScore(oPC,ABILITY_CHARISMA)*5;
|
|
iFishingChance = iFishingChance+(GetAbilityScore(oPC,ABILITY_STRENGTH)*3);
|
|
iFishingChance = iFishingChance+(GetAbilityScore(oPC,ABILITY_DEXTERITY)*2);
|
|
iFishingChance = iFishingChance*3;
|
|
if (iFishingChance >350) iFishingChance = 350;
|
|
if (iFishingSkill > iFishingChance) iFishingChance = iFishingSkill;
|
|
}
|
|
|
|
int iFishRange = 7;
|
|
if (iFishingChance > 250) iFishRange++; //smallmouth
|
|
if (iFishingChance > 350) iFishRange++; // largemouth
|
|
if (iFishingChance > 450) iFishRange++; // trout
|
|
if (iFishingChance > 500) iFishRange++; // small channel cat
|
|
if (iFishingChance > 550) iFishRange++; // small channel cat
|
|
if (iFishingChance > 600) iFishRange++; // medium
|
|
if (iFishingChance > 650) iFishRange++; // medium
|
|
if (iFishingChance > 700) iFishRange++; // large
|
|
if (iFishingChance > 750) iFishRange++; // very large
|
|
|
|
int iRandom = Random(1000);
|
|
int iSuccess = 0;
|
|
int iSkillGain = 0;
|
|
string sFishResRef = "";
|
|
string sSuccessMessage = "";
|
|
string sFailMessage = "You fish for a while but fail to catch anything...";
|
|
|
|
if (iRandom <= iFishingChance)
|
|
{
|
|
iSuccess = 1;
|
|
}
|
|
else
|
|
{
|
|
AssignCommand(oPC,DelayCommand(11.0,DelayText(oPC,sFailMessage)));
|
|
}
|
|
|
|
if (iSuccess == 1)
|
|
{
|
|
if (Random(1000)<500)
|
|
{
|
|
AssignCommand(oPC,DelayCommand(11.0,PlaySound("as_na_splash1")));
|
|
}
|
|
else
|
|
{
|
|
AssignCommand(oPC,DelayCommand(11.0,PlaySound("as_na_splash2")));
|
|
}
|
|
iRandom = Random(1000);
|
|
if (iRandom >= iFishingSkill)
|
|
{
|
|
if (d10(1)+1 >= iFishingChance/100) iSkillGain = 1;
|
|
}
|
|
int iFishNormalFlag = 0;
|
|
iRandom = Random(iFishRange);
|
|
|
|
switch (iRandom)
|
|
{
|
|
case 1:
|
|
{
|
|
sFishResRef = "fish002";
|
|
sSuccessMessage = "You pitifully manage to catch a freshwater guppy...";
|
|
break;
|
|
}
|
|
case 2:
|
|
{
|
|
sFishResRef = "fish003";
|
|
sSuccessMessage = "You pitifully manage to catch a freshwater tadpole...";
|
|
break;
|
|
}
|
|
case 3:
|
|
{
|
|
sFishResRef = "fish004";
|
|
sSuccessMessage = "You manage to catch a freshwater bullfrog.";
|
|
break;
|
|
}
|
|
case 4:
|
|
{
|
|
sFishResRef = "fish005";
|
|
sSuccessMessage = "You manage to catch a freshwater bluegill.";
|
|
break;
|
|
}
|
|
case 5:
|
|
{
|
|
sFishResRef = "fish006";
|
|
sSuccessMessage = "You manage to catch a freshwater crappie.";
|
|
break;
|
|
}
|
|
case 6:
|
|
{
|
|
sFishResRef = "fish007";
|
|
sSuccessMessage = "You manage to catch a freshwater carp.";
|
|
break;
|
|
}
|
|
case 7:
|
|
{
|
|
sFishResRef = "fish008";
|
|
sSuccessMessage = "You manage to catch a freshwater smallmouth bass.";
|
|
break;
|
|
}
|
|
case 8:
|
|
{
|
|
sFishResRef = "fish009";
|
|
sSuccessMessage = "You manage to catch a freshwater largemouth bass.";
|
|
break;
|
|
}
|
|
case 9:
|
|
{
|
|
sFishResRef = "fish010";
|
|
sSuccessMessage = "You manage to catch a freshwater rainbow trout.";
|
|
break;
|
|
}
|
|
case 10:
|
|
{
|
|
sFishResRef = "fish011";
|
|
sSuccessMessage = "You manage to catch a very small channel catfish.";
|
|
break;
|
|
}
|
|
case 11:
|
|
{
|
|
sFishResRef = "fish012";
|
|
sSuccessMessage = "You manage to catch a small channel catfish.";
|
|
break;
|
|
}
|
|
case 12:
|
|
{
|
|
sFishResRef = "fish013";
|
|
sSuccessMessage = "You manage to catch a medium channel catfish.";
|
|
break;
|
|
}
|
|
case 13:
|
|
{
|
|
sFishResRef = "fish014";
|
|
sSuccessMessage = "You manage to catch a somewhat large channel catfish.";
|
|
break;
|
|
}
|
|
case 14:
|
|
{
|
|
sFishResRef = "fish015";
|
|
sSuccessMessage = "You manage to catch a rather large channel catfish.";
|
|
break;
|
|
}
|
|
case 15:
|
|
{
|
|
sFishResRef = "fish016";
|
|
sSuccessMessage = "You manage to catch an extremely large channel catfish.";
|
|
break;
|
|
}
|
|
default:
|
|
{
|
|
sFishResRef = "fish001";
|
|
sSuccessMessage = "You jokingly manage to catch a freshwater minnow.";
|
|
break;
|
|
}
|
|
|
|
}
|
|
|
|
//Assign a 1 in 20 chance of a non-fish retrieval
|
|
if (d20(1) == 10)
|
|
{
|
|
iFishNormalFlag = Random(6);
|
|
switch (iFishNormalFlag)
|
|
{
|
|
case 1:
|
|
{
|
|
sFishResRef = "junk001";
|
|
AssignCommand(oPC,DelayCommand(11.5,CreateAnObject(sFishResRef,oPC,1)));
|
|
sSuccessMessage = "You fish for a while and manage to catch an old human skull.";
|
|
break;
|
|
}
|
|
case 2:
|
|
{
|
|
sFishResRef = "junk001";
|
|
AssignCommand(oPC,DelayCommand(11.5,CreateAnObject(sFishResRef,oPC,1)));
|
|
sSuccessMessage = "You fish for a while and manage to catch a bundle of oily rags.";
|
|
break;
|
|
}
|
|
case 3:
|
|
{
|
|
sFishResRef = "junk001";
|
|
AssignCommand(oPC,DelayCommand(11.5,CreateAnObject(sFishResRef,oPC,1)));
|
|
sSuccessMessage = "You fish for a while and manage to catch a waterlogged corpse.";
|
|
break;
|
|
}
|
|
case 4:
|
|
{
|
|
AssignCommand(oPC,DelayCommand(11.0,PlaySound("al_an_bugs1")));
|
|
sFishResRef = "btlstink003"; // lesser water beetle
|
|
if (GetHitDice(oPC) > 6) sFishResRef = "btlstink002"; // water beetle
|
|
if (GetHitDice(oPC) > 9) sFishResRef = "btlstink001"; // greater water beetle
|
|
if (Random(1000)<300) sFishResRef = "btlstink003";
|
|
if (Random(1000)<100) sFishResRef = "btlstink002";
|
|
AssignCommand(oPC,DelayCommand(11.5,CreateAMonster(sFishResRef,oPC,1)));
|
|
sSuccessMessage = "You have disturbed a water beetle!";
|
|
break;
|
|
}
|
|
case 5:
|
|
{
|
|
AssignCommand(oPC,DelayCommand(11.0,PlaySound("al_an_bugs1")));
|
|
sFishResRef = "spidgiant003"; // small water spider
|
|
if (GetHitDice(oPC) > 6) sFishResRef = "spidgiant004"; // water spider
|
|
if (GetHitDice(oPC) > 9) sFishResRef = "spidgiant005"; // large water spider
|
|
if (Random(1000)<300) sFishResRef = "spidgiant003";
|
|
if (Random(1000)<100) sFishResRef = "spidgiant004";
|
|
AssignCommand(oPC,DelayCommand(11.5,CreateAMonster(sFishResRef,oPC,1)));
|
|
sSuccessMessage = "You have disturbed a water spider!";
|
|
break;
|
|
}
|
|
default:
|
|
{
|
|
AssignCommand(oPC,DelayCommand(11.5,(CreatePlaceable(oPC, "waterloggedcorps",GetLocation(oPC),600.0))));
|
|
sSuccessMessage = "You have pulled a water-soaked corpse fromt he water!";
|
|
break;
|
|
}
|
|
}
|
|
|
|
}
|
|
AssignCommand(oPC,DelayCommand(11.0,DelayText(oPC,sSuccessMessage)));
|
|
if (iFishNormalFlag == 0)
|
|
{
|
|
//chance of fishing up map
|
|
if (iFishingChance>800)
|
|
{
|
|
if (Random(1000)>950)
|
|
{
|
|
if (Random(1000)>990) iFishNormalFlag++;
|
|
if (iFishingChance>900)
|
|
{
|
|
if (Random(1000)>990) iFishNormalFlag++;
|
|
}
|
|
if (iFishingChance>999)
|
|
{
|
|
if (Random(1000)>990) iFishNormalFlag++;
|
|
}
|
|
}
|
|
}
|
|
if (iFishNormalFlag==0)
|
|
{
|
|
AssignCommand(oPC,DelayCommand(11.5,CreateAnObject(sFishResRef,oPC,1)));
|
|
}
|
|
else
|
|
{
|
|
string sTempResRef;
|
|
if (iFishNormalFlag==1) sTempResRef="_undecoded_tmap1";
|
|
if (iFishNormalFlag==2) sTempResRef="_undecoded_tmap2";
|
|
if (iFishNormalFlag==3) sTempResRef="_undecoded_tmap3";
|
|
|
|
AssignCommand(oPC,DelayCommand(11.1,DelayText(oPC,sSuccessMessage)));
|
|
AssignCommand(oPC,DelayCommand(11.5,CreateAnObject(sFishResRef,oPC,1)));
|
|
AssignCommand(oPC,DelayCommand(11.9,CreateAnObject(sTempResRef,oPC,1)));
|
|
AssignCommand(oPC,DelayCommand(12.1,DelayText(oPC,"You also pull out a waterlogged piece of old parchment!")));
|
|
}
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//Begin freshwater fish descriptors
|
|
// fish001 - minnow
|
|
// fish002 - guppy
|
|
// fish003 - tadpole
|
|
// fish004 - bullfrog
|
|
// fish005 - bluegill
|
|
// fish006 - crappie
|
|
// fish007 - carp
|
|
// fish008 - smallmouth bass
|
|
// fish009 - largemouth bass
|
|
// fish010 - rainbow trout
|
|
// fish011 - Small channel catfish
|
|
// fish012 - small channel catfish
|
|
// fish013 - Medium Channel Catfish
|
|
// fish014 - Medium Channel Catfish
|
|
// fish015 - Large channel catfish
|
|
// fish016 - Very Large Channel Catfish
|
|
|
|
// ---------------begin saltwater fish descriptors
|
|
// fish017 - Cod
|
|
// fish018 - Flounder
|
|
// fish019 - shad
|
|
// fish020 - Sea Bass
|
|
// fish021 - Black Sea Bass
|
|
// fish022 - mackerel
|
|
// fish023 - blue fish
|
|
// fish024 - fluke
|
|
// fish025 - striped bass
|
|
// fish026 - white marlin
|
|
// fish027 - Blue shark
|
|
// fish028 - yellowfin tuna
|
|
// fish029 - mako shark
|
|
// fish030 - swordfish
|
|
// fish031 - bluefin tuna
|
|
|
|
//Ensure no more than 1 skill gain every 10 seconds to avoid token droppage.
|
|
if (iSkillGain ==1)
|
|
{
|
|
if (GetLocalInt(oPC,"iSkillGain")!= 0)
|
|
{
|
|
iSkillGain = 0;
|
|
}
|
|
else
|
|
{
|
|
SetLocalInt(oPC,"iSkillGain",99);
|
|
DelayCommand(10.0,SetLocalInt(oPC,"iSkillGain",0));
|
|
}
|
|
}
|
|
|
|
|
|
if (iSkillGain ==1)
|
|
{
|
|
string sOldSkill = "";
|
|
string sOldSkill2 = "";
|
|
iFishingSkill++;
|
|
sOldSkill2 = IntToString(iFishingSkill);
|
|
sOldSkill = "."+GetStringRight(sOldSkill2,1);
|
|
if (iFishingSkill > 9)
|
|
{
|
|
sOldSkill = GetStringLeft(sOldSkill2,GetStringLength(sOldSkill2)-1)+sOldSkill;
|
|
}
|
|
else
|
|
{
|
|
sOldSkill = "0"+sOldSkill;
|
|
}
|
|
if (iFishingSkill <= 1000)
|
|
{
|
|
AssignCommand(oPC,DelayCommand(12.0,DelaySkill(oPC,iFishingSkill, sOldSkill)));
|
|
//DelayCommand(12.0,SetTokenPair(oPC,14,13,iFishingSkill));
|
|
//DelayCommand(12.0,SendMessageToPC(oPC,"=================================="));
|
|
//DelayCommand(12.0,SendMessageToPC(oPC,"Your skill in fishing has gone up!"));
|
|
//DelayCommand(12.0,SendMessageToPC(oPC,"Current fishing skill : "+ sOldSkill+"%"));
|
|
//DelayCommand(12.0,SendMessageToPC(oPC,"=================================="));
|
|
}
|
|
}
|
|
|
|
|
|
}
|
|
|
|
void CreateAnObject(string sResource, object oPC, int iStackSize)
|
|
{
|
|
if (GetDistanceBetweenLocations(GetLocalLocation(oPC,"lIWasHere"),GetLocation(oPC))<0.9)
|
|
CreateItemOnObject(sResource,oPC,iStackSize);
|
|
return;
|
|
}
|
|
|
|
void CreateAMonster(string sMonster, object oPC, int iNumberOfMonsters)
|
|
{
|
|
if (GetDistanceBetweenLocations(GetLocalLocation(oPC,"lIWasHere"),GetLocation(oPC))>0.8) return;
|
|
object oTemp = OBJECT_INVALID;
|
|
location lSelf = GetLocation(oPC);
|
|
vector vSelf = GetPosition(oPC);
|
|
object oArea = GetArea(oPC);
|
|
vector vFire;
|
|
int vDirection;
|
|
float fSelf;
|
|
int iRandom;
|
|
float fDistance;
|
|
location lFire;
|
|
|
|
for (iNumberOfMonsters; iNumberOfMonsters>0; iNumberOfMonsters--)
|
|
{
|
|
SendMessageToPC(oPC,"Oops! You disturbed a Monster!!");
|
|
fSelf = GetFacing(oPC)+Random(360);
|
|
|
|
fDistance = (IntToFloat(Random(100)+1)/10.0);
|
|
vFire = vSelf + (AngleToVector(fSelf) * fDistance);
|
|
lFire = Location(oArea,vFire,fSelf);
|
|
oTemp = CreateObject(OBJECT_TYPE_CREATURE,sMonster,lFire,FALSE);
|
|
AssignCommand(oTemp,SetFacingPoint(AngleToVector(GetFacing(oPC))));
|
|
AssignCommand(oTemp, ActionAttack(oPC,FALSE));
|
|
}
|
|
return;
|
|
}
|
|
|
|
void CancelFishing(object oPC, location lCurrent)
|
|
{
|
|
if (GetDistanceBetweenLocations(GetLocalLocation(oPC,"lIWasHere"),GetLocation(oPC))>0.4)
|
|
{
|
|
SetLocalInt(oPC,"iCancelFishing",99);
|
|
}
|
|
if (GetIsDead(oPC)==TRUE) SetLocalInt(oPC,"iCancelFishing",99);
|
|
if (GetArea(oPC)!=GetAreaFromLocation(GetLocalLocation(oPC,"lIWasHere"))) SetLocalInt(oPC,"iCancelFishing",99);
|
|
AssignCommand(oPC,ExecuteScript("_craft_fishing",oPC));
|
|
return;
|
|
}
|
|
|
|
void CreatePlaceable(object oPC, string sObject, location lPlace, float fDuration)
|
|
{
|
|
if (GetDistanceBetweenLocations(GetLocalLocation(oPC,"lIWasHere"),GetLocation(oPC))>0.8) return;
|
|
object oPlaceable = CreateObject(OBJECT_TYPE_PLACEABLE,sObject,lPlace,FALSE);
|
|
if (fDuration != 0.0)
|
|
DestroyObject(oPlaceable,fDuration);
|
|
return ;
|
|
}
|
|
|
|
void DelayText(object oPC, string sMessage)
|
|
{
|
|
if (GetDistanceBetweenLocations(GetLocalLocation(oPC,"lIWasHere"),GetLocation(oPC))>0.8) return;
|
|
FloatingTextStringOnCreature(sMessage,oPC,FALSE);
|
|
return;
|
|
}
|
|
|
|
void DelaySkill(object oPC, int iFishingSkill, string sOldSkill)
|
|
{
|
|
if (GetDistanceBetweenLocations(GetLocalLocation(oPC,"lIWasHere"),GetLocation(oPC))>0.8) return;
|
|
//SetTokenPair(oPC,14,13,iFishingSkill);
|
|
SetCampaignInt("UOACraft","iFishingSkill",iFishingSkill,oPC);
|
|
SendMessageToPC(oPC,"==================================");
|
|
SendMessageToPC(oPC,"Your skill in fishing has gone up!");
|
|
SendMessageToPC(oPC,"Current fishing skill : "+ sOldSkill+"%");
|
|
SendMessageToPC(oPC,"==================================");
|
|
if (GetLocalInt(GetModule(),"_UOACraft_XP")!=0) GiveXPToCreature(oPC,GetLocalInt(GetModule(),"_UOACraft_XP"));
|
|
return;
|
|
}
|