Mod-able defense

From VbGORE Visual Basic Online RPG Engine

For those of you who would like to be able to spend points on Def, I have a little tutorial for you.


Bluewave.ini

First, go to Bluewave.ini (or appropriate skin file) and find [STATWINDOW]. In this code below, I added added on a AddDefX, AddDefY, AddDefHeight, and AddDefWidth. Also I moved things a round a little. Here's my code:

<vb>[STATWINDOW] ScreenX=0 ScreenY=150 ScreenWidth=250 ScreenHeight=250 CmbX=25 CmbY=20 AddStrX=7 AddStrY=40 AddStrWidth=16 AddStrHeight=16 AddDefX=7 AddDefY=60 AddDefWidth=16 AddDefHeight=16 AddAgiX=7 AddAgiY=80 AddAgiWidth=16 AddAgiHeight=16 AddMagX=7 AddMagY=100 AddMagWidth=16 AddMagHeight=16 StrX=25 StrY=40 DefX=25 DefY=60 AgiX=25 AgiY=80 MagX=25 MagY=100 PointsX=25 PointsY=140 DmgX=25 DmgY=120 GoldX=25 GoldY=160</vb>


Client

in the client side script: Go to TileEngine.bas. Find "Private Type StatWindow" and add the following in there:

<vb>AddDef As Rectangle</vb>

go to the "Engine_Init_Gui" function and find 'Load stats window. Add this in there:

<vb> .AddDef.X = Val(Var_Get(s, "STATWINDOW", "AddDefX"))

       .AddDef.Y = Val(Var_Get(s, "STATWINDOW", "AddDefY"))
       .AddDef.Width = Val(Var_Get(s, "STATWINDOW", "AddDefWidth"))
       .AddDef.Height = Val(Var_Get(s, "STATWINDOW", "AddDefHeight"))</vb>

Find the "Engine_Render_GUI_Window" function. In there find "Case StatWindow". In there find "If BaseStats(SID.Points) > 0 Then". Add this too it:

<vb>Engine_Render_Grh .AddGrh, .Screen.X + .AddDef.X, .Screen.Y + .AddDef.Y, 0, 1</vb>

Go to the Input.bas file now. Go to the "Input_Mouse_LeftClick_Window" function. Find "Case StatWindow" and add this to it:

<vb> 'Raise def

                       If Engine_Collision_Rect(MousePos.X, MousePos.Y, 1, 1, .Screen.X + .AddDef.X, .Screen.Y + .AddDef.Y, .AddDef.Width, .AddDef.Height) Then
                           sndBuf.Allocate 2
                           sndBuf.Put_Byte DataCode.User_BaseStat
                           sndBuf.Put_Byte SID.DEF
                       End If</vb>


Server

Go to the TCP.bas file and find the "Data_User_BaseStat" function. find the line "'Invalid stats" and remove SID.DEF from there.


There you go!

This tutorial is made by: GoreMania

Personal tools