Welcome, Guest. Please login or register. Did you miss your activation email?

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - snaef98

Pages: [1]
1
General / Inventory system for text based rpg/mud
« on: May 25, 2011, 11:07:11 pm »
Hmmm you may be on to something there... depends on what you think im trying to use it for... my problem is right now im trying to organize my items into 1 database, and the monsters into another... thats relatively simple if done with just variables and strins 8-10 per item each commented in a specifc function  that manages them temporarily. My problem is managing my Global Variables that are tied to switching the information from storage unit to storage unit... for example


Moving items from inventory slot to inventory or from inventory to equipment or equipment to inventory or from the loot buffer to inventory, quest slots etc... it takes a ton of nested statements to do it, is there an easier way to manage them and still be able to load individual variables to the save files 1 line at a time for simple reloading upon loading the saved game.

2
General / Inventory system for text based rpg/mud
« on: May 25, 2011, 06:24:56 pm »
ok i tried to re-do what you did and its giving me a couple errors.

Code: [Select]
class CopperSword
{
public:
CopperSword(string CopperSword, string CopperSwordDesc, int DatabaseID, int ItemType, int Attack, int Defense, int GoldValue, int Stack, int MaxStack, bool Stackable);
string GetCopperSword();
string GetCopperSwordDesc();
int GetDatabaseID();
int GetItemType();
int GetAttack();
int GetDefense();
int GetGoldVale();
int GetStack();
int GetMaxStack();
bool GetStackable();
private:
string CopperSword;
string CopperSwordDesc;
int DatabaseID;
int ItemType;
int Attack;
int Defense;
int GoldValue;
int Stack;
int MaxStack;
bool Stackable;
};




 error C2380: type(s) preceding 'CopperSword' (constructor with return  error C2208: 'CopperSword' : no members defined using this type

3
General / Inventory system for text based rpg/mud
« on: May 25, 2011, 05:22:59 pm »
Another good question is how will Classes effect my global variables and my saves? Because i save all my variables 1 per line in as specific order to text file for reload later. And i should correct myself i did use 1 array awhile ago for exp to next level for my ExperienceCalculator() function after each fight it checks if character needs to level and handles all the stats. ill show you a sample of the code.


Code: [Select]
int ExperienceCalculator()
{
HANDLE hConsole; // Code for colored text
hConsole = GetStdHandle(STD_OUTPUT_HANDLE); // Code for colored text
// Array that stores the exp needed for each level
const int NextExperienceLevels[] = {0, 100, 225, 400, 925, 1400, 2425, 3650, 5675, 8150};
// LEVEL CHART GUIDE - Exp for each level
// Level 1 = 0
// Level 2 = 100
// Level 3 = 225
// Level 4 = 400
// Level 5 = 925
// Level 6 = 1400
// Level 7 = 2425
// Level 8 = 3650
// Level 9 = 5675
// Level 10 = 8150

// LEVEL CHART GUIDE - Total Exp at each level
// Level 1 = 0
// Level 2 = 100
// Level 3 = 325
// Level 4 = 725
// Level 5 = 1650
// Level 6 = 3025
// Level 7 = 5475
// Level 8 = 7900
// Level 9 = 11550
// Level 10 = 19700
// Variable that stores new hit points value for next level (Base 20 + 5 per level)
const int PlayerHitPointsUp = 5;
// Variable that stores new magic points value for next level (Base 10 + 3 per level)
const int PlayerMagicPointsUp = 3;
// Variable that store new attack value for next level (Base 6 + 2 per level)
const int PlayerAttackUp = 2;

// Variable that store new defense value for next level (Base 3 + 3 per level)
const int PlayerDefenseUp = 3;

// Variable that stores new hitrate value for next level (Base 50% + 1% per level)
const int PlayerHitRateUp = 1;
    {
SetConsoleTextAttribute(hConsole, 15); // Colored Text White
}
cout << "\n[";
{
SetConsoleTextAttribute(hConsole, 12); // Colored Text Red
}
cout << " SYSTEM MESSAGE: ";
{
SetConsoleTextAttribute(hConsole, 15); // Colored Text White
}
cout << "Experience Calculator ]\n";
cout << "\nChecking players level & experience stats.\n";
do
{
if (PlayerExperience >= PlayerNextExperience)
{
cout << "Leveling up player.\n";
if (PlayerLevel < PlayerMaxLevel) PlayerNextExperience = NextExperienceLevels[PlayerLevel+1];
++PlayerLevel;
PlayerHitPoints = PlayerHitPoints + PlayerHitPointsUp;
PlayerMaxHitPoints = PlayerLevel * 5 + 15;
PlayerMagicPoints = PlayerMagicPoints + PlayerMagicPointsUp;
PlayerMaxMagicPoints = PlayerLevel * 3 + 10;
PlayerAttack = PlayerAttack + PlayerAttackUp;
PlayerDefense = PlayerDefense + PlayerDefenseUp;
PlayerHitRate = PlayerHitRate + PlayerHitRateUp;
}
else
{
cout << "\nPlayer does not need to be leveled up.\n";
cout << "Returning to game...\n\n";
}
} while ( PlayerExperience >= PlayerNextExperience);
return 0;
}

4
General / Inventory system for text based rpg/mud
« on: May 25, 2011, 05:02:31 pm »
yeah i kind of figured out a portion of it, this was just a test


Code: [Select]
class RustyBuckler
{
public:
static const int DataBaseID = 9;
static const int ItemType = 2;
static const int Atk = 0;
static const int Def = 2;
static const int GoldValue = 50;
static const int Stack = 1;
static const int MaxStack = 1;
};



obviously im missing the portion you put in. Can you rework it with that info? basically though i need to access different portions for stuff the inventory i have to accually take the variable of 1 inventory slot and make it take on the values of the item im transfering. Another thing i have is a database for monsters too but really anything that is temporary can just be run as a temp variable in its own function. Anything thats saved needs to be in global variable format 1 line at a time for saving / loading purposes.

Inventory Management consists of


Equipment Slots 1-7
Weapon
Shield
Helm
Gloves
Body
Pants
Boots

Inventory Slots ( 10 Of Them)
Quest Item Slots (5 Of Them)
Loot Buffer Slots (5 of them) (Temporary Loot Droped Goes Here)


Bank (Undecided number could be as high as 50 or 100 slots)


DatabaseID is item number in database
ItemType will either be 1-7 Equipment 8 for quest 9 for loot buffer 10 for general inventory.



For stacks it would be like an item thats stackable..... like say Fish Eyes or Arrows or some other item you that can stack up to 50 or 10 or 99 or whatever the setting is.. because if you swap items or combine stacks you would need to chec to see if

Is it stackable?
If it is, is it the same item,
If it is, does the location you moving to have room,
If so can you fit all items.
If not how many. xfer variable data and make modifications as needed.

5
General / Inventory system for text based rpg/mud
« on: May 25, 2011, 10:39:39 am »
Would this be correct? What else is missing? It won't let me store bool values or strings inside the class though.



Code: [Select]
class CopperSword
{
public:
                string Equip001 = "Copper_Sword";
string Equip001Title = "A_Short_Sword_Made_Of_Copper";
int Equip001Atk = 2;
int Equip001Price = 50;
int Equip001Slot = 1;
bool Equip001Stack = false;
};

6
General / Inventory system for text based rpg/mud
« on: May 25, 2011, 10:25:42 am »
Well im accually planning to work on a mud style without graphics just text and sound and puzzles with a simple combat system for now. I already have most of the engine done including inventory and other stuff but i revising it with wav files for the music using playsound instead of midi because the preload for a file with increased length due to the inability to loop was a pain... secondly coding the entire inventoy required a huge ammount of nested if/else just for inventory swaping... the global variables will be needed for the save file which is just a simple text file. What i need is a sample code on how to do classes/arrays specifically in the manner used for inventory/bank/equipment management.


Also for all the menu options for different text stuff is there an easier way to manage the dialog then lots of switch's or if/else? id rather not have to have tons of nested switch's or if/else for all the dialog if possible. im trying to clean up my code and reduce the coding needed. The old style engine i designed required about 18,000 lines of code most of which was just inventory swaping not even counting the bank which was missing atm

7
General / Inventory system for text based rpg/mud
« on: May 24, 2011, 11:51:04 am »
I have a question is there an easier way to manage inventory/bank and equiping/transfering items then using massive ammounts of variables / bools to keep track of stuff? I'm only at a moderate level of knowledge with C++ ive yet to learn arrays and classes and stuff like that. Could someone show me some code examples? Thanks

I would need to seperate things like:

Is the item stackable?
Loot buffer.
Quest Items.
Player bag inventory.
Bank vault.
Equipment slots.


Like an example

Item 1
Short Sword
Description
Atk +5
Gold Value: 50
Equipment Slot: Weapon
Stackable: No

8
Graphics / 2d video game with text
« on: May 23, 2011, 11:44:23 pm »
I think i was wrong accually its the the regular window not  opengl window but i think the problem lies with the fact im using Catalyst 11.5 with ATI graphics i read somewhere that anything past 10.10 won't work with SFML? Im using visual studio 2008  SFML 1.6 with radeon HD 5870 / Catalyst 11.5


The program compiles correctly but after i updated my graphics drivers now the window won't even open it just sits idle with the console window.
Prior to this i was able to open a blank window, load some music but was unable to get the fonts/text string to load.

9
Graphics / 2d video game with text
« on: May 23, 2011, 04:07:59 pm »
Hi,

I'm trying to build a video game similar to the old might and magic game on the Sega... with 2d vide movement and text. I've been able to initialize a blank openGL window and play music but ive been having problems printing a string to the window, also when i load music to the window the window itself seems to cause stuff to loop. Im very new to this kind of programming since im used to console applications. If anyone could point me in the direction for getting a basic window setup id appreicate it thanks!

10
Window / Error during compile
« on: August 31, 2010, 04:14:08 pm »
does this have anything to do with it?

Im running windows 7 64 bit

11
Window / Error during compile
« on: August 31, 2010, 04:13:13 pm »
I copied a copy of all the debug dlls to the programs folder under visual studio.


I set the preproccessor, lib, and linker input as well as setup the options for Vs to load from both C:/smfl verison

and placed the files in VS


i just dont get it

12
Window / Error during compile
« on: August 31, 2010, 11:11:22 am »
i already did that when i set it up and it still gives errors.

13
Window / Error during compile
« on: August 31, 2010, 09:42:54 am »
I'm not exactly sure what you mean by that.

14
Window / Error during compile
« on: August 31, 2010, 04:10:26 am »
Trying out tutorial:
http://www.sfml-dev.org/tutorials/1.6/window-window.php

Error:

1>KingdomOfMythos Version 2.0.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: virtual __thiscall sf::Window::~Window(void)" (__imp_??1Window@sf@@UAE@XZ) referenced in function _main
1>KingdomOfMythos Version 2.0.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: void __thiscall sf::Window::Display(void)" (__imp_?Display@Window@sf@@QAEXXZ) referenced in function _main
1>KingdomOfMythos Version 2.0.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: __thiscall sf::Window::Window(class sf::VideoMode,class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &,unsigned long,struct sf::WindowSettings const &)" (__imp_??0Window@sf@@QAE@VVideoMode@1@ABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@KABUWindowSettings@1@@Z) referenced in function _main
1>KingdomOfMythos Version 2.0.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: __thiscall sf::VideoMode::VideoMode(unsigned int,unsigned int,unsigned int)" (__imp_??0VideoMode@sf@@QAE@III@Z) referenced in function _main
1>C:\Users\Snaef98\Documents\Visual Studio 2008\Projects\KingdomOfMythos Version 2.0\Debug\KingdomOfMythos Version 2.0.exe : fatal error LNK1120: 4 unresolved externals



Code:
Code: [Select]
////////////////////////////////////////////////////////////
// Headers
////////////////////////////////////////////////////////////
#include <stdafx.h>
#include <Window.hpp>
////////////////////////////////////////////////////////////
/// Entry point of application
///
///
///
////////////////////////////////////////////////////////////
int main()
{
// Create the main window
sf::Window App(sf::VideoMode(800, 600, 32), "SFML Window");

// Start main loop
bool Running = true;
while (Running)
{
App.Display();
}
return EXIT_SUCCESS;
}
[/code]

Pages: [1]
anything