Page 1 of 1

Howto display additional information?

Posted: Thu Jul 07, 2016 11:30 am
by kalle
Dear Community members,

I got another question regarding on what is the best option to display something in the hud of a player. I currently use HintText for fast changing things and its working very well. But I'm on my way to create a little gamemode where I need to display dynamic changing text for the round. This information is neccessary to have an idea what this gamemode is about.

I tried to use a simplemenu and it worked quite well but I can't update the menu (the player needs to close it first). The needed function HudMsg is not working for CSGO (nothing gets displayed).

Is there any chance to display text on the players HUD on the upper left under the current amount of money? Maybe in the same style? Would be great :)

Re: Howto display additional information?

Posted: Thu Jul 07, 2016 1:12 pm
by Ayuto
Yes, HudMsg doesn't work in CS:GO, but your first aproach with menus was already correct. All you need is a build callback. It gets called everytime the menu is sent to the Player (every second).

Example:

Syntax: Select all

import time
from menus import SimpleMenu

my_menu = SimpleMenu()

@my_menu.register_build_callback
def my_build_callback(menu, index):
menu.clear()

# Fill your menu here
menu.append(time.ctime())
An alternative would be to subclass a menu option class and override its _render method. Then you don't need the build_callback. However, the build callback is the easiest solution.

Re: Howto display additional information?

Posted: Thu Jul 07, 2016 2:20 pm
by kalle
Thanks,

now I'm feeling dumb because I had a look at that class before and didn't find a solution. Anyway its working quite well for me :)

Re: Howto display additional information?

Posted: Wed Jul 13, 2016 3:30 pm
by kalle
So I've got a question related to this :) - the main problem is that players can't use their hotkeys for weapon changing any more because it's a menu at all. Any possibility to render stuff directly in the UI in CSGO instead of using a menu? Maybe directly as an 2D Object that marks an object? Something like in BF3 (see the blue C and the red B):

http://static1.gamespot.com/uploads/scr ... 111_m2.jpg

Or sth like the current amount of cash on the left.

Background: I'm currently successful in creating a conquest mod for CSGO at all. It's working quite well for now but I'm on my way to make it "good looking" for everyone. So it would at least be nice to have some more nice looking visuals ingame.