EXP and max stats

Michael Gaddass wants to keep up with you on Twitter

Moderator: zamros

Pancake
grand wizard cyclops
Posts: 136
Joined: Fri Jun 16, 2006 1:18 am

EXP and max stats

Post by Pancake »

I'm looking to create an RPG, but am lost when it comes to dealing out EXP and making it so your health can't go above a certain number, depending on your level.

I was thinking that for the EXP, I could give the player whatever amount of points after finishing a battle, and then have the player type something like ?+level in the main game to level up, assuming they have enough points. However, I would greatly prefer it if there was something I could do to have the player level up automatically.

Any ideas?!

Also, how do I make an object #put a passage somewhere, having the passage not go to the title screen?
User avatar
Quantum P.
Level 17 Accordion Thief
Posts: 1433
Joined: Fri Sep 12, 2003 1:41 am
Location: Edmonds, WA
Contact:

Post by Quantum P. »

I think gingermuffins did something like this. The engine occupies most of the later half of the game, if I remember correctly.

Here's an example of a health limiter which limits you to 200 health, checking every half-second:

Code: Select all

#cycle 1
'loop while health <= 200
:loop
/i/i/i/i/i#take health 201 loop
'reset health and continue loop
#endgame
#give health 200
#loop
So for what you want, you'd need a block of code like that for each level, and you'd want a copy of that object on each board. I guess you'd probably also want to use flags to indicate level, and determine which limiter runs based on the player's level. Haven't thought out the specifics, but that's a starting place.

As for passages, you can't make a new passage that goes somewhere other than the title screen. However, you can #put a passage over an existing, hidden passage. This changes the color of the passage, but doesn't change the destination of the passage. If done right, you can make it look like a passage appeared out of nowhere.

Or you might be able to cheat with an object that looks like a passage and the carefully coordinated creation of player clones. Again, gingermuffins did it.
Pancake
grand wizard cyclops
Posts: 136
Joined: Fri Jun 16, 2006 1:18 am

Post by Pancake »

Thanks for the help. For how the levels effect your health, I'll have an object like this (adding on to your code):

Code: Select all

#cycle 1
#if lv1 lv1
#if lv2 lv2
#end
:lv1
/i/i/i/i/i#take health 101 lv1
#endgame
#give health 100
#lv1
#end
:lv2
/i/i/i/i/i#take health 201 lv2
#endgame
#give health 200
#lv2
And so on. I've decided that for the leveling up process, at the end of the battles, I'll have the following object:

Code: Select all

@end_battle
#cycle 1
#end
:start
#play [victory theme]
#give points 50
You gained 50 EXP!
/i/i/i/i/i/i/i/i#take points 100 leave_battle
You gained a level!
#if lv1 lv2
#if lv2 lv3
#end
:lv2
#clear lv1
#set lv2
#leave_battle
#end
:lv3
#clear lv2
#set lv3
#leave_battle
#end
:leave_battle
/i/i/i/i/i/i/i/i#change invisible player
The invisible blocks would be adjacent to passages as described here; method #1.

As for Gingermuffin's player clone trick, it would definitely be great for entering RPG battles.
User avatar
Quantum P.
Level 17 Accordion Thief
Posts: 1433
Joined: Fri Sep 12, 2003 1:41 am
Location: Edmonds, WA
Contact:

Post by Quantum P. »

Don't forget that your health-capping object is going to have to switch which loop it runs every time you level up:

Code: Select all

#cycle 1
:loop
/i/i/i/i/i
#if lv1 lv1
#if lv2 lv2
#end
:lv1
#take health 101 loop
#endgame
#give health 100
#loop
#end
:lv2
#take health 201 loop
#endgame
#give health 200
#loop
User avatar
Dr. Dos
OH YES! USE VINE WHIP! &lt;3
Posts: 1772
Joined: Tue Mar 11, 2003 12:00 am
Location: Washington

Post by Dr. Dos »

Quantum P. wrote:Don't forget that your health-capping object is going to have to constantly check which loop it runs every time you level up:
You know, since if I'm level 1 on one board, then level 2 on the next I shouldn't lose health by going back to the old board.
Visit the Museum of ZZT
Follow Worlds of ZZT on Twitter

Apologies for the old post you may have just read.
User avatar
Commodore
fgsdfs
Posts: 2471
Joined: Wed Mar 12, 2003 5:44 pm
Location: :noitacoL
Contact:

Post by Commodore »

well the simple solution is to simply tell them they've leveled up and not give them any health. Wait to check for the health cap when you heal or go to an inn or something.

In my rpg I had an object on the battle board put blocks next to it for the EXP, so it would only have to take and give EXP at the start of each fight and could check really fast what the cap was. At least that's how I think I did it. I'm never looking at the code for those boards again.
*POW* *CLANK* *PING*
User avatar
Quantum P.
Level 17 Accordion Thief
Posts: 1433
Joined: Fri Sep 12, 2003 1:41 am
Location: Edmonds, WA
Contact:

