Mirage Source

Free ORPG making software.
It is currently Thu Apr 18, 2024 1:38 pm

All times are UTC


Forum rules


Make sure your tutorials are kept up to date with the latest MS4 releases.



Post new topic Reply to topic  [ 1259 posts ]  Go to page 1, 2, 3, 4, 5 ... 51  Next
Author Message
 Post subject: Fishing
PostPosted: Sun Jan 25, 2009 1:46 am 
Offline
Persistant Poster
User avatar

Joined: Thu Jul 24, 2008 6:42 am
Posts: 703
Google Talk: infectiousbyte@gmail.com
This is a simple fishing system. Read the code, and find out what it does. xD, It's heavily commented, so it shouldn't be too hard.

Download this and add it to your clients source:
http://www.mediafire.com/file/mwnjonyzzqt/frmFish.frm

Server Side
SPOILER: (click to show)
Under:
Code:
Sub HandleQuit


Add:
Code:
Sub HandleGoFishing(ByVal Index As Long)
    Dim Chance As Long
    Dim FishRod As Long
    Dim Fishname As Long
    Dim BaitNum As Long

    Fishname = Map(GetPlayerMap(Index)).Tile(GetPlayerX(Index), GetPlayerY(Index)).Data1
    FishRod = Map(GetPlayerMap(Index)).Tile(GetPlayerX(Index), GetPlayerY(Index)).Data2
    BaitNum = Map(GetPlayerMap(Index)).Tile(GetPlayerX(Index), GetPlayerY(Index)).Data3
    Chance = Rand(100, GetPlayerLevel(Index))
   

    'Make sure they have the fishing rod.
    If GetPlayerInvItemNum(Index, GetPlayerEquipmentSlot(Index, Weapon)) = FishRod Then

        If BaitNum <> 0 Then
            'Check to make sure they have the bait
            If HasItem(Index, BaitNum) Then
                'Take the bait
                Call TakeItem(Index, BaitNum, 1)
            End If
        End If

        'If the baitnum is 0 than don't make it harder if they don't have any
        If BaitNum = 0 Then
            Chance = Rand(100, GetPlayerLevel(Index))
        Else
            'They don't have the bait... Make it twice as hard to catch
            Chance = Rand(200, GetPlayerLevel(Index))
        End If
       
        'Randomize based on players level. If chance = 100, you caught a fish!
        If Chance = 100 Then
            Call PlayerMsg(Index, "You have caught a " & Item(Fishname).Name, Blue)
            'WE'RE HAVING FISH TONITE OMNOMNOMNOM
            Call GiveItem(Index, Fishname, 1)
        Else
            Call PlayerMsg(Index, "Your attempt at catching a fish, has failed", Red)
        End If

    Else
        Call PlayerMsg(Index, "You need a: " & Item(FishRod).Name, Blue)
    End If

End Sub


Under
Code:
Sub HandleAttack(ByVal Index As Long)
    Dim i As Long
    Dim n As Long
    Dim Damage As Long
    Dim TempIndex As Long


Add:
Code:
    If Map(GetPlayerMap(Index)).Tile(GetPlayerX(Index), GetPlayerY(Index)).Type = TILE_TYPE_FISHING Then
        Call HandleGoFishing(Index)
        Exit Sub
    End If


Find:
Code:
Public Const TILE_TYPE_KEYOPEN As Byte = 6


Under it add:
Code:
Public Const TILE_TYPE_FISHING As Byte = 7


Find:
Code:
Function isNameLegal(ByVal sInput As Integer) As Boolean


Under it add:
Code:
Function Rand(ByVal High As Long, ByVal Low As Long)
    Randomize
    High = High + 1

    Do Until Rand >= Low
        Rand = Int(Rnd * High)
    Loop

End Function


Client Side
SPOILER: (click to show)
Go into your map editor, right click the frame that has Fringe, Ground, Etc, etc. Click Send to back. Now you should see options like: Item, Blocked, ETc, etc. Add an option there and name it OptFishing. Double click it and add:

Code:
Private Sub OptFishing_Click()
    frmFish.Show vbModal
End Sub
to it.

Find:
Code:
Public Const TILE_TYPE_KEYOPEN As Byte = 6


Under it add:
Code:
Public Const TILE_TYPE_FISHING As Byte = 7


Then find:
Code:
' Used for map key open editor
Public KeyOpenEditorX As Long

Public KeyOpenEditorY As Long


