Eclipse
January 05, 2009, 08:17:02 PM *
Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
News:
 
   Home   Chat Help Rules Arcade Search Calendar Gallery Login Register  
 
 
 
Recent Topics +-
Sig please :) by Kreator
Today at 08:16:38 PM

Disparity Recruiting by The Tribal
Today at 08:16:25 PM

Lostica [Project Revamp] by The Tribal
Today at 08:13:21 PM

The New Eclipse Raid on Runscape by Devogen
Today at 08:12:00 PM

32 by 32 pd by ‪‫‬‭‮‪‫‬‭The Admiral
Today at 08:03:00 PM

Actual Map for the continents by Amperglyph
Today at 07:54:10 PM

Last one to post Wins by Hikaru
Today at 07:46:39 PM

Spike's Adminishness! by Marsh
Today at 07:36:56 PM

My Game by Sʎ|3><(_)z
Today at 07:36:22 PM

THE Cult by ‪‫‬‭‮‪‫‬‭The Admiral
Today at 07:34:15 PM

Members Online +-
11 Guests, 22 Users
Kreator,
thingyguy,
The Tribal,
‪‫‬‭‮‪‫‬‭The Admiral,
The Roujo,
The BanHammer! [Thor!],
Devogen,
ʇıunpp ʎqɹıʞ࣭,
Teh_General,
Doomteam1,
Ambard,
The Troy,
Airscar,
Peter,
Hikaru,
dg1423,
westin444,
Artorios,
Japez,
Cynicle,
Amperglyph,
grenegg1
Pages: [1]
  Print  
Author Topic: fishing script  (Read 1528 times)
0 Members and 1 Guest are viewing this topic.
snowking2
Newb
*
Offline Offline

Posts: 22


View Profile Email
« on: July 18, 2006, 09:29:17 AM »

1) Find the blank part just above the 'Sub ScriptedTile(index, Script)' part in main.txt. I have shown it on the diagram below. This is NOT the code you have to copy and paste in.



Code:
Code:
Sub DropItems(index)
    If GetPlayerWeaponSlot(index) > 0 Then
        Call PlayerMapDropItem(index, GetPlayerWeaponSlot(index), 0)
    End If

    If GetPlayerArmorSlot(index) > 0 Then
        Call PlayerMapDropItem(index, GetPlayerArmorSlot(index), 0)
    End If
   
    If GetPlayerHelmetSlot(index) > 0 Then
        Call PlayerMapDropItem(index, GetPlayerHelmetSlot(index), 0)
    End If

    If GetPlayerShieldSlot(index) > 0 Then
        Call PlayerMapDropItem(index, GetPlayerShieldSlot(index), 0)
    End If
End Sub
###############BLANK PART!###############
Sub ScriptedTile(index, Script)
Select Case Script
    Case 0
        Call Flash(index, "Intro.swf")



2) Paste the following piece of script into the blank area that we just found (shown on the last diagram):

Code:
Code:
Sub ReplaceOneInvItem(index, olditem, newitem)
Dim n
n = 1
Do
   If GetPlayerInvItemNum(index, n) = olditem Then
      Call SetPlayerInvItemNum(index, n, newitem)
      Call SendInventoryUpdate(index, n)
      Exit Do
   End If
   n = n + 1
Loop Until n > 24
End Sub

Sub GoFishing(index, item, maxlevel, name)
   Dim c
   Dim level
   level = maxlevel + 1
      If GetPlayerlevel(index) < maxlevel Then
         c = Int(Rnd * Int(level - GetPlayerLevel(index)))
         If c = 1 Then
            Call PlayerMsg(index, GetPlayerName(index) & " caught a " & name, 2)
            Call ReplaceOneInvItem(index, 0, item)
         Else
            Call PlayerMsg(index, GetPlayerName(index) & " found nothing!", 12)
         End If
      Else
         Call PlayerMsg(index, GetPlayerName(index) & " caught a " & name, 2)
         Call ReplaceOneInvItem(index, 0, item)
      End If
End Sub
 



3)Ok. Now that you have pasted that part in, its time to add the part you will actually tread on.

Find the cases section within Main.txt, and then find the next case number that is not being used. For this demo, we will assume that we are on case 2 - However, some of you may be on different numbers


