Jump to content
Search In
  • More options...
Find results that contain...
Find results in...

[EO 2] Epic Resource Mod


Richy420Rich
 Share

Recommended Posts

I'm going to finally release my epic resource mod for EO 2.0 - 2.3.

What do it do?

1. It adds dynamic recs for resource level, experience, and the likes.
2. It allows multiple resource materials to be gathered from one resource at a selected resource level.
3. It allows linking resources, EG: You can't cook without fish, you can't smith without ores!
4. It allows taking stacked and non-stacked items for the linking resource.
5. It allows the giving of rare items.
6. It allows a resource description for resource info-help logs, (Logs not included).
7. It tells a player what is needed for a resource if they attack it with a wrong tool.
8. It utilizes a graphical interface which when a tool is equipped, it brings up a window for a player to choose their material.
9. It utilizes a HotKey which can be pressed while tool is equipped to open the window and choose again.
10. Blah blah blah, let's get started.

Difficulty? 10-10! You should be alright if you follow this step by step correctly, and if I make sure everything is added here lol.

**Step 1**

Back up your client and server files before attempting.

**Step 2**

Download the attachment I placed here, extract it and place it inside your clients **src** folder.

[attachment=1112:ResourceSrc.zip]

**Step 3**

Open VB6 and make sure your frmEditor_Resource looks like this:

