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

Creating an Image on the Game Screen In PvP Maps (SOLVED)


Kimimaru
 Share

Recommended Posts

Hello. I would like to make it so that once you enter a PvP map, it displays a sign on the bottom right of the game screen indicating that the area is a PvP zone. For example, upon entering a PvP map, it displays a "VS" sign on the bottom right. Additionally, I only want the image to appear in PvP maps. I think that I know the basics of getting this to work, although I'm not sure if my thoughts are correct or not. Any help would be appreciated.
Link to comment
Share on other sites

uhh no heres what u do. paste an image on and name it "imgnone"
and find ' draw map name and replace it with this

> ' Draw map name
>                     If Map(GetPlayerMap(MyIndex)).Moral = MAP_MORAL_NONE Then
>                         Call DrawText(TexthDC, 0 + sx, 0 + sx,
>                         imgnone.visible=true
> Trim$(Map(GetPlayerMap(MyIndex)).Name), QBColor(BRIGHTRED))
>                     ElseIf Map(GetPlayerMap(MyIndex)).Moral = MAP_MORAL_HOUSE Then
>                         Call DrawText(TexthDC, 0 + sx, 0 + sx,
>                           imgnone.visible=false
> Trim$(Map(GetPlayerMap(MyIndex)).Name), QBColor(YELLOW))
>                     ElseIf Map(GetPlayerMap(MyIndex)).Moral = MAP_MORAL_SAFE Then
>                         Call DrawText(TexthDC, 0 + sx, 0 + sx,
> imgnone.visible=false
> Trim$(Map(GetPlayerMap(MyIndex)).Name), QBColor(BRIGHTGREEN))
>                     ElseIf Map(GetPlayerMap(MyIndex)).Moral = MAP_MORAL_NO_PENALTY Then
>                         Call DrawText(TexthDC, 0 + sx, 0 + sx,
> imgnone.visible=false
> Trim$(Map(GetPlayerMap(MyIndex)).Name), QBColor(WHITE))
Link to comment
Share on other sites

The only way I can move my image on the game screen after I paste it is to put it into a picture box and then move the picture box. I can't name the image, but I can name the picture box. Your method would work; however, I believe that I would have to have some sort of background behind the image because I cannot make the picture box transparent. I believe I would need some DirectX coding skills of some sort to do that. If I'm wrong, please correct me. Thanks for the help, though. I can use this to my benefit.
Link to comment
Share on other sites

Okay, thanks. I understand what you're saying, but whenever I paste my image onto there, it has a white background, even though I previously removed the background from the image and made the background transparent. Do you know what I can do?
Link to comment
Share on other sites

I've managed to make some modifications, and everything is fine. Thanks a lot Zultar! However, your code was slightly off and didn't work. I modified it to make it work, though. This is how it should be:

```
' Draw map name
If Map(GetPlayerMap(MyIndex)).Moral = MAP_MORAL_NONE Then
    Call DrawText(TexthDC, Int((20.5) * PIC_X / 2) - (Int(Len(Trim$(Map(GetPlayerMap(MyIndex)).Name)) / 2) * 8) + sx, 2 + sx, Trim$(Map(GetPlayerMap(MyIndex)).Name), QBColor(BRIGHTRED))
    frmMirage.imgnone.Visible = True
ElseIf Map(GetPlayerMap(MyIndex)).Moral = MAP_MORAL_HOUSE Then
    Call DrawText(TexthDC, Int((20.5) * PIC_X / 2) - (Int(Len(Trim$(Map(GetPlayerMap(MyIndex)).Name)) / 2) * 8) + sx, 2 + sx, Trim$(Map(GetPlayerMap(MyIndex)).Name), QBColor(YELLOW))
    frmMirage.imgnone.Visible = False
ElseIf Map(GetPlayerMap(MyIndex)).Moral = MAP_MORAL_SAFE Then
    Call DrawText(TexthDC, Int((20.5) * PIC_X / 2) - (Int(Len(Trim$(Map(GetPlayerMap(MyIndex)).Name)) / 2) * 8) + sx, 2 + sx, Trim$(Map(GetPlayerMap(MyIndex)).Name), QBColor(WHITE))
    frmMirage.imgnone.Visible = False
ElseIf Map(GetPlayerMap(MyIndex)).Moral = MAP_MORAL_NO_PENALTY Then
    Call DrawText(TexthDC, Int((20.5) * PIC_X / 2) - (Int(Len(Trim$(Map(GetPlayerMap(MyIndex)).Name)) / 2) * 8) + sx, 2 + sx, Trim$(Map(GetPlayerMap(MyIndex)).Name), QBColor(BLACK))
    frmMirage.imgnone.Visible = False
End If

```
Since I have the map name placed above my game screen, I no longer need to have all of that code there, so I'll show you my current code:

