Difficulty: Moderate 2/5
Although, I already posted the scripts, I have found the right one's and they are fixed.
Mining Script
Explanation
This script will randomly generate a number, which will then allow you to find an ore, or find nothing...
The script is activated as soon as the player stands on the tile that the script is set to.
The higher your level, the easier it is for you to find the ore, or item. ^^
The Code
To install the mining script, follow the instructions below:
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:
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:
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 GoMining(index, item, maxlevel, name)
Dim m
Dim level
level = maxlevel + 1
If GetPlayerlevel(index) < maxlevel Then
m = Int(Rnd * Int(level - GetPlayerLevel(index)))
If m = 1 Then
Call PlayerMsg(index, GetPlayerName(index) & " found " & name & " amongst the rocks.", 2)
Call ReplaceOneInvItem(index, 0, item)
Else
Call PlayerMsg(index, GetPlayerName(index) & " found nothing interesting!", 12)
End If
Else
Call PlayerMsg(index, GetPlayerName(index) & " found " & name & " amongst the rocks.", 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:
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 GoMining(index, #ORE NUM#, #MAX LEVEL#, "#ORE 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 mine the rock (ie. a mining pickaxe).
#EQUIPMENT NAME# - This is the name of the equipment that you need to mine the ore (ie. a mining pickaxe).
#ORE NUM# - This is the number of the item that you want to be able to mine
#ORE NAME# - This is the name of the ore. 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 mining spot, by simply copying and pasting this code into a different free case slot further down, and changing the numbers around.
PM me if you get stuck

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:
GoMining(INDEX, ITEM, MAXLEVEL, "NAME")
-Sets the variables for going mining. Item, is the item number. Maxlevel, is the level at which you start obtaining the ore 100% of the time. Name, is the name of the ore - The name that's printed into the Player Message.
Example:Call GoFishing(index, 24, 5, "Metal Ore")
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:
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
Fishing Script
Explanation
This script will randomly generate a number, which will then allow you to catch a fish, or find nothing...
The script is activated as soon as the player stands on the tile that the script is set to.
The higher your level, the easier it is for you to catch the fish, or item. ^^
The Code
To install the fishing script, follow the instructions below:
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:
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:
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:
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

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:
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