![](http://i.imgur.com/64FdJd3.png)

**Step 4**

Inside frmMain, you're going to want to create a Picture Box. Name it: PicResource

After that, you're going to want to create another Picture Box inside, height/width = 32/32

Name this second Picture Box: PicResourceItem

**Step 5**

After making PicResourceItem, you're going to want to copy and paste this control. Right click

on the Picture Box and click 'copy'. Then inside PicResource, right click and click 'paste'.

Doing this will tell you that you already have a PicResouceItem, would you like to create an array? Click YES.

Paste this control 14 more times. The end result should look something like this:

![](http://i.imgur.com/muVFaJL.png)

After you create 16 PicResourceItems, go back to your first one, inside your Property Window, find INDEX

set this INDEX to 16\. Also, set PicResource.visible to false in its property window.

![](http://i.imgur.com/winKFwc.png)

**Step 6**

Double click on PicResourceItem, you're going to want to paste this code inside the Sub:

```

Call SendMaterialRequest(Index, HoldResourceNum)

```
After the End Sub, make a new line and make sure it's clear, then paste this code in:

```

Private Sub PicResourceItem_MouseMove(Index As Integer, Button As Integer, Shift As Integer, x As Single, y As Single)

If Index > 0 Then
x = PicResource.Left + picItemDesc.width - 80
y = PicResource.top - picItemDesc.height - 40
UpdateDescWindow Resource(HoldResourceNum).ItemReward(Index), x, y
LastItemDesc = Resource(HoldResourceNum).ItemReward(Index)
Exit Sub
End If

picItemDesc.Visible = False
LastItemDesc = 0 ' no item was last loaded

End Sub

```
**Step 7**

Go inside modGameEditors, look for ResourceEditorInit. Remove that entire sub and paste this in:

```

' ////////////////
' // Resource Editor //
' ////////////////
Public Sub ResourceEditorInit()
Dim i As Long
Dim SoundSet As Boolean

' If debug mode, handle error then exit out
If Options.Debug = 1 Then On Error GoTo errorhandler

If frmEditor_Resource.Visible = False Then Exit Sub
EditorIndex = frmEditor_Resource.lstIndex.ListIndex + 1

' populate the cache if we need to
If Not hasPopulated Then
PopulateLists
End If
' add the array to the combo
frmEditor_Resource.cmbSound.Clear
frmEditor_Resource.cmbSound.AddItem "None."
For i = 1 To UBound(soundCache)
frmEditor_Resource.cmbSound.AddItem soundCache(i)
Next
' finished populating

With frmEditor_Resource
.scrlExhaustedPic.Max = NumResources
.scrlNormalPic.Max = NumResources
.scrlAnimation.Max = MAX_ANIMATIONS
.scrlItemLevel.Max = MAX_LEVELS

.txtName.text = Trim$(Resource(EditorIndex).Name)
.txtMessage.text = Trim$(Resource(EditorIndex).SuccessMessage)
.txtMessage2.text = Trim$(Resource(EditorIndex).EmptyMessage)
.txtlogit.text = Trim$(Resource(EditorIndex).TalkAboutIt)
.cmbType.ListIndex = Resource(EditorIndex).ResourceType
.scrlNormalPic.Value = Resource(EditorIndex).ResourceImage
.scrlExhaustedPic.Value = Resource(EditorIndex).ExhaustedImage
.scrlTool.Value = Resource(EditorIndex).ToolRequired
.scrlHealth.Value = Resource(EditorIndex).health
.scrlRespawn.Value = Resource(EditorIndex).RespawnTime
.scrlAnimation.Value = Resource(EditorIndex).Animation
.HScroll1.Value = Resource(EditorIndex).ResourceGiveExp
.scrlMultiItem.Value = 1
.scrlItemLevel.Value = 1

.scrlReward.Value = Resource(EditorIndex).ItemReward(1)
.scrlrewardvalue.Value = 1
.scrlItemneeded.Value = Resource(EditorIndex).ItemNeeded(1)
.scrlItemvalue.Value = Resource(EditorIndex).ItemValueNeeded(1)
.scrlrareitem.Value = Resource(EditorIndex).RareItem(1)

.Check1.Value = Resource(EditorIndex).IsLinked

' find the sound we have set
If .cmbSound.ListCount >= 0 Then
For i = 0 To .cmbSound.ListCount
If .cmbSound.List(i) = Trim$(Resource(EditorIndex).Sound) Then
.cmbSound.ListIndex = i
SoundSet = True
End If
Next
If Not SoundSet Or .cmbSound.ListIndex = -1 Then .cmbSound.ListIndex = 0
End If
End With

Call EditorResource_BltSprite

Resource_Changed(EditorIndex) = True

' Error handler
Exit Sub
errorhandler:
HandleError "ResourceEditorInit", "modGameEditors", Err.Number, Err.Description, Err.Source, Err.HelpContext
Err.Clear
Exit Sub
End Sub

```
**Step 8**

Go to modGlobals and place this at the bottom, this keeps track of the resource number during Material selecting.

```

Public HoldResourceNum As Byte

```
**Step 9**

Go to modHandleData and place this code at the bottom:

```

Private Sub HandleResourceMaterial(ByVal Index As Long, ByRef Data() As Byte, ByVal StartAddr As Long, ByVal ExtraVar As Long)
'Modification(S)
Dim buffer As clsBuffer
Dim i As Long
Dim resourcenum As Long
Dim ItemNumber As Long
Dim Picture As Long
Dim Level As Long
Dim n As Long

Set buffer = New clsBuffer
buffer.WriteBytes Data()

resourcenum = buffer.ReadLong
HoldResourceNum = resourcenum

For n = 1 To 16
frmMain.PicResourceItem(n).Visible = False
Next

For i = 1 To 16
ItemNumber = buffer.ReadLong
If ItemNumber > 0 Then
Picture = buffer.ReadLong
Level = buffer.ReadLong
frmMain.PicResourceItem(i) = LoadPicture(App.Path & "\data files\graphics\items\" & Picture & ".bmp")
frmMain.PicResourceItem(i).Visible = True
Resource(resourcenum).ItemReward(i) = ItemNumber

If Level = 99 Then
Exit For
End If
End If
Next i

frmMain.PicResource.Visible = True
Set buffer = Nothing

End Sub

```
**Step 10**

While inside modHandleData, go to InitMessages and add this at the bottom.

```

HandleDataSub(SResourceMaterial) = GetAddress(AddressOf HandleResourceMaterial)

```
**Step 11**

Go to modEnumerations and add these to the S/C packet lists, make sure they are last, but before CMSG_COUNT and SMSG_COUNT. SResourceMaterial goes with the Server packet list while CResourceMaterial goes with the Client packet list.

```

SResourceMaterial
CResourceMaterial

```
**Step 12**

Go to modClientTCP, paste this in a blank line.

```

Sub SendMaterialRequest(ByVal ItemValue As Integer, ByVal resourcenum As Long)
'Modification(S)
Dim buffer As clsBuffer
Dim ItemReward As Long
Dim ResNum As Long

ItemReward = ItemValue
ResNum = resourcenum

Set buffer = New clsBuffer
buffer.WriteLong CResourceMaterial
buffer.WriteLong ItemReward
buffer.WriteLong ResNum
SendData buffer.ToArray()

frmMain.PicResource.Visible = False
Set buffer = Nothing
End Sub

```
**Step 13**

Go to modTypes, look for Public Type ResourceRec, replace the whole type with this:

(Note that this will most likely force you to delete all resources.)

```

Private Type ResourceRec
Name As String * NAME_LENGTH
SuccessMessage As String * NAME_LENGTH
EmptyMessage As String * NAME_LENGTH
Sound As String * NAME_LENGTH
ResourceType As Byte
ResourceImage As Long
ExhaustedImage As Long
ItemReward(1 To 16) As Long
ToolRequired As Long
health As Long
RespawnTime As Long
Walkthrough As Boolean
Animation As Long
ResourceGiveExp As Long
ItemLevel(1 To 16) As Long
IsLinked As Byte
ItemNeeded(1 To 16) As Long
ItemValueNeeded(1 To 16) As Long
RareItem(1 To 16) As Long
DescTool As String * NAME_LENGTH
TalkAboutIt As String * 500
RewardValue(1 To 16) As Long
End Type

```
Still inside modTypes, go inside PlayerRec and add these to the bottom, above End Type:

```

' Resource stuffs
ResourceLv(1 To MAX_RESOURCES) As Byte
ResourceExp(1 To MAX_RESOURCES) As Long
ResourceNextLv(1 To MAX_RESOURCES) As Long
ResourceBonusExp(1 To MAX_RESOURCES) As Long
MaterialRequested As Long

```
**Step 14**

Go to modInput, CheckInputKeys, and place this after the End If of GetKeyState(vbkeyControl):

This uses ESCAPE to bring the material window back up, which can be changed simply by checking another key's state.

```

If GetKeyState(vbKeyEscape) < 0 Then
If GetPlayerEquipment(MyIndex, Weapon) > 0 Then
If Item(GetPlayerEquipment(MyIndex, Weapon)).Data3 > 0 Then
frmMain.PicResource.Visible = True
End If
End If
End If
```
**Step 15**

(SAVING POST AS DRAFT)

Congratulations if you've made it this far! I believe we're done with all of the client side work, (save your client and compile it).. If all works well, lets move on to the server:

**Step 16**

Okay, on the server, let's go to modTypes: Replace the ResourceRec with this:

```

Private Type ResourceRec
Name As String * NAME_LENGTH
SuccessMessage As String * NAME_LENGTH
EmptyMessage As String * NAME_LENGTH
Sound As String * NAME_LENGTH
ResourceType As Byte
ResourceImage As Long
ExhaustedImage As Long
ItemReward(1 To 16) As Long
ToolRequired As Long
health As Long
RespawnTime As Long
Walkthrough As Boolean
Animation As Long
ResourceGiveExp As Long
ItemLevel(1 To 16) As Long
IsLinked As Byte
ItemNeeded(1 To 16) As Long
ItemValueNeeded(1 To 16) As Long
RareItem(1 To 16) As Long
DescTool As String * NAME_LENGTH
TalkAboutIt As String * 500
RewardValue(1 To 16) As Long
End Type

```
And the PlayerRec on the bottom, above End Type: Place this.

```

' Resource stuffs
ResourceLv(1 To MAX_RESOURCES) As Byte
ResourceExp(1 To MAX_RESOURCES) As Long
ResourceNextLv(1 To MAX_RESOURCES) As Long
ResourceBonusExp(1 To MAX_RESOURCES) As Long
MaterialRequested As Long

```
**Step 17**

Now we'll go to modServerTCP and place this in:

```

Sub SendResourceMaterial(ByVal index As Long, ByVal itemnum As Long)
'Modification(S)
Dim Buffer As clsBuffer
Dim i As Long
Dim ResourceNum As Long
Dim ItemNumber As Long
Dim Picture As Long
Dim level As Long

ResourceNum = Item(itemnum).Data3

If Len(Trim(Resource(ResourceNum).Name)) <= 0 Then Exit Sub

Set Buffer = New clsBuffer
Buffer.WriteLong SResourceMaterial

Buffer.WriteLong ResourceNum

For i = 1 To 16
ItemNumber = Resource(ResourceNum).ItemReward(i)
Buffer.WriteLong ItemNumber
If ItemNumber > 0 Then
Picture = Item(Resource(ResourceNum).ItemReward(i)).Pic
Buffer.WriteLong Picture
level = Resource(ResourceNum).ItemLevel(i)
Buffer.WriteLong level
End If
Next

SendDataTo index, Buffer.ToArray()
Set Buffer = Nothing
End Sub

```
**Step 18**

Now we'll go over to modHandleData, first let's go to the bottom and place this in:

```

Public Sub HandleResourceMaterial(ByVal index As Long, ByRef Data() As Byte, ByVal StartAddr As Long, ByVal ExtraVar As Long)
'Modification(S)
Dim Buffer As clsBuffer
Dim ItemReward As Long
Dim ResNum As Long

Set Buffer = New clsBuffer
Buffer.WriteBytes Data()

ItemReward = Buffer.ReadLong
ResNum = Buffer.ReadLong

If ItemReward < 0 Or ItemReward > 16 Then Exit Sub
If ResNum <= 0 Or ResNum > MAX_RESOURCES Then Exit Sub

If IsPlaying(index) Then
If Player(index).ResourceLv(ResNum) >= Resource(ResNum).ItemLevel(ItemReward) Then
Player(index).MaterialRequested = ItemReward
PlayerMsg index, "You have chosen to obtain the " & Trim(Item(Resource(ResNum).ItemReward(ItemReward)).Name) & " with this skill tool.", brightgreen
Else
PlayerMsg index, "You're not the required level to obtain this material, please re-equip the skill tool to choose another!", brightred
Player(index).MaterialRequested = 1
End If
End If

End Sub

```
**Step 19**

Stay inside modHandleData, look for InitMessages, place this on the bottom.

```

HandleDataSub(CResourceMaterial) = GetAddress(AddressOf HandleResourceMaterial)

```
**Step 20**

Go to modEnumerations and add these to the S/C packet lists, make sure they are last, but before CMSG_COUNT and SMSG_COUNT. SResourceMaterial goes with the Server packet list while CResourceMaterial goes with the Client packet list.

```

SResourceMaterial
CResourceMaterial
```
**Step 21**

Let's go to modPlayer, find CheckResource, replace that whole sub with this:

```

Sub CheckResource(ByVal index As Long, ByVal X As Long, ByVal Y As Long)
Dim Resource_num As Long
Dim Resource_index As Long
Dim rX As Long, rY As Long
Dim i As Long
Dim Damage As Long
Dim Exp As Long
Dim FinalReward As Long
Dim attackspeed As Long
Dim PercentageComplete As Long
Dim SpawnARare As Long
Dim checkme As Boolean
Dim extrarate As Long
Dim scanvalue As Long
Dim countvalue As Long
Dim percentageexp As Long
Dim Buffer As clsBuffer

'Gather the attack speed from tool.
If GetPlayerEquipment(index, Weapon) > 0 Then
attackspeed = Item(GetPlayerEquipment(index, Weapon)).Speed
Else
attackspeed = 1000
End If

'If a players attack speed is irregular, exit out.
If TempPlayer(index).AttackTimer + attackspeed > GetTickCount Then Exit Sub

checkme = True

'Make sure the player is actually next to the job source.
If Map(GetPlayerMap(index)).Tile(X, Y).Type = TILE_TYPE_RESOURCE Then
Resource_num = 0
Resource_index = Map(GetPlayerMap(index)).Tile(X, Y).Data1

' Get the cache number of the job.
For i = 0 To ResourceCache(GetPlayerMap(index)).Resource_Count

If ResourceCache(GetPlayerMap(index)).ResourceData(i).X = X Then
If ResourceCache(GetPlayerMap(index)).ResourceData(i).Y = Y Then
Resource_num = i
End If
End If

Next

'Checks for resource index, and the job tool.
If Resource_num > 0 Then
If GetPlayerEquipment(index, Weapon) > 0 Then
If Item(GetPlayerEquipment(index, Weapon)).Data3 = Resource(Resource_index).ToolRequired Then

'Grabbing the item which the player chose to gather.
FinalReward = Player(index).MaterialRequested

'Check to see if the item and level are correct.
If Resource(Resource_index).ItemReward(FinalReward) <= 0 And Resource(Resource_index).ItemReward(FinalReward) > MAX_ITEMS Then Exit Sub
If Player(index).ResourceLv(Resource_index) < Resource(Resource_index).ItemLevel(FinalReward) Then Exit Sub

'Enough inventory?
If FindOpenInvSlot(index, Resource(Resource_index).ItemReward(FinalReward)) = 0 Then
PlayerMsg index, "You have no inventory space.", brightred
Exit Sub
End If

'Check to see if resource is linked.
If Resource(Resource_index).IsLinked > 0 Then

'Is there an item even offered?
If Resource(Resource_index).ItemNeeded(FinalReward) <= 0 And Resource(Resource_index).ItemNeeded(FinalReward) > MAX_ITEMS Or Resource(Resource_index).ItemValueNeeded(FinalReward) <= 0 Then
PlayerMsg index, "This skill has no item requirements set, please contact an admin with this problem.", brightred
Exit Sub
End If

If Item(Resource(Resource_index).ItemNeeded(FinalReward)).Type = ITEM_TYPE_CURRENCY Then
If Not HasItem(index, Resource(Resource_index).ItemNeeded(FinalReward)) = Resource(Resource_index).ItemValueNeeded(FinalReward) Then
PlayerMsg index, "You need " & Resource(Resource_index).ItemValueNeeded(FinalReward) & " " & Trim$(Item(Resource(Resource_index).ItemNeeded(FinalReward)).Name) & " to interact with this skill!", brightred
Exit Sub
End If
Else
'If so. Check if player has item required before allowing them to do skill.
scanvalue = Resource(Resource_index).ItemValueNeeded(FinalReward)
countvalue = 0

For i = 1 To MAX_INV
If GetPlayerInvItemNum(index, i) = Resource(Resource_index).ItemNeeded(FinalReward) Then
countvalue = countvalue + 1
End If
Next

If countvalue < scanvalue Then
PlayerMsg index, "You need " & Resource(Resource_index).ItemValueNeeded(FinalReward) & " " & Trim$(Item(Resource(Resource_index).ItemNeeded(FinalReward)).Name) & " to interact with this skill!", brightred
Exit Sub
End If

End If
End If

'Check if job was already completed or not.
If ResourceCache(GetPlayerMap(index)).ResourceData(Resource_num).ResourceState = 0 Then

rX = ResourceCache(GetPlayerMap(index)).ResourceData(Resource_num).X
rY = ResourceCache(GetPlayerMap(index)).ResourceData(Resource_num).Y

Damage = Item(GetPlayerEquipment(index, Weapon)).Data2

'Check if completion is greater than job health.
If Damage > 0 Then

' Finalize the job.
If ResourceCache(GetPlayerMap(index)).ResourceData(Resource_num).cur_health - Damage <= 0 Then

'Base experience given.
Exp = Resource(Resource_index).ResourceGiveExp

' Base Exp multiply by multi-item exp progression..
Exp = Exp * FinalReward

' Then add the players level up exp bonus.
Exp = (Exp + Player(index).ResourceBonusExp(Resource_index))

SetPlayerSkillExp index, Resource_index, (GetPlayerSkillExp(index, Resource_index) + Exp)
Call CheckPlayerSkillLevelUp(index, Resource_index)

'Remove the tile from the map, player accomplished it.
ResourceCache(GetPlayerMap(index)).ResourceData(Resource_num).ResourceState = 1 ' Cut
ResourceCache(GetPlayerMap(index)).ResourceData(Resource_num).ResourceTimer = GetTickCount
SendResourceCacheToMap GetPlayerMap(index), Resource_num
'Tell a player they done the job.
If Len(Trim$(Resource(Resource_index).SuccessMessage)) > 0 Then
percentageexp = (GetPlayerSkillExp(index, Resource_index) * 100) \ GetPlayerNextSkillLevel(index, Resource_index)
SendActionMsg GetPlayerMap(index), Trim$(Resource(Resource_index).SuccessMessage) & " + " & Exp & " , " & percentageexp & "% TNL!", Yellow, 0, (GetPlayerX(index) * 32), (GetPlayerY(index) * 32), index
End If

If Resource(Resource_index).IsLinked > 0 Then

If Item(Resource(Resource_index).ItemNeeded(FinalReward)).Type = ITEM_TYPE_CURRENCY Then
TakeInvItem index, Resource(Resource_index).ItemNeeded(FinalReward), Resource(Resource_index).ItemValueNeeded(FinalReward)
Else
' Take the required item, give the job item finalized.
For i = 1 To MAX_INV
If scanvalue > 0 Then
TakeInvItem index, Resource(Resource_index).ItemNeeded(FinalReward), 1
scanvalue = scanvalue - 1
End If
Next

End If
End If

If Resource(Resource_index).RewardValue(FinalReward) < 1 Then
GiveInvItem index, Resource(Resource_index).ItemReward(FinalReward), 1
End If

If Resource(Resource_index).RewardValue(FinalReward) >= 1 Then
If Item(Resource(Resource_index).ItemReward(FinalReward)).Type = ITEM_TYPE_CURRENCY Then
GiveInvItem index, Resource(Resource_index).ItemReward(FinalReward), Resource(Resource_index).RewardValue(FinalReward)
Else
GiveInvItem index, Resource(Resource_index).ItemReward(FinalReward), 1
End If
End If

'Check to see if rare item is even available for this current job and/or job level, skip this process if not.
If Resource(Resource_index).RareItem(FinalReward) <= 0 And Resource(Resource_index).RareItem(FinalReward) > MAX_ITEMS Then checkme = False

If checkme = True Then
SpawnARare = RAND(1, 100)

'5 value random chance of getting a rare item if inventory allows it!
If SpawnARare > 95 Then
If FindOpenInvSlot(index, Resource(Resource_index).RareItem(FinalReward)) > 0 Then
GiveInvItem index, Resource(Resource_index).RareItem(FinalReward), 1
SendActionMsg GetPlayerMap(index), "You received a rare item!", Yellow, 1, (GetPlayerX(index) * 32), (GetPlayerY(index) * 32), index
End If
End If
End If

SendAnimation GetPlayerMap(index), Resource(Resource_index).Animation, rX, rY

Else

If Resource(Resource_index).IsLinked > 0 Then
If countvalue < scanvalue Then
PlayerMsg index, "You need " & Resource(Resource_index).ItemValueNeeded(FinalReward) & " " & Trim$(Item(Resource(Resource_index).ItemNeeded(FinalReward)).Name) & " to interact with this skill!", brightred
Exit Sub
End If
End If

' Just record the hit.
ResourceCache(GetPlayerMap(index)).ResourceData(Resource_num).cur_health = ResourceCache(GetPlayerMap(index)).ResourceData(Resource_num).cur_health - Damage
'Find the percentage left
PercentageComplete = (ResourceCache(GetPlayerMap(index)).ResourceData(Resource_num).cur_health * 100) \ Resource(Resource_index).health
SendActionMsg GetPlayerMap(index), PercentageComplete & "%", brightred, 1, (rX * 32), (rY * 32)
SendAnimation GetPlayerMap(index), Resource(Resource_index).Animation, rX, rY

TempPlayer(index).AttackTimer = GetTickCount
'Send the sound effect.
SendMapSound index, rX, rY, SoundEntity.seResource, Resource_index
End If
Else
' Ability failed.
SendActionMsg GetPlayerMap(index), "Miss!", brightred, 1, (rX * 32), (rY * 32), index
End If
Else
' Job already done? Tell a player to wait.
If Len(Trim$(Resource(Resource_index).EmptyMessage)) > 0 Then
SendActionMsg GetPlayerMap(index), Trim$(Resource(Resource_index).EmptyMessage), brightred, 1, (GetPlayerX(index) * 32), (GetPlayerY(index) * 32), index
End If
End If
Else
'Player needs the required tool so let them know.
PlayerMsg index, "You need " & Trim$(Resource(Resource_index).DescTool) & " equipped to interact with this skill.", brightred
End If
Else
'Player needs the required tool so let them know.
PlayerMsg index, "You need " & Trim$(Resource(Resource_index).DescTool) & " equipped to interact with this skill.", brightred
End If
End If
End If
End Sub

```
**Step 22**

On the bottom of modPlayer, paste all this in:

```

Sub CheckPlayerSkillLevelUp(ByVal index As Long, ByVal ResourceNum As Long)
' Modification(S)
    Dim i As Long
    Dim expRollover As Long
    Dim level_count As Long

    level_count = 0

    Do While GetPlayerSkillExp(index, ResourceNum) >= GetPlayerNextSkillLevel(index, ResourceNum)
        expRollover = GetPlayerSkillExp(index, ResourceNum) - GetPlayerNextSkillLevel(index, ResourceNum)

        ' can level up?
        If Not SetPlayerSkillLevel(index, ResourceNum, Int(GetPlayerSkillLevel(index, ResourceNum)) + 1) Then
            Exit Sub
        End If

        Call SetPlayerSkillExp(index, ResourceNum, expRollover)

        level_count = level_count + 1
        Player(index).ResourceBonusExp(ResourceNum) = (Resource(ResourceNum).ResourceGiveExp \ 5) * GetPlayerSkillLevel(index, ResourceNum)
    Loop

    If level_count > 0 Then
        If level_count = 1 Then
            'singular
            PlayerMsg index, "You have gained " & level_count & " " & Trim(Resource(ResourceNum).Name) & " level! You're now level " & Player(index).ResourceLv(ResourceNum) & "!", BrightGreen
        Else
            'plural
            PlayerMsg index, "You have gained " & level_count & " " & Trim(Resource(ResourceNum).Name) & " levels! You're now level " & Player(index).ResourceLv(ResourceNum) & "!", BrightGreen
        End If
    End If
End Sub

Function GetPlayerNextSkillLevel(ByVal index As Long, ByVal ResourceNum As Long) As Long
GetPlayerNextSkillLevel = (50 / 3) * ((GetPlayerSkillLevel(index, ResourceNum) + 1) ^ 3 - (6 * (GetPlayerSkillLevel(index, ResourceNum) + 1) ^ 2) + 17 * (GetPlayerSkillLevel(index, ResourceNum) + 1) - 12) / 4
End Function

Function GetPlayerSkillExp(ByVal index As Long, ByVal ResourceNum As Long) As Long
' Modification(S)
GetPlayerSkillExp = Player(index).ResourceExp(ResourceNum)
End Function

Function GetPlayerSkillLevel(ByVal index As Long, ByVal ResourceNum As Long) As Long
' Modification(S)
If index <= 0 Or index > MAX_PLAYERS Then Exit Function
GetPlayerSkillLevel = Player(index).ResourceLv(ResourceNum)
End Function

Sub SetPlayerSkillExp(ByVal index As Long, ByVal ResourceNum As Long, ByVal Exp As Long)

If GetPlayerSkillLevel(index, ResourceNum) = MAX_LEVELS And Player(index).ResourceExp(ResourceNum) > GetPlayerNextSkillLevel(index, ResourceNum) Then
Player(index).ResourceExp(ResourceNum) = GetPlayerNextSkillLevel(index, ResourceNum)
Exit Sub
End If
Player(index).ResourceExp(ResourceNum) = Exp
End Sub

Function SetPlayerSkillLevel(ByVal index As Long, ByVal ResourceNum As Long, ByVal level As Long) As Boolean
' Modification(S)
SetPlayerSkillLevel = False
If Player(index).ResourceLv(ResourceNum) = MAX_LEVELS Then Exit Function
Player(index).ResourceLv(ResourceNum) = level
SetPlayerSkillLevel = True
End Function

```
**Step 23**

In modPlayer, UseItem, place this inside Case ITEM_TYPE_WEAPON on the bottom

```

If Item(itemnum).Data3 > 0 Then
Call SendResourceMaterial(index, itemnum)
Player(index).MaterialRequested = 1
End If

```
**Step 24**

Go to modDatabase, AddChar: Add this below the Player(n).Stat loop;

```

For n = 1 To MAX_RESOURCES
Player(index).ResourceExp(n) = 0
Player(index).ResourceLv(n) = 1
Next n

```
This should finalize the tutorial, credit isn't needed but appreciated, thanks. :)
Link to comment
Share on other sites

It doesn't mess with rendering so it might work for 3.0's (The only reason why I said EO 2 is because it uses PictureBox control, and the resource editor has DX7 rendering going on.

As for my pictureboxes. There's no DX7 rendering going on as I'm using the basic LoadPicture function for them. Lame… I know lol. I never bothered to render.
Link to comment
Share on other sites

Ignorance doesn't mean it's hard ;D

> As for my pictureboxes. There's no DX7 rendering going on as I'm using the basic LoadPicture function for them. Lame… I know lol. I never bothered to render.

Don't think there's anything wrong with using LoadPicture. The hardest thing with DX7 is initializing it. Understanding what you need to do to render an image isn't too difficult, but in this situation using it to render images to a picturebox will barely make a difference.
Link to comment
Share on other sites

*shrug* You can always make a GUI for it. If you wanted transparency instead of the background color, you'd need to get rid of the pictureboxes altogether and then put in some checks with an algorithm to see if you're click on one of the locations of the image (and so on and so forth). So long long story short, unless you need the transparency, go with the GUI ;D
Link to comment
Share on other sites

  • 6 months later...

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...