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

[EO] Show NPC Levels


Beanie93
 Share

Recommended Posts

Been a while since I don't post a tutorial. By the end of this tutorial, your NPCs will have their level displayed at their side. It's really a simple edit, all client-side.

Go to modText, we will do all of our edits there.
In **Sub DrawNpcName**, look for:
```
            Name = Trim$(Npc(npcNum).Name)
```
Delete it. We don't need that.
Now, just above, look for:
```
    Select Case Npc(npcNum).Behaviour
        Case NPC_BEHAVIOUR_ATTACKONSIGHT
            color = QBColor(BrightRed)
        Case NPC_BEHAVIOUR_ATTACKWHENATTACKED
            color = QBColor(Yellow)
        Case NPC_BEHAVIOUR_GUARD
            color = QBColor(Grey)
        Case Else
            color = QBColor(BrightGreen)
    End Select
```
And replace it with:
```
    Select Case Npc(npcNum).Behaviour
        Case NPC_BEHAVIOUR_ATTACKONSIGHT
            color = QBColor(BrightRed)
            Name = Trim$(Npc(npcNum).Name) & " [" & Npc(npcNum).Level & "]"
        Case NPC_BEHAVIOUR_ATTACKWHENATTACKED
            color = QBColor(Yellow)
            Name = Trim$(Npc(npcNum).Name) & " [" & Npc(npcNum).Level & "]"
        Case NPC_BEHAVIOUR_GUARD
            color = QBColor(Grey)
            Name = Trim$(Npc(npcNum).Name) & " [" & Npc(npcNum).Level & "]"
        Case Else
            color = QBColor(BrightGreen)
            Name = Trim$(Npc(npcNum).Name)
    End Select
```
This code will show their levels only if they are attack on sight, attack when attacked, or guards. We don't want a friendly/shopkeeper NPC's level to be visible if we can't attack it… right?

That's pretty much it. Hope it helps.
Link to comment
Share on other sites

  • 2 months later...
  • 1 month later...
  • 1 year later...
Simple and great, 8\. Thanks for sharing.

> hey can you help me for showing level for player ?

Put this in modText, drawplayername```
Name = Trim$(Player(index).Name) & " [" & GetPlayerLevel(index) & "]"

```
Same formatting as above.

> instead of using text how can I show an img?

I understand that your question is relevant in theme. In terms of the actual code required, a separate topic in Q&A would be more appropriate than in thus tutorial, because of both the scope of the request and since the methods have practically nothing to do with each other. All the same… a lot of people have asked for this in the past and I don't think a tutorial exists. So I've just uploaded one. [Here's the link](http://www.touchofdeathforums.com/community/index.php?/topic/133157-eo-images-by-player-names-base-for-further-specific-coding/).
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...