Under it add:
Code:
'Used for the fish editor
Public FishNumber As Long

Public ToolNumber As Long

Public BaitNumber As Long


Then find:
Code:
                If frmMirage.optKeyOpen.Value Then
                    .Type = TILE_TYPE_KEYOPEN
                    .Data1 = KeyOpenEditorX
                    .Data2 = KeyOpenEditorY
                    .Data3 = 0
                End If


Under it add:
Code:
                If frmMirage.OptFishing.Value Then
                    .Type = TILE_TYPE_FISHING
                    .Data1 = FishNumber
                    .Data2 = ToolNumber
                    .Data3 = BaitNumber
                End If


Then find:
Code:
Case TILE_TYPE_KEYOPEN
                            DrawText TexthDC, ((X * PIC_X) - 4) + (PIC_X * 0.5), ((Y * PIC_Y) - 7) + (PIC_Y * 0.5), "O", QBColor(White)


Under it add:
Code:
                         Case TILE_TYPE_FISHING
                            DrawText TexthDC, ((X * PIC_X) - 4) + (PIC_X * 0.5), ((Y * PIC_Y) - 7) + (PIC_Y * 0.5), "F", QBColor(Blue)

Voila, it's done.

_________________
Image
GIAKEN wrote:
Since I'm into men, not women

GIAKEN wrote:
I can't take these huge penises anymore! All that's left is shame! And blood


Last edited by Nean on Fri Feb 27, 2009 2:02 pm, edited 3 times in total.

Top
 Profile  
 
 Post subject: Re: Fishing
PostPosted: Sun Jan 25, 2009 4:50 am 
Offline
Regular

Joined: Fri Feb 16, 2007 6:57 pm
Posts: 77
Google Talk: pepin1337@gmail.com
This is a great tutorial. Everything works 100%.

Thanks Nean :)


Top
 Profile  
 
 Post subject: Re: Fishing
PostPosted: Sun Jan 25, 2009 7:41 pm 
Offline
Persistant Poster
User avatar

Joined: Thu Jul 24, 2008 6:42 am
Posts: 703
Google Talk: infectiousbyte@gmail.com
I edited Sub GoFishing to make bait optional, I also uploaded a new form, so go ahead and download it. This one seems to work a bit better.

_________________
Image
GIAKEN wrote:
Since I'm into men, not women

GIAKEN wrote:
I can't take these huge penises anymore! All that's left is shame! And blood


Top
 Profile  
 
 Post subject: Re: Fishing
PostPosted: Sat Jan 31, 2009 8:57 pm 
Offline
Regular
User avatar

Joined: Mon Sep 22, 2008 4:37 am
Posts: 40
Google Talk: emerl19@gmail.com
Where the hell is Sub HandleQuit
i search for it and it tells me its not there

_________________
Image


Top
 Profile  
 
 Post subject: Re: Fishing
PostPosted: Sat Jan 31, 2009 9:34 pm 
Searching the entire project?


Top
  
 
 Post subject: Re: Fishing
PostPosted: Sun Feb 01, 2009 4:04 am 
Offline
Knowledgeable
User avatar

Joined: Fri Feb 02, 2007 4:50 am
Posts: 263
Location: usa michigan centriville
everything worked 100% for me as well Rian could you please move this to working tuts thank you.

_________________
Fuck? I really joined in 2006.
Spirea, Chat Rooms, Discussions, Help. everything you need in one spot.
http://spirean.com
I love my computer, you never ask for more, you can be my princess or be my whore


Top
 Profile  
 
 Post subject: Re: Fishing
PostPosted: Sun Feb 01, 2009 4:19 am 
Quit assuming you're the lead on the project. It's still DFA's project, he's lead, he'll say when a tut should be moved.

-_- God you annoy me.


Top
  
 
 Post subject: Re: Fishing
PostPosted: Sun Feb 01, 2009 4:53 am 
Offline
Regular
User avatar

Joined: Mon Sep 22, 2008 4:37 am
Posts: 40
Google Talk: emerl19@gmail.com
Matt wrote:
Searching the entire project?


Yep :O
What version of Mirage is this for?
Just a question..or...maybe its just me.....

_________________
Image


Top
 Profile  
 
 Post subject: Re: Fishing
PostPosted: Sun Feb 01, 2009 6:24 am 
Offline
Persistant Poster
User avatar

