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

[Any version] Custom resource reward amount 2.0


Marcus
 Share

Recommended Posts

Yo guys! I haven't been around since Thomas was running shop, which was a few years ago, but I've definitely been around for 10+ years and I miss contributing so here's a short tutorial for something weird missing in the engine!

Edit: From **@or3o's** suggestion I added a min/max amount so the reward is a random number between the two.

**[Client]** _(I think)_

Simply, when you get resources there was no slider to increase the reward amount.. I use the old Prospekt Engine source which has an editor suite.. But in Eclipse, most likely you gotta open the client and your map editor, find the frame that contains the slider that chooses what number your resource has, and add these four babies:
![](http://i.imgur.com/nWVgvRc.png)
Make sure to set the min amount to 1 on the scroll and max amount to whatever you feel like, but something Base10:y in my opinion (not 32767, looks ugly af!)
I named them **"lblAmountMin/Max"** and **"scrlResourceMin/Max"** and then added this sub for actually using then:
```
Private Sub scrlResourceMin_Scroll()
lblAmountMin.Caption = "Min. reward: " & scrlResourceMin.Value
End Sub

Private Sub scrlResourceMax_Scroll()

lblAmountMax.Caption = "Max. reward: " & scrlResourceMax.Value
End Sub
```
Now all you need to do is find the part that places a resource tile in EditorMouseDown or whatever your sub is called, should look like this:
```
               ' resource
               If frmMain.optResource.Value Then
                   .Type = TILE_TYPE_RESOURCE
                   .Data1 = ResourceEditorNum
                   .Data2 = 0
                   .Data3 = 0
                   .Data4 = 0
               End If
```and just replace ".Data2 = 0" and ".Data3 = 0" with ".Data2 = scrlResourceMin.value" and ".Data3 = scrlResourceMax.value" or if your sub is outside the form of the object, "FORMNAME.scrlResourceAmount.value".

**[Server]**

This one is sooo simple, I love the way tiles can store more data than they need, so you can add shiz to existing tile types. All we need to do is find the sub that rewards the player for exhausting a resource **(CheckResource)** I believe, so open that sub, find the place where the player is given an item, the amount will be a static "1", so just change that to:
```
RAND(Map(GetPlayerMap(index)).Tile(X, Y).Data2, Map(GetPlayerMap(index)).Tile(X, Y).Data3)
```
And you're done!

That felt good.
Link to comment
Share on other sites

I remember a tutorial that is similar to this but it added 2 sliders so you could make a min and max and they would drop a random amount in between the high n low value, I also recall making a lvl requirement is really easy to add. I cant seem to find the original tutorials but it is good to see a new tut poseted!
Link to comment
Share on other sites

@'or3o':

> I remember a tutorial that is similar to this but it added 2 sliders so you could make a min and max and they would drop a random amount in between the high n low value, I also recall making a lvl requirement is really easy to add. I cant seem to find the original tutorials but it is good to see a new tut poseted!

That's a good one too, I suppose that adds more functionality as it includes this feature too hehe.. Give me a minute!

Edit: Ok it's updated to do exactly that now!
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...