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

Resource Tool Power Requirement! (Easy)


Zappy
 Share

Recommended Posts

**What It Does**

Frustrated trying to make higher tier ores/trees/etc more difficult to collect, purely on the basis of extra health? Want to prevent that bronze pickaxe wielder from mining your rich cobalt deposits? Well then this simple modification is for you!

I've simply thrown in a new interacting requirement for resources and items called Tool power.
eg:

A **bronze pickaxe** will be given a **tool power of 1**, while a deposit of **copper and tin** will also be given a **tool power (required) of 1**. Therefore, anyone wielding at least a **bronze pickaxe** can mine **copper and tin**, but they won't be able to get at that deposit of **iron**, with a **tool power (required) of 2**.
Don't worry though, an **iron pickaxe** with **tool power 2** can mine any ore with a **tool power (required) equal too or less than 2!**

Now, let's begin the installation.

**Server Side**

In **modTypes**, in **ItemRec**
add to the **BOTTOM**(before End Type):
```
Toolpower As Long
```
In **modTypes**, in **ResourceRec**
add to the **BOTTOM**(before End Type):
```
ToolpowerReq As Long
```
In **modPlayer**, in **Sub CheckResource**
Under:
```
Dim Damage As Long
```Add:
```
    Dim ToolpowerReq As Long
    Dim Toolpower As Long
```
Above:
```
' check if damage is more than health
If Damage > 0 Then
```
Add:
```
' check if tool power is strong enough
If (Resource(Resource_index).ToolpowerReq <= Item(GetPlayerEquipment(index, Weapon)).Toolpower) Then
```
Under:
```
Else
' too weak
SendActionMsg GetPlayerMap(index), "Miss!", BrightRed, 1, (rX * 32), (rY * 32)
End If
```
Add:

```
Else
'Tool power too low
SendActionMsg GetPlayerMap(index), "Tool too weak!", BrightRed, 1, (rX * 32), (rY * 32)
Call PlayerMsg(index, "Your " & Trim$(Item(GetPlayerEquipment(index, Weapon)).Name) & " isn't up to the task.", White)
End If
```
And that's all for the server side!

**Client Side**
In **modTypes**, in **ItemRec**
add to the **BOTTOM**(before End Type):
```
Toolpower As Long
```
In **modTypes**, in **ResourceRec**
add to the **BOTTOM**(before End Type):
```
ToolpowerReq As Long
```
In **modGameEditors**
Find:
```
' Basic requirements

```
Under that, insert:
```
frmEditor_Item.scrlToolpower.Value = .Toolpower
```
Find:
```
.scrlAnimation.Value = Resource(EditorIndex).Animation
```
Underneath, add this:
```
.scrlPwrReq.Value = Resource(EditorIndex).ToolpowerReq
```
Now onto the form work.

_**Form Work**_

**1.**    Open up frmEditor_Item
**2.**    Preferably in the frame "Equipment data" add a label somewhere with space
**3.**    Name it lblToolpwr, change it's caption too "Tool Power: 0"
**4.**    Underneath that, add a horizontal scroll bar.
**5.**    Name it scrlToolpower.
**6.**    (Optional) Set it's Max to 255.
**7.**    Double click scrlToolpower and add in:
```
If scrlToolpower.Value > 0 Then
        lblToolPwr.Caption = "Tool Power: " & scrlToolpower.Value
    Else
        lblToolPwr.Caption = "Tool Power: 0"
    End If

    Item(EditorIndex).Toolpower = scrlToolpower.Value
```**8.**    Save frmEditor_Item and now open frmEditor_Resource
**9.**    Extend the window to make room for a label and scroll bar.
**10.**  Create a label, name it lblToolpowerReq, set its caption too "Tool Power Required: 0"
**11.**  Create a horizontal scroll bar,name it scrlPwrReq
**12.**  (Optional) Set it's Max as 255.
**13**.  Double click scrlPwrReq and add:
```
If scrlPwrReq.Value > 0 Then
        lblToolpowerReq.Caption = "Tool Power Required: " & scrlPwrReq.Value
    Else
        lblToolpowerReq.Caption = "Tool Power Required: 0"
    End If

    Resource(EditorIndex).ToolpowerReq = scrlPwrReq.Value
```
Tada! You're done!
If you followed the steps correctly, it should be working wonderfully!
![](http://img706.imageshack.us/img706/8063/derpyw.png)

I'm not a professional coder, this was something small I made for myself and was simply sharing it with people who have trouble!
Link to comment
Share on other sites

@Peter120:

> Hello!
> Nice tutorial, but at compile I get Variable not defined lblToolPwr

If you've named your labels something else, replace "lblToolpwr.Caption" with "[insert label name].Caption" in the form work code, or rename your label. lblToolpwr isn't utilized anywhere but the frmEditor_Item. So trouble shoot there, I'm sure you'll find it ;)
Link to comment
Share on other sites

@Justn:

> Ur label has to be named lblToolPwr not lblToolPower as it says in the tutorial :)

That… could also be an issue...
Ya, it's kinda hard writing the tut from code you've already implemented, you kinda type things wrong and screw the whole thing up. thanks for catching that ^-^ fixed*
Link to comment
Share on other sites

@Peter120:

> Okay, now I get this  :mad: :
>
> >! ![](http://www.freemmorpgmaker.com/files/imagehost/pics/a8caf60fcc5ad538dd76de0561078f3a.png)

You need the "=" between them silly. I don't know where yours went :3

Item(EditorIndex).Toolpower = scrlToolpower.Value
Link to comment
Share on other sites

  • 4 weeks 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...