Damage Layer

From VbGORE Visual Basic Online RPG Engine

How would you like it if scratches and damage showed up on character sprites when their health is low? Well, here's the tutorial to do that.

first download the resource files for this tutorial.

Resources: http://www.vbgore.com/forums/download/file.php?id=277

Misc

Open GrhRaw.txt and add this to it:

<ini>'**** Damaged Body Layer ***** Grh201=1-154-0-0-32-48-(128) Grh202=1-154-0-48-32-48-(128) Grh203=1-154-0-96-32-48-(128) Grh204=1-154-0-144-32-48-(128) Grh205=1-154-0-0-32-48-(128) Grh206=1-154-32-0-32-48-(128) Grh207=1-154-64-0-32-48-(128) Grh208=1-154-96-0-32-48-(128) Grh209=1-154-0-48-32-48-(128) Grh210=1-154-32-48-32-48-(128) Grh211=1-154-64-48-32-48-(128) Grh212=1-154-96-48-32-48-(128) Grh213=1-154-0-96-32-48-(128) Grh214=1-154-32-96-32-48-(128) Grh215=1-154-64-96-32-48-(128) Grh216=1-154-96-96-32-48-(128) Grh217=1-154-0-144-32-48-(128) Grh218=1-154-32-144-32-48-(128) Grh219=1-154-64-144-32-48-(128) Grh220=1-154-96-144-32-48-(128) Grh221=1-154-128-0-32-48-(128) Grh222=1-154-160-0-32-48-(128) Grh223=1-154-192-0-32-48-(128) Grh224=1-154-224-0-32-48-(128) Grh225=1-154-128-48-32-48-(128) Grh226=1-154-160-48-32-48-(128) Grh227=1-154-192-48-32-48-(128) Grh228=1-154-224-48-32-48-(128) Grh229=1-154-128-96-32-48-(128) Grh230=1-154-160-96-32-48-(128) Grh231=1-154-192-96-32-48-(128) Grh232=1-154-224-96-32-48-(128) Grh233=1-154-128-144-32-48-(128) Grh234=1-154-160-144-32-48-(128) Grh235=1-154-192-144-32-48-(128) Grh236=1-154-224-144-32-48-(128)

Grh237=4-205-206-207-208-8-(128) Grh238=4-209-210-211-212-8-(128) Grh239=4-213-214-215-216-8-(128) Grh240=4-217-218-219-220-8-(128) Grh241=2-208-209-13-(128) Grh242=2-212-212-13-(128) Grh243=2-216-216-13-(128) Grh244=2-220-220-13-(128)

Grh245=1-154-0-192-32-48-(128) Grh246=1-154-32-192-32-48-(128) Grh247=1-154-64-192-32-48-(128) Grh248=1-154-96-192-32-48-(128) Grh249=1-154-128-192-32-48-(128) Grh250=1-154-160-192-32-48-(128) Grh251=1-154-192-192-32-48-(128) Grh252=1-154-224-192-32-48-(128) Grh253=1-154-192-191-32-48-(128) Grh254=1-154-224-191-32-48-(128)

Grh255=4-251-253-251-253-8-(128) Grh256=4-252-254-252-254-8-(128) Grh257=4-245-246-245-247-8-(128) Grh258=4-248-249-248-250-8-(128)</ini>

Open Body.dat Add this:

<ini>'Humanoid Body Damage Overlay [3] 1=239 2=238 3=237 4=240 5=239 6=238 7=237 8=240 a1=241 a2=242 a3=243 a4=244 a5=241 a6=242 a7=243 a8=244 r1=255 r2=257 r3=256 r4=258 r5=255 r6=257 r7=256 r8=258 HeadOffsetY=-19 HeadOffsetX=0 DamageSprite=3</ini>

Note, if the third body slot is taken, just change [3] to the next available one.

Now add "DamageSprite=3" to each section of code for the body (just like it is shown above). Change 3 to whatever number you set for the new body as explained above. Note, this damage layer I made is for humanoid bodies. You'll need to add new damage sprites for other body types like monsters.

At the top of the file, change the NumBodies appropriately.

run ToolGrhDatMaker.exe

GameClient

TileEngine.bas

Go to "Public Type BodyData"

add this to that section of code:

<vb>DamageSprite As Integer</vb>

go to Engine_Init_BodyData Find "Next LoopC" and above that line add this:

<vb>BodyData(LoopC).DamageSprite = CLng(Var_Get(DataPath & "Body.dat", LoopC, "DamageSprite"))</vb>

Go to Engine_Render_Char at the beginning of the function, add this:

<vb>Dim DamageGrh As Grh</vb>

if you added my Mount and Shield script do this, else skip to this part: Find this:

<vb>If CharList(CharIndex).ActionIndex <= 1 Then</vb>

then find

<vb>If IsOnMount Then</vb>

Below that add this:

<vb>DamageGrh = BodyData(CharList(CharIndex).Body.DamageSprite).Ride(CharList(CharIndex).Heading)</vb>

then Find

<vb>Else</vb>

and below it add this:

<vb>DamageGrh = BodyData(CharList(CharIndex).Body.DamageSprite).Walk(CharList(CharIndex).Heading)</vb>


If you didn't use my mount and shield tutorial, do this: Find

<vb>BodyGrh = CharList(CharIndex).Body.Walk(CharList(CharIndex).Heading)</vb>

and below it add this:

<vb>DamageGrh = BodyData(CharList(CharIndex).Body.DamageSprite).Walk(CharList(CharIndex).Heading)</vb>


Now find

<vb>BodyGrh = CharList(CharIndex).Body.Attack(CharList(CharIndex).Heading)</vb>

and below it add this:

<vb>DamageGrh = BodyData(CharList(CharIndex).Body.DamageSprite).Attack(CharList(CharIndex).Heading)</vb>

now find

<vb>'Make the paperdoll layering based off the direction they are heading</vb>

below that are the various lines of code for rendering the sprite based on direction. For the four sections of code that render the various directions the sprite may face, locate this:

<vb>Engine_Render_Grh BodyGrh, ...</vb>

and below that line add this:

<vb> If CharList(CharIndex).HealthPercent <= 50 Then

           Engine_Render_Grh DamageGrh, PixelOffsetX + Offset.X, PixelOffsetY + Offset.Y, 1, 0, True, RenderColor(1), RenderColor(2), RenderColor(3), RenderColor(4)
       End If</vb>

oh, and one more thing, in the body.dat file, remove r1 through r8 mentioned in my tutorial (if you didn't use the mount and shield tutorial). If you remove those, remove the appropriate grh values from GrhRaw.txt

Basically, follow these steps for each new damage sprite you wish to add. this particular one I made will cover all humanoid creatures. You specify which damage sprite to use by editing DamageSprite in the body.dat to the number that references that particular sprite.

This tutorial is made by: GoreMania

Personal tools