Jump to content
Search In
  • More options...
Find results that contain...
Find results in...

[EO DX8]Target-Details Tutorial


Kaymak
 Share

Recommended Posts

Make this little changes to optimize :3:

```
'write name & level & hp
     For i = 1 To Npc_HighIndex
if mapNpc(i).num > 0 And Not myTarget > Npc_HighIndex Then
       If MapNpc(myTarget).num = mapNpc(i).num Then
               RenderText Font_Default, NPC(MapNpc(myTarget).num).Name, x + 10, y + 4, Yellow
               RenderText Font_Default, MapNpc(myTarget).Vital(HP) & "/" & NPC(MapNpc(myTarget).num).HP, x + 55, y + 15, Red
               RenderText Font_Default, NPC(MapNpc(myTarget).num).Level, x + 150, y + 4, Yellow
               Exit For ' Leave the sub when this drawed
              End If
          End if
   Next

```
Link to comment
Share on other sites

  • Replies 53
  • Created
  • Last Reply

Top Posters In This Topic

@'DarkDino':

> Make this little changes to optimize :3:
>
> ```
> 'write name & level & hp
>      For i = 1 To Npc_HighIndex
> if mapNpc(i).num > 0 And Not myTarget > Npc_HighIndex Then
>        If MapNpc(myTarget).num = mapNpc(i).num Then
>                RenderText Font_Default, NPC(MapNpc(myTarget).num).Name, x + 10, y + 4, Yellow
>                RenderText Font_Default, MapNpc(myTarget).Vital(HP) & "/" & NPC(MapNpc(myTarget).num).HP, x + 55, y + 15, Red
>                RenderText Font_Default, NPC(MapNpc(myTarget).num).Level, x + 150, y + 4, Yellow
>                Exit For ' Leave the sub when this drawed
>               End If
>           End if
>    Next
>
> ```

You don't need the for loop lol, it's already rendering to myTarget and it's already checking before the sub is even being called lol, just a waste of cpu power
Link to comment
Share on other sites

@'Growlith1223':

> You don't need the for loop lol, it's already rendering to myTarget and it's already checking before the sub is even being called lol, just a waste of cpu power

Sure haha, I thought that this showed the details of several NPCs i don't law all code:

```
if myTarget > 0 And Not NPC(MapNpc(myTarget).num).Name = "" then
RenderText Font_Default, NPC(MapNpc(myTarget).num).Name, x + 10, y + 4, Yellow
RenderText Font_Default, MapNpc(myTarget).Vital(HP) & "/" & NPC(MapNpc(myTarget).num).HP, x + 55, y + 15, Red
RenderText Font_Default, NPC(MapNpc(myTarget).num).Level, x + 150, y + 4, Yellow
End If

```
Link to comment
Share on other sites

Good? or not?

```
'write name & level & hp
For i = 1 To Npc_HighIndex
If myTarget > 0 And Not NPC(MapNpc(myTarget).num).name = "" Then
RenderText Font_Default, NPC(MapNpc(myTarget).num).name, x + 10, y + 4, Yellow
RenderText Font_Default, MapNpc(myTarget).Vital(HP) & "/" & NPC(MapNpc(myTarget).num).HP, x + 55, y + 15, Red
RenderText Font_Default, NPC(MapNpc(myTarget).num).Level, x + 150, y + 4, Yellow
End If
Next
```
Link to comment
Share on other sites

@'adiif1':

> Good? or not?
>
> ```
>    'write name & level & hp
>      For i = 1 To Npc_HighIndex
>        If myTarget > 0 And Not NPC(MapNpc(myTarget).num).name = "" Then
>                RenderText Font_Default, NPC(MapNpc(myTarget).num).name, x + 10, y + 4, Yellow
>                RenderText Font_Default, MapNpc(myTarget).Vital(HP) & "/" & NPC(MapNpc(myTarget).num).HP, x + 55, y + 15, Red
>                RenderText Font_Default, NPC(MapNpc(myTarget).num).Level, x + 150, y + 4, Yellow
>        End If
>    Next
> ```

There is no need for the For loop.
Link to comment
Share on other sites

@'adiif1':

> Good? or not?
>
> ```
> 'write name & level & hp
> For i = 1 To Npc_HighIndex
> If myTarget > 0 And Not NPC(MapNpc(myTarget).num).name = "" Then
> RenderText Font_Default, NPC(MapNpc(myTarget).num).name, x + 10, y + 4, Yellow
> RenderText Font_Default, MapNpc(myTarget).Vital(HP) & "/" & NPC(MapNpc(myTarget).num).HP, x + 55, y + 15, Red
> RenderText Font_Default, NPC(MapNpc(myTarget).num).Level, x + 150, y + 4, Yellow
> End If
> Next
> ```

