EOSERV Forum > EOSERV > Ananas Skill Master
Topic is locked.
Page: << 1 2 3 >>
Ananas Skill Master
Author Message
Post #48516 Ananas Skill Master

Hello guys and girls!
Another release of ananas! YEEY!
Its the Skill Master system :]
You can now ask data from it to make skill masters sell spells.
I'm not going to tell you how to do everything exactly so I just hope that you know how to use the search function in codeblocks.
I took Apollo's syntax as example. he once showed it to ethanmoffat to create a program for it.
Anyways lets get started!

SRC\NPC.CPP
--------
Search for;
this->shop_craft.clear();

Paste below;
this->spell_shop.clear();

Search for;
https://tehsausage.com/paste/npc-cpp-search-for

Paste below;
https://tehsausage.com/paste/npc-cpp-spell-shop
---------------------------------

SRC\NPC.HPP
---------
Search for;
struct NPC_Drop : public Shared
{
    unsigned short id;
    int min;
    int max;
    double chance;

    SCRIPT_REGISTER_REF_DF(NPC_Drop)
        SCRIPT_REGISTER_VARIABLE("uint16", id);
        SCRIPT_REGISTER_VARIABLE("int", min);
        SCRIPT_REGISTER_VARIABLE("int", max);
        SCRIPT_REGISTER_VARIABLE("double", chance);
    SCRIPT_REGISTER_END()
};

Paste below;
struct NPC_Spell_Trade : public Shared
{
    unsigned short id;
    int gold;
    int level;
    int clas;
    int spell1;
    int spell2;
    int spell3;
    int spell4;
    int str;
    int intt;
    int wis;
    int agi;
    int con;
    int cha;

    SCRIPT_REGISTER_REF_DF(NPC_Spell_Trade)
        SCRIPT_REGISTER_VARIABLE("uint16", id);
        SCRIPT_REGISTER_VARIABLE("int", gold);
        SCRIPT_REGISTER_VARIABLE("int", level);
        SCRIPT_REGISTER_VARIABLE("int", clas);
        SCRIPT_REGISTER_VARIABLE("int", spell1);
        SCRIPT_REGISTER_VARIABLE("int", spell2);
        SCRIPT_REGISTER_VARIABLE("int", spell3);
        SCRIPT_REGISTER_VARIABLE("int", spell4);
        SCRIPT_REGISTER_VARIABLE("int", str);
        SCRIPT_REGISTER_VARIABLE("int", intt);
        SCRIPT_REGISTER_VARIABLE("int", wis);
        SCRIPT_REGISTER_VARIABLE("int", agi);
        SCRIPT_REGISTER_VARIABLE("int", con);
        SCRIPT_REGISTER_VARIABLE("int", cha);
    SCRIPT_REGISTER_END()
};

Search for;
std::string shop_name;

Paste below;
std::string skill_name;

Search for;
PtrVector<NPC_Shop_Craft_Item> shop_craft;

Paste below;
PtrVector<NPC_Spell_Trade> spell_shop;
---------------------------------------

SRC\FWD\NPC.HPP
---------------
Search for;
struct NPC_Shop_Craft_Item;

Paste below;
struct NPC_Spell_Trade;
-----------------------

SRC\HANDLERS\STATSKILL.CPP

---------------------------
Paste the followed piece of code into StatSkill.cpp at almost the top.
Please search a bit and use your common sense on how to add it. If you then really can't figure it out. Ask me.

https://tehsausage.com/paste/statskill-cpp-spell-shop-data
---------------------------

SRC\WORLD.CPP
--------------
Search for;
this->home_config.Read(this->config["HomeFile"]);

Paste below;
this->spells_config.Read(this->config["SpellsFile"]);

Search at Rehash() for;
this->home_config.Read(this->config["HomeFile"]);

Paste below;
this->spells_config.Read(this->config["SpellsFile"]);
------------------------------------------------------

SRC\WORLD.HPP
-------------
Search for;
Config home_config;

Paste below;
Config spells_config;
---------------------

CONFIG.INI
----------
Search for;
## HomeFile (string)
# Spawn point and innkeeper data
HomeFile = ./data/home.ini

