Fishing Script

*Created by Taz.*

```
Using "RC_Core.rcm"
; Morgance Online 0.1
; Date/Time: 8:19:14 PM on 8/29/2012
; By Dan Seguin on TAZCO-PC
;Fishing Skill
 ;Give fishing rod item 1 or more fishing attribute.

;when the type of fish is figured out, add a better chance to fish based on fishing rod fishing attrbiute.
Function Main()
Player = Actor()
Target = ContextActor()
Plvl% = ActorLevel(Player)

     ;find Fishing Spot and see if its in range to use it.
    FishSpotName$ = "Fishing Spot"
    FoundFS% = FindActor(FishSpotName, 2) ;type 2 look through npcs

       IsClose3# = ActorDistance(FoundFS, Player)

       IsClose% = IsClose3

        If (FoundFS = 0)
            OutPut(Player, "Fishing Spot not found!!",255, 200, 100)
            Return
        EndIf

         If (IsClose > 27)
            OutPUt(Player, "You need to find a Fishing Spot, to to use your fishing rod.",255, 200, 100)
            Return
        EndIf

      FishingLvl% = Attribute(Player, "Fishing")
     FishingXp% = Split(ActorGlobal(Player, 2), 13, "|")
     HasFishingPole% = ItemAttribute(ActorWeapon(Player), "Fishing")

      BaseFishingXp% = FishingLvl + Plvl + HasFishingPole + Rand(1, 5)

 If (HasFishingPole <= 0) ;actor weapons fishing attribute is lower then 1 tell them they need a fishing rod.
     OutPut(Player, "You need a fishing rod equiped to fish." ,255, 200, 100)
    Return
 Else ;player has fishing rod rod

         CatchChance% = FishingLvl + HasFishingPole + Rand(105, 125)
        CatchMiss% = Rand(25, 45) + Rand(70, 185)

         If (FishingLvl < 5) ;fishing level less then 5 give player only Bass fish chance
            ;if CatchChance is less then catchmiss then miss chance at fish
            If (CatchChance < CatchMiss)

        ;NOTE play a few fishing animations, and maybe a line snap sound or something.
               ; OutPut(Player, "You were unable to catch a fish.",255, 200, 100)
                Return
            EndIf ; end miss chance

             ;Player did not miss play some animations and a fish flaping sound and give player a fish

             GiveItem(Player, "Bass Fish", 1)
            OutPut(Player, "You were able to catch a fish.",255, 220, 190)

             FSHP% = Attribute(Target, "Health") - 1 ;Fish Spot health
            SetAttribute(Target, "Health", FSHP)

             ;give and write fishing xp
              ;--------------------------------------------------------------------------------------------------------------------
            ;Send to levelup if Alchemy level should be given.
                  ;get Alchemy xp, add new xp and ccheck if player has a Alchemy level
                    MeleeXp% = Split(ActorGlobal(Player, 2), 1, "|")
                    RangingXp% = Split(ActorGlobal(Player, 2), 2, "|")
                    MagicXp% = Split(ActorGlobal(Player, 2), 3, "|")
                    AlchemyXp% = Split(ActorGlobal(Player, 2), 4, "|")
                    CraftingXp% = Split(ActorGlobal(Player, 2), 5, "|")
                    HerbingXp% = Split(ActorGlobal(Player, 2), 6, "|")
                    MiningXp% = Split(ActorGlobal(Player, 2), 7, "|")
                    PrayerXp% = Split(ActorGlobal(Player, 2), 8, "|")
                    SmeltingXp% = Split(ActorGlobal(Player, 2), 9, "|")
                    WoodCuttingXp% = Split(ActorGlobal(Player, 2), 10, "|")
                    DodgeXp% = Split(ActorGlobal(Player, 2), 11, "|")
                    DexXp% = Split(ActorGlobal(Player, 2), 12, "|")
                    ;extra skills for easy adding later.
                    NewSkillXp1% = Split(ActorGlobal(Player, 2), 13, "|") ;Fishing xp
                    NewSkillXp2% = Split(ActorGlobal(Player, 2), 14, "|")
                    NewskillXp3% = Split(ActorGlobal(Player, 2), 15, "|")
                    NewskillXp4% = Split(ActorGlobal(Player, 2), 16, "|")
                    NewskillXp5% = Split(ActorGlobal(Player, 2), 17, "|")
                    NewskillXp5% = Split(ActorGlobal(Player, 2), 18, "|")

                    FishingXpToGive% = NewSkillXp1 + BaseFishingXp ;get amount of xp

              If (FishingXpToGive >= FishingLvl * 750) ;if player has amount of xp need to level send them to level up

                 ThreadExecute("LevelUp", "Main", Player, Target, 13)	;parameter for Fishing = 13
                  FishingXpToGive% = 0 ;set xp back to 0
              EndIf

      SetActorGlobal(Player, 2, SkillXPToStore) ;set dilimiter to actor global 2 with new Alchemy xp amount
 ;--------------------------------------------------------------------------------------------------------------------

             Return
        EndIf ;end less then 5 fishing level chance

 EndIf ;end fishing rod check

 End Function

```