|
|
Elysium Source - Your Only
Source! |
|
View
previous topic :: View
next topic |
Author |
Message |
Markz88 Member
Joined: 18 Mar
2006 Posts: 102
Points
|
Posted: Tue Jul 18,
2006 3:13 am
Post subject: Bank Tutorial (Code for Diamond
v2.0) |
|
|
Tutorial based on: Bank Tutorial (Code from
Deloria) Adapted for Diamond v2.0 by
Markz88
I've tested it, it works for me.
-----------------------------------------------------------------------
////Client/////
In ModTypes, find:
Code: |
Public Const MAX_INV =
24 |
and under it, paste:
Code: |
Public Const MAX_BANK =
50 |
Now find:
Code: |
Public Const TILE_TYPE_NONE
= 20 |
under that, paste:
Code: |
Public Const TILE_TYPE_BANK
= 23 |
Find:
Code: |
Type ChatBubble
Text As String Created As
Long End Type |
under, paste:
Code: |
Type BankRec
Num As Long Value As Long
Dur As Long End
Type |
Find:
Code: |
Spell(1 To
MAX_PLAYER_SPELLS) As
Long |
under that, paste:
Code: |
Bank(1 To MAX_BANK) As
BankRec |
Now, find:
Code: |
For n = 1 To MAX_INV
Player(Index).Inv(n).Num = 0
Player(Index).Inv(n).Value = 0
Player(Index).Inv(n).Dur = 0
Next n |
under paste:
Code: |
For n = 1 To MAX_BANK
Player(Index).Bank(n).Num = 0
Player(Index).Bank(n).Value = 0
Player(Index).Bank(n).Dur = 0
Next n |
Go to the bottom of modTypes and
paste this in:
Code: |
Function
GetPlayerBankItemNum(ByVal Index As Long, ByVal
BankSlot As Long) As Long If
BankSlot > MAX_BANK Then Exit Function
GetPlayerBankItemNum =
Player(Index).Bank(BankSlot).Num End Function
Sub SetPlayerBankItemNum(ByVal Index As
Long, ByVal BankSlot As Long, ByVal ItemNum As
Long)
Player(Index).Bank(BankSlot).Num = ItemNum End
Sub
Function GetPlayerBankItemValue(ByVal
Index As Long, ByVal BankSlot As Long) As Long
GetPlayerBankItemValue =
Player(Index).Bank(BankSlot).Value End
Function
Sub SetPlayerBankItemValue(ByVal
Index As Long, ByVal BankSlot As Long, ByVal
ItemValue As Long)
Player(Index).Bank(BankSlot).Value = ItemValue
End Sub
Function
GetPlayerBankItemDur(ByVal Index As Long, ByVal
BankSlot As Long) As Long
GetPlayerBankItemDur =
Player(Index).Bank(BankSlot).Dur End Function
Sub SetPlayerBankItemDur(ByVal Index As
Long, ByVal BankSlot As Long, ByVal ItemDur As
Long)
Player(Index).Bank(BankSlot).Dur = ItemDur End
Sub |
Switch to modGameLogic Find:
Code: |
If .Type
= TILE_TYPE_SCRIPTED Then
ScriptNum = .Data1
frmMapEditor.optScripted.Value = True
End If | under paste:
Code: |
If .Type = TILE_TYPE_BANK
Then
frmMapEditor.optBank.Value = True
End If |
Find:
Code: |
If
frmMapEditor.optScripted.Value = True Then
.Type = TILE_TYPE_SCRIPTED
.Data1 = ScriptNum
.Data2 = 0
.Data3 = 0
.String1 = ""
.String2 = ""
.String3
= ""
End If |
under that, paste:
Code: |
If
frmMapEditor.optBank.Value = True Then
.Type = TILE_TYPE_BANK
.Data1 = 0
.Data2 = 0
.Data3 = 0
.String1 = ""
.String2 = ""
.String3 = ""
End
If |
Go to the bottom of modGameLogic
and paste this:
Code: |
Sub UpdateBank() Dim i
As Long
frmBank.lstInventory.Clear
frmBank.lstBank.Clear
For i = 1 To
MAX_INV If
GetPlayerInvItemNum(MyIndex, i) > 0 Then
If
Item(GetPlayerInvItemNum(MyIndex, i)).Type =
ITEM_TYPE_CURRENCY Then
frmBank.lstInventory.AddItem
i & "> " &
Trim(Item(GetPlayerInvItemNum(MyIndex, i)).name)
& " (" & GetPlayerInvItemValue(MyIndex, i)
& ")" Else
If
GetPlayerWeaponSlot(MyIndex) = i Or
GetPlayerArmorSlot(MyIndex) = i Or
GetPlayerHelmetSlot(MyIndex) = i Or
GetPlayerShieldSlot(MyIndex) = i Then
frmBank.lstInventory.AddItem i & "> " &
Trim(Item(GetPlayerInvItemNum(MyIndex, i)).name)
& " (worn)"
Else
frmBank.lstInventory.AddItem i & "> " &
Trim(Item(GetPlayerInvItemNum(MyIndex, i)).name)
End
If End If
Else
frmBank.lstInventory.AddItem i & ">
Empty" End If
DoEvents Next i
For i = 1 To MAX_BANK
If GetPlayerBankItemNum(MyIndex,
i) > 0 Then If
Item(GetPlayerBankItemNum(MyIndex, i)).Type =
ITEM_TYPE_CURRENCY Then
frmBank.lstBank.AddItem i
& "> " &
Trim(Item(GetPlayerBankItemNum(MyIndex, i)).name)
& " (" & GetPlayerBankItemValue(MyIndex,
i) & ")" Else
If
GetPlayerWeaponSlot(MyIndex) = i Or
GetPlayerArmorSlot(MyIndex) = i Or
GetPlayerHelmetSlot(MyIndex) = i Or
GetPlayerShieldSlot(MyIndex) = i Then
frmBank.lstBank.AddItem i & "> " &
Trim(Item(GetPlayerBankItemNum(MyIndex, i)).name)
& " (worn)"
Else
frmBank.lstBank.AddItem i & "> " &
Trim(Item(GetPlayerBankItemNum(MyIndex, i)).name)
End
If End If
Else
frmBank.lstBank.AddItem i & ">
Empty" End If
DoEvents Next i frmBank.lstBank.ListIndex
= 0 frmBank.lstInventory.ListIndex = 0 End
Sub |
Now go over to frmMapEditor and
go to cmdFill Find:
Code: |
If optScripted.Value = True
Then
.Type =
TILE_TYPE_SCRIPTED
.Data1 =
ScriptNum
.Data2 = 0
.Data3 = 0
.String1 = ""
.String2 = ""
.String3 = ""
End
If |
after that, paste:
Code: |
If optBank.Value = True Then
.Type = TILE_TYPE_BANK
.Data1 = 0
.Data2 = 0
.Data3 = 0
.String1 = ""
.String2 = ""
.String3 = ""
End If |
Find the GameLoop sub and search
for:
Code: |
If .Light > 0 Then Call
DrawText(TexthDC, x * PIC_X + sx + 18 -
(NewPlayerX * PIC_X) - NewXOffset, y * PIC_Y + sx
+ 14 - (NewPlayerY * PIC_Y) - NewYOffset, "L",
QBColor(Yellow)) |
under that, paste:
Code: |
If .Type = TILE_TYPE_BANK
Then Call DrawText(TexthDC, x * PIC_X + sx + 8 -
(NewPlayerX * PIC_X) - NewXOffset, y * PIC_Y + sx
+ 8 - (NewPlayerY * PIC_Y) - NewYOffset, "BANK",
QBColor(BrightRed)) |
Now you go over to the HandleData
sub (inside modClientTCP) and search for the packet:
Code: |
Player worn equipment
packet |
under that packet, paste:
Code: |
'
:::::::::::::::::::::::: ' ::
Player bank packet :: '
:::::::::::::::::::::::: If
LCase(Parse(0)) = "playerbank" Then
n = 1
For i = 1 To MAX_BANK
Call
SetPlayerBankItemNum(MyIndex, i, Val(Parse(n)))
Call
SetPlayerBankItemValue(MyIndex, i, Val(Parse(n +
1)))
Call SetPlayerBankItemDur(MyIndex, i, Val(Parse(n
+ 2)))
n = n + 3
Next i
If frmBank.Visible = True
Then Call UpdateBank
Exit Sub End If
'
:::::::::::::::::::::::::::::::
' :: Player bank update packet ::
' :::::::::::::::::::::::::::::::
If LCase(Parse(0)) =
"playerbankupdate" Then
n = Val(Parse(1))
Call
SetPlayerBankItemNum(MyIndex, n, Val(Parse(2)))
Call
SetPlayerBankItemValue(MyIndex, n, Val(Parse(3)))
Call
SetPlayerBankItemDur(MyIndex, n, Val(Parse(4)))
If frmBank.Visible
= True Then Call UpdateBank
Exit Sub End If
If
LCase(Parse(0)) = "openbank" Then
frmBank.lblBank.Caption =
Trim(Map(GetPlayerMap(MyIndex)).name)
frmBank.lstInventory.Clear
frmBank.lstBank.Clear
For i = 1 To MAX_INV
If
GetPlayerInvItemNum(MyIndex, i) > 0 Then
If Item(GetPlayerInvItemNum(MyIndex,
i)).Type = ITEM_TYPE_CURRENCY Then
frmBank.lstInventory.AddItem i &
"> " &
Trim(Item(GetPlayerInvItemNum(MyIndex, i)).name)
& " (" & GetPlayerInvItemValue(MyIndex, i)
& ")"
Else
If GetPlayerWeaponSlot(MyIndex) = i Or
GetPlayerArmorSlot(MyIndex) = i Or
GetPlayerHelmetSlot(MyIndex) = i Or
GetPlayerShieldSlot(MyIndex) = i Then
frmBank.lstInventory.AddItem i & "> " &
Trim(Item(GetPlayerInvItemNum(MyIndex, i)).name)
& " (worn)"
Else
frmBank.lstInventory.AddItem i & "> " &
Trim(Item(GetPlayerInvItemNum(MyIndex, i)).name)
End If
End If
Else
frmBank.lstInventory.AddItem
i & "> Empty"
End If
DoEvents
Next i
For
i = 1 To MAX_BANK
If GetPlayerBankItemNum(MyIndex, i)
> 0 Then
If
Item(GetPlayerBankItemNum(MyIndex, i)).Type =
ITEM_TYPE_CURRENCY Then
frmBank.lstBank.AddItem i & "> " &
Trim(Item(GetPlayerBankItemNum(MyIndex, i)).name)
& " (" & GetPlayerBankItemValue(MyIndex,
i) & ")"
Else
If GetPlayerWeaponSlot(MyIndex) = i Or
GetPlayerArmorSlot(MyIndex) = i Or
GetPlayerHelmetSlot(MyIndex) = i Or
GetPlayerShieldSlot(MyIndex) = i Then
frmBank.lstBank.AddItem i & "> " &
Trim(Item(GetPlayerBankItemNum(MyIndex, i)).name)
& " (worn)"
Else
frmBank.lstBank.AddItem i & "> " &
Trim(Item(GetPlayerBankItemNum(MyIndex, i)).name)
End If
End If
Else
frmBank.lstBank.AddItem i
& "> Empty"
End If
DoEvents
Next i
frmBank.lstBank.ListIndex = 0
frmBank.lstInventory.ListIndex = 0
frmBank.Show vbModal
Exit Sub End If
If
LCase(Parse(0)) = "bankmsg" Then
frmBank.lblMsg.Caption =
Trim(Parse(1))
Exit Sub End
If |
Now download the Bank Form (http://chaosfusion.com/elysiumwiki/DELORIA_BANK_FORM.rar)
And add it to the project (Right click the FORMS
folder, go to Add, then "Add File...", last browse for
the bank form, wherever you extracted it)
After
go to the frmMapEditor, add an OptionButton item (click
the OptionButton item on the toolbar and put it in the
fraAttribs [attributes frame]), and rename it optBank
Last edited by Markz88 on Tue Jul
18, 2006 1:07 pm; edited 1 time in
total | |
Back
to top |
|
|
Markz88 Member
Joined: 18 Mar
2006 Posts: 102
Points
|
Posted: Tue Jul 18,
2006 5:03 am
Post subject: |
|
|
////Server/////
Open your server project!
Go to ModTypes
and find:
Code: |
Public Const MAX_INV =
24 |
under it, past:
Code: |
Public Const MAX_BANK =
50 |
Find:
Code: |
Public Const TILE_TYPE_NONE
= 20 |
under, paste:
Code: |
Public Const TILE_TYPE_BANK
= 23 |
Find:
Code: |
Type PlayerInvRec
Num As Long
Value
As Long
Dur As Long
End Type |
under that, past:
Code: |
Type BankRec
Num As Long
Value
As Long
Dur As Long
End Type |
Find:
Code: |
Spell(1 To
MAX_PLAYER_SPELLS) As
Long |
under it, paste:
Code: |
Bank(1 To MAX_BANK) As
BankRec |
In ClearPlayer sub, find:
Code: |
For N = 1 To MAX_INV
Player(Index).Char(i).Inv(N).num = 0
Player(Index).Char(i).Inv(N).Value = 0
Player(Index).Char(i).Inv(N).Dur = 0
Next |
after that, past:
Code: |
For N = 1 To MAX_BANK
Player(Index).Char(i).Bank(N).num = 0
Player(Index).Char(i).Bank(N).Value = 0
Player(Index).Char(i).Bank(N).Dur = 0
Next
N |
In ClearChar sub, find:
Code: |
For N = 1 To MAX_INV
Player(Index).Char(CharNum).Inv(N).num = 0
Player(Index).Char(CharNum).Inv(N).Value = 0
Player(Index).Char(CharNum).Inv(N).Dur = 0
Next |
under it, paste:
Code: |
For N = 1 To MAX_BANK
Player(Index).Char(CharNum).Bank(N).num = 0
Player(Index).Char(CharNum).Bank(N).Value = 0
Player(Index).Char(CharNum).Bank(N).Dur = 0
Next N |
Go to the bottom of modTypes and
paste this in:
Code: |
Function
GetPlayerBankItemNum(ByVal index As Long, ByVal
BankSlot As Long) As Long
GetPlayerBankItemNum =
Player(index).Char(Player(index).CharNum).Bank(BankSlot).Num
End Function
Sub
SetPlayerBankItemNum(ByVal index As Long, ByVal
BankSlot As Long, ByVal ItemNum As Long)
Player(index).Char(Player(index).CharNum).Bank(BankSlot).Num
= ItemNum Call
SendBankUpdate(index, BankSlot) End Sub
Function GetPlayerBankItemValue(ByVal
index As Long, ByVal BankSlot As Long) As Long
GetPlayerBankItemValue =
Player(index).Char(Player(index).CharNum).Bank(BankSlot).Value
End Function
Sub
SetPlayerBankItemValue(ByVal index As Long, ByVal
BankSlot As Long, ByVal ItemValue As Long)
Player(index).Char(Player(index).CharNum).Bank(BankSlot).Value
= ItemValue Call
SendBankUpdate(index, BankSlot) End Sub
Function GetPlayerBankItemDur(ByVal index
As Long, ByVal BankSlot As Long) As Long
GetPlayerBankItemDur =
Player(index).Char(Player(index).CharNum).Bank(BankSlot).Dur
End Function
Sub
SetPlayerBankItemDur(ByVal index As Long, ByVal
BankSlot As Long, ByVal ItemDur As Long)
Player(index).Char(Player(index).CharNum).Bank(BankSlot).Dur
= ItemDur End Sub |
Go to the bottom ModGameLogic and
paste this in:
Code: |
Function
FindOpenBankSlot(ByVal index As Long, ByVal
ItemNum As Long) As Long Dim i As Long
FindOpenBankSlot = 0
' Check for subscript out of range
If IsPlaying(index) = False Or
ItemNum <= 0 Or ItemNum > MAX_ITEMS Then
Exit Function
End If
If Item(ItemNum).Type =
ITEM_TYPE_CURRENCY Then
' If currency then check to see if they
already have an instance of the item and add it to
that For i = 1 To
MAX_BANK
If GetPlayerBankItemNum(index, i) = ItemNum
Then
FindOpenBankSlot = i
Exit Function
End If
Next i End If
For i = 1 To MAX_BANK
' Try to find an
open free slot If
GetPlayerBankItemNum(index, i) = 0 Then
FindOpenBankSlot = i
Exit Function
End If Next
i End Function |
Find the GiveItem sub and under
that sub, paste this:
Code: |
Sub TakeBankItem(ByVal index
As Long, ByVal ItemNum As Long, ByVal ItemVal As
Long) Dim i As Long, n As Long Dim
TakeBankItem As Boolean
TakeBankItem = False
' Check for subscript out of range
If IsPlaying(index) = False Or
ItemNum <= 0 Or ItemNum > MAX_ITEMS Then
Exit Sub
End If
For i = 1 To MAX_BANK
' Check to see if the player
has the item If
GetPlayerBankItemNum(index, i) = ItemNum Then
If
Item(ItemNum).Type = ITEM_TYPE_CURRENCY Then
' Is what we are trying to take away
more then what they have? If so just set it to
zero
If ItemVal >=
GetPlayerBankItemValue(index, i) Then
TakeBankItem = True
Else
Call
SetPlayerBankItemValue(index, i,
GetPlayerBankItemValue(index, i) - ItemVal)
Call
SendBankUpdate(index, i)
End If
Else
' Check to see if its any sort of
ArmorSlot/WeaponSlot
Select Case
Item(GetPlayerBankItemNum(index, i)).Type
Case ITEM_TYPE_WEAPON
If
GetPlayerWeaponSlot(index) > 0 Then
If i =
GetPlayerWeaponSlot(index) Then
Call SetPlayerWeaponSlot(index, 0)
Call SendWornEquipment(index)
TakeBankItem = True
Else
' Check if the item we are taking isn't
already equipped
If ItemNum
<>
GetPlayerBankItemNum(index,GetPlayerWeaponSlot(index))
Then
TakeBankItem =
True
End If
End If
Else
TakeBankItem = True
End If
Case ITEM_TYPE_ARMOR
If
GetPlayerArmorSlot(index) > 0 Then
If i =
GetPlayerArmorSlot(index) Then
Call SetPlayerArmorSlot(index, 0)
Call SendWornEquipment(index)
TakeBankItem = True
Else
' Check if the item we are taking isn't
already equipped
If ItemNum
<>
GetPlayerBankItemNum(index,GetPlayerArmorSlot(index))
Then
TakeBankItem =
True
End If
End If
Else
TakeBankItem = True
End If
Case
ITEM_TYPE_HELMET
If GetPlayerHelmetSlot(index) > 0 Then
If i = GetPlayerHelmetSlot(index) Then
Call
SetPlayerHelmetSlot(index, 0)
Call SendWornEquipment(index)
TakeBankItem = True
Else
'
Check if the item we are taking isn't already
equipped
If ItemNum <>
GetPlayerBankItemNum(index,GetPlayerHelmetSlot(index))
Then
TakeBankItem =
True
End If
End If
Else
TakeBankItem = True
End If
Case
ITEM_TYPE_SHIELD
If GetPlayerShieldSlot(index) > 0 Then
If i = GetPlayerShieldSlot(index) Then
Call
SetPlayerShieldSlot(index, 0)
Call SendWornEquipment(index)
TakeBankItem = True
Else
'
Check if the item we are taking isn't already
equipped
If ItemNum <>
GetPlayerBankItemNum(index,GetPlayerShieldSlot(index))
Then
TakeBankItem =
True
End If
End If
Else
TakeBankItem = True
End If
End
Select
n =
Item(GetPlayerBankItemNum(index, i)).Type
' Check if its not an equipable
weapon, and if it isn't then take it away
If (n <> ITEM_TYPE_WEAPON) And
(n <> ITEM_TYPE_ARMOR) And (n <>
ITEM_TYPE_HELMET) And (n <>
ITEM_TYPE_SHIELD) Then
TakeBankItem = True
End If
End
If
If TakeBankItem = True Then
Call SetPlayerBankItemNum(index, i, 0)
Call SetPlayerBankItemValue(index, i, 0)
Call SetPlayerBankItemDur(index, i,
0)
' Send the Bank update
Call SendBankUpdate(index, i)
Exit Sub
End If
End If Next i
End Sub
Sub GiveBankItem(ByVal index
As Long, ByVal ItemNum As Long, ByVal ItemVal As
Long, ByVal BankSlot As Long) Dim i As Long
' Check for subscript out of
range If IsPlaying(index) =
False Or ItemNum <= 0 Or ItemNum > MAX_ITEMS
Then Exit Sub
End If
i = BankSlot
' Check to see if Bankentory is
full If i <> 0 Then
Call
SetPlayerBankItemNum(index, i, ItemNum)
Call
SetPlayerBankItemValue(index, i,
GetPlayerBankItemValue(index, i) + ItemVal)
If (Item(ItemNum).Type =
ITEM_TYPE_ARMOR) Or (Item(ItemNum).Type =
ITEM_TYPE_WEAPON) Or (Item(ItemNum).Type =
ITEM_TYPE_HELMET) Or (Item(ItemNum).Type =
ITEM_TYPE_SHIELD) Then
Call
SetPlayerBankItemDur(index, i,
Item(ItemNum).Data1)
End If Else
Call SendDataTo(index,
"bankmsg" & SEP_CHAR & "Bank full!" &
SEP_CHAR & END_CHAR) End If
End Sub |
Go to the PlayerMove sub, and at
the end of the sub, but BEFORE the command End Sub,
paste this:
Code: |
' Check if player
stepped on Bank tile If
Map(GetPlayerMap(index)).Tile(GetPlayerX(index),
GetPlayerY(index)).Type = TILE_TYPE_BANK Then
Call
SendDataTo(index, "openbank" & SEP_CHAR &
END_CHAR) End
If |
Go to the JoinGame sub and find:
Code: |
Call
SendInventory(index) |
under that, paste:
Code: |
Call
SendBank(index) |
Go to modGeneral and go to the
InitServer sub, find:
Code: |
If
LCase$(Dir$(App.Path & "\shops", vbDirectory))
<> "shops" Then
Call MkDir$(App.Path & "\Shops")
End If |
under it, paste:
Code: |
If LCase(Dir(App.Path & "\banks",
vbDirectory)) <> "banks" Then
Call MkDir(App.Path &
"\Banks") End
If |
Go to modServerTCP, then go to
SendInventory sub, and above that, paste this:
Code: |
Sub SendBank(ByVal index As
Long) Dim Packet As String Dim i As Long
Packet = "PLAYERBANK" &
SEP_CHAR For i = 1 To MAX_BANK
Packet = Packet
& GetPlayerBankItemNum(index, i) &
SEP_CHAR & GetPlayerBankItemValue(index, i)
& SEP_CHAR & GetPlayerBankItemDur(index,
i) & SEP_CHAR Next i
Packet = Packet & END_CHAR
Call
SendDataTo(index, Packet) End Sub
Sub
SendBankUpdate(ByVal index As Long, ByVal BankSlot
As Long) Dim Packet As String
Packet =
"PLAYERBANKUPDATE" & SEP_CHAR & BankSlot
& SEP_CHAR & GetPlayerBankItemNum(index,
BankSlot) & SEP_CHAR &
GetPlayerBankItemValue(index, BankSlot) &
SEP_CHAR & GetPlayerBankItemDur(index,
BankSlot) & SEP_CHAR & END_CHAR
Call SendDataTo(index, Packet) End
Sub |
Go to clsCommands, and at the
bottom, paste this:
Code: |
Function
GetPlayerBankItemNum(ByVal index As Long, ByVal
BankSlot As Long) As Long
GetPlayerBankItemNum =
Player(index).Char(Player(index).CharNum).Bank(BankSlot).Num
End Function
Sub
SetPlayerBankItemNum(ByVal index As Long, ByVal
BankSlot As Long, ByVal ItemNum As Long)
Player(index).Char(Player(index).CharNum).Bank(BankSlot).Num
= ItemNum Call
SendBankUpdate(index, BankSlot) End Sub
Function GetPlayerBankItemValue(ByVal
index As Long, ByVal BankSlot As Long) As Long
GetPlayerBankItemValue =
Player(index).Char(Player(index).CharNum).Bank(BankSlot).Value
End Function
Sub
SetPlayerBankItemValue(ByVal index As Long, ByVal
BankSlot As Long, ByVal ItemValue As Long)
Player(index).Char(Player(index).CharNum).Bank(BankSlot).Value
= ItemValue Call
SendBankUpdate(index, BankSlot) End Sub
Function GetPlayerBankItemDur(ByVal index
As Long, ByVal BankSlot As Long) As Long
GetPlayerBankItemDur =
Player(index).Char(Player(index).CharNum).Bank(BankSlot).Dur
End Function
Sub
SetPlayerBankItemDur(ByVal index As Long, ByVal
BankSlot As Long, ByVal ItemDur As Long)
Player(index).Char(Player(index).CharNum).Bank(BankSlot).Dur
= ItemDur End Sub |
Go to the HandleData sub which is
in modServerTCP, and search for:
Code: |
Call SendDataTo(index,
Packs) |
Under that, paste this:
Code: |
If
FileExist("banks\" & Trim(Name) & ".ini")
= False Then
For i =
1 To MAX_CHARS
For n = 1 To MAX_BANK
Call
PutVar(App.Path & "\banks\" & Trim(Name)
& ".ini", "CHAR" & i, "BankItemNum" &
n, STR(Player(index).Char(i).Bank(n).Num))
Call PutVar(App.Path & "\banks\" &
Trim(Name) & ".ini", "CHAR" & i,
"BankItemVal" & n,
STR(Player(index).Char(i).Bank(n).Value))
Call PutVar(App.Path & "\banks\" &
Trim(Name) & ".ini", "CHAR" & i,
"BankItemDur" & n,
STR(Player(index).Char(i).Bank(n).Dur))
Next n
Next i
End If
|
Go to HandleData sub, and under
the last variable being declared, paste this:
Code: |
Dim TempNum As Long, TempVal
As Long |
Go to the end of the HandleData
sub, and right before the HackingAttempt call, paste
this :
Code: |
Select Case LCase(Parse(0))
Case "bankdeposit"
x =
GetPlayerInvItemNum(index, Val(Parse(1)))
i =
FindOpenBankSlot(index, x)
If i = 0 Then
Call SendDataTo(index,
"bankmsg" & SEP_CHAR & "Bank full!" &
SEP_CHAR & END_CHAR)
Exit Sub
End If
If
Val(Parse(2)) > GetPlayerInvItemValue(index,
Val(Parse(1))) Then
Call SendDataTo(index,
"bankmsg" & SEP_CHAR & "You cant deposit
more than you have!" & SEP_CHAR &
END_CHAR)
Exit Sub
End If
If GetPlayerWeaponSlot(index)
= Val(Parse(1)) Or GetPlayerArmorSlot(index) =
Val(Parse(1)) Or GetPlayerShieldSlot(index) =
Val(Parse(1)) Or GetPlayerHelmetSlot(index) =
Val(Parse(1)) Then
Call SendDataTo(index, "bankmsg"
& SEP_CHAR & "You cant deposit worn
equipment!" & SEP_CHAR & END_CHAR)
Exit
Sub End If
If Item(x).Type = ITEM_TYPE_CURRENCY
Then
If Val(Parse(2)) <= 0 Then
Call
SendDataTo(index, "bankmsg" & SEP_CHAR &
"You must deposit more than 0!" & SEP_CHAR
& END_CHAR)
Exit Sub
End If
End If
Call TakeItem(index, x, Val(Parse(2)))
Call
GiveBankItem(index, x, Val(Parse(2)), i)
Call SendBank(index)
Exit Sub
Case "bankwithdraw"
i =
GetPlayerBankItemNum(index, Val(Parse(1)))
TempVal =
Val(Parse(2)) x =
FindOpenInvSlot(index, i)
If x = 0 Then
Call SendDataTo(index,
"bankmsg" & SEP_CHAR & "Inventory full!"
& SEP_CHAR & END_CHAR)
Exit Sub
End If
If
Val(Parse(2)) > GetPlayerBankItemValue(index,
Val(Parse(1))) Then
Call SendDataTo(index,
"bankmsg" & SEP_CHAR & "You cant withdraw
more than you have!" & SEP_CHAR &
END_CHAR)
Exit Sub
End If
If Item(i).Type = ITEM_TYPE_CURRENCY Then
If
Val(Parse(2)) <= 0 Then
Call
SendDataTo(index, "bankmsg" & SEP_CHAR &
"You must withdraw more than 0!" & SEP_CHAR
& END_CHAR)
Exit Sub
End If
If Trim(LCase(Item(GetPlayerInvItemNum(index,
x)).Name)) <> "gold" Then
If
GetPlayerInvItemValue(index, x) + Val(Parse(2))
> 100 Then
TempVal
= 100 - GetPlayerInvItemValue(index, x)
End If
End If End
If
Call
GiveItem(index, i, TempVal)
Call TakeBankItem(index, i, TempVal)
Call SendBank(index)
Exit Sub End Select
|
Go to modDatabase, and then go to
SavePlayer sub, search:
Code: |
' Spells For N = 1
To MAX_PLAYER_SPELLS
Call PutVar(FileName, "CHAR"
& i, "Spell" & N,
STR(Player(Index).Char(i).Spell(N)))
Next
|
under that, paste:
Code: |
FileName = App.Path & "\banks\" &
Trim(Player(index).Login) & ".ini"
' Bank
For n = 1 To MAX_BANK
Call
PutVar(FileName, "CHAR" & i, "BankItemNum"
& n, STR(Player(index).Char(i).Bank(n).Num))
Call
PutVar(FileName, "CHAR" & i, "BankItemVal"
& n, STR(Player(index).Char(i).Bank(n).Value))
Call
PutVar(FileName, "CHAR" & i, "BankItemDur"
& n, STR(Player(index).Char(i).Bank(n).Dur))
Next
n |
Scroll down to LoadPlayer,
search:
Code: |
' Spells For N = 1
To MAX_PLAYER_SPELLS
Call PutVar(FileName, "CHAR"
& i, "Spell" & N,
STR(Player(Index).Char(i).Spell(N)))
Next
|
under it, paste:
Code: |
FileName = App.Path
& "\banks\" & Trim(Name) & ".ini"
' Bank
For n = 1 To MAX_BANK
Player(index).Char(i).Bank(n).Num =
Val(GetVar(FileName, "CHAR" & i,"BankItemNum"
& n))
Player(index).Char(i).Bank(n).Value =
Val(GetVar(FileName, "CHAR" & i, "BankItemVal"
& n))
Player(index).Char(i).Bank(n).Dur =
Val(GetVar(FileName, "CHAR" & i,"BankItemDur"
& n)) Next
n |
That's all | |
Back
to top |
|
Jamie Member
Joined: 23 Feb
2006 Posts: 144 Location:
England Points
|
Posted: Tue Jul 18,
2006 9:44 am
Post subject: |
|
|
wow looks good, il
add it soon and il tell ya if it works _________________
| |
Back
to top |
|
Markz88 Member
Joined: 18 Mar
2006 Posts: 102
Points
|
Posted: Mon Jul 24,
2006 2:05 pm
Post subject: |
|
|
Did you
try? | |
Back
to top |
|
NexSteve Sr. Member
Joined: 04 Mar 2006 Posts:
566 Location: Missouri Points
|
Posted: Mon Jul 24,
2006 9:44 pm
Post subject: |
|
|
Isnt this tutorial
already on here somewhere
else? _________________
| |
Back
to top |
|
Markz88 Member
Joined: 18 Mar
2006 Posts: 102
Points
|
Posted: Wed Jul 26,
2006 2:00 am
Post subject: |
|
|
NexSteve wrote: |
Isnt this tutorial already
on here somewhere else? |
I dont' think, I saw only Bank
Tutorial (Code from Deloria) | |
Back
to top |
|
ManiacSteve Sr. Member
Joined: 14 May
2006 Posts: 251
Points
|
Posted: Wed Jul 26,
2006 9:30 am
Post subject: |
|
|
yeah the other 1
needs adapting to Diamond but this one has been adapted
already, however i didnt use this 1 as you can tell
because it was added in V4 of ET before you posted
lol _________________ maniacsteve@hotmail.co.uk | |
Back
to top |
|
iresh Member
Joined: 09 May
2006 Posts: 164
Points
|
Posted: Thu Aug 03,
2006 11:23 am
Post subject: |
|
|
THere ae a few notes.
As written, this code places a limit of 100
currency items tha taren't named "gold"
I had to
delete that part of the code when i put tit in my game.
Since you are so kind as to adapt this to
DDiamond, think you are up to making a version that
instead of storing the banks per playe,r making one that
uses the MAP NUMBER to determine the data file used?
We have "guild towers" in our gme, and peoepl
want a shared item storage area for guildies, you see.
and it's not a s simple as cutting and pasting and
slightly changing the bank code here. | |
Back
to top |
|
two noob 4
u Señor
Noob
Joined: 31 Jul 2006 Posts: 465 Location:
ZZZ Town Points
|
Posted: Tue Aug 22,
2006 9:04 pm
Post subject: |
|
|
U TOTALLY FLUFFED UP
THIS TUT I CAN'T PUT DOWN ANY OTHER
TILES _________________ Muunster's The MAN!!!!!!!
No Longer Working On MMORPGS Game | |
Back
to top |
|
Markz88 Member
Joined: 18 Mar
2006 Posts: 102
Points
|
Posted: Wed Aug 23,
2006 4:06 am
Post subject: |
|
|
two
noob 4 u wrote: |
U TOTALLY FLUFFED UP THIS
TUT I CAN'T PUT DOWN ANY OTHER
TILES | FLUFFED what means? I'm italian and I
don't understand this word...
However, this is
the fix for the problem of 100 gold!
- SERVER SIDE -
Find:
visual basic
code:
LCase(Item(GetPlayerInvItemNum(index,
X)).Name)) <> "gold" Then
If GetPlayerInvItemValue(index,
X) + Val(Parse(2)) > 100 Then
TempVal = 100 - GetPlayerInvItemValue(index,
X)
End
If
replace it
with:
visual basic
code:
LCase(Item(GetPlayerInvItemNum(index,
X)).Name)) <> "gold" Then
If GetPlayerInvItemValue(index,
X) + Val(Parse(2)) > 1999999999 Then
TempVal = 1999999999 - GetPlayerInvItemValue(index,
X)
End
If
thanks to
Imperial | |
Back
to top |
|
two noob 4
u Señor
Noob
Joined: 31 Jul 2006 Posts: 465 Location:
ZZZ Town Points
|
Posted: Thu Aug 24,
2006 5:25 pm
Post subject: |
|
|
Markz88
wrote: |
two
noob 4 u wrote: |
U TOTALLY FLUFFED UP THIS
TUT I CAN'T PUT DOWN ANY OTHER
TILES | FLUFFED what means? I'm italian
and I don't understand this word...
However, this is the fix for the problem
of 100 gold!
|
Fluff = fucked
u
fucked it up i cant put down any other tiles but bank
with the news compiled
client _________________ Muunster's The MAN!!!!!!!
No Longer Working On MMORPGS Game | |
Back
to top |
|
Neon Sr. Member
Joined: 01 Jun 2006 Posts:
353 Location: Manistee,
Michigan. Points
|
Posted: Thu Aug 24,
2006 5:29 pm
Post subject: |
|
|
Perhaps you should
learn a little more? It's not hard to fix that at all.
I'll give you a hint, it's got something to do with
an addition to the Client source.
It works
PERFECTLY for me.
Last edited by Neon on Thu Aug
24, 2006 5:46 pm; edited 1 time in
total | |
Back
to top |
|
frozengod Sr. Member
Joined: 11 May 2006 Posts:
658 Location: Unknown Points
|
Posted: Thu Aug 24,
2006 5:39 pm
Post subject: |
|
|
im italian too :P
mark you should try to get that visual bank to work, it
would be cool if you could get it to work
:P _________________
| |
Back
to top |
|
El_Dindonnier Newcomer
Joined: 18 Jun
2006 Posts: 17
Points
|
Posted: Sat Aug 26,
2006 9:00 am
Post subject: |
|
|
Good job thanks you
| |
Back
to top |
|
Budda Newcomer
Joined: 01 Sep
2006 Posts: 15 Location: That place over
there>>> Points
|
Posted: Sat Sep 16,
2006 4:26 am
Post subject: |
|
|
Quote: |
After go to the
frmMapEditor, add an OptionButton item (click the
OptionButton item on the toolbar and put it in the
fraAttribs [attributes frame]), and rename it
optBank |
Ummmm is something missing from
here? I was adding this tut in as my players wanted a
bank, and realised all this part is a button with a
name. I carried on anyways, finished everything, tried
adding a bank tile and it does nothing.
Someone
help please. I have no idea what to do as I'm not very
good at VB. _________________ I am the Budda.
The one and only. If anyone else claims to be
Budda, Please shoot them in the face. | |
Back
to top |
|
|
|
|
You can post new topics in this
forum You can reply to topics in this forum You
cannot edit your posts in this forum You
cannot delete your posts in this forum You
cannot vote in polls in this
forum
|
|
|
|
Powered by phpBB © 2001, 2002
phpBB Group iCGstation v1.0 Template By Ray © 2003, 2004
iOptional
|
| |
|