Adventure Game Studio

AGS Support => Advanced Technical Forum => Topic started by: on Thu 26/02/2004 20:49:32

Title: Giving the player Hit Points
Post by: on Thu 26/02/2004 20:49:32
Is there a way to give the player character Hit Points, like in Quest for Glory?  I don't want it to be based on stats though.  Just a random number
(8-48).  I saw something about

Random (int max)
to return
0,1,2 or 3 on Random(3),

but how can I return 8-48?  Or am I going about the whole thing wrong?
Title: Re:Giving the player Hit Points
Post by: SSH on Thu 26/02/2004 20:58:05
You mean 8+Random(40)?

by the way, questions like this should maybe be placed in the Beginner's Tech Forum...
Title: Re:Giving the player Hit Points
Post by: on Thu 26/02/2004 21:45:38
That makes sense.
How do I get the random number to be displayed on a GUI though?  @SCORETEXT@ is the closest thing I can think of, but that would affect the score, (which I'm using for something else)

And should (can) I move this topic?  Or can I continue here for now?
Title: Re:Giving the player Hit Points
Post by: deltamatrix on Fri 27/02/2004 00:19:46
To display an number in a GUI, it needs to be converted to a string.

This is how I did it...

StrFormat(health, "%d",GetGlobalInt(10));
SetLabelText(3, 8,health);

where 'health' is the string to be drawn on the GUI and 'GlobalInt(10)' is the health stat.