Officer Johnson Posted January 26, 2018 Author Share Posted January 26, 2018 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 beginIn both the **Server & Client** in Private Type **PlayerRec** add:```ExpMultiplier as LongExpMultiplierTime as Longin Private Type ItemRec addaddExpMultiplier As LongaddExpMultiplierTime 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 NextEnd Sub```in sub GivePlayerEXP add after ' give the exp```If Player(index).ExpMultiplierTime > 0 Then exp = exp * Player(index).ExpMultiplierEnd 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) * 32End 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 Suberrorhandler: 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 Suberrorhandler: 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 = .addExpMultiplierfrmEditor_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 More sharing options...
SolidLink Posted January 26, 2018 Share Posted January 26, 2018 Welcome back @Officer-Johnson :D nice tutorials! Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now