Joined: Thu Jul 24, 2008 6:42 am
Posts: 703
Google Talk: infectiousbyte@gmail.com
Well... It is in the MS4 tutorials board....

_________________
Image
GIAKEN wrote:
Since I'm into men, not women

GIAKEN wrote:
I can't take these huge penises anymore! All that's left is shame! And blood


Top
 Profile  
 
 Post subject: Re: Fishing
PostPosted: Mon Feb 02, 2009 2:48 pm 
Offline
Knowledgeable
User avatar

Joined: Fri Feb 02, 2007 4:50 am
Posts: 263
Location: usa michigan centriville
who said anything about me wanting to be lead =P. i just want to make sure the good tutorials are separated form the not working ones.

_________________
Fuck? I really joined in 2006.
Spirea, Chat Rooms, Discussions, Help. everything you need in one spot.
http://spirean.com
I love my computer, you never ask for more, you can be my princess or be my whore


Top
 Profile  
 
 Post subject: Re: Fishing
PostPosted: Mon Feb 02, 2009 3:28 pm 
Offline
Submit-Happy
User avatar

Joined: Fri Jun 16, 2006 7:01 am
Posts: 2768
Location: Yorkshire, UK
Nean, learn when to use commas.

Quote:
Your attempt at catching a fish, has failed


Wrong.

_________________
Quote:
Robin:
Why aren't maps and shit loaded up in a dynamic array?
Jacob:
the 4 people that know how are lazy
Robin:
Who are those 4 people?
Jacob:
um
you, me, and 2 others?


Image


Top
 Profile  
 
 Post subject: Re: Fishing
PostPosted: Mon Feb 02, 2009 8:02 pm 
Shouldn't be any commas unless what's BETWEEN the commas can be removed from the sentence and the sentence STILL makes sense. Of if you're using something with the word and and have more than 2 things involved.

Robin and Nean.

Robin, Matt and Nean.

See?


Top
  
 
 Post subject: Re: Fishing
PostPosted: Mon Feb 02, 2009 10:15 pm 
Offline
Community Leader
User avatar

Joined: Sun May 28, 2006 10:29 pm
Posts: 1762
Location: Salt Lake City, UT, USA
Google Talk: Darunada@gmail.com
http://grammar.ccc.commnet.edu/grammar/commas.htm


Don't shoot your pages with a comma shotgun :D

_________________
I'm on Facebook! Google Plus LinkedIn My Youtube Channel Send me an email Call me with Skype Check me out on Bitbucket Yup, I'm an EVE Online player!
Why not try my app, ColorEye, on your Android devlce?
Do you like social gaming? Fight it out in Battle Juice!

I am a professional software developer in Salt Lake City, UT.


Top
 Profile  
 
 Post subject: Re: Fishing
PostPosted: Mon Feb 02, 2009 10:58 pm 
Offline
Persistant Poster
User avatar

Joined: Thu Jul 24, 2008 6:42 am
Posts: 703
Google Talk: infectiousbyte@gmail.com
I lol'd really hard.

I will take this page to heart... When I'm not baked.

_________________
Image
GIAKEN wrote:
Since I'm into men, not women

GIAKEN wrote:
I can't take these huge penises anymore! All that's left is shame! And blood


Top
 Profile  
 
 Post subject: Re: Fishing
PostPosted: Tue Feb 03, 2009 12:41 am 
Offline
Regular

Joined: Wed Oct 31, 2007 11:41 pm
Posts: 43
thanks, added this to 3.0.3 only had to change like 2 lines of coding (Y)


Top
 Profile  
 
 Post subject: Re: Fishing
PostPosted: Tue Feb 03, 2009 1:07 am 
Offline
Persistant Poster
User avatar

Joined: Thu Jul 24, 2008 6:42 am
Posts: 703
Google Talk: infectiousbyte@gmail.com
So while we're still on topic, was there anything that was done badly? Unoptomized?

_________________
Image
GIAKEN wrote:
Since I'm into men, not women

GIAKEN wrote:
I can't take these huge penises anymore! All that's left is shame! And blood


Top
 Profile  
 
 Post subject: Re: Fishing
PostPosted: Tue Feb 03, 2009 10:37 am 
Offline
Submit-Happy
User avatar

Joined: Fri Jun 16, 2006 7:01 am
Posts: 2768
Location: Yorkshire, UK
Lea wrote:
http://grammar.ccc.commnet.edu/grammar/commas.htm


Don't shoot your pages with a comma shotgun :D