Code:
Code:
    Case 9
   dim weapon
   weapon = GetPlayerWeaponSlot(index)
   If weapon = 0 Then
      Call PlayerMsg(index, "You don't have a #EQUIPMENT NAME# equiped", 15)
      ElseIf GetPlayerInvItemNum(index, weapon) = #EQUIPMENT NUM# Then
      Call GoFishing(index, #FISH NUM#, #MAX LEVEL#, "#FISH NAME")
      Else
      Call PlayerMsg(index, "You don't have a #EQUIPMENT NAME# equiped", 15)
   End If



Parts you need to change

#EQUIPMENT NUM# - This is the item number of the equipment you need to catch the fish (ie. a fishing net).

#EQUIPMENT NAME# - This is the name of the equipment that you need to catch the fish (ie. a fishing net).

#FISH NUM# - This is the number of the item that you want to be able to catch

#FISH NAME# - This is the name of the fish. Just change the name, DO NOT delete the quotation marks from around the name ^^.

#MAX LEVEL# - This is the level at which you will start to catch the fish 100% of the time

PLEASE NOTE: That, you can make it so that you can have more than one fishing spot, by simply copying and pasting this code into a free case slot further down, and changing the numbers around.
PM me if you get stuck XD



For the more advanced programmers

A more advanced programmer would notice that I have made two new Sub-Routines; called 'GoFishing' and 'ReplaceOneInvItem'. Any of you are welcome to use this subroutine, and I shall give you the Syntax for it:


GoFishing(INDEX, ITEM, MAXLEVEL, "NAME")
-Sets the variables for going fishing. Item, is the item number. Maxlevel, is the level at which you start catching the fish 100% of the time. Name, is the name of the fish - The name that's printed into the Player Message.

Example:Call GoFishing(index, 24, 5, "Shrimp")
ReplaceOneInvItem(INDEX, OLDITEM, NEWITEM)

-This replaces just ONE of the items in your inventory with another item. Set the replace item to 0, to replace the item with an empty slot, or to fill the next empty slot.

Example:Call ReplaceOneInvItem(index, 24, 0)


However, some of you may be wondering why it is replace 'ONE' inv item. This is because i have made another which i shall also give you the syntax for ^^. ReplaceAllInvItems(INDEX, OLDITEM, NEWITEM)

Will search every single slot in your inventory and replace an item with a new item. Set the replace item to 0, to replace the items with an empty slot, or to fill all the empty slots.

ExampleCall ReplaceAllInvItems(index, 24, 0)

And then, you will also need the code for this sub... (Although you DO NOT need this code to make the fishing script work)


Code:
Code:
Sub ReplaceAllInvItem(index, olditem, newitem)

Dim n
n = 1
Do
   If GetPlayerInvItemNum(index, n) = olditem Then
      Call SetPlayerInvItemNum(index, n, newitem)
      Call SendInventoryUpdate(index, n)
   End If
   n = n + 1
Loop Until n > 24
End Sub
IrunoHatake
Active Member
***
Offline Offline

Posts: 109



View Profile WWW Email
« Reply #1 on: April 12, 2008, 10:31:45 AM »

??? you didn't explain which case section ???
where does this go?

Code: [Select]
    Case 9
   dim weapon
   weapon = GetPlayerWeaponSlot(index)
   If weapon = 0 Then
      Call PlayerMsg(index, "You don't have a #EQUIPMENT NAME# equiped", 15)
      ElseIf GetPlayerInvItemNum(index, weapon) = #EQUIPMENT NUM# Then
      Call GoFishing(index, #FISH NUM#, #MAX LEVEL#, "#FISH NAME")
      Else
      Call PlayerMsg(index, "You don't have a #EQUIPMENT NAME# equiped", 15)
   End If
[/s]

EDIT: nm also is it possible for it to check not only if u have a fishing item but a item like bait also? i put bait as a shield so probably check shield right?
Pages: [1]
  Print  
 
 

Powered by EzPortal
Powered by MySQL Powered by PHP Powered by SMF 2.0 Beta 4 | SMF © 2006–2008, Simple Machines LLC | Sitemap Valid XHTML 1.0! Valid CSS!
Page created in 0.285 seconds with 33 queries.