FireBlade97 requested this via PM and since it’s been a long time since I wrote a tutorial, I thought why not?
After you add this you’ll have control over how items in game look by tweaking the colour of the texture. So let’s get started.
Note: I’ve used Eclipse Worlds for writing this source but this should work on any DX8 engine.
Note2: This tutorial is not noob friendly at the end. I suggest you have basic understanding of VB6 and certain terminologies like what methods are.
Open up the item editor form a make something like this:
Leave the Frame properties as it is. Change the frame caption to Colour if you want.
Caption: Red: 255
Caption: Blue: 255
Caption: Green: 255
Caption: Alpha: 255
Now open up the source code of the Editors and paste the following at the end
Private Sub scrlRed_Change() If EditorIndex < 1 Or EditorIndex > MAX_ITEMS Then Exit Sub Item(EditorIndex).Red = scrlRed.Value lblRed.Caption = "Red: " & scrlRed.Value End Sub Private Sub scrlBlue_Change() If EditorIndex < 1 Or EditorIndex > MAX_ITEMS Then Exit Sub Item(EditorIndex).Blue = scrlBlue.Value lblBlue.Caption = "Blue: " & scrlBlue.Value End Sub Private Sub scrlGreen_Change() If EditorIndex < 1 Or EditorIndex > MAX_ITEMS Then Exit Sub Item(EditorIndex).Green = scrlGreen.Value lblGreen.Caption = "Green: " & scrlGreen.Value End Sub Private Sub scrlAlpha_Change() If EditorIndex < 1 Or EditorIndex > MAX_ITEMS Then Exit Sub Item(EditorIndex).Alpha = scrlAlpha.Value lblAlpha.Caption = "Alpha: " & scrlAlpha.Value End Sub
Find **ItemEditorInit **and before the end with add in this:
frmEditor_Item.scrlRed = .Red frmEditor_Item.scrlBlue = .Blue frmEditor_Item.scrlGreen = .Green frmEditor_Item.scrlAlpha = .Alpha
This part is common for both client and server. Open up modTypes and find ItemRec. Before End Type add the following:
Red As Byte Blue As Byte Green As Byte Alpha As Byte
Find RenderTextureByRects method in modRendering
Add this to the end of the method declaration
Optional ByVal Red As Long = 255, Optional ByVal Green As Long = 255, Optional ByVal Blue = 255, Optional ByVal Alpha As Long = 255
Add this to the end of the RenderTexture call
D3DColorRGBA(Red, Green, Blue, Alpha)
Find the **EditorItem_DrawItem **method in modRendering
Find the RenderTextureByRects call in this method
Add this to the end:
frmEditor_Item.scrlRed.Value, frmEditor_Item.scrlBlue.Value, frmEditor_Item.scrlGreen.Value, frmEditor_Item.scrlAlpha.Value
Now this part changes per change so I’ll provide you with the code and help you figure out. You’ll have to add in the code yourself.
Wherever there items are being drawn in game, declare the following variables.
Dim R As Long, G As Long, B As Long, A As Long
After this check
ItemNum = GetPlayerInvItemNum(MyIndex, i) If ItemNum > 0 And ItemNum <= MAX_ITEMS Then
Add the following
R = Item(ItemNum).Red G = Item(ItemNum).Green B = Item(ItemNum).Blue A = Item(ItemNum).Alpha
Now find the call to the RenderTexture method (It can be just RenderTexture for rendering dropped items or RenderTextureByRects for inventory or it may all just be RenderTexture)
Add this to the end of the call:
R, G, B, A
And it should work. Depending upon how stupid your request of help is I’ll help you. If it’s very stupid then I won’t. Ask someone else.
Here are a few methods that render items. I’m not sure if there are more but search for them. (Search for Tex_Item and in modRendering and you’ll find the methods)
NOTE: For DrawMapItem use this code to set the r,g,b,a rather than using the above mentioned code:
R = Item(MapItem(ItemNum).num).Red G = Item(MapItem(ItemNum).num).Green B = Item(MapItem(ItemNum).num).Blue A = Item(MapItem(ItemNum).num).Alpha