Creator: Unknown_raven
Description: This script allows you to fuse two
items together to make one new one. This allows for adding blacksmithing as you
can fuse various metals together to create swords and what not.
Paste this sub at the bottom of the
main.txt
'
*********************
' * Blacksmithing 1.1 *
' * Made by: Grey *
'
*********************
Sub Blacksmithing(index, item1, value1, item2,
value2, reward, durability, stackable, chance)
' IMPORTANT NOTES
'
-stackable should be set to "True" if reward is a currency item.
' -if the
values of item1 and item2 should be 0 if they are not currency.
' -players
must not try and fuse items that are equipped.
' *Please besure to follow
these notes if you wish the script to work*
emptyslot = 0 'signifys that emptyslot was not
found
item1slot = 0 'signifys that the item was not found
item2slot = 0
'signifys that the item was not found
i = 1
Do While i <=24
x =
GetPlayerInvItemNum(index, i)
If x = 0 Then
If emptyslot = 0
Then
emptyslot = i
End If
End If
If x = item1 Then
If item1slot =
0 Then
item1slot = i
End If
End If
If x = item2 Then
If item2slot
= 0 Then
item2slot = i
End If
End If
i=i+1
Loop
' this
section checks to make sure the player has the required items and space.
If
emptyslot <> 0 Then
If item1slot <> 0 Then
If item2slot
<> 0 Then
If GetPlayerInvItemValue(index, item1slot) >= value1 and
GetPlayerInvItemValue(index, item2slot) >= value2 Then
DICE1=(Int((100 - 1
+ 1) * Rnd + 1))
If DICE1 <= chance Then
i = 1
Do While i <=
24
If GetPlayerInvItemNum(index, i) = reward Then
STACKREWARD = 0
If
GetPlayerInvItemValue(index, i) >= 1 Then
Call PlayerMsg(index, "Value is
" &GetPlayerInvItemValue(index, i), 14)
rewardslot = i
STACKREWARD =
1
i = 25
End If
End If
i=i+1
Loop
If value1 = 0
Then
value1 = 1
End If
If value2 = 0 Then
value2 = 1
End
If
value1 = GetPlayerInvItemValue(index, item1slot)-value1
value2 =
GetPlayerInvItemValue(index, item2slot)-value2
Call PlayerMsg(index, "You
successfully created a new item.", 14)
If value1 <= 0 Then
Call
SetPlayerInvItemNum(index, item1slot, 0)
Call SetPlayerInvItemValue(index,
item1slot, 0)
Else
Call SetPlayerInvItemValue(index, item1slot,
value1)
End If
If value2 <= 0 Then
Call SetPlayerInvItemNum(index,
item2slot, 0)
Call SetPlayerInvItemValue(index, item2slot, 0)
Else
Call
SetPlayerInvItemValue(index, item2slot, value2)
End If
If stackable =
"True" Then
If STACKREWARD = 0 Then
Call SetPlayerInvItemNum(index,
emptyslot, reward)
Call SetPlayerInvItemValue(index, emptyslot, 1)
Call
SetPlayerInvItemDur(index, emptyslot, durability)
Call
SendInventoryUpdate(index, item1slot)
Call SendInventoryUpdate(index,
item2slot)
Call SendInventoryUpdate(index, emptyslot)
Else
Call
SetPlayerInvItemValue(index, rewardslot, GetPlayerInvItemValue(index,
rewardslot)+1)
Call SendInventoryUpdate(index, item1slot)
Call
SendInventoryUpdate(index, item2slot)
Call SendInventoryUpdate(index,
rewardslot)
End If
Else
Call SetPlayerInvItemNum(index, emptyslot,
reward)
Call SetPlayerInvItemValue(index, emptyslot, 1)
Call
SetPlayerInvItemDur(index, emptyslot, durability)
Call
SendInventoryUpdate(index, item1slot)
Call SendInventoryUpdate(index,
item2slot)
Call SendInventoryUpdate(index, emptyslot)
End If
Else
Call PlayerMsg(index, "You failed to create a new item.", 12)
End
If
Else
Call PlayerMsg(index, "You do not have the valid resources to
fuse.", 12)
End If
Else
Call PlayerMsg(index, "You do not have the
valid resources to fuse.", 12)
End If
Else
Call PlayerMsg(index, "You
do not have the valid resources to fuse.", 12)
End If
Else
Call
PlayerMsg(index, "Your inventory is full!", 12)
End If
End
Sub
now you can use the command
Call Blacksmithing(index, item1, value1,
item2, value2, reward, durability, stackable, chance)
-item1 and item2 represent the two items being fused
-value1 and
value2 are for specifying how much of that item you need for the
fusion
-reward is the item that will be created.
-durability is for when
the reward is an item that has durability. If it does not have durability then
just set it to 0.
-stackable is a true/false that you must fill in to specify
whether the item is a currency type or not. Simply say "True" if the reward is
currency and "False" if it is not. Dont forget the quotation marks.
-chance
can be a number from 1-100. It represents the chance of the fusion succeeding.
If it fails nothing is taken away. Best to leave it at 100 if you want it to
always work.