@Adiif do you need change this to that code:
```
if myTarget > 0 And Not NPC(MapNpc(myTarget).num).Name = "" then
RenderText Font_Default, NPC(MapNpc(myTarget).num).Name, x + 10, y + 4, Yellow
RenderText Font_Default, MapNpc(myTarget).Vital(HP) & "/" & NPC(MapNpc(myTarget).num).HP, x + 55, y + 15, Red
RenderText Font_Default, NPC(MapNpc(myTarget).num).Level, x + 150, y + 4, Yellow
End If

```
Link to comment
Share on other sites

  • 2 weeks later...
i have updated the thread and changed the whole sub, to make it easier to handle for the server.

```
npcNum = MapNpc(myTarget).Num
' exists?
If npcNum > 0 Then
Name = Trim$(NPC(npcNum).Name)
HpBar = Trim$(MapNpc(npcNum).Vital(HP))
' show the information
RenderText Font_Default, Name, x + 10, y + 4, Yellow
RenderText Font_Default, MapNpc(myTarget).Vital(HP) & "/" & NPC(MapNpc(myTarget).Num).HP, x + 66, y + 15, Yellow
RenderText Font_Default, NPC(npcNum).Level, x + 150, y + 4, Yellow
End If
```
Link to comment
Share on other sites

  • 2 months later...
  • 2 months later...
Hello.. Can someone tell me what exactly what

**Tex_GUI(24)**

in

```
RenderTexture Tex_GUI(24), x, y, 0, 0, Width, Height, Width, Height
```
is?

I always get this error when i click a npc:

![](http://i.imgur.com/t1RtiBt.png)

Without this line i see the details but not the gui for this.

I created the Texture like this:

```
Public Tex_GUI As DX8TextureRec
```
```
Private Sub LoadTextures()

   NumTextures = NumTextures + 12

   ReDim Preserve gTexture(NumTextures)
   Tex_Shadow.filepath = App.Path & "\Pack\grafik\misc\shadow.png"
   Tex_Shadow.Texture = NumTextures - 11
   LoadTexture Tex_Shadow
   Tex_Fade.filepath = App.Path & "\Pack\grafik\misc\fader.png"
   Tex_Fade.Texture = NumTextures - 10
   LoadTexture Tex_Fade
   Tex_ChatBubble.filepath = App.Path & "\Pack\grafik\misc\chatbubble.png"
   Tex_ChatBubble.Texture = NumTextures - 9
   LoadTexture Tex_ChatBubble
   Tex_Weather.filepath = App.Path & "\Pack\grafik\misc\weather.png"
   Tex_Weather.Texture = NumTextures - 8
   LoadTexture Tex_Weather
   Tex_White.filepath = App.Path & "\Pack\grafik\misc\white.png"
   Tex_White.Texture = NumTextures - 7
   LoadTexture Tex_White
   Tex_Door.filepath = App.Path & "\Pack\grafik\misc\door.png"
   Tex_Door.Texture = NumTextures - 6
   LoadTexture Tex_Door
   Tex_Direction.filepath = App.Path & "\Pack\grafik\misc\direction.png"
   Tex_Direction.Texture = NumTextures - 5
   LoadTexture Tex_Direction
   Tex_Target.filepath = App.Path & "\Pack\grafik\misc\target.png"
   Tex_Target.Texture = NumTextures - 4
   LoadTexture Tex_Target
   Tex_Misc.filepath = App.Path & "\Pack\grafik\misc\misc.png"
   Tex_Misc.Texture = NumTextures - 3
   LoadTexture Tex_Misc
   Tex_Blood.filepath = App.Path & "\Pack\grafik\misc\blood.png"
   Tex_Blood.Texture = NumTextures - 2
   LoadTexture Tex_Blood
   Tex_Bars.filepath = App.Path & "\Pack\grafik\misc\bars.png"
   Tex_Bars.Texture = NumTextures - 1
   LoadTexture Tex_Bars
     Tex_Selection.filepath = App.Path & "\Pack\grafik\misc\select.png"
   Tex_Selection.Texture = NumTextures
   LoadTexture Tex_Selection

  Tex_GUI.filepath = App.Path & "\Pack\grafik\misc\select.png"
   Tex_GUI.Texture = NumTextures
   LoadTexture Tex_GUI

End Sub
```
Whats wrong?

Thank you :)
Link to comment
Share on other sites