Paste below;
## SpellsFile (string)
# File containing Spell settings
SpellsFile = ./data/skills.ini
--------------------------------

DATA FOLDER(skills.ini)
-----------------------
Create a new file called skills.ini and paste the followed information in it and save it.

https://tehsausage.com/paste/skills-cpp-ananas
-----------------------

Enjoy!

If I forgot anything please let me know. I had to do this in a hurry ;p


Also note: You do need spells to get this to work ;p

---
"Pineapples and shit."
13 years, 31 weeks ago
Post #48517 Re: Ananas Skill Master

Well, I'm first post, I'll be first to say "Nice release". My post is to say I get errors =}

 
||=== eoserv, MYSQL+SQLITE ===|
s EOserv Rev 189 v0.2\src\character.cpp|20|warning: extra tokens at end of #include directive|
s EOserv Rev 189 v0.2\src\handlers\Item.cpp||In member function 'bool EOClient::Handle_Item(PacketFamily, PacketAction, PacketReader&, int)':|
s EOserv Rev 189 v0.2\src\handlers\Item.cpp|49|warning: suggest parentheses around assignment used as truth value|
s EOserv Rev 189 v0.2\src\handlers\StatSkill.cpp:22|13|instantiated from here|
s EOserv Rev 189 v0.2\src\container\ptr_vector.hpp|315|error: invalid covariant return type for 'T* PtrVector<T>::FastIterator::Dereference() [with T = NPC, T* = NPC*]'|
s EOserv Rev 189 v0.2\src\container\ptr_vector.hpp|135|error:   overriding 'virtual Shared* GenericPtrVector::FastIterator::Dereference()'|
s EOserv Rev 189 v0.2\src\handlers\StatSkill.cpp||In member function 'bool EOClient::Handle_StatSkill(PacketFamily, PacketAction, PacketReader&, int)':|
s EOserv Rev 189 v0.2\src\handlers\StatSkill.cpp|22|error: invalid use of incomplete type 'struct Map'|
s EOserv Rev 189 v0.2\src\fwd\map.hpp|10|error: forward declaration of 'struct Map'|
s EOserv Rev 189 v0.2\src\handlers\StatSkill.cpp|24|error: invalid use of incomplete type 'struct NPC'|
s EOserv Rev 189 v0.2\src\fwd\npc.hpp|10|error: forward declaration of 'struct NPC'|
s EOserv Rev 189 v0.2\src\handlers\StatSkill.cpp|24|error: invalid use of incomplete type 'struct NPC'|
s EOserv Rev 189 v0.2\src\fwd\npc.hpp|10|error: forward declaration of 'struct NPC'|
s EOserv Rev 189 v0.2\src\handlers\StatSkill.cpp|24|error: invalid use of incomplete type 'struct NPC'|
s EOserv Rev 189 v0.2\src\fwd\npc.hpp|10|error: forward declaration of 'struct NPC'|
s EOserv Rev 189 v0.2\src\handlers\StatSkill.cpp|31|error: invalid use of incomplete type 'struct NPC'|
s EOserv Rev 189 v0.2\src\fwd\npc.hpp|10|error: forward declaration of 'struct NPC'|
s EOserv Rev 189 v0.2\src\handlers\StatSkill.cpp|32|error: invalid use of incomplete type 'struct NPC'|
s EOserv Rev 189 v0.2\src\fwd\npc.hpp|10|error: forward declaration of 'struct NPC'|
s EOserv Rev 189 v0.2\src\handlers\StatSkill.cpp:34|21|instantiated from here|
s EOserv Rev 189 v0.2\src\container\ptr_vector.hpp|315|error: invalid covariant return type for 'T* PtrVector<T>::FastIterator::Dereference() [with T = NPC_Spell_Trade, T* = NPC_Spell_Trade*]'|
s EOserv Rev 189 v0.2\src\container\ptr_vector.hpp|135|error:   overriding 'virtual Shared* GenericPtrVector::FastIterator::Dereference()'|
s EOserv Rev 189 v0.2\src\handlers\StatSkill.cpp||In member function 'bool EOClient::Handle_StatSkill(PacketFamily, PacketAction, PacketReader&, int)':|
s EOserv Rev 189 v0.2\src\handlers\StatSkill.cpp|34|error: invalid use of incomplete type 'struct NPC'|
s EOserv Rev 189 v0.2\src\fwd\npc.hpp|10|error: forward declaration of 'struct NPC'|
s EOserv Rev 189 v0.2\src\handlers\StatSkill.cpp|36|error: invalid use of incomplete type 'struct NPC_Spell_Trade'|
s EOserv Rev 189 v0.2\src\fwd\npc.hpp|17|error: forward declaration of 'struct NPC_Spell_Trade'|
s EOserv Rev 189 v0.2\src\handlers\StatSkill.cpp|37|error: invalid use of incomplete type 'struct NPC_Spell_Trade'|
s EOserv Rev 189 v0.2\src\fwd\npc.hpp|17|error: forward declaration of 'struct NPC_Spell_Trade'|
s EOserv Rev 189 v0.2\src\handlers\StatSkill.cpp|38|error: invalid use of incomplete type 'struct NPC_Spell_Trade'|
s EOserv Rev 189 v0.2\src\fwd\npc.hpp|17|error: forward declaration of 'struct NPC_Spell_Trade'|
s EOserv Rev 189 v0.2\src\handlers\StatSkill.cpp|39|error: invalid use of incomplete type 'struct NPC_Spell_Trade'|
s EOserv Rev 189 v0.2\src\fwd\npc.hpp|17|error: forward declaration of 'struct NPC_Spell_Trade'|
s EOserv Rev 189 v0.2\src\handlers\StatSkill.cpp|40|error: invalid use of incomplete type 'struct NPC_Spell_Trade'|
s EOserv Rev 189 v0.2\src\fwd\npc.hpp|17|error: forward declaration of 'struct NPC_Spell_Trade'|
s EOserv Rev 189 v0.2\src\handlers\StatSkill.cpp|41|error: invalid use of incomplete type 'struct NPC_Spell_Trade'|
s EOserv Rev 189 v0.2\src\fwd\npc.hpp|17|error: forward declaration of 'struct NPC_Spell_Trade'|
s EOserv Rev 189 v0.2\src\handlers\StatSkill.cpp|42|error: invalid use of incomplete type 'struct NPC_Spell_Trade'|
s EOserv Rev 189 v0.2\src\fwd\npc.hpp|17|error: forward declaration of 'struct NPC_Spell_Trade'|
s EOserv Rev 189 v0.2\src\handlers\StatSkill.cpp|43|error: invalid use of incomplete type 'struct NPC_Spell_Trade'|
s EOserv Rev 189 v0.2\src\fwd\npc.hpp|17|error: forward declaration of 'struct NPC_Spell_Trade'|
s EOserv Rev 189 v0.2\src\handlers\StatSkill.cpp|44|error: invalid use of incomplete type 'struct NPC_Spell_Trade'|
s EOserv Rev 189 v0.2\src\fwd\npc.hpp|17|error: forward declaration of 'struct NPC_Spell_Trade'|
s EOserv Rev 189 v0.2\src\handlers\StatSkill.cpp|45|error: invalid use of incomplete type 'struct NPC_Spell_Trade'|
s EOserv Rev 189 v0.2\src\fwd\npc.hpp|17|error: forward declaration of 'struct NPC_Spell_Trade'|
s EOserv Rev 189 v0.2\src\handlers\StatSkill.cpp|46|error: invalid use of incomplete type 'struct NPC_Spell_Trade'|
s EOserv Rev 189 v0.2\src\fwd\npc.hpp|17|error: forward declaration of 'struct NPC_Spell_Trade'|
s EOserv Rev 189 v0.2\src\handlers\StatSkill.cpp|47|error: invalid use of incomplete type 'struct NPC_Spell_Trade'|
s EOserv Rev 189 v0.2\src\fwd\npc.hpp|17|error: forward declaration of 'struct NPC_Spell_Trade'|
s EOserv Rev 189 v0.2\src\handlers\StatSkill.cpp|48|error: invalid use of incomplete type 'struct NPC_Spell_Trade'|
s EOserv Rev 189 v0.2\src\fwd\npc.hpp|17|error: forward declaration of 'struct NPC_Spell_Trade'|
s EOserv Rev 189 v0.2\src\handlers\StatSkill.cpp|64|error: invalid use of incomplete type 'struct NPC'|
s EOserv Rev 189 v0.2\src\fwd\npc.hpp|10|error: forward declaration of 'struct NPC'|
s EOserv Rev 189 v0.2\src\handlers\StatSkill.cpp|66|error: invalid use of incomplete type 'struct NPC_Spell_Trade'|
s EOserv Rev 189 v0.2\src\fwd\npc.hpp|17|error: forward declaration of 'struct NPC_Spell_Trade'|
s EOserv Rev 189 v0.2\src\handlers\StatSkill.cpp|66|error: invalid use of incomplete type 'struct NPC_Spell_Trade'|
s EOserv Rev 189 v0.2\src\fwd\npc.hpp|17|error: forward declaration of 'struct NPC_Spell_Trade'|
||More errors follow but not being shown.|
||Edit the max errors limit in compiler options...|
||=== Build finished: 50 errors, 2 warnings ===|