Never trust an American website with teaching you English.

_________________
Quote:
Robin:
Why aren't maps and shit loaded up in a dynamic array?
Jacob:
the 4 people that know how are lazy
Robin:
Who are those 4 people?
Jacob:
um
you, me, and 2 others?


Image


Top
 Profile  
 
 Post subject: Re: Fishing
PostPosted: Tue Feb 03, 2009 4:40 pm 
Fuck English. I prefer to speak American. :P


Top
  
 
 Post subject: Re: Fishing
PostPosted: Tue Feb 03, 2009 4:55 pm 
Offline
Submit-Happy
User avatar

Joined: Fri Jun 16, 2006 7:01 am
Posts: 2768
Location: Yorkshire, UK
Matt wrote:
Fuck English. I prefer to speak Gangsta. :P

_________________
Quote:
Robin:
Why aren't maps and shit loaded up in a dynamic array?
Jacob:
the 4 people that know how are lazy
Robin:
Who are those 4 people?
Jacob:
um
you, me, and 2 others?


Image


Top
 Profile  
 
 Post subject: Re: Fishing
PostPosted: Tue Feb 03, 2009 5:23 pm 
If you heard me speak in real life, I do speak more gangsta than anything, sadly. However, that doesn't make me black. You're gonna make me hook up my damn webcam and prove I'm white. Lol.


Top
  
 
 Post subject: Re: Fishing
PostPosted: Tue Feb 03, 2009 5:29 pm 
Offline
Community Leader
User avatar

Joined: Sun May 28, 2006 10:29 pm
Posts: 1762
Location: Salt Lake City, UT, USA
Google Talk: Darunada@gmail.com
color filters to wonderful things matt, you can't lie to us we know the truth!

_________________
I'm on Facebook! Google Plus LinkedIn My Youtube Channel Send me an email Call me with Skype Check me out on Bitbucket Yup, I'm an EVE Online player!
Why not try my app, ColorEye, on your Android devlce?
Do you like social gaming? Fight it out in Battle Juice!

I am a professional software developer in Salt Lake City, UT.


Top
 Profile  
 
 Post subject: Re: Fishing
PostPosted: Tue Feb 03, 2009 5:34 pm 
Lea wrote:
color filters to wonderful things matt, you can't lie to us we know the truth!


I feel bad for you when we finally meet in person, Lea. You're gonna have to wear sunglasses the entire time just so you don't lose your mind. Lol.


Top
  
 
 Post subject: Re: Fishing
PostPosted: Wed Feb 04, 2009 12:05 am 
Offline
Community Leader
User avatar

Joined: Sun May 28, 2006 10:29 pm
Posts: 1762
Location: Salt Lake City, UT, USA
Google Talk: Darunada@gmail.com
lol

_________________
I'm on Facebook! Google Plus LinkedIn My Youtube Channel Send me an email Call me with Skype Check me out on Bitbucket Yup, I'm an EVE Online player!
Why not try my app, ColorEye, on your Android devlce?
Do you like social gaming? Fight it out in Battle Juice!

I am a professional software developer in Salt Lake City, UT.


Top
 Profile  
 
 Post subject: Re: Fishing
PostPosted: Wed Feb 18, 2009 6:14 pm 
Offline
Knowledgeable

Joined: Thu Nov 22, 2007 2:59 pm
Posts: 143
Location: London, England
Google Talk: aeronjl+mirage@googlemail.com
How would I be able to add a time constraint so people don't spam fish. I.e. you can only fish once every 10 seconds.
Would I use a timer?


Top
 Profile  
 
 Post subject: Re: Fishing
PostPosted: Wed Feb 18, 2009 6:15 pm 
Offline
Submit-Happy
User avatar

Joined: Fri Jun 16, 2006 7:01 am
Posts: 2768
Location: Yorkshire, UK
Acruno wrote:
How would I be able to add a time constraint so people don't spam fish. I.e. you can only fish once every 10 seconds.
Would I use a timer?


Sure, if you're using Elysium.

_________________
Quote:
Robin:
Why aren't maps and shit loaded up in a dynamic array?
Jacob:
the 4 people that know how are lazy
Robin:
Who are those 4 people?
Jacob:
um
you, me, and 2 others?


Image


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 1259 posts ]  Go to page 1, 2, 3, 4, 5 ... 51  Next

All times are UTC


Who is online

Users browsing this forum: wanai and 11 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB® Forum Software © phpBB Group