Yeah i know this, but i created a new because the Targetpicture should be target, and this here should be detail.png.

Tried this:

   Tex_GUI.filepath = App.Path & "\Pack\grafik\misc\select.png"
   Tex_GUI.Texture = NumTextures
   LoadTexture Tex_GUI

But this doesn´t work.

I think its because the array(?). The numbers from 12 to 0:

```
NumTextures = NumTextures + 12

   ReDim Preserve gTexture(NumTextures)
   Tex_Shadow.filepath = App.Path & "\Pack\grafik\misc\shadow.png"
   Tex_Shadow.Texture = NumTextures - 11
   LoadTexture Tex_Shadow
   Tex_Fade.filepath = App.Path & "\Pack\grafik\misc\fader.png"
   Tex_Fade.Texture = NumTextures - 10
   LoadTexture Tex_Fade
   Tex_ChatBubble.filepath = App.Path & "\Pack\grafik\misc\chatbubble.png"
   Tex_ChatBubble.Texture = NumTextures - 9
   LoadTexture Tex_ChatBubble
   Tex_Weather.filepath = App.Path & "\Pack\grafik\misc\weather.png"
   Tex_Weather.Texture = NumTextures - 8
   LoadTexture Tex_Weather
   Tex_White.filepath = App.Path & "\Pack\grafik\misc\white.png"
   Tex_White.Texture = NumTextures - 7
   LoadTexture Tex_White
   Tex_Door.filepath = App.Path & "\Pack\grafik\misc\door.png"
   Tex_Door.Texture = NumTextures - 6
   LoadTexture Tex_Door
   Tex_Direction.filepath = App.Path & "\Pack\grafik\misc\direction.png"
   Tex_Direction.Texture = NumTextures - 5
   LoadTexture Tex_Direction
   Tex_Target.filepath = App.Path & "\Pack\grafik\misc\target.png"
   Tex_Target.Texture = NumTextures - 4
   LoadTexture Tex_Target
   Tex_Misc.filepath = App.Path & "\Pack\grafik\misc\misc.png"
   Tex_Misc.Texture = NumTextures - 3
   LoadTexture Tex_Misc
   Tex_Blood.filepath = App.Path & "\Pack\grafik\misc\blood.png"
   Tex_Blood.Texture = NumTextures - 2
   LoadTexture Tex_Blood
   Tex_Bars.filepath = App.Path & "\Pack\grafik\misc\bars.png"
   Tex_Bars.Texture = NumTextures - 1
   LoadTexture Tex_Bars
     Tex_Selection.filepath = App.Path & "\Pack\grafik\misc\select.png"
   Tex_Selection.Texture = NumTextures
   LoadTexture Tex_Selection

   Tex_GUI.filepath = App.Path & "\Pack\grafik\misc\select.png"
   Tex_GUI.Texture = NumTextures
   LoadTexture Tex_GUI
```
Can i change 12 to 13 and set Tex_Selection to -1 then ?

Also with

```
RenderTexture Tex_Target, x, y, 0, 0, Width, Height, Width, Height
```
i can´t see the image :D
Link to comment
Share on other sites

Okay i deleted anything except

```
Public Sub DrawTargetDetails()

Dim I As Long, X As Long, Y As Long, npcNum As Long
Dim Width As Long, Height As Long, SpriteNum As Long
Dim MapNpcNum As Long
Dim Name As String
Dim HpBar As String

' render the window
Width = 256
Height = 64
' render the window on screen
X = 300
Y = 64

' render the details

RenderTexture Tex_GUI(24), X, Y, 0, 0, Width, Height, Width, Height
npcNum = MapNpc(myTarget).num
' exists?
If npcNum > 0 Then
Name = Trim$(NPC(npcNum).Name)
HpBar = Trim$(MapNpc(npcNum).Vital(HP))
' show the information

RenderText Font_Default, Name, X + 10, Y + 4, Yellow
RenderText Font_Default, MapNpc(myTarget).Vital(HP) & "/" & NPC(MapNpc(myTarget).num).HP, X + 66, Y + 15, Yellow
RenderText Font_Default, NPC(npcNum).Level, X + 150, Y + 4, Yellow
End If

End Sub
```
```
Tex_GUI(24)
```
24 is the Texture number right?
So where do i need to declare it? :c
Sorry..
Link to comment
Share on other sites

Pull the information from the tutorial it self, its height and width are clearly in the code and you could just steal the image from the screen shot, Combine the two and you have a picture. Your best of creating your own as the image he provided may not be for public use.
Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share


×
×
  • Create New...