Facebook Twitter YouTube Frictional Games | Forum | Privacy Policy | Dev Blog | Dev Wiki | Support | Gametee


Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Script Help Shows how much health you have.
onv Offline
Member

Posts: 51
Threads: 12
Joined: Feb 2012
Reputation: 2
#1
Shows how much health you have.

Is there anyway to put a message on the top of the screen , that shows your health in a number ? (kinda like : "YOUR HEALTH : 100%")
Maybe we can script a loop that checks for player health's every 0.2 seconds ?

Thanks.
08-22-2012, 10:12 PM
Find
Melvin Offline
Member

Posts: 245
Threads: 38
Joined: Jun 2012
Reputation: 5
#2
RE: Shows how much health you have.

I think you need to make a certain model for that.

I'm not sure though.

[Image: 25F7U37.png]
08-22-2012, 10:51 PM
Website Find
Adny Offline
Posting Freak

Posts: 1,766
Threads: 6
Joined: Mar 2012
Reputation: 173
#3
RE: Shows how much health you have.

You could use set message and get player health with an if statement. something like:

void CheckHealth(string &in asTimer)
{

AddTimer("", 0.2f, "CheckHealth")

if (GetPlayerHealth == 100)
{
SetMessage("Health", "100", 0);
}
}

Repeating the script 100 times (for 0-100).

I rate it 3 memes.
08-22-2012, 11:05 PM
Find
Robby Offline
Posting Freak

Posts: 2,549
Threads: 38
Joined: Jun 2009
Reputation: 47
#4
RE: Shows how much health you have.

(08-22-2012, 11:05 PM)andyrockin123 Wrote: You could use set message and get player health with an if statement. something like:

void CheckHealth(string &in asTimer)
{

AddTimer("", 0.2f, "CheckHealth")

if (GetPlayerHealth == 100)
{
SetMessage("Health", "100", 0);
}
}

Repeating the script 100 times (for 0-100).
That's a long way to go, but it should work completely. But the text would always appear on the center of the screen. But yeah, this is a great way to try it out.

Infrequently active. Don't expect an immediate response. Best to contact me at a different locale. If I create a thread, expect me to be quite active.
08-23-2012, 09:37 AM
Website Find
Damascus Offline
Senior Member

Posts: 646
Threads: 118
Joined: Mar 2012
Reputation: 29
#5
RE: Shows how much health you have.

There may be a way to convert the integer generated by GetPlayerHealth into a string usable with the SetMessage function so you don't literally have to write it out 100 times. I did some research, but I'm not all that familiar with complicated programming, so you can take a look yourself:

PHP Code: (Select All)
string convertInt(int number)
{
   
stringstream ss;//create a stringstream
   
ss << number;//add number to the stream
   
return ss.str();//return a string with the contents of the stream


PHP Code: (Select All)
string convertInt(int number)
{
    if (
number == 0)
        return 
"0";
    
string temp="";
    
string returnvalue="";
    while (
number>0)
    {
        
temp+=number%10+48;
        
number/=10;
    }
    for (
int i=0;i<temp.length();i++)
        
returnvalue+=temp[temp.length()-i-1];
    return 
returnvalue;


08-23-2012, 09:51 AM
Find




Users browsing this thread: 1 Guest(s)