Ancordia_PRC8/_module/nss/fishing_action.nss
Jaysyn904 102ba7dab6 Initial Commit
Initial Commit
2023-09-21 19:51:32 -04:00

31 lines
1.2 KiB
Plaintext

void CatchOpportunity(object oPC, location eLoc, float fReaction)
{
SetLocalInt(oPC, "FishChance", TRUE);
//effect eEffect = EffectVisualEffect(93); //splash effect
//ApplyEffectAtLocation(DURATION_TYPE_TEMPORARY, eEffect, eLoc, 0.5);
PlaySound("as_na_splash2");
FloatingTextStringOnCreature("!", oPC, FALSE);
DelayCommand(fReaction, DeleteLocalInt(oPC, "FishChance"));
}
void main()
{
object oPC = GetPCSpeaker();
object oFishingSpot = GetLocalObject(oPC, "oFishingSpot");
location eLoc = GetLocation(oFishingSpot);
//effect eEffect = EffectVisualEffect(93); //splash effect
//ApplyEffectAtLocation(DURATION_TYPE_TEMPORARY, eEffect, eLoc, 0.5);
PlaySound("as_na_splash1");
//Let's remove one instance of fishing bait from the PC's inventory
object oBait = GetItemPossessedBy(oPC, "fish_bait");
if (GetIsObjectValid(oBait)) DestroyObject(oBait);
//Now we need to fire the opportunity event at a random time
int nDelay = Random(18)+3;
float fDelay = IntToFloat(nDelay);
float fReaction = 1.0; //The PC will have this many seconds to catch the fish
if (Random(100)+1 <= 75) DelayCommand(fDelay, CatchOpportunity(oPC, eLoc, fReaction));
}