Raised This Month: $ Target: $400
 0% 

[TUT] Day Of Defeat Custom HUD Flag Icons


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
TheVaskov
Member
Join Date: Sep 2021
Location: Russia
Old 04-24-2024 , 07:06   [TUT] Day Of Defeat Custom HUD Flag Icons
Reply With Quote #1

Good afternoon, today I will tell you how to use standard amxx solutions to install a custom flag icon in the interface of all players and on the radar with the map.

Description of the technique:
The icon is changed when assigning a serial number to a pre-cached flag icon.
It is important to understand that we cannot simply create a measure and place the index of a pre-cached file in it and simply assign it. it won't work. We will try to get to a free cell for icons from 0 to 24 approximately.
When the map is launched, it comes with flag icons. For example, we will consider dod_caen.bsp

PHP Code:

#define m_iAlliesIcon 553
#define m_iAxisIcon 554
#define m_iNeutralIcon 555

public control_points_retune()
{    

    new 
idx_cpoint
    
while((idx_cpoint engfunc(EngFunc_FindEntityByStringidx_cpoint"classname""dod_control_point")) != 0)
    {

        
set_pdata_int(idx_cpoint,m_iNeutralIcon0linux_diff_entity// 
        
set_pdata_int(idx_cpoint,m_iAlliesIcon16linux_diff_entity//
        
set_pdata_int(idx_cpoint,m_iAxisIcon17linux_diff_entity//
        
     /*
    0 == Белый нейтральный
    1 == Allies Star
    2 == Axis Axis
    3 == Neutral White 
    3 == Allies Artillery
    5 == Axis Artillery
    6 == Neutral White 
    7 == Allies Bridge
    8 == Axis Bridge
    9 == Neutral White 
    10 == Allies Radio
    11 == Axis Radio
    12 == Neutral White 
    13 == Allies Docs
    14 == Axis Docs
    15 == Neutral White 
    16 == Allies Truck
    17 == Axis Ganamak
    18 == Neutral Mers W136
    19 == Allies Mers W136
    20 == Axis Mers W136 
    21 == Neutral Tank
    22 == Allies Tank
    23 == Axis Tank
    21 == Neutral Tank
    22 == Allies Weelys
    23 == Axis Weelys
    */
  
}

And so here we have simply assigned the same icons to all the serial numbers of the flags. Below is a list of serial numbers for standard icons, but I'm not sure that these are constants. and the most important subject of research begins now, in the next paragraph

At a certain moment, you go to assign icon number 22 to some flag, but when assigned, the icon will be missing in the game, it will be an empty slot in the interface, as if the flag does not exist, you will not see this icon on the radar map either.
We remember this number for dod_caen == 22 (please note that this may be a different number, since I conducted this research a month ago, and if you need to know for sure, then you will check it empirically. upd:: it's 22 for caen)
If we open the game client console, we will see the following returns
PHP Code:
Errorcould not load file sprites/obj_icons/dod_caen/icon_obj_custom2_neutral.spr
Error
could not load file sprites/obj_icons/dod_caen/icon_obj_custom2_allies.spr
Error
could not load file sprites/obj_icons/dod_caen/icon_obj_custom2_axis.spr 
I tested this technique on the dod_anzio card, and each time the game engine accesses the standard directory and the standard file name, generating an ordinal at the end.

PHP Code:
Half-Life\dod\sprites\obj_icons\dod_caen == 
Half-Life\dod\sprites\obj_icons\*mapname\icon_obj_custom*NUMBER*_axis.spr 
Good!
All that remains to be done:
Create a custom sprite (preferably for both teams)
First cache it, and assign our supposedly constant number to the flag.

in the archive you will find an absolutely working solution for dod_caen

In the image you will see that for dod_caen it worked, but for dod_donner , you need to look for free slots again, ultimately for customization you will have to create a downloadable configuration file that loads values ​​for each map.
Also in the source file of the plugin you will see that there is a collection of some information for each point, and taking its index, we can assign our own icon to a certain flag using the switch{case} ..

So!
Memo - Method for installing a custom sprite on a flag:
1. try all the numbers on m_iNeutral\Axis|AlliesIcon
2. If the flag icons are missing, open the console and there should be something like this:
Server #2
Error: could not load file sprites/obj_icons/dod_caen/icon_obj_custom2_neutral.spr
Error: could not load file sprites/obj_icons/dod_caen/icon_obj_custom2_allies.spr
Error: could not load file sprites/obj_icons/dod_caen/icon_obj_custom2_axis.spr
3. Create sprites with the desired name from the console
4. Pre-cache sprites
5. Put empty numbers.
6. Done
Attached Thumbnails
Click image for larger version

Name:	dod_caen_donner_huds.jpg
Views:	52
Size:	93.5 KB
ID:	204177  
Attached Files
File Type: zip cpoints.zip (8.3 KB, 36 views)
__________________
TheVaskov 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 13:05.


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