13 years, 31 weeks ago
Post #48528 Re: Ananas Skill Master

Has to do something with including certain files.


Add at the top of StatSkill.cpp

#include "map.hpp"
#include "npc.hpp"


Make sure you got this added at the top of npc.cpp. If you are missing an include add it;

#include "config.hpp"
#include "console.hpp"
#include "eoclient.hpp"
#include "eodata.hpp"
#include "map.hpp"
#include "npc.hpp"
#include "quest.hpp"
#include "packet.hpp"
#include "party.hpp"
#include "player.hpp"
#include "timer.hpp"
#include "world.hpp"

---
"Pineapples and shit."
13 years, 31 weeks ago
Post #48547 Re: Ananas Skill Master

Wtf this is really awesome. keep the good work going

Come on he deserves a +1 isn't it?

---
opensource isometric game engine ~ www.avac-engine.blogspot.com
13 years, 31 weeks ago
Post #48567 Re: Ananas Skill Master

Ananas, That didn't help I still get the errors, I'll try re adding it completely(Fresh Rev) and see what happenens.

13 years, 31 weeks ago
Post #48569 Re: Ananas Skill Master
xIFearlessIxx posted: (6th Sep 2010 05:48 pm)

Ananas, That didn't help I still get the errors, I'll try re adding it completely(Fresh Rev) and see what happenens.


