FISHING SCRIPT
Page 1 of 1
FISHING SCRIPT
Fishing Script
Quoted form Perkko
Fishing...
SCRIPT
SCRIPT NAME: fishr_fishing
ACTION: Placed in the triggers OnClick Event
void main()
{
object oPC = GetClickingObject(); //Checks the PC clicking
object oFishingRod = GetObjectByTag("fishr_fishingrod"); //Checks so the item fishr_fishingrod is there
object oFishingTackle = GetObjectByTag("fishr_fishingtackle"); //Checks so the item fishr_fishingtackle is there
object oEquiped = GetItemInSlot(INVENTORY_SLOT_RIGHTHAND, oPC); //Checks that the PC has something equiped
object oPoss = GetItemPossessor(oFishingRod); //Gets the possessor of the fishing rod
object oPossT = GetItemPossessor(oFishingTackle); //Gets the possessor of the fishing tackle
location lLoc = GetLocation(oPC); // Checks the location of the PC
int nDexMod = GetAbilityModifier (ABILITY_DEXTERITY, oPC); // Gets the Dex Modifier of the PC
int nWisMod = GetAbilityModifier (ABILITY_WISDOM, oPC); // Gets the Wis Modifier of the PC
int nRoll = d20(); //The Die roll for the FishingCheck
int nTotal = nRoll + (nDexMod/2) + nWisMod; //Total roll inc. modifiers
int nFishLong = d20() + 9; //The size of the fish in inches
string sFish = IntToString(nFishLong); //Converts the size of the fish (integer) to a string
if (!GetIsPC(oPC)) return; //Checks so the one entering the trigger is a PC not used since I changed it to a click action
//Makes the check
if (oPoss == oPC && oPossT == oPC)//Checks if the PC has the fishing rod & the fishing tackle!
{
if (oEquiped == oFishingRod)
{
if ((nTotal >= 18 ) || (nRoll == 20))) //DC check to catch a fish, it's not that easy!
{
SendMessageToPC(oPC, "You sit down and toss the hook and bait into the water");
AssignCommand(oPC, ActionPlayAnimation(ANIMATION_LOOPING_SIT_CROSS, 1.0, 6.0));
int nCatch= d100(); //Die roll to check what the PC catch
if (nCatch == 100) //PC gets a loot bag!
{
ActionWait(5.0);
CreateObject(OBJECT_TYPE_PLACEABLE, "plc_lootbag2", lLoc, TRUE);
DelayCommand(5.0f, SendMessageToPC(oPC, "You caught a bag! You are unlucky aren't you...?"));
}
if ( (nCatch >= 30) && (nCatch <= 99) ) //PC gets a fish
{
ActionWait(5.0);
CreateObject(OBJECT_TYPE_ITEM, "nw_it_msmlmisc20", lLoc, TRUE);
DelayCommand(5.0f, SendMessageToPC(oPC, "You caught a " + sFish + " inches fish."));
}
if ( (nCatch >= 20) && (nCatch <=29) ) //PC gets a bottle
{
ActionWait(5.0);
CreateObject(OBJECT_TYPE_ITEM, "nw_it_thnmisc001", lLoc, TRUE);
DelayCommand(5.0f, SendMessageToPC(oPC, "You caught an empty bottle! Are you sure you put the bait on correctly?"));
}
if ( (nCatch >= 10) && (nCatch <=19) ) //PC gets some rags
{
ActionWait(5.0);
CreateObject(OBJECT_TYPE_ITEM, "nw_it_msmlmisc21", lLoc, TRUE);
DelayCommand(5.0f, SendMessageToPC(oPC, "You caught some smelly rags! Purely bad luck..."));
}
if ( (nCatch >= 05) && (nCatch <=09) ) //PC gets a skull
{
ActionWait(5.0);
CreateObject(OBJECT_TYPE_ITEM, "nw_it_msmlmisc14", lLoc, TRUE);
DelayCommand(5.0f, SendMessageToPC(oPC, "You caught a skull! Hmm, wonder who this was?"));
}
if ( (nCatch >= 01) && (nCatch <=04) ) //PC gets a stein
{
ActionWait(5.0);
CreateObject(OBJECT_TYPE_ITEM, "nw_it_thnmisc002", lLoc, TRUE);
DelayCommand(5.0f, SendMessageToPC(oPC, "You caught an empty ale stein! I wouldn't drink from it... yet."));
}
} //nTotal
if (nTotal <=17) //Too bad!
{
SendMessageToPC(oPC, "You sit down and toss the hook and bait into the water");
AssignCommand(oPC, ActionPlayAnimation(ANIMATION_LOOPING_SIT_CROSS, 1.0, 6.0));
DelayCommand(5.0f, SendMessageToPC(oPC, "You caught nothing, better luck next time!"));
}
}
else
{
// The player forgot to equip the fishing rod or have forgotten to buy fishing tackle
SendMessageToPC(oPC, "This is an excellent place to catch fish but you need to equip the fishing rod to be able to catch some fish!");
}
}
else
{
// The player have forgotten to buy the fishing rod and/or fishing tackle
SendMessageToPC(oPC, "This is an excellent place to catch some fish but you don't have a fishing rod or fishing tackle, get some if you want to fish!");
}
}
ITEMS
Fishing Rod
Item Name: Fishing Rod
Tag: fishr_fishingrod
Base Type: Quarterstaff
Fishing Tackle
Item Name: Fishing Tackle
Tag: fishr_fishingtackle
Base Type: Miscellaneous Small 2*
CONVERSATION/MERCHANT
Conversation: conv_npc_openstr
Merchant: Fisherman
Tag: fishr_FishermanStore
Quoted form Perkko
Fishing...
SCRIPT
SCRIPT NAME: fishr_fishing
ACTION: Placed in the triggers OnClick Event
void main()
{
object oPC = GetClickingObject(); //Checks the PC clicking
object oFishingRod = GetObjectByTag("fishr_fishingrod"); //Checks so the item fishr_fishingrod is there
object oFishingTackle = GetObjectByTag("fishr_fishingtackle"); //Checks so the item fishr_fishingtackle is there
object oEquiped = GetItemInSlot(INVENTORY_SLOT_RIGHTHAND, oPC); //Checks that the PC has something equiped
object oPoss = GetItemPossessor(oFishingRod); //Gets the possessor of the fishing rod
object oPossT = GetItemPossessor(oFishingTackle); //Gets the possessor of the fishing tackle
location lLoc = GetLocation(oPC); // Checks the location of the PC
int nDexMod = GetAbilityModifier (ABILITY_DEXTERITY, oPC); // Gets the Dex Modifier of the PC
int nWisMod = GetAbilityModifier (ABILITY_WISDOM, oPC); // Gets the Wis Modifier of the PC
int nRoll = d20(); //The Die roll for the FishingCheck
int nTotal = nRoll + (nDexMod/2) + nWisMod; //Total roll inc. modifiers
int nFishLong = d20() + 9; //The size of the fish in inches
string sFish = IntToString(nFishLong); //Converts the size of the fish (integer) to a string
if (!GetIsPC(oPC)) return; //Checks so the one entering the trigger is a PC not used since I changed it to a click action
//Makes the check
if (oPoss == oPC && oPossT == oPC)//Checks if the PC has the fishing rod & the fishing tackle!
{
if (oEquiped == oFishingRod)
{
if ((nTotal >= 18 ) || (nRoll == 20))) //DC check to catch a fish, it's not that easy!
{
SendMessageToPC(oPC, "You sit down and toss the hook and bait into the water");
AssignCommand(oPC, ActionPlayAnimation(ANIMATION_LOOPING_SIT_CROSS, 1.0, 6.0));
int nCatch= d100(); //Die roll to check what the PC catch
if (nCatch == 100) //PC gets a loot bag!
{
ActionWait(5.0);
CreateObject(OBJECT_TYPE_PLACEABLE, "plc_lootbag2", lLoc, TRUE);
DelayCommand(5.0f, SendMessageToPC(oPC, "You caught a bag! You are unlucky aren't you...?"));
}
if ( (nCatch >= 30) && (nCatch <= 99) ) //PC gets a fish
{
ActionWait(5.0);
CreateObject(OBJECT_TYPE_ITEM, "nw_it_msmlmisc20", lLoc, TRUE);
DelayCommand(5.0f, SendMessageToPC(oPC, "You caught a " + sFish + " inches fish."));
}
if ( (nCatch >= 20) && (nCatch <=29) ) //PC gets a bottle
{
ActionWait(5.0);
CreateObject(OBJECT_TYPE_ITEM, "nw_it_thnmisc001", lLoc, TRUE);
DelayCommand(5.0f, SendMessageToPC(oPC, "You caught an empty bottle! Are you sure you put the bait on correctly?"));
}
if ( (nCatch >= 10) && (nCatch <=19) ) //PC gets some rags
{
ActionWait(5.0);
CreateObject(OBJECT_TYPE_ITEM, "nw_it_msmlmisc21", lLoc, TRUE);
DelayCommand(5.0f, SendMessageToPC(oPC, "You caught some smelly rags! Purely bad luck..."));
}
if ( (nCatch >= 05) && (nCatch <=09) ) //PC gets a skull
{
ActionWait(5.0);
CreateObject(OBJECT_TYPE_ITEM, "nw_it_msmlmisc14", lLoc, TRUE);
DelayCommand(5.0f, SendMessageToPC(oPC, "You caught a skull! Hmm, wonder who this was?"));
}
if ( (nCatch >= 01) && (nCatch <=04) ) //PC gets a stein
{
ActionWait(5.0);
CreateObject(OBJECT_TYPE_ITEM, "nw_it_thnmisc002", lLoc, TRUE);
DelayCommand(5.0f, SendMessageToPC(oPC, "You caught an empty ale stein! I wouldn't drink from it... yet."));
}
} //nTotal
if (nTotal <=17) //Too bad!
{
SendMessageToPC(oPC, "You sit down and toss the hook and bait into the water");
AssignCommand(oPC, ActionPlayAnimation(ANIMATION_LOOPING_SIT_CROSS, 1.0, 6.0));
DelayCommand(5.0f, SendMessageToPC(oPC, "You caught nothing, better luck next time!"));
}
}
else
{
// The player forgot to equip the fishing rod or have forgotten to buy fishing tackle
SendMessageToPC(oPC, "This is an excellent place to catch fish but you need to equip the fishing rod to be able to catch some fish!");
}
}
else
{
// The player have forgotten to buy the fishing rod and/or fishing tackle
SendMessageToPC(oPC, "This is an excellent place to catch some fish but you don't have a fishing rod or fishing tackle, get some if you want to fish!");
}
}
ITEMS
Fishing Rod
Item Name: Fishing Rod
Tag: fishr_fishingrod
Base Type: Quarterstaff
Fishing Tackle
Item Name: Fishing Tackle
Tag: fishr_fishingtackle
Base Type: Miscellaneous Small 2*
CONVERSATION/MERCHANT
Conversation: conv_npc_openstr
Merchant: Fisherman
Tag: fishr_FishermanStore
Page 1 of 1
Permissions in this forum:
You cannot reply to topics in this forum
|
|