[Feature Addition] Eclipse Origins - Resource Success Rate

Eclipse Origins

Description:  This adds a success rate bar 1-100% to resources.  This determines your chances at getting the reward or simply getting nothing.

==CLIENT SIDE==

-open modTypes find Private Type ResourceRec then change it to

Private Type ResourceRec
    Name As String * NAME_LENGTH
    SuccessMessage As String * NAME_LENGTH
    EmptyMessage As String * NAME_LENGTH
    ResourceType As Byte
    ResourceImage As Byte
    ExhaustedImage As Byte
    ItemReward As Long
    ToolRequired As Long
    Health As Byte
    RespawnTime As Long
    Walkthrough As Boolean
    Animation As Long
    SuccessRate As Byte
End Type

-open up form ResourceEditor and add a new scroll bar named scrlSuccess (make sure to set the scroll bars Min to 1 and max value to 100)

-also add a lable above it named lblSuccess

-If your not understanding heres the image http://img.photobucket.com/albums/v352/salcon/ResourceEditor.png

-double click on the new scroll bar so it opens up this code

Private Sub scrlSuccess_Change()

End Sub

-next replace that with this

Private Sub scrlSuccess_Change()
    lblSuccess.Caption = "Success: " & scrlSuccess.Value & "%"
    Resource(EditorIndex).SuccessRate = scrlSuccess.Value
End Sub

-find Public Sub ResourceEditorInit() then change the whole sub to this:

Public Sub ResourceEditorInit()

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

    frmEditor_Resource.scrlExhaustedPic.Max = NumResources
    frmEditor_Resource.scrlNormalPic.Max = NumResources
    frmEditor_Resource.scrlAnimation.Max = MAX_ANIMATIONS

    frmEditor_Resource.txtName.text = Trim$(Resource(EditorIndex).Name)
    frmEditor_Resource.txtMessage.text = Trim$(Resource(EditorIndex).SuccessMessage)
    frmEditor_Resource.txtMessage2.text = Trim$(Resource(EditorIndex).EmptyMessage)
    frmEditor_Resource.cmbType.ListIndex = Resource(EditorIndex).ResourceType
    frmEditor_Resource.scrlNormalPic.Value = Resource(EditorIndex).ResourceImage
    frmEditor_Resource.scrlExhaustedPic.Value = Resource(EditorIndex).ExhaustedImage
    frmEditor_Resource.scrlReward.Value = Resource(EditorIndex).ItemReward
    If Resource(EditorIndex).SuccessRate <= 0 Then
        frmEditor_Resource.scrlSuccess.Value = 1
    Else
        frmEditor_Resource.scrlSuccess.Value = Resource(EditorIndex).SuccessRate
    End If
    frmEditor_Resource.scrlTool.Value = Resource(EditorIndex).ToolRequired
    frmEditor_Resource.scrlHealth.Value = Resource(EditorIndex).Health
    frmEditor_Resource.scrlRespawn.Value = Resource(EditorIndex).RespawnTime
    frmEditor_Resource.scrlAnimation.Value = Resource(EditorIndex).Animation

    Call ResourceEditorBltSprite

    Resource_Changed(EditorIndex) = True
End Sub

==SERVER SIDE==

-open modTypes find Private Type ResourceRec then change it to

Private Type ResourceRec
    Name As String * NAME_LENGTH
    SuccessMessage As String * NAME_LENGTH
    EmptyMessage As String * NAME_LENGTH
    ResourceType As Byte
    ResourceImage As Byte
    ExhaustedImage As Byte
    ItemReward As Long
    ToolRequired As Long
    Health As Byte
    RespawnTime As Long
    Walkthrough As Boolean
    Animation As Long
    SuccessRate As Byte
End Type

-open the Sub CheckResource

-find:

' check if damage is more than health
                        If Damage > 0 Then

then replace that IF/THEN with this:

' check if damage is more than health
                        If Damage > 0 Then
                            ' cut it down!
                            If ResourceCache(GetPlayerMap(Index)).ResourceData(Resource_num).cur_health - Damage <= 0 Then
                                ResourceCache(GetPlayerMap(Index)).ResourceData(Resource_num).ResourceState = 1 ' Cut
                                ResourceCache(GetPlayerMap(Index)).ResourceData(Resource_num).ResourceTimer = GetTickCount
                                SendResourceCacheToMap GetPlayerMap(Index), Resource_num

                                If Random(1, 100) <= Resource(Resource_index).SuccessRate Then
                                    SendActionMsg GetPlayerMap(Index), Trim$(Resource(Resource_index).SuccessMessage), BrightGreen, 1, (GetPlayerX(Index) * 32), (GetPlayerY(Index) * 32)
                                    GiveItem Index, Resource(Resource_index).ItemReward, 1
                                Else
                                    SendActionMsg GetPlayerMap(Index), Trim$(Resource(Resource_index).EmptyMessage), BrightRed, 1, (GetPlayerX(Index) * 32), (GetPlayerY(Index) * 32)
                                End If
                                SendAnimation GetPlayerMap(Index), Resource(Resource_index).Animation, rX, rY
                            Else
                                ' just do the damage
                                ResourceCache(GetPlayerMap(Index)).ResourceData(Resource_num).cur_health = ResourceCache(GetPlayerMap(Index)).ResourceData(Resource_num).cur_health - Damage
                                SendActionMsg GetPlayerMap(Index), "-" & Damage, BrightRed, 1, (rX * 32), (rY * 32)
                                SendAnimation GetPlayerMap(Index), Resource(Resource_index).Animation, rX, rY
                            End If
                        Else
                            ' too weak
                            SendActionMsg GetPlayerMap(Index), "Miss!", BrightRed, 1, (rX * 32), (rY * 32)
                        End If

I think this would benefit a tool item more than the resource itself.

@Rose:

I think this would benefit a tool item more than the resource itself.

Or possibly a success rate modifier for the item.

Basically what I meant. But thank you.

Well actually I think what would be even better is if the tool had a bonus percentage stat so basically… Lets say the Stone your mining has a 30% chance of giving you a gem.  Well on the pick axe there would be a percentage bonus that you could perhaps set to 5% which means when your mining that particular stone using this special pickaxe your have a total of 35%.

@Unknown_raven:

Well actually I think what would be even better is if the tool had a bonus percentage stat so basically… Lets say the Stone your mining has a 30% chance of giving you a gem.  Well on the pick axe there would be a percentage bonus that you could perhaps set to 5% which means when your mining that particular stone using this special pickaxe your have a total of 35%.

That’s what I meant when I said a success rate modifier.

Log in to reply