Raised This Month: $51 Target: $400
 12% 

[TF2] game_text_tf advertisements


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
404UserNotFound
BANNED
Join Date: Dec 2011
Old 10-11-2014 , 19:56   [TF2] game_text_tf advertisements
Reply With Quote #1

So I reverse-engineered Mecha the Slag's Golden Wrench notification plugin and turned it into a message-displaying command.

Thing is, I'm at a brick wall in regards to what to do with this. The game_text_tf entity that the plugin calls on is so diverse and so easily modifiable that it could easily be used in so many ways.

Attached is an example plugin I made for this, and below is all the information you need on customizing this.


IDEAS FOR THIS
- TF2-specific "Advertisement" plugin that utilizes this to display adverts alongside the standard hint/top/chat/center/menu messages. - Would definitely like to see this made, just not sure on how to set it up properly. I'm thinking giving the option to choose the background color, icon, message text, which team to display it to.

- Incorporation into existing game mode plugins? - Could be neat in Jailbreak, TF2 Tower Defense, VS Saxton Hale/Freak Fortress 2



ICONS
For the "DispatchKeyValue(entity, "icon", "ico_build");" bit, you can use anything found within "tf/scripts/mod_textures.res" in place of "ico_build". This includes HUD elements (such as the Engineer's building status icons), killfeed icons and much more.


BACKGROUND VALUES
For DispatchKeyValue(entity, "background", "0");
0 - Grey
2 - Red
3 - Blue


TEAM-BASED DISPLAY
For DispatchKeyValue(entity, "display_to_team", "0");
0 - Everyone
2 - RED Team only
3 - BLU Team only


TARGETNAME
For DispatchKeyValue(entity, "targetname", "game_text1");

I don't know what this is. I've been trying to find info on "game_text1" in an effort to see if there's other things this can target (I'm thinking this could lead to different background styles)
Attached Files
File Type: sp Get Plugin or Get Source (TF2_HUDMessages.sp - 969 views - 1.7 KB)
404UserNotFound is offline
Zephyrus
Cool Pig B)
Join Date: Jun 2010
Location: Hungary
Old 10-11-2014 , 20:03   Re: [TF2] game_text_tf advertisements
Reply With Quote #2

picture pls
__________________
Taking private C++/PHP/SourcePawn requests, PM me.
Zephyrus is offline
404UserNotFound
BANNED
Join Date: Dec 2011
Old 10-11-2014 , 20:06   Re: [TF2] game_text_tf advertisements
Reply With Quote #3

Quote:
Originally Posted by Zephyrus View Post
picture pls
Custom Weapons 2 just crashed my server (using Advanced Weaponiser 2 attributes plugin, Firkin' Flamer's alt-fire crashed it) so I can't grab a pic.

Gimme a few seconds and I'll grab some.

EDIT: Here you go! Grabbed a screenie of each background color and tried out 3 different HUD icons from mod_textures.txt (used to be mod_textures.res, I guess they renamed it):



From top to bottom: hud_taunt_hint, hud_taunt_menu_icon and hud_spy_disguise_menu_icon.

You'll notice the lack of squishing. If you use icons whose height/width are the same, there won't be any squishing. For some icons however (such as ico_notify_golden_wrench from Mecha's plugin), they get squished due to being disproportioned (96w x 32h)

Last edited by 404UserNotFound; 10-11-2014 at 20:20.
404UserNotFound is offline
Zephyrus
Cool Pig B)
Join Date: Jun 2010
Location: Hungary
Old 10-11-2014 , 20:23   Re: [TF2] game_text_tf advertisements
Reply With Quote #4

this is nice, i wonder why it hasnt been used before, whats the max length of the message? does it support new line? btw i can tell you targetname is not used for anything its just an identifier for entities, can be anything
__________________
Taking private C++/PHP/SourcePawn requests, PM me.

Last edited by Zephyrus; 10-11-2014 at 20:30.
Zephyrus is offline
psychonic

BAFFLED
Join Date: May 2008
Old 10-11-2014 , 20:48   Re: [TF2] game_text_tf advertisements
Reply With Quote #5

Quote:
Originally Posted by Zephyrus View Post
i wonder why it hasnt been used before
It has. I remember seeing it before, and a quick forum search shows references going back to 2008.

It can also be triggered by the HudNotifyCustom message as shown in the Snippets forum, https://forums.alliedmods.net/showthread.php?t=155911

Last edited by psychonic; 10-11-2014 at 20:50.
psychonic is offline
404UserNotFound
BANNED
Join Date: Dec 2011
Old 10-11-2014 , 20:50   Re: [TF2] game_text_tf advertisements
Reply With Quote #6

Quote:
Originally Posted by psychonic View Post
It has. I remember seeing it before, and a quick forum search shows references going back to 2008.
Mhm, it's been out for ages. As I've said before, I'd love to see a TF2-specific advertisement-type plugin that utilizes this.

I haven't figured out the max length of the message (not sure of the quickest way to go about this).