```
' Draw map name
If Map(GetPlayerMap(MyIndex)).Moral = MAP_MORAL_NONE Then
    frmMirage.imgnone.Visible = True
ElseIf Map(GetPlayerMap(MyIndex)).Moral = MAP_MORAL_HOUSE Then
    frmMirage.imgnone.Visible = False
ElseIf Map(GetPlayerMap(MyIndex)).Moral = MAP_MORAL_SAFE Then
    frmMirage.imgnone.Visible = False
ElseIf Map(GetPlayerMap(MyIndex)).Moral = MAP_MORAL_NO_PENALTY Then
    frmMirage.imgnone.Visible = False
End If

```
Anyway, thanks a lot for the help!
Link to comment
Share on other sites

  • 1 month later...
Since I display the map name in a spot other than the game screen, you would use this code:

```
' Draw map name
If Map(GetPlayerMap(MyIndex)).Moral = MAP_MORAL_NONE Then
    Call DrawText(TexthDC, Int((20.5) * PIC_X / 2) - (Int(Len(Trim$(Map(GetPlayerMap(MyIndex)).Name)) / 2) * 8) + sx, 2 + sx, Trim$(Map(GetPlayerMap(MyIndex)).Name), QBColor(BRIGHTRED))
    frmMirage.imgnone.Visible = True
ElseIf Map(GetPlayerMap(MyIndex)).Moral = MAP_MORAL_HOUSE Then
    Call DrawText(TexthDC, Int((20.5) * PIC_X / 2) - (Int(Len(Trim$(Map(GetPlayerMap(MyIndex)).Name)) / 2) * 8) + sx, 2 + sx, Trim$(Map(GetPlayerMap(MyIndex)).Name), QBColor(YELLOW))
    frmMirage.imgnone.Visible = False
ElseIf Map(GetPlayerMap(MyIndex)).Moral = MAP_MORAL_SAFE Then
    Call DrawText(TexthDC, Int((20.5) * PIC_X / 2) - (Int(Len(Trim$(Map(GetPlayerMap(MyIndex)).Name)) / 2) * 8) + sx, 2 + sx, Trim$(Map(GetPlayerMap(MyIndex)).Name), QBColor(WHITE))
    frmMirage.imgnone.Visible = False
ElseIf Map(GetPlayerMap(MyIndex)).Moral = MAP_MORAL_NO_PENALTY Then
    Call DrawText(TexthDC, Int((20.5) * PIC_X / 2) - (Int(Len(Trim$(Map(GetPlayerMap(MyIndex)).Name)) / 2) * 8) + sx, 2 + sx, Trim$(Map(GetPlayerMap(MyIndex)).Name), QBColor(BLACK))
    frmMirage.imgnone.Visible = False
End If

```
Make sure that the image you pasted onto Visual Basic 6 has the name "imgnone." The name shouldn't contain the "." at the end. Also, make sure that you've placed your image within a Picture Box. For the best results, make sure the image takes up the whole Picture Box. Your image may need to have a background on it because the picture box is a box and cannot take a transparent background. You would need to know how to program in DirectX to create an image without a background.

Please post here again if you have any other problems.
Link to comment
Share on other sites

Strange. Try downloading a fresh copy of frmMirage.frm. Then, copy the part in the original where it renders the map name and replace it with yours. This should hopefully prevent the error from occuring. Once we get the error to stop, we can continue with the code.
Link to comment
Share on other sites

hmm, well It works on a fresh clean mirage. May be something conflicting within mine. I'll rebuild mine and see where the error lies. Doing an Alpha test of my game tomorrow so I'll have to do a new file so I can give the game out.
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...