Charas-Project

Game Creation => Requests => Tutorials => Topic started by: Fortet on November 18, 2008, 04:46:24 AM

Title: CMS Help (RM2K3)
Post by: Fortet on November 18, 2008, 04:46:24 AM
So, I'm teaching myself how to create a CMS, but the one thing I can't figure out is a quicker way to display HP, MP, and Exp. Sure, I could go in and make a variable for EVERY SINGLE NUMBER, but there's got to be a better way, right?
And as far as items go, is a picture the best way to go for each item? And how do you code it to where if a certain item isn't there, another item takes its place on the list?
In other words, who wants to help me learn to code XD
Title: Re: CMS Help (RM2K3)
Post by: Desimodontidae on November 18, 2008, 05:35:24 AM
Well. If you find a way to make it where you don't have to make a variable for every single number please tell me.

And about making it to where if a certain item isn't there, another item takes its place, I guess it would bee possible, but I never figured it out. What I did was just make it to where there's only about 10 or so items that you can actually use and I set their graphics (which was just letters) to show up only if you have one or more of the item and if you didn't it disappeared. But they all had their own place that didn't move. But if you use my method A) It doesn't look as good as it could and B)It limits the number of usable items, unless you wanna make multiple pages, but then an item might be on page 6, and you have to go through  pages of nothing to find it.
Title: Re: CMS Help (RM2K3)
Post by: DragonBlaze on November 18, 2008, 06:15:42 AM
Okay, you need to make a picture for every number (0-9) and then a variable for every value you want to display. You can use the modulus function to split the digits of a multi-digit number (such as 1234) into 4 single digit numbers (such as 1, 2, 3, and 4) this makes displaying the variables with pictures a lot easier. If you don't know how to do this, I'll find a tutorial that will help you.
 
With the items, its pretty simple, but it requires a lot more lines of code. But basically its like this.

Give every item a vaiable a referance such as 1 = potion, 2=hi potion, 3 = ether, and so on for ALL you're items.

Then make a variable for every item slot for however item slots you have. then you assign the variable slots numbers equal to the item in reference.
For examble, if you have a potion in slot 1, then the variable [slot 1] will equal 1, if slot 1 held an ether, then it'd hold a 3, and so on.

THEN you make a conditional branch for EVERY slot and EVERY item.
so it'd look like:
if [slot1] = 1
 show potion picture at position 1
if [slot1] = 2
 show hi potion picture at slot 1
if [slot2] = 1
 show potion picture at position 2
and so on...

I can't think of any easier way to do that.

One other way to do it though would be to test the hero's actual inventory, so instead of testing what the variable hero1 slot is equal to, test to see if the hero holds a certain item, if so, display it at the next position, and increase another counter varieble by 1. Check to see if the hero holds the next item, if so, increase the counter vairble, if they don't hold it, don't increase the variable and dont display a picture. Then go on to the next position. That may be kind of complictated though if you're not familuar with a cms system
Title: Re: CMS Help (RM2K3)
Post by: Prpl_Mage on November 18, 2008, 08:02:20 AM
I did this once, but i only did the part where items show up.
And because of lazyness - selling item#1 didn't make item#2 move to that spot. But the next item you picked up was placed in slot#1.

I takes a lot of work, and I still havn't figured out if it's even possible to do if you have random encounters that can grant you items.

But I think Desi and DB covered it all.
Title: Re: CMS Help (RM2K3)
Post by: DragonBlaze on November 18, 2008, 08:36:13 AM
Yeah, it is possible, just check through all you're item slots, and the first slot with a 0 for item value (meaning there is no item there) set equal to the value of the new item. The tricky part is if you get rid of an item, you have to take ever item after that and move it up one position, then fill the last slot with a 0. I made a cbs system like this once, it was a real pain...