ok , let's say gondar ( a hero ) has 1800 hp on new round. i want to check if it's health becomes lower than 900 , then i will add some effects and if it becomes lower than 600 i will disable that effects and will add new effects.
basically this is how i'm checking :
Code:
(if ((g_gondar_health / 2) >= current_health)
and at the same
Code:
(if ((g_gondar_health / 3) >= current_health)
so both sentence becomes true when gondar health reaches 599 and effects will be activated. problem is both sentence will be excuted while the health is under (main health /3 ). and 1 of them is unnnessesary.
Code:
check_health(index)
{
new current_health
current_health = get_user_health(index)
if ((g_gondar_health / 2) >= current_health)
{
set_user_maxspeed(index , 450.0)
set_user_rendering(index, kRenderFxGlowShell, 0, 0, 0, kRenderTransAlpha,155)
message_begin(MSG_ALL,iconstatus,{0,0,0},index)
write_byte(1) // status (0=hide, 1=show, 2=flash)
write_string("dmg_poison") // sprite name
write_byte(255) // red
write_byte(255) // green
write_byte(0) // blue
message_end()
}
if((g_gondar_health / 3) >= current_health)
{
set_user_maxspeed(index , 800.0)
set_user_rendering(index, kRenderFxGlowShell, 0, 0, 0, kRenderTransAlpha,55)
message_begin(MSG_ALL,iconstatus,{0,0,0},index)
write_byte(1) // status (0=hide, 1=show, 2=flash)
write_string("dmg_poison") // sprite name
write_byte(255) // red
write_byte(0) // green
write_byte(0) // blue
message_end()
}
}