The Daily Click ::. Forums ::. Klik Coding Help ::. Issues about inventory and battle systems (Help! ))
 

Post Reply  Post Oekaki 
 

Posted By Message

koobare



Registered
  29/06/2004
Points
  3
19th March, 2006 at 17:50:45 -

Hi there all!

I'm rather a new person to this site, but I'm clicking from some time right now (started on KnP, then TGF, MMF is still quite new to me ), and I decided to throw all those platform games out the window and go "one step up the ladder", starting an Action-Adventure-RPG game project, based on some ideas that I have... Well, it's all quite fun, I'm working on the main code right now, but I've encountered some problems. Anyone here that could lend a helping hand (or two)? I would be utterly grateful.

Having all the "hallo's" done, here's what I've got problem with:

a) Inventory system

I've got two basic ideas how to create an inventory system - either with a sub-application (using GlobalStoreX extension object as the data storage thingie) or within the same app (in this variation I'm working with an Array and one INI file, and the whole inventory is just a separate frame that You can access from any other frame of the game), and everything is quite cool...

Except for one thing. I don't have a friggin' idea how to make all those items appear in unused slots of the inventory, in the right order, in the right places!

I've managed to think of a basic system for those objects that the player gets from the ground or something - game saves in an array (or INI) how many objects does the player have and based on that it puts the objects in the right places. And that's cool. Until I use some object and it disappeares from the inventory - it just creates a hollow, unfilled space in the inventory (for example: I have an axe, a magical potion and a stick. When I use the magical potion, the inventory looks like this: an axe, unused slot, a stick - and I want it to look like this: an axe, a stick, unused slot).

How can I make a system that would place the objects in right slots of the inventory? Is there someone here that could help me with that, either by showing me some how to do it step-by-step or creating an engine that would do so? (of course, if a person helps me with creating such an engine, she/he will be credited in the game )

And now... Going along to the second problem...

b) Turn-based battle system

The whole thing kinda' looks like the FinalFantasy battle system - characters don't move, they just exchange strikes. :] The player doesn't have to move towards the enemy - he just pushes one of the attack buttons and the whole thing's coming alive. I have a kinda' cool fighting algorythm (based on many attributes, bonuses and a few randoms here and there), that uses special abilities, items, "critical hits", etc. - and it actually works... somehow. I use an array and couple of counters to make the whole thing work.

The trick is... Scripting the whole fighting algorythm was easy, I don't know the heck how to enable the enemy to fight back... In other words - currently when I push the "END TURN" button or the player attacks, it's once again the round of the player... Because there are no "TURNS", no "ROUNDS"! It's just clicking the attack button until the enemy lies dead. How can I make the whole game operate with the enemy? I tried using a counter to determine if it's the turn of the player, or the enemy's turn - but it's quite buggy, can't make it work right. Is there anyone here that could help me with that? How to make the distingsion between enemy's turns and those that belong to the player? How to make the game use just those commands that it should during the right phrase? Should I use fastloops or groups? If yes - could someone give me a hint how to use them properly in this situation, since I'm still a newbie about them - I have an idea what they are, I can use them for something easy, I've read some tutorials about them on the Clickteam page... But I sure could use some training.

C) And now... For some questions.

- I have a lot global values to save, and I'm using a 2D Array (X,Y) to do so - it's gonna' be quite big (about 145 values X, 50 values Y) - will it make the game play slower if the whole Array is that big?

- I'm using the Active Picture object a lot (I have several .jpegs in the subdirectory called "pictures" inside the game directory) - will there be any problems with creating the stand-alone application? I guess that I would like to have the game installed in the same fashion as I do have it now on my disk (the main game directory is /shadows1, the outside pictures are located in /shadows1/pictures and the game saves to /shadows1/sg), with some of the pictures being outside of the program, in stand-alone jpegs. Could that cause any problems? And what path should I give when looking for the Active Picture? Using appdir$/pictures doesn't seem to work.

- And the last question: Is there a way to make the "Save array to file via a file selector" command operate in just one directory? For example, I want all the saved games to appear in the /shadows1/sg directory (for example C:/Program Files/Games/shadows1/sg if the player decided to install the game in his Program Files/Games folder) and I want to have the Array's saving file selector having the possibility to save only in that folder. Is that possible?

Uffff... That was quite a set of questions. Sorry for writing for so long - I just wanted to have it all explained well so that no extra questions were needed. I would be utterly grateful if someone could help me.

Cheers and take care!
Koobare

P.S. Sorry for my lack of English skills, I'm not a native speaker...


 
Kooba

Knudde (Shab)

Administrator
Crazy?

Registered
  31/01/2003
Points
  5125

Has Donated, Thank You!Clickzine StaffKlikCast StarVIP MemberGhostbuster!Dos Rules!I donated an open source project
19th March, 2006 at 17:56:27 -

Not sure if this would work for you, but when I do turn based battles I use a counter with a minimum value of 1 and a max of 3 to determine what "Phase" it is.

Counter = 1 - All your player stuff here
Counter = 2 - Enemy attacks/defends/whatever
counter = 3 - Cleanup phase

