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

[EO][SUPER and SIMPLE] Make resources have a level requirement! [Updated]


Guest
 Share

Recommended Posts

Resources level requirement V1.0.2
NOW! tested on EO 2.0 And it Works

Result if tutorial complete

>! ![](http://img5.imageshack.us/img5/5104/resultd.png)

What are you going to do?
Client things

Add things to the modEditor_Resource.frm form
Add things to the modEditor_Resource.frm source
Add things to modTypes.bas
Add things to modGameEditors.bas

Server things

Add things to modTypes.bas
Add things to modPlayer.bas

Server things
1\. modTypes.bas

>! 1\. Open modTypes.bas
2\. Search for "Private Type ResourceRec" , without the ".
3\. Make a clean rule under "ToolRequired As Long", so it will look like:
```
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
  <<<<<============= Clean rule
    health As Byte
    RespawnTime As Long
    Walkthrough As Boolean
    Animation As Long
End Type
>! ```4\. Paste this in the clean rule:
```
    Stat_Req(1 To Stats.Stat_Count - 1) As Byte
>! ```

2\. modPlayer.bas

>! 1\. Open modPlayer.bas
2\. Search for "Sub CheckResource", Without the "
3\. Add this at the top of this sub, under "Dim Damage As Long".
```
Dim il as long
>! ```4\. Make a clean rule under "If Resource_num > 0 Then"
5\. Paste this in the clean rule:
```
            ' Check if Stat_Req are the same as Stats
            For il = 1 To Stats.Stat_Count - 1
                If GetPlayerStat(index, il) < Resource(Resource_index).Stat_Req(il) Then
                  PlayerMsg index, "Fail: You have not the stat requirement(s)!", BrightRed ' Change here the text and color
                  Exit Sub
                End If
            Next
>! ```

Client things

3\. modTypes.bas

>! 1\. Open modTypes.bas
2\. Search for "Private Type ResourceRec" , without the ".
3\. Make a clean rule under "ToolRequired As Long", so it will look like:
```
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
<<<<<<<============ Clean rule
    health As Byte
    RespawnTime As Long
    Walkthrough As Boolean
    Animation As Long
End Type
>! ```4\. Paste this in the clean rule:
```
    Stat_Req(1 To Stats.Stat_Count - 1) As Byte
>! ```

4\. modGameEditors.bas

>! 1\. Open modGameEditors.bas
2\. Search for "Public Sub ResourceEditorInit()" , without the ".
3\. Add this at the top of this sub, under "Public Sub ResourceEditorInit()":
```
Dim il As Long
```4\. Make a clean rule under```
frmEditor_Resource.scrlTool.Value = Resource(EditorIndex).ToolRequired
```so it will look like```
Public Sub ResourceEditorInit()
    Dim il As Long
>!     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
    frmEditor_Resource.scrlTool.Value = Resource(EditorIndex).ToolRequired
<<<<<<<<<<<<========== Clean rule
    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
```5\. Paste this in the clean rule:
```
    For il = 1 To Stats.stat_count - 1
        frmEditor_Resource.scrlStatReq(il).Value = Resource(EditorIndex).Stat_Req(il)
    Next
>! ```

5\. frmEditor_Resource.frm

>! 1\. Open the form of frmEditor_Item.frm
2\. Copy lblStatReq(1), lblStatReq(2), lblStatReq(3..4..5..6), scrlStatReq(1), scrlStatReq(2), scrlStatReq(3..4..5..6) Just like:
![](http://img837.imageshack.us/img837/6223/copyuj.png)
3\. Open the form of frmEditor_Resource.frm
4\. Make a place to paste the copied items.
5\. Paste the copied items on the place you made for it.
6\. Open the source of modEditor_Resource.frm
7\. Go to the bottom of the source, just under "End Sub" and paste:
```
Private Sub scrlStatReq_Change(Index As Integer)
    Dim text As String

    Select Case Index
        Case 1 ' str
            text = "Str: "
        Case 2 ' end
            text = "End: "
        Case 3 ' vit
            text = "Vit: "
        Case 4 ' int
            text = "Int: "
        Case 5 ' will
            text = "Will: "
        Case 6 ' spr
            text = "Spr: "
    End Select

    lblStatReq(Index).Caption = text & scrlStatReq(Index).Value
    Resource(EditorIndex).Stat_Req(Index) = scrlStatReq(Index).Value
End Sub
>! ```

Final things

6\. Finishing…

>! Yes! This is the last part, you need to finish it… You need to finish your Resources.. I mean something else...
Before you go to start the server and client, you will have to backup your resources…
If you don't have any resources made earlier, then delete the resource files.
Let's start with the following:
If you want to backup…

>! Go to your "Server" folder, open "Data", Copy "resources" folder, and past it somewhere you can remember.
>! If you want to delete…

>! Go to your "Server" folder, open "Data", Open "resources" folder, delete everything inside.
Link to comment
Share on other sites

Resources level requirement V2.0.2
You need to have the previous version V1.0.2 installed to get this work

This update will just make it possible to let every resource have its own error message given when stats are lower the the required stats.

What are you going to go?
Client things

Add things to the frmEditor_Resource.frm form
Add things to the frmEditor_Resource.frm source
Add things to modTypes.bas
Add things to modGameEditors.bas
Add things to modDatabase.bas

Server things

Add things to modTypes.bas
Add things to modDatabase.bas
Add things to modPlayer.bas

Client things
1\. modTypes.bas

>! 1\. Open modTypes.bas
2\. Search for "Private Type ResourceRec" , without the ".
3\. Make a clean rule between "EmptyMessage As String * NAME_LENGTH" and "Sound As String * NAME_LENGTH", and add this in that rule:
```
Msg As String * 100
>! ```4\. Now a clean rule between "ResourceType As Byte" and "ResourceImage As Long", and add the following:
```
    MsgClr As Byte
>! ```

2\. modDatabase.bas

>! 1\. Open modDatabase.bas
2\. Search for "Sub ClearResource(ByVal Index As Long)", Without the "
3\. Add this under "Resource(Index).EmptyMessage = vbNullString".
```
Resource(Index).Msg = vbNullString
>! ```

3\. modGameEditors.bas

>! 1\. Open modGameEditors.bas
2\. Search for "Public Sub ResourceEditorInit()"
3\. Make a clean rule between:
```
.txtMessage2.text = Trim$(Resource(EditorIndex).EmptyMessage)
''''''''''''Çlean rule nr1''''''''''
.cmbType.ListIndex = Resource(EditorIndex).ResourceType
''''''''''''Clean rule nr2''''''''''
.scrlNormalPic.Value = Resource(EditorIndex).ResourceImage'
>! ```4\. Now add this in the clean rules nr1 and nr2
```
.txtMessage2.text = Trim$(Resource(EditorIndex).EmptyMessage)
.Msg.text = Trim$(Resource(EditorIndex).Msg) ''''''''Clean rule nr1''''''''
.cmbType.ListIndex = Resource(EditorIndex).ResourceType
.MsgClr = Resource(EditorIndex).MsgClr ''''''''Clean rule nr2''''''''
.scrlNormalPic.Value = Resource(EditorIndex).ResourceImage
>! ```

4\. frmEditor_Resource.frm form

>! Add somewhere a TextBox called Msg Here you should type the message will be viewed if stat < stat_req
Add somewhere a TextBox called MsgClr Here you should choose a number from 0 to 15 as colour
Add somewhere a ComboBox called cmbClr1 This is just so you can see what colour each number have, for msgClr

5\. frmEditor_Resource.frm source

>! 1\. Just add this at the bottom of the sorce, under the last"End Sub":
```
Private Sub Msg_Change()
    If Options.Debug = 1 Then On Error GoTo errorhandler

    Resource(EditorIndex).Msg = Trim$(Msg.text)

    ' Error handler
    Exit Sub
errorhandler:
    HandleError "Msg_Change", "frmEditor_Resource", Err.Number, Err.Description, Err.Source, Err.HelpContext
    Err.Clear
    Exit Sub
End Sub
>! Private Sub MsgClr_Change()
    ' If debug mode, handle error then exit out
    If Options.Debug = 1 Then On Error GoTo errorhandler ' Boynaar 8

    Resource(EditorIndex).MsgClr = MsgClr.text

    ' Error handler
    Exit Sub
errorhandler:
    HandleError "MsgClr_Change", "frmEditor_Resource", Err.Number, Err.Description, Err.Source, Err.HelpContext
    Err.Clear
    Exit Sub
End Sub
>! ```2\. Search for "Private Sub Form_Load()"
3\. Make a clean rule under "If Options.Debug = 1 Then On Error GoTo errorhandler", and add:
```
    cmbClr1.AddItem "0 Black" ' Boynaar 6
    cmbClr1.AddItem "1 Blue"
    cmbClr1.AddItem "2 Green"
    cmbClr1.AddItem "3 Cyan"
    cmbClr1.AddItem "4 Red"
    cmbClr1.AddItem "5 Magenta"
    cmbClr1.AddItem "6 Brown"
    cmbClr1.AddItem "7 Grey"
    cmbClr1.AddItem "8 DarkGrey"
    cmbClr1.AddItem "9 BrightBlue"
    cmbClr1.AddItem "10 BrightGreen"
    cmbClr1.AddItem "11 BrightCyan"
    cmbClr1.AddItem "12 BrightRed"
    cmbClr1.AddItem "13 Pink"
    cmbClr1.AddItem "14 Yellow"
    cmbClr1.AddItem "15 White"
>! ```

Server Things

6\. modTypes.bas

>! 1\. Open modTypes.bas
2\. Search for "Private Type ResourceRec" , without the ".
3\. Make a clean rule under "EmptyMessage As String * NAME_LENGTH", Then add:
```
Msg As String * 100
>! ```4\. Make a clean rule under "ResourceType As Byte", and add:
```
    MsgClr As Byte
>! ```

7\. modDatabase.bas

>! 1\. Open modDatabase.bas
2\. Search for "Sub ClearResource(ByVal index As Long)" , without the ".
3\. Add this under "Resource(index).EmptyMessage = vbNullString":
```
Resource(index).Msg = vbNullString
```

8\. modPlayer.bas

>! 1\. Open modPlayer.bas
2\. Search for "Sub CheckResource(ByVal index As Long, ByVal x As Long, ByVal y As Long)"
3\. Add at the top of this sub, just where the dim blabla as long are:
```
Dim il As long
```4\. Add under the "If Resource_num > 0 Then" the next:
```
            For il = 1 To Stats.Stat_Count - 1
                If GetPlayerStat(index, il) < Resource(Resource_index).Stat_Req(il) Then
                  PlayerMsg index, Resource(Resource_index).Msg, Resource(Resource_index).MsgClr ' Change here the text and color
                  Exit Sub
                End If
            Next
>! ```

Final things

9\. Finishing…

>! Yes! This is the last part, you need to finish it… You need to finish your Resources.. I mean something else...
Before you go to start the server and client, you will have to backup your resources…
If you don't have any resources made earlier, then delete the resource files.
Let's start with the following:
If you want to backup…

>! Go to your "Server" folder, open "Data", Copy "resources" folder, and past it somewhere you can remember.
>! If you want to delete…

>! Go to your "Server" folder, open "Data", Open "resources" folder, delete everything inside.
Link to comment
Share on other sites

@Esmeyana:

> Can you make the same with monsters?
> I have a monster, but I want, that if you want to attack the monster you need lvl 20 speed, because he is too fast, can you?

Its easy, it works the same as what I did with the resources…
I will make it ^^
Link to comment
Share on other sites

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