Gamestudio Links
Zorro Links
Newest Posts
Zorro 2.70
by jcl. 09/29/25 09:24
optimize global parameters SOLVED
by dBc. 09/27/25 17:07
ZorroGPT
by TipmyPip. 09/27/25 10:05
assetHistory one candle shift
by jcl. 09/21/25 11:36
Plugins update
by Grant. 09/17/25 16:28
AUM Magazine
Latest Screens
Rocker`s Revenge
Stug 3 Stormartillery
Iljuschin 2
Galactic Strike X
Who's Online Now
3 registered members (Dico, AndrewAMD, TipmyPip), 16,868 guests, and 5 spiders.
Key: Admin, Global Mod, Mod
Newest Members
krishna, DrissB, James168, Ed_Love, xtns
19168 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Using Potions and other curing items (RPG) #150422
08/26/07 23:53
08/26/07 23:53
Joined: Jun 2007
Posts: 18
Houston. TX, USA
C
Cyan Offline OP
Newbie
Cyan  Offline OP
Newbie
C

Joined: Jun 2007
Posts: 18
Houston. TX, USA
I've made an inventory system that's going nicely, except for when it comes to actually using the items in the list.

Say I wanted to use a potion on 1 of 3 characters( 1 of 6 characters actually -- 1 character is the "leader" and the other 2 slots are taken by 2 of the other 5 characters the player chooses). How would I make it so that A character's HP would be replenished but it would not exceed his Maximum HP?

If I can figure this out I should be able to work everything else out.

Re: Using Potions and other curing items (RPG) [Re: Cyan] #150423
08/27/07 00:36
08/27/07 00:36
Joined: Jan 2002
Posts: 4,225
Germany / Essen
Uhrwerk Offline
Expert
Uhrwerk  Offline
Expert

Joined: Jan 2002
Posts: 4,225
Germany / Essen
You can use the min function.

DEFINE Skill1,health;

player.health = min(100,player.health + 25);


Always learn from history, to be sure you make the same mistakes again...
Re: Using Potions and other curing items (RPG) [Re: Uhrwerk] #150424
08/28/07 00:53
08/28/07 00:53
Joined: Nov 2003
Posts: 1,257
Wade_Adams Offline
Serious User
Wade_Adams  Offline
Serious User

Joined: Nov 2003
Posts: 1,257
I would just set a skill for Max HP then do what Uhrwerk said but replace 100 with the entity skill like player.maxhealth

DEFINE Skill1,health;
DEFINE Skill2,maxhealth

player.health = min(player.maxhealth,player.health + 25);


Optimism is an occupational hazard of programming: feedback is the treament.
Kent Beck

Moderated by  HeelX, Lukas, rayp, Rei_Ayanami, Superku, Tobias, TWO, VeT 

Gamestudio download | Zorro platform | shop | Data Protection Policy

oP group Germany GmbH | Birkenstr. 25-27 | 63549 Ronneburg / Germany | info (at) opgroup.de

Powered by UBB.threads™ PHP Forum Software 7.7.1