Fresh rev? Its skill master. Skill master needs spells. Did you do everything the tutorial said? Also the src/fwd/npc.hpp
---
"Pineapples and shit."
13 years, 31 weeks ago
Post #48570 Re: Ananas Skill Master

I can compile this just fine but when I click on the npc that I set in the config file nothing happens. Do you know what I'm doing wrong? I have added the 

## SpellsFile (string)

# File containing Spell settings

SpellsFile = ./data/skills.ini

to the config file and I'm sure I have set up the skills.ini properly aswell.

13 years, 31 weeks ago
Post #48571 Re: Ananas Skill Master

Can you go ingame and to $rehash then press the NPC Again. Also (Sorry if this sounds dumb) are you sure that the NPC Has a skill master ID :p

---
"Pineapples and shit."
13 years, 31 weeks ago
Post #48576 Re: Ananas Skill Master
Ananas posted: (6th Sep 2010 06:02 pm)

Can you go ingame and to $rehash then press the NPC Again. Also (Sorry if this sounds dumb) are you sure that the NPC Has a skill master ID :p


I tried rehashing but it didn't work. Here is my skills.ini
## Aeven Skill Master ##
116.name = Aven Skill Master
116.learn = 4,3000,7,0,0,0,0,0,0,0,0,0,0,0, 2,2500,10,0,0,0,0,0,0,0,0,0,0,0
13 years, 31 weeks ago
Post #48577 Re: Ananas Skill Master

Looks fine to me. So you added in everything the toturial said + the fact that you got the world.cpp and world.hpp correct?

---
"Pineapples and shit."
13 years, 31 weeks ago
Post #48590 Re: Ananas Skill Master

Thanks again Ananas!!

13 years, 31 weeks ago
Post #48614 Re: Ananas Skill Master


Hey Ananas u know why the class requirement not workin?

the rest of the requirements works prefectly fine except for class requirements.?

