Welcome!

Join our community of MMO enthusiasts and game developers! By registering, you'll gain access to discussions on the latest developments in MMO server files and collaborate with like-minded individuals. Join us today and unlock the potential of MMO server development!

Join Today!

[HELP] Weapon icon in HUD

Newbie Spellweaver
Joined
Jun 30, 2013
Messages
43
Reaction score
3
Icon flickering in hud.

Video:
[video]https://streamable.com/5bwx4[/video]

HUD.as
Code:
public    function setWeaponInfo (ammo:int, clips:int, type:String, durability:int, icon:String):void        {            Main.Weapon.Weapon.Ammo.text = ammo;            Main.Weapon.Weapon.AmmoShad.text = ammo;            Main.Weapon.Weapon.Clips.text = clips;            Main.Weapon.Weapon.ClipsShad.text = clips;            Main.Weapon.Weapon.DuraScale.gotoAndStop(Math.max(1, Math.min(100, 100-durability)));            while (Main.Weapon.Weapon.Pic.numChildren)                    Main.Weapon.Weapon.Pic.removeChildAt(0);            if (icon != "")                    loadSlotIcon (icon, Main.Weapon.Weapon.Pic);            else if (Main.Weapon.Weapon.Fire.currentLabel != type)                    Main.Weapon.Weapon.Fire.gotoAndPlay(type);        }

HUDDisplay.cpp

Code:
void HUDDisplay::setWeaponInfo(int ammo, int clips, int firemode, int durability, const char* Pic){
    if(!Inited) return;
    Scaleform::GFx::Value var[5];
    var[0].SetInt(ammo);
    var[1].SetInt(clips);
    if(firemode==1)
        var[2].SetString("one");
    else if(firemode ==2)
        var[2].SetString("three");
    else
        var[2].SetString("auto");
    var[3].SetInt(durability);
    var[4].SetString(Pic);
    gfxHUD.Invoke("_root.api.setWeaponInfo", var, 5);
}

AI_Player.cpp

Code:
if(m_Weapons[m_SelectedWeapon] && hudMain->isWeaponInfoVisible()==1)//Cynthia:554            
{    
                if(m_Weapons[m_SelectedWeapon]->getCategory() == storecat_GRENADE) // treated as items
                {    
                    const wiInventoryItem& wi = m_Weapons[m_SelectedWeapon]->getPlayerItem();
                    hudMain->setWeaponInfo(R3D_MIN(1, wi.quantity), R3D_MIN(0, wi.quantity-1), 1, 100, "weapons/HG_Glock18.png");
                }
                else
                    hudMain->setWeaponInfo(m_Weapons[m_SelectedWeapon]->getNumBulletsLeft(), m_Weapons[m_SelectedWeapon]->getNumClipsLeft(), (int)m_Weapons[m_SelectedWeapon]->getFiremode(), m_Weapons[m_SelectedWeapon]->getPlayerItem().Var3/100, m_Weapons[m_SelectedWeapon]->getStoreIcon());


            }

Code similar to United's DeadMsg.
 
Last edited:
Joined
Apr 23, 2013
Messages
1,172
Reaction score
1,786
I already had this problem, something on HUD was blinking. I honestly can not remember how I got it, but I remember it was something repeated in the code, something like conflict, 2 of the same code running in different places. you can try to fix it by looking at the function if it exists. you can use the "find all"

If it gets AI_Player.cpp or HUD file, try using WinMarge and compare it to another source closest to it to find the error.
 
Upvote 0
Experienced Elementalist
Joined
May 28, 2017
Messages
225
Reaction score
127
The function you are using is in an update function and gets updated in milliseconds... thats why its flickering, your game code sets it everytime again and hud is refreshing it because of the new request from the game code. I hope you understand what I mean.
 
Upvote 0
Newbie Spellweaver
Joined
Jun 30, 2013
Messages
43
Reaction score
3
FIXED!

in HUD.as replace:
Code:
                       while (Main.Weapon.Weapon.Pic.numChildren)                    
                                    Main.Weapon.Weapon.Pic.removeChildAt(0);            
                       if (icon != "")                    
                                    loadSlotIcon (icon, Main.Weapon.Weapon.Pic);

to:

Code:
if(Main.Weapon.Weapon.prevPicIcon != icon)            {
            while (Main.Weapon.Weapon.Pic.numChildren > 0)
                    Main.Weapon.Weapon.Pic.removeChildAt(0);
            if (icon != "")
                    loadSlotIcon (icon, Main.Weapon.Weapon.Pic);
                
            Main.Weapon.Weapon.prevPicIcon = icon;
            }
 
Last edited:
Upvote 0
Back
Top