Raised This Month: $13 Target: $400
 3% 

Solved HP Bar


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
MayroN
Senior Member
Join Date: Aug 2017
Location: Kyiv
Old 06-25-2020 , 21:11   HP Bar
Reply With Quote #1

There is a bar ( Health) Sprite that counts health from the end
In this section of the code produces Health from the beginning
How do I set the countdown from the end?
Thanks
PHP Code:
    if(HEALTH_BOSS < (cso_boss_health 1000.0))
    {
        
set_pev(y_hpbarpev_frame100.0)
    } else {
        
set_pev(y_hpbarpev_frame0.0 + ((((cso_boss_health 1000.0) - ) * 100) / HEALTH_BOSS))
    } 

Last edited by MayroN; 07-02-2020 at 19:18.
MayroN is offline
Send a message via ICQ to MayroN Send a message via Skype™ to MayroN
AnimalMonster
Member
Join Date: May 2020
Old 06-26-2020 , 08:46   Re: HP Bar
Reply With Quote #2

Sorry but i don't really know.....
maybe try to inverse them??
PHP Code:
if(HEALTH_BOSS < (cso_boss_health 1000.0))
    {
        
set_pev(y_hpbarpev_frame0.0 + ((((cso_boss_health 1000.0) - ) * 100) / HEALTH_BOSS))
    } else {
        
set_pev(y_hpbarpev_frame100.0)
    } 
AnimalMonster is offline
supertrio17
Senior Member
Join Date: May 2020
Location: Serbia
Old 06-26-2020 , 08:49   Re: HP Bar
Reply With Quote #3

Can you share the whole plugin with us?
__________________
Contact! || Discord:
Mr_Boopsy_#2066

Last edited by supertrio17; 06-26-2020 at 08:49.
supertrio17 is offline
MayroN
Senior Member
Join Date: Aug 2017
Location: Kyiv
Old 06-26-2020 , 17:30   Re: HP Bar
Reply With Quote #4

The solution was this
PHP Code:
set_pev(y_hpbarpev_frame0.0 + ((((cso_boss_health 1000.0) - ) * 100) / HEALTH_BOSS)) 
>>>
PHP Code:
set_pev(y_hpbarpev_frame100.0 - ((((cso_boss_health 1000.0) - ) * 100.0) / HEALTH_BOSS)) 

Last edited by MayroN; 06-26-2020 at 17:34.
MayroN is offline
Send a message via ICQ to MayroN Send a message via Skype™ to MayroN
MayroN
Senior Member
Join Date: Aug 2017
Location: Kyiv
Old 06-28-2020 , 20:29   Re: HP Bar
Reply With Quote #5

I'll ask again here.How to get rid of sharp jerks of the sprite with the movement of Entity here?
PHP Code:
public create_phobos()
{
    new 
ent create_entity("info_target")

        if(!
is_valid_ent(ent))
          return;


    
y_think ent
    
static Float:Origin[3]
    
Origin[0] = y_spawn_points[0]
    
Origin[1] = y_spawn_points[1]
    
Origin[2] = y_spawn_points[2]
    
entity_set_origin(entOrigin)
    
entity_set_float(entEV_FL_takedamage1.0)
    
entity_set_float(entEV_FL_healthnpc_healthpoints 1000.0)
    
entity_set_string(entEV_SZ_classname"npc_phobos")
    
entity_set_model(entnpc_mdl)
    
entity_set_int(entEV_INT_solidSOLID_BBOX)
    
entity_set_int(entEV_INT_movetypeMOVETYPE_PUSHSTEP)
    new 
Float:maxs[3] = {25.050.0200.0}
    new 
Float:mins[3] = {-25.0, -50.0, -35.0}
    
entity_set_size(entminsmaxs)
    
entity_set_int(entEV_INT_modelindexy_npc_mdl)
    
anim(ent5)
    
set_task(0.1"phobos_done"ent+npc_start_think)            // Phobos prepare time
    
if(!y_start_npc)
    {
        
y_start_npc 1
        RegisterHamFromEntity
(Ham_TakeDamageent"phobos_take_damage"1)
    }
    for(new 
0get_maxplayers(); i++)
    {
        if(
is_user_alive(i) && entity_range(enti) <= 400)
        {

        }
    }
    
y_hpbar create_entity("env_sprite")
    
set_pev(y_hpbarpev_scale0.2)
    
set_pev(y_hpbarpev_ownerent)
    
engfunc(EngFunc_SetModely_hpbarhp_spr)    
    
set_task(0.1"phobos_ready"ent+npc_restart__"b")
    
set_task(random_float(7.015.0), "punish"npc_ability)
}