---
"With your feet steady and firm on the ground soar high and ignore limitations"  -Bladex
EOSERV Class : Pixel Artist, Grammar Nazi, Server Owner, Mapping Artist, Server Coder, Test Player,
The Game Maker
13 years, 31 weeks ago
Post #48623 Re: Ananas Skill Master
Bladex posted: (7th Sep 2010 07:04 am)


Hey Ananas u know why the class requirement not workin?

the rest of the requirements works prefectly fine except for class requirements.?


Check your StatSkill.cpp It need certain data for spell->clas, But when I added that the whole data of spells wen't corrupt and if you had 5K for a spell it turned into 302930 Coins and you had to be level 19 if you had your level as 10. Something like that.
---
"Pineapples and shit."
13 years, 31 weeks ago
Post #48624 Re: Ananas Skill Master


i thought so aswell i found that here

case PACKET_OPEN: // Talked to a skill master NPC
        {
           if (this->state < EOClient::Playing) return false;
            CLIENT_QUEUE_ACTION(0.0)

            short id = reader.GetShort();

            UTIL_PTR_VECTOR_FOREACH(this->player->character->map->npcs, NPC, npc)
            {
                if (npc->index == id && (npc->spell_shop.size() > 0 || npc->spell_shop.size() > 0))
                {

                    this->player->character->npc = *npc;
                    this->player->character->npc_type = ENF::Skills;

                    reply.SetID(PACKET_STATSKILL, PACKET_OPEN);
                    reply.AddShort(npc->id);
                    reply.AddBreakString(npc->skill_name.c_str());

                    UTIL_PTR_VECTOR_FOREACH(npc->spell_shop, NPC_Spell_Trade, spell)
                    {
                        reply.AddShort(spell->id);
                        reply.AddShort(spell->level);
                        reply.AddInt(spell->gold);

                        reply.AddShort(spell->clas); // This i s what i tried adding but it ended up stuffing up...
                        reply.AddShort(spell->spell1);
                        reply.AddShort(spell->spell2);
                        reply.AddShort(spell->spell3);
                        reply.AddShort(spell->spell4);
                        reply.AddShort(spell->str);
                        reply.AddShort(spell->wis);
                        reply.AddShort(spell->intt);
                        reply.AddShort(spell->agi);
                        reply.AddShort(spell->con);
                        reply.AddShort(spell->cha);
                    }
                    CLIENT_SEND(reply);
                }
            }
        }
        break;

---
"With your feet steady and firm on the ground soar high and ignore limitations"  -Bladex
EOSERV Class : Pixel Artist, Grammar Nazi, Server Owner, Mapping Artist, Server Coder, Test Player,
The Game Maker
13 years, 31 weeks ago
Post #48625 Re: Ananas Skill Master
lewis999 posted: (6th Sep 2010 06:11 pm)

Ananas posted: (6th Sep 2010 06:02 pm)

Can you go ingame and to $rehash then press the NPC Again. Also (Sorry if this sounds dumb) are you sure that the NPC Has a skill master ID :p


I tried rehashing but it didn't work. Here is my skills.ini
## Aeven Skill Master ##
116.name = Aven Skill Master
116.learn = 4,3000,7,0,0,0,0,0,0,0,0,0,0,0, 2,2500,10,0,0,0,0,0,0,0,0,0,0,0

have you set the NPC to "skill master" in the pub files (: ?

Bladex posted: (7th Sep 2010 09:45 am)
This i s what i tried adding but it ended up stuffing up..

Ananas posted: (7th Sep 2010 09:29 am)

Bladex posted: (7th Sep 2010 07:04 am)


Hey Ananas u know why the class requirement not workin?

the rest of the requirements works prefectly fine except for class requirements.?


Check your StatSkill.cpp It need certain data for spell->clas, But when I added that the whole data of spells wen't corrupt and if you had 5K for a spell it turned into 302930 Coins and you had to be level 19 if you had your level as 10. Something like that.
^^ 'swhy he didnt add it (: 

---
If money doesn't grow on trees, then why do banks have branches?
13 years, 31 weeks ago
Page: << 1 2 3 >>
Topic is locked.
EOSERV Forum > EOSERV > Ananas Skill Master