Kaymak Posted May 11, 2015 Author Share Posted May 11, 2015 Hello lovely Community, again i do need your help! As far i did to make it alone but now i cant go forward and stuck at following problem.Currently i'm using Eclipse Worlds. Since the GUI isnt rendered through DX8 i wanted to rip the GUI stuff from Eclipse Final Frontier to Eclipse Worlds.As far i did manage to show the .png GUIBars at the game screen through following code:```Public Sub DrawGUIBars()Dim tmpWidth As Long, barWidth As Long, x As Long, y As Long, dX As Long, dY As Long, sString As StringDim Width As Long, Height As LongDim I As LongDim sWidth As Long ' backwindow + empty bars x = GUIWindow(GUI_BARS).x y = GUIWindow(GUI_BARS).y Width = 254 Height = 75 'EngineRenderRectangle Tex_GUI(4), x, y, 0, 0, width, height, width, height, width, height RenderTexture Tex_GUI(4), x, y, 0, 0, Width, Height, Width, Height ' hardcoded for POT textures barWidth = 241 ' health bar BarWidth_GuiHP = ((GetPlayerVital(I, Vitals.HP) / sWidth) / (GetPlayerMaxVital(I, Vitals.HP) / sWidth)) * sWidth RenderTexture Tex_GUI(13), x + 7, y + 9, 0, 0, BarWidth_GuiHP, Tex_GUI(13).Height, BarWidth_GuiHP, Tex_GUI(13).Height ' render health 'barWidth = ((GetPlayerVital(I, Vitals.HP) / sWidth) / (GetPlayerMaxVital(I, Vitals.HP) / sWidth)) * sWidth sString = GetPlayerVital(I, Vitals.HP) & "/" & GetPlayerMaxVital(I, Vitals.HP) dX = x + 7 + (barWidth / 2) - (EngineGetTextWidth(Font_Default, sString) / 2) dY = y + 9 RenderText Font_Default, sString, dX, dY, White ' spirit bar BarWidth_GuiSP = ((GetPlayerVital(MyIndex, Vitals.MP) / barWidth) / (GetPlayerMaxVital(MyIndex, Vitals.MP) / barWidth)) * barWidth RenderTexture Tex_GUI(14), x + 7, y + 31, 0, 0, BarWidth_GuiSP, Tex_GUI(14).Height, BarWidth_GuiSP, Tex_GUI(14).Height ' render spirit sString = GetPlayerVital(MyIndex, Vitals.MP) & "/" & GetPlayerMaxVital(MyIndex, Vitals.MP) dX = x + 7 + (barWidth / 2) - (EngineGetTextWidth(Font_Default, sString) / 2) dY = y + 31 RenderText Font_Default, sString, dX, dY, White ' exp bar If GetPlayerLevel(MyIndex) < MAX_LEVELS Then BarWidth_GuiEXP = ((GetPlayerExp(MyIndex) / barWidth) / (TNL / barWidth)) * barWidth Else BarWidth_GuiEXP = barWidth End If RenderTexture Tex_GUI(15), x + 7, y + 53, 0, 0, BarWidth_GuiEXP, Tex_GUI(15).Height, BarWidth_GuiEXP, Tex_GUI(15).Height ' render exp If GetPlayerLevel(MyIndex) < MAX_LEVELS Then sString = GetPlayerExp(MyIndex) & "/" & TNL Else sString = "Max Level" End If dX = x + 7 + (barWidth / 2) - (EngineGetTextWidth(Font_Default, sString) / 2) dY = y + 53 RenderText Font_Default, sString, dX, dY, WhiteEnd Sub```Also i did add ofc:```Public Sub DrawGUI()Dim I As Long, x As Long, y As LongDim Width As Long, Height As LongIf GUIWindow(GUI_BARS).Visible Then DrawGUIBarsEnd IfEnd Sub```Also everything you need to show a .PNG picture on the gamescreen like```Public Enum GUIType GUI_CHAT = 1 GUI_HOTBAR GUI_MENU GUI_BARS... etc```Also i did add at Render_Graphics to call the GUIBars```DrawGUI```But now i have the problem, that the HP/MP/EXP does not show or load as you see on the screen:![](http://fs2.directupload.net/images/150511/yvyvyrpe.png)Before you ask: Yes i did add to the source the GFX Path and stuff. Also the Graphics are in my folder count from 1-13.png ( or else the GUIBar (4.png) would not show on the game screen.But now my problem, what did i miss that the HP/MP/EXP does not show? (13,14,15.png in folder)Maybe you got the solution for me!THank you alot Link to comment Share on other sites More sharing options...
hisherwin Posted May 11, 2015 Share Posted May 11, 2015 Index is Zero```Dim i as long```sWidth have no value```Dim sWidth as long```Note: This is not an error but, you only render the HP Graphics on code, the MP and EXP are text based on your codeIf you have no programming experience.. better wait for somebody to tell you how to fix it, i'm kinda lazy to check it outI'm just pointing out the mistake Link to comment Share on other sites More sharing options...
Kaymak Posted May 11, 2015 Author Share Posted May 11, 2015 yea but as you see the HP Graphic does not render for some reason, and i cant figure out the problem.when i change ```RenderTexture Tex_GUI(4), x, y, 0, 0, Width, Height, Width, Height```*(4) = the HP/MP/EXP HUD like you see on screento```RenderTexture Tex_GUI(13), x, y, 0, 0, Width, Height, Width, Height```*(13) in this case is the HP GraphicIt does not render the Graphic Link to comment Share on other sites More sharing options...
abhi2011 Posted May 11, 2015 Share Posted May 11, 2015 I don't know how the bars are shown in EW but I'm guessing they are rendered on a picturebox. You may have forgotten to remove that picturebox from the form. Now, I'm guessing that that that method is never even called, or at least, this isn't ``` BarWidth_GuiHP = ((GetPlayerVital(I, Vitals.HP) / sWidth) / (GetPlayerMaxVital(I, Vitals.HP) / sWidth))```The reason being that, like Sherwin said, I = 0; sWidth = 0, which would mean that either Division by Zero would be thrown or an overflow. Try setting a breakpoint on DrawGUI in Render_Graphics and step through your code. **Note**: If you don't know how to set a break point, find DrawGui and hit F9\. When the program runs till that point, it'll automatically pause exectuion and wait for user input. Press F8 to run the highlighted line of code, and as soon as it is run, to stop execution. Keep doing this and make sure you actually enter into the DrawGUIBars and see if it executes everything in that method fully. 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