Please note that Phase 3 could probably be eliminated from your system, I'm basing this off of some code I did for a Turn Based Strat game.

 
Craps, I'm an old man!

Del Duio

Born in a Bowling Alley

Registered
  29/07/2005
Points
  1078

GOTW WINNER CUP 1!GOTW WINNER CUP 2!GOTW WINNER CUP 3!GOTW WINNER CUP 4!Evil klikerHasslevania 2!The OutlawSanta Boot
19th March, 2006 at 18:50:03 -

Crap, I can tell you the basic idea from what I know in Visual Basic but I don't know how to in MMF so bear with me please.

Equin Village uses this system and it works fine. Basically, picking up or adding an item to your inventory is very easy. I do it like this:

DD = 0
FF = 0
I = 1 to (your max inventory items allowed here)
If ItemName(I) = "" and DD = 0 Then DD = 1: FF = I
Next I

If DD = 0 Then Exit

ItemName(FF) = PickedUpItem

Here, "DD" acts like a flag does in MMF. If it's value is 1, then you've already selected a slot to put the item you just got in. When you find the first empty slot, counter "FF" is set to the array cell's number so the computer remembers where to add the item after the loop is finished. If the inventory is maxed out, DD will stil be 0 after the loop, and you can give a "Your inventory is full!" message or something and exit the function.

Of course you also want to transfer your item's properties, picture, and other stuff aside from just it's name, but this is the basic idea.

Okay, now subtracting an item (either by using it up or selling it away) is a lot more complex to code everything but here's what I know, idea-wise. You're going to basically have 2 lists- One is your inventory with the "space" where your sold / used up item used to be, and the other is a "temporary list". Here's what I do:

'set up temporary inventory list now

For I = 1 to (MAXinventory)
tmpItem(I) = ItemName(I)
Next I

'okay, now to re-sort your real inventory

EE = 1
For I = 1 to MAXinventory
If tmpItem(I) <> "" Then ItemName(EE) = tmpItem(I) : EE = EE + 1
Next I


I'll explain what is happening here. The first loop, the set-up loop, copies your entire inventory list (space item included). Then, the second loop goes through each item's "slot" of the temporary inventory. It checks the temporary item's name. If it HAS a name, then it's not a blank space from something you've used or sold, so it copies that value to the next available slot of your regular inventory and increments counter "EE" by 1. When the loop is done, your list is completely sorted with no spaces in between items.

It's a huge pain in the ass when your items have a lot of values that need to be copied, but well-worth it in the end.







Image Edited by the Author.

 
--

"Del Duio has received 0 trophies. Click here to see them all."

"To be a true ninja you must first pick the most stealthy of our assorted combat suits. Might I suggest the bright neon orange?"

DXF Games, coming next: Hasslevania 2- This Space for Rent!

koobare



Registered
  29/06/2004
Points
  3
19th March, 2006 at 18:52:56 -

Thanks for Your answer Knudde. Well, I tried using a counter, but it just (don't know why) doesn't work properly in my game. All the events just come crushing down all of a sudden (I mean: they just all happen at once, like if the "only one action when the event loops" command didn't work). Do You perhaps have an example of how did You set up this counter? Would love to see some examples - they are the best thing that can happen when I'm out of ideas.

Furthermore... Did You use fastloops, grouping or activating/deactivating some commands? If yes - would You be so kind to shed a little light about how did You use them?

 
Kooba

koobare



Registered
  29/06/2004
Points
  3
19th March, 2006 at 18:59:38 -

Oh, another post. Del Duio, I... Don't know what this is all about. Thank You for Your effort, I just thing that I'm a bit to dumb and unexperienced to understand Visual Basic ways.

Heeheehee - as old master Yoda used to laugh - Does someone know how to do Del Duio's way in MMF, by using just those basic functions like counters, an array and setting object's visibility and position?

Of course, any other suggestions based on MMF could be used too.



 
Kooba

Del Duio

Born in a Bowling Alley

Registered
  29/07/2005
Points
  1078

GOTW WINNER CUP 1!GOTW WINNER CUP 2!GOTW WINNER CUP 3!GOTW WINNER CUP 4!Evil klikerHasslevania 2!The OutlawSanta Boot
19th March, 2006 at 19:03:27 -

Yeah, sorry man I wish I did. This is unfortunately why I don't think I'll be able to "port" a lot of my old games into MMF. I don't know it well enough to get MMF to do the same kind of things that I can do in VB. I'm sure there are a lot of people here who can though, so don't worry.


 
--

"Del Duio has received 0 trophies. Click here to see them all."

"To be a true ninja you must first pick the most stealthy of our assorted combat suits. Might I suggest the bright neon orange?"

DXF Games, coming next: Hasslevania 2- This Space for Rent!

Lazernaut



Registered
  08/09/2002
Points
  1103

VIP MemberThe Cake is a LieIt's-a me, Mario!Wii OwnerPokemon Ball!
21st March, 2006 at 12:01:11 -

I made a simple inventory tutorial. It might not be advanced enough for what you want (i didnt read your whole post because there was alot of text, and i'm lazy). You can get it here: http://www2.create-games.com/forum_post.asp?id=147540

 
n/a
   

Post Reply



 



Advertisement

Worth A Click