Quote:
Originally Posted by psychonic View Post
It can also be triggered by the HudNotifyCustom message as shown in the Snippets forum, https://forums.alliedmods.net/showthread.php?t=155911
Oh beauty! Well if those natives in the INC had the fields for the icon, and had the background color/team display set separately, that would be perfect and could easily be merged into existing advertisements plugins.

Last edited by 404UserNotFound; 10-11-2014 at 20:52.
404UserNotFound is offline
pheadxdll
AlliedModders Donor
Join Date: Jun 2008
Old 10-11-2014 , 21:12   Re: [TF2] game_text_tf advertisements
Reply With Quote #7

That explains the squishing.

I think they are not used very much because they only show up for a few seconds (unless you hit the input repeatedly with a timer) and because these messages will not be seen by any players using the minimized TF2 HUD. And I don't believe they are multi-line, correct me if wrong.
__________________

Last edited by pheadxdll; 10-11-2014 at 21:14.
pheadxdll is offline
friagram
Veteran Member
Join Date: Sep 2012
Location: Silicon Valley
Old 10-13-2014 , 05:41   Re: [TF2] game_text_tf advertisements
Reply With Quote #8

I put them into some custom maps years ago, but never found much use aside from giving simple hints.
https://developer.valvesoftware.com/wiki/Game_text_tf

Iirc it also messages everyone on the team, which is quite annoying due to their placement.
__________________
Profile - Plugins
Add me on steam if you are seeking sp/map/model commissions.
friagram is offline
ddhoward
Veteran Member
Join Date: May 2012
Location: California
Old 10-17-2014 , 06:46   Re: [TF2] game_text_tf advertisements
Reply With Quote #9

someone test pls

http://ddhoward.bitbucket.org/script...me_text_tf.inc

Examples: These examples have been removed due to a change in how the order of arguments.

Also, the indentations of the different @param lines show up correctly in notepad and Notepad++, just not in a browser.
__________________

Last edited by ddhoward; 10-18-2014 at 13:02.
ddhoward is offline
friagram
Veteran Member
Join Date: Sep 2012
Location: Silicon Valley
Old 10-17-2014 , 14:26   Re: [TF2] game_text_tf advertisements
Reply With Quote #10

Quote:
Originally Posted by ddhoward View Post
someone test pls

http://ddhoward.bitbucket.org/script...me_text_tf.inc

Examples:
PHP Code:
PrintTFText("this is a HUD message"TFTeam_Red_10.0); 
PHP Code:
PrintTFText("u r a butt"TFTeam_Unassigned30.0"hud_spy_disguise_menu_icon"); 
Also, the indentations of the different @param lines show up correctly in notepad and Notepad++, just not in a browser.
Gross..
I did this:
PHP Code:
public Action:MessageCmd(clientargs)
{
    if(
args >= 2)
    {
        new 
String:message[256];
        new 
String:time[3];
        new 
String:icon[64];
        new 
String:team[2];
        new 
String:color[2];
        
        
GetCmdArg(1message256);
        
GetCmdArg(2time3);
        
GetCmdArg(3icon64);
        
GetCmdArg(4team2);
        
GetCmdArg(5color2);
        
        
ReplaceString(message,512,"\\n","\n");
        
        
CreateTFmessage(messageStringToFloat(time), iconStringToInt(team), StringToInt(color));
    }
    else
    {
        
ReplyToCommand(client"[sm] usage: <message> <time> <icon> <team> <color>");
    }
    return 
Plugin_Handled;
}

CreateTFmessage(const String:message[], Float:time, const String:icon[]="leaderboard_streak"team 0color 0)
{
    new 
entity CreateEntityByName("game_text_tf");
    if(
entity != -1)
    {
        
DispatchKeyValue(entity"message"message);
        switch(
team)
        {
            case 
2DispatchKeyValue(entity"display_to_team""2");
            case 
3DispatchKeyValue(entity"display_to_team""3");
            default: 
DispatchKeyValue(entity"display_to_team""0");
        }
        switch(
color)
        {
            case 
2DispatchKeyValue(entity"background""3");
            case 
3DispatchKeyValue(entity"background""3");
            default: 
DispatchKeyValue(entity"background""3");
        }
        
DispatchKeyValue(entity"icon"icon);

        
DispatchSpawn(entity);
        
AcceptEntityInput(entity"Display");

        new 
Handle:data;
        
CreateDataTimer(3.0Timer_TFmessagedataTIMER_REPEAT|TIMER_FLAG_NO_MAPCHANGE);
        
WritePackCell(dataEntRefToEntIndex(entity));
        
WritePackFloat(dataGetEngineTime() + time);
    }
}

public 
Action:Timer_TFmessage(Handle:timerHandle:pack)
{
    
ResetPack(pack);
    new 
entity EntRefToEntIndex(ReadPackCell(pack));
    if(
entity != INVALID_ENT_REFERENCE)
    {
        if(
GetEngineTime() < ReadPackFloat(pack))
        {
            
AcceptEntityInput(entity"Display");

            return 
Plugin_Continue;
        }
        else
        {
            
AcceptEntityInput(entity"Kill");
        }
    }
    return 
Plugin_Stop;

__________________
Profile - Plugins
Add me on steam if you are seeking sp/map/model commissions.
friagram is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 07:51.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode