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

EXP Multiplier Items


Officer Johnson
 Share

Recommended Posts

Hey everyone,

Been awhile since I've posted but i'm cleaning off the old pc today and figured to post all my codes to the site with the hopes that someone will find a use for them. So you can expect a lot of tutorials posted by me today. To get started this tutorial will show you how to code a new item type that will allow an item to double, triple, etc your EXP for a time duration.

So lets begin

In both the **Server & Client**

in Private Type **PlayerRec** add:

```
ExpMultiplier as Long
ExpMultiplierTime as Long
in Private Type ItemRec add
addExpMultiplier As Long
addExpMultiplierTime As Long
```

**Server Side**:

in Sub ServerLoop dim
```
Dim LastUpdateExpMod As Long
```

in modServerLoop add

```
Private Sub UpdateExpMod()
Dim i As Long
For i = 1 To Player_HighIndex
If IsPlaying(i) Then
If Player(i).ExpMultiplierTime > 0 Then
Player(i).ExpMultiplierTime = Player(i).ExpMultiplierTime - 1
End If
End If
Next
End Sub
```

in sub GivePlayerEXP add after ' give the exp

```
If Player(index).ExpMultiplierTime > 0 Then
exp = exp * Player(index).ExpMultiplier
End If
```

in sub UseItem add after the if statement If Item(itemnum).AddEXP > 0 Then
```
If Item(itemnum).addExpMultiplierTime > 0 Then
Player(index).ExpMultiplierTime = Item(itemnum).addExpMultiplierTime
Player(index).ExpMultiplier = Item(itemnum).addExpMultiplier
SendActionMsg GetPlayerMap(index), "x" & Item(itemnum).addExpMultiplier & " EXP", White, ACTIONMSG_SCROLL, GetPlayerX(index) * 32, GetPlayerY(index) * 32
End If
```

**Client Side**:
in frmEditor_Item in frame fraVitals create two labels (lblExpTime "Multiplier Time: 0", lblExpMultiplier "Exp Multiplier: 0") and two scrlbars (scrlMultiplierTime,scrlMultiplier)

x2 click scrlMultiplierTime input
```
' If debug mode, handle error then exit out
If Options.Debug = 1 Then On Error GoTo errorhandler
lblExpTime.Caption = "Multiplier Time: " & scrlMultiplierTime.Value
Item(EditorIndex).addExpMultiplierTime = scrlMultiplierTime.Value

' Error handler
Exit Sub
errorhandler:
HandleError "scrlMultiplierTime_Change", "frmEditor_Item", Err.Number, Err.Description, Err.Source, Err.HelpContext
Err.Clear
Exit Sub
```

x2 click scrlMultiplier input

```
' If debug mode, handle error then exit out
If Options.Debug = 1 Then On Error GoTo errorhandler
lblExpMultiplier.Caption = "Exp Multiplier: " & scrlMultiplier.Value
Item(EditorIndex).addExpMultiplier = scrlMultiplier.Value

' Error handler
Exit Sub
errorhandler:
HandleError "scrlMultiplier_Change", "frmEditor_Item", Err.Number, Err.Description, Err.Source, Err.HelpContext
Err.Clear
Exit Sub
```

In sub ItemEditorInit in the if statement If frmEditor_Item.cmbType.ListIndex = ITEM_TYPE_CONSUME Then under frmEditor_Item.chkInstant.Value = .instaCast add

```
frmEditor_Item.scrlMultiplier.Value = .addExpMultiplier
frmEditor_Item.scrlMultiplierTime.Value = .addExpMultiplierTime
```


**That should be it! Hope someone finds this useful enjoy let me know if any questions.**
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...