public 
phobos_ready(ent)
{
    
ent -= npc_restart
    
if(!pev_valid(ent))
    {
        
remove_task(ent+npc_restart)
        return
    }
    static 
Float:Origin[3], Float:phobos_health
    pev
(entpev_originOrigin)
    
Origin[2] += 270.0    
    engfunc
(EngFunc_SetOriginy_hpbarOrigin)
    
pev(entpev_healthphobos_health)
    if(
npc_healthpoints < (phobos_health 1000.0))
    {
        
set_pev(y_hpbarpev_frame100.0)
    }
    else
    {
        
set_pev(y_hpbarpev_frame100.0 - ((((phobos_health 1000.0) - ) * 100) / npc_healthpoints))
    }        

MayroN is offline
Send a message via ICQ to MayroN Send a message via Skype™ to MayroN
AnimalMonster
Member
Join Date: May 2020
Old 06-29-2020 , 22:38   Re: HP Bar
Reply With Quote #6

Quote:
Originally Posted by MayroN View Post
I'll ask again here.How to get rid of sharp jerks of the sprite with the movement of Entity here?
PHP Code:
public create_phobos()
{
    new 
ent create_entity("info_target")

        if(!
is_valid_ent(ent))
          return;


    
y_think ent
    
static Float:Origin[3]
    
Origin[0] = y_spawn_points[0]
    
Origin[1] = y_spawn_points[1]
    
Origin[2] = y_spawn_points[2]
    
entity_set_origin(entOrigin)
    
entity_set_float(entEV_FL_takedamage1.0)
    
entity_set_float(entEV_FL_healthnpc_healthpoints 1000.0)
    
entity_set_string(entEV_SZ_classname"npc_phobos")
    
entity_set_model(entnpc_mdl)
    
entity_set_int(entEV_INT_solidSOLID_BBOX)
    
entity_set_int(entEV_INT_movetypeMOVETYPE_PUSHSTEP)
    new 
Float:maxs[3] = {25.050.0200.0}
    new 
Float:mins[3] = {-25.0, -50.0, -35.0}
    
entity_set_size(entminsmaxs)
    
entity_set_int(entEV_INT_modelindexy_npc_mdl)
    
anim(ent5)
    
set_task(0.1"phobos_done"ent+npc_start_think)            // Phobos prepare time
    
if(!y_start_npc)
    {
        
y_start_npc 1
        RegisterHamFromEntity
(Ham_TakeDamageent"phobos_take_damage"1)
    }
    for(new 
0get_maxplayers(); i++)
    {
        if(
is_user_alive(i) && entity_range(enti) <= 400)
        {

        }
    }
    
y_hpbar create_entity("env_sprite")
    
set_pev(y_hpbarpev_scale0.2)
    
set_pev(y_hpbarpev_ownerent)
    
engfunc(EngFunc_SetModely_hpbarhp_spr)    
    
set_task(0.1"phobos_ready"ent+npc_restart__"b")
    
set_task(random_float(7.015.0), "punish"npc_ability)
}

public 
phobos_ready(ent)
{
    
ent -= npc_restart
    
if(!pev_valid(ent))
    {
        
remove_task(ent+npc_restart)
        return
    }
    static 
Float:Origin[3], Float:phobos_health
    pev
(entpev_originOrigin)
    
Origin[2] += 270.0    
    engfunc
(EngFunc_SetOriginy_hpbarOrigin)
    
pev(entpev_healthphobos_health)
    if(
npc_healthpoints < (phobos_health 1000.0))
    {
        
set_pev(y_hpbarpev_frame100.0)
    }
    else
    {
        
set_pev(y_hpbarpev_frame100.0 - ((((phobos_health 1000.0) - ) * 100) / npc_healthpoints))
    }        

I don't really know but you can edit the spirite if there are some sharp thing you don t wanna see
#idon'treallyknow

Last edited by AnimalMonster; 06-29-2020 at 22:39.
AnimalMonster is offline
Reply


Thread Tools
Display Modes

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 14:42.


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