Zelda Style Heart Bar- how to do?

Topics regarding Scripting with Reality Factory
User avatar
darksmaster923
Posts: 1857
Joined: Wed Jan 03, 2007 10:32 pm
Location: Huntington Beach, California, USA

Re: Zelda Style Heart Bar- how to do?

Post by darksmaster923 »

arkanus thats pretty easy.
first you have 2 attributes in the player.ini

Code: Select all

[health]
initial = 100
low = 0
high = 0

[armor]
initial = 100
low = 0
high = 0


then in the enemy script during the attack order you have it check if player has armor var like

Code: Select all

if(GetAttribute(shield, "Player") > 0)
you make it damage the shield var
Herp derp.
User avatar
ardentcrest
Posts: 735
Joined: Wed Jan 25, 2006 10:55 pm
Location: Ireland

Re: Zelda Style Heart Bar- how to do?

Post by ardentcrest »

QOD been looking for the link for "The Legend Of Okkora"

seen it in the gallery is it ready yet or have you stoped working on it ?
He's a Bot Jim, But not as we know It.
User avatar
QuestOfDreams
Site Admin
Posts: 1520
Joined: Sun Jul 03, 2005 11:12 pm
Location: Austria
Contact:

Re: Zelda Style Heart Bar- how to do?

Post by QuestOfDreams »

I've stopped working on it, it would have been a full time job to realize the project the way I imagined it and I just don't have the time. I'm now working in a team on a point & click adventure instead (not RF based), which will be released this summer. We'll present it at the Games Convention in Leipzig in August and you will be able to download it for free from the web then.
Broken Sword 2.5
User avatar
Graywolf
Posts: 75
Joined: Mon Apr 14, 2008 8:36 pm
Location: Anchorage, Alaska
Contact:

Shield

Post by Graywolf »

ArKanuS wrote: I would like to have like a shield (like health) which when runs out starts affecting your health but if you wait awhile the shield recharges but your health stays the same?
For this, I'd suggest setting up a seperate damage manager.

First thing, keep the player from running out of health as mentioned above(set low to 1). Next, set the high and initial to.. Let's go with 1000. Now, add 2 attributes, real_health and shield, both low=0, high=100, initial=100.

Now, create a dummy pawn, no render, no collision, drop to a low level order. This pawn needs to do these things:

1. Get the player's "health" attribute, and subtract this from 1000. Store it in a variable... We'll call it CUR_DAMAGE. This let's us know how much damage the player took. Also, get the current value of "shield", and store it in CUR_SHIELD.
2. Now, we check if CUR_DAMAGE is greater than CUR_SHIELD. If so, we set "shield" to 0, and modify "real_health" by CUR_DAMAGE - CUR_SHIELD. If not, we just modify "shield" by -CUR_DAMAGE.
3. Next, we check if "real_health" is less than 1, and if so, kill the player(setting "health" to zero should do it, but maybe not... I'm not sure offhand. Anyone know for sure? Might be a problem with the low being 1...)
4. Next, to regenerate the shield. We need a variable for regeneration, and a counter system, like so:

Code: Select all

if(COUNTER > REGEN_RATE)
{
ModifyAttribute("player", "shield", 1);
COUNTER = 0;
}
else
{
COUNTER = COUNTER +1;
}
Please excuse me if I made any parameter errors, I don't have docs handy... (Are the HTML docs on-site? If so, anyone got a link?)

5. Last off, we set "health" back to 1000.

Well, that's the general gist of it... Or, at least, the best approach I can think of.
"So, what's the life of a programmer like?" "...Huh? What life?!"

RF System X:
http://www.realityfactory.info/forum/vi ... f=9&t=3599
User avatar
ArKanuS
Posts: 54
Joined: Wed Jan 23, 2008 7:29 am
Location: Perth, Australia

Re: Zelda Style Heart Bar- how to do?

Post by ArKanuS »

Thanks, Graywolf.

Nice necro of the thread ardentcrest
/sarcasm
Post Reply