The code is unfinished...I stopped working on this a while ago. But I'll complete here soon.
By the way, you can create your own items, and races as well. Just as easily in the same way.
Header files:
stdafx.h:
Code: Select all
#include "iostream"
#include "Irrlicht.h"
Code: Select all
#include "stdafx.h"
#include "Races.h"
#include "ItemTypes.h"
using namespace irr;
using namespace core;
using namespace io;
using namespace video;
using namespace scene;
using namespace std;
class NPC// : public ISceneNode
{
private:
IAnimatedMesh* MSkeleton;
IAnimatedMesh* MHead;
IAnimatedMesh* MUpperBody;
IAnimatedMesh* MHands; // could go even further to support fingers and toes
IAnimatedMesh* MLowerBody;
IAnimatedMesh* MFoot;
IAnimatedMeshSceneNode* SSkeleton;
IAnimatedMeshSceneNode* SHead;
IAnimatedMeshSceneNode* SUpperBody;
IAnimatedMeshSceneNode* SHands;
IAnimatedMeshSceneNode* SLowerBody;
IAnimatedMeshSceneNode* SFoot;
public:
eRaceType Race;
//char Name;
int Health;
int Magic;
int Fatigue;
int Weight;
int Encumberance;
float scale;
// Attributes
int Strength;
int Intelligence;
int WillPower;
int Agility;
int Speed;
int Endurance;
int Luck;
NPC(eRaceType race, int health, int magic, int fatigue, int weight, int encumberance,
int strength, int intelligence, int willpower, int agility, int speed, int endurance, int luck);
eRaceType getRace(void);
void addInstance();
void setRace(eRaceType race);
void equipItem(eItemType item);
void setHealth(int i);
void setMagic(int i);
void setFatigue(int i);
void setWeight(int i);
void setEncumberance(int i);
int getHealth(void);
int getMagic(void);
int getFatigue(void);
int getWeight(void);
int getEncumberance(void);
void setStrength(int i);
void setIntelligence(int i);
void setWillPower(int i);
void setAgility(int i);
void setSpeed(int i);
void setEndurance(int i);
void setLuck(int i);
int getStrength(void);
int getIntelligence(void);
int getWillPower(void);
int getAgility(void);
int getSpeed(void);
int getEndurance(void);
int getLuck(void);
};
/*eRaceType NPC::getRace()
{
return Race;
};*/
NPC::NPC(eRaceType race, int health, int magic, int fatigue, int weight, int encumberance,
int strength, int intelligence, int willpower, int agility, int speed, int endurance, int luck)
{
//MSkeleton = smgr->getMesh("Data/Meshes/Character/Skeleton.x");
//MHead = ;
//MUpperBody = ;
//MHands = ;
//MLowerBody = ;
//Mfoot = ;
Race = race;
Health = health;
Magic = magic;
Fatigue = fatigue;
Weight = weight;
Encumberance = encumberance;
Strength = strength;
Intelligence = intelligence;
WillPower = willpower;
Agility = agility;
Speed = speed;
Endurance = endurance;
Luck = luck;
};
// Set main stats
void NPC::setHealth(int i)
{
Health = i;
};
void NPC::setMagic(int i)
{
Magic = i;
};
void NPC::setFatigue(int i)
{
Fatigue = i;
};
void NPC::setWeight(int i)
{
Weight = i;
};
void NPC::setEncumberance(int i)
{
Encumberance = i;
};
// get main stats
int NPC::getHealth(void)
{
return Health;
};
int NPC::getMagic()
{
return Magic;
};
int NPC::getFatigue(void)
{
return Fatigue;
};
int NPC::getWeight(void)
{
return Weight;
};
int NPC::getEncumberance(void)
{
return Encumberance;
};
// set attributes
void NPC::setStrength(int i)
{
Strength = i;
};
void NPC::setIntelligence(int i)
{
Intelligence = i;
};
void NPC::setWillPower(int i)
{
WillPower = i;
};
void NPC::setAgility(int i)
{
Agility = i;
};
void NPC::setSpeed(int i)
{
Speed = i;
};
void NPC::setEndurance(int i)
{
Endurance = i;
};
void NPC::setLuck(int i)
{
Luck = i;
};
// get attributes
int NPC::getStrength(void)
{
return Strength;
};
int NPC::getIntelligence(void)
{
return Intelligence;
};
int NPC::getWillPower(void)
{
return WillPower;
};
int NPC::getAgility(void)
{
return Agility;
};
int NPC::getSpeed(void)
{
return Speed;
};
int NPC::getEndurance(void)
{
return Endurance;
};
int NPC::getLuck(void)
{
return Luck;
};
eRaceType NPC::getRace(void)
{
return Race;
};
void NPC::addInstance()
{
//ISceneNode* n =
//smgr->addSceneNode("IAnimatedMeshSceneNode",0);
//SHead = ;
//SUpperBody = ;
//SHands = ;
//SLowerBody = ;
//Sfoot = ;
};
void NPC::setRace(eRaceType race)
{
Race = race;
};
void NPC::equipItem(eItemType item)
{
};
Code: Select all
#include "stdafx.h"
using namespace std;
enum eRaceType
{
Human = 0,
Orc = 1,
High_Elf = 2,
Dark_Elf = 3,
Wood_Elf = 4,
Beast = 5
};
Code: Select all
#include "stdafx.h"
using namespace std;
enum eItemType
{
Armor = 0,
Clothing = 1,
Weapon = 2,
Ingredient = 3,
};
Main_Content.h:
Code: Select all
#include "stdafx.h"
using namespace irr;
using namespace core;
using namespace io;
using namespace video;
using namespace scene;
using namespace gui;
using namespace std;
// NPC's. Race, Health, Magic, Fatiuge, Weight, Encumberance,
// Strength, Intelligence, WillPower, Agility, Speed, Endurance, Luck
NPC* Player = new NPC(Human, 100, 50, 200, 0, 150,
15, 15, 15 , 15, 15, 15, 15);
NPC* TestNPC = new NPC(Human, 25, 50, 150, 0, 100,
5, 5, 5 , 5, 5, 5, 5);
NPC* BobTheBeast = new NPC(Beast, 200, 50, 150, 0, 100,
5, 5, 5 , 5, 5, 5, 5);