Post by Quantum P. »

Commodore wrote:Wait to check for the health cap when you heal or go to an inn or something.
Good idea. This lets you have less junk running in loops all the time (possible speedup on really old computers/DOSBox).
User avatar
Kjorteo
^o.O^
Posts: 432
Joined: Sat Feb 28, 2004 10:59 am
Location: Kjorteoville or something
Contact:

Post by Kjorteo »

For Adventure of Sam, I'm just having the checks be at any point when a player is given health (casting a cure spell, sleeping at an inn, etc.) instead of an idle check looping in the background at all times. It makes the code at the moment the game is giving you health a little cumbersome, and it doesn't stop the player from using ?health, but oh, well.

Of course, I'm also saving on code a bit by making the advancement happen at predetermined points (usually when you beat a boss) instead of whenever you happen to accumulate enough experience from random encounters.

Here's the code from a treasure chest I just dropped in the latest version, which gives you 30 Ammo and 40 Health, checks to make sure those didn't set you over the cap of either, drains them down to the appropriate levels if you did, and then lets you go on your way.

Code: Select all

@Adventure of Sam
#end
:touch
Inside the treasure chest is:
30 Ammo
40 Health

Will you take the contents?
!y;Yes
!n;No
/i#touch
:y
#lock
#zap touch
#give ammo 30
#if twoammo ammodrainb
#if thrammo ammodranc
:ammodraina
#take ammo 101 ammofull
#give ammo 100
#ammodraina
:ammodrainb
#take ammo 111 ammofull
#give ammo 110
#ammodrainb
:ammodrainc
#take ammo 121 ammofull
#give ammo 120
#ammodrainc
:ammofull
#give health 40
#if twohealth healthdrainb
#if thrhealth healthdraonc
:healthdraina
#take health 101 healthfull
#give health 1
#endgame
#give health 100
#healthfull
:healthdrainb
#take health 121 healthfull
#give health 1
#endgame
#give health 120
#healthfull
:healthdrainc
#take health 141 healthfull
#give health 1
#endgame
#give health 140
:healthfull
#unlock
#char 95
You acquire 30 Ammo and 40 Health!
/i
#restart
:touch
The treasure chest is empty.
/i
:n
#restart
The fact that it #gives 1 health right after the cap check and before the next #endgame/#give section is because otherwise this object would accidentally kill you if giving you 40 health brings you to exactly 101/121/141 (depending on cap.)
"You're alive," said the maker, and smiled at the aardvark.

<Kjorteo> "yiff"
<gbelo> Wanna yiff.
<Kjorteo> yes
<gbelo> No no no.
User avatar
Zenith Nadir
this is my hammer
Posts: 2767
Joined: Wed Mar 12, 2003 11:40 am
Location: between the black and white spiders

Post by Zenith Nadir »

ADVENTURE OF SDA,M
he looked upon the world and saw it was still depraved :fvkk:

Overall: Rotton egg for breakfast
User avatar
Zenith Nadir
this is my hammer
Posts: 2767
Joined: Wed Mar 12, 2003 11:40 am
Location: between the black and white spiders

Post by Zenith Nadir »

DAUDVENTURS OF SGAEM
he looked upon the world and saw it was still depraved :fvkk:

Overall: Rotton egg for breakfast
User avatar
Zenith Nadir
this is my hammer
Posts: 2767
Joined: Wed Mar 12, 2003 11:40 am
Location: between the black and white spiders

Post by Zenith Nadir »

SHIT OR GET OFF THE FUCKING POT, JESUS CHRIST
he looked upon the world and saw it was still depraved :fvkk:

Overall: Rotton egg for breakfast
User avatar
zamros
my power level is enormous
Posts: 543
Joined: Thu Mar 20, 2003 9:34 pm

Post by zamros »

Nadir is finally drunk
User avatar
Zenith Nadir
this is my hammer
Posts: 2767
Joined: Wed Mar 12, 2003 11:40 am
Location: between the black and white spiders

Post by Zenith Nadir »

DRUNK ON FURY :beancounter:
he looked upon the world and saw it was still depraved :fvkk:

Overall: Rotton egg for breakfast
User avatar
Kjorteo
^o.O^
Posts: 432
Joined: Sat Feb 28, 2004 10:59 am
Location: Kjorteoville or something
Contact:

Post by Kjorteo »

Nadir is drunk on furry, you heard it here first
"You're alive," said the maker, and smiled at the aardvark.

<Kjorteo> "yiff"
<gbelo> Wanna yiff.
<Kjorteo> yes
<gbelo> No no no.
User avatar
Aplsos
ill make a meal of you
Posts: 429
Joined: Fri Jan 23, 2004 3:06 pm
Location: beautiful downtown joelville
Contact:

Post by Aplsos »

emptyquoting ain't usually my style, but
Zenith Nadir wrote:SHIT OR GET OFF THE FUCKING POT, JESUS CHRIST
r
Locked