EOSERV Forum > EOSERV > Harvest System [Tutorial]
Topic is locked.
Page: << 1 2 >>
Harvest System [Tutorial]
Author Message
Post #33968 Harvest System [Tutorial]

EDIT: During the fact of people being not able to call there work. I figured I should remove my snippets of code. Though if you want the harvest system. Go look somewhere else on this forum or contact me.

Hello there,

I got my harvest system cracked up a bit.
It now takes values from a .ini

Lets get started!

 

######
Step 1. (Making the config file)
######

We go to src\world.hpp.

Scroll down a bit and you will see the Config files as in;

Config admin_config;
Config drops_config;
Config shops_config;
Config arenas_config;
Config formulas_config;

Place under formulas the followed line;

Config harvs_config;

Done with world.hpp!
###############################################

######
Step 2. (Making the config file part 2)
######

We go to src\world.cpp.

We search for;

this->formulas_config.Read(static_cast<std::string>(this->config["FormulasFile"]));

And place under that line;

<Code removed> Make it yourself ^^


Now, If you want to take the file to rehash search for;

this->formulas_config.Read(this->config["FormulasFile"]);

Place under that line;

<Code removed> Make it yourself ^^

Done with world.cpp!
################################################

######
Step 3. (Adding (Making) The script in attack.cpp)
######

We go to src\handlers\attack.cpp.

We search for;

this->player->character->Attack(direction);

Place under that line;


<Code removed> Make it yourself ^^


Which is harvesting.

Done with attack.cpp!
###############################################

######
Step 4. (Adding the HarvsFile to load withing the config.ini)
######

Go to you config.ini (Which is located inside your trunk)

Search for;

FormulasFile = ./data/formulas.ini

Place under that line (Do space it up a bit);

<Code removed> Make it yourself ^^

Then save the config file.

Done with the config.ini!
###############################################

######
Step 5. (Adding the harvs.ini)
######

Go to the data folder (located in your trunk).

Now you can do a few things of adding a new .ini file.

1. Copy and paste lets say arena.ini and rename it to harvs.ini then clear the file.
2. Make a new txt file and remame txt to .ini
3. Make a new txt file save it as (do click save as.. all files first) harvs.ini.

Now when you got this file delete (if you copied arena.ini) the lines and add;


(File explains what things do)

Done with the harvs.ini!
##############################################

Now once we all done this, Compile the source and test it out!

---
"Pineapples and shit."
15 years, 15 weeks ago
Post #33975 Re: Harvest System [Tutorial]

yo i added it but do you need to have a special weapon or something to harvest?

---
Live and let live. Hurt but do not kill. Finish what you start. NEVER GIVE UP!!!
15 years, 15 weeks ago
Post #33976 Re: Harvest System [Tutorial]


did my tutorial said anything about a special weapon?

The answer is no.

---
"Pineapples and shit."
15 years, 15 weeks ago
Post #33977 Re: Harvest System [Tutorial]

OK i compiled it, but then when i go into the game, Nothing happens i think i sat there and hit it like 500 times and it still didnt give me anything :/

P.S. It compiled fine, but i got 3 warnings from Attack.cpp

---
Create your own destiny, don't let someone else do it for you.
15 years, 15 weeks ago
Post #33978 Re: Harvest System [Tutorial]


Just post your errors here, I might know how to solve them.

---
"Pineapples and shit."
15 years, 15 weeks ago
Post #33979 Re: Harvest System [Tutorial]

ok here are the warnings 

-------------- Build: MYSQL+SQLITE in eoserv ---------------


Compiling: ..\src\guild.cpp

Compiling: ..\src\handlers\Account.cpp

Compiling: ..\src\handlers\AdminInteract.cpp

Compiling: ..\src\handlers\Bank.cpp

Compiling: ..\src\handlers\Barber.cpp

Compiling: ..\src\handlers\Board.cpp

Compiling: ..\src\handlers\Book.cpp

Compiling: ..\src\handlers\Chair.cpp

Compiling: ..\src\handlers\Character.cpp

Compiling: ..\src\handlers\Chest.cpp

Compiling: ..\src\handlers\Citizen.cpp

Compiling: ..\src\handlers\Connection.cpp

Compiling: ..\src\arena.cpp

Compiling: ..\src\handlers\Emote.cpp

Compiling: ..\src\handlers\Face.cpp

Compiling: ..\src\handlers\Global.cpp

Compiling: ..\src\handlers\Guild.cpp

Compiling: ..\src\handlers\Init.cpp

Compiling: ..\src\handlers\Internal.cpp

Compiling: ..\src\handlers\Item.cpp

Compiling: ..\src\handlers\Jukebox.cpp

Compiling: ..\src\handlers\Locker.cpp

Compiling: ..\src\handlers\Login.cpp

Compiling: ..\src\handlers\Paperdoll.cpp

Compiling: ..\src\handlers\Party.cpp

Compiling: ..\src\handlers\Ping.cpp

Compiling: ..\src\handlers\Players.cpp

Compiling: ..\src\handlers\Refresh.cpp

Compiling: ..\src\handlers\Shop.cpp

Compiling: ..\src\handlers\Sit.cpp

Compiling: ..\src\handlers\StatSkill.cpp

Compiling: ..\src\handlers\Talk.cpp

Compiling: ..\src\handlers\Trade.cpp

Compiling: ..\src\handlers\Walk.cpp

Compiling: ..\src\handlers\Warp.cpp

Compiling: ..\src\handlers\Welcome.cpp

Compiling: ..\src\handlers\Door.cpp

Compiling: ..\src\main.cpp

C:\Users\Austin\Desktop\Flash drive\trunk\src\main.cpp: In function 'int main(int, char**)':

C:\Users\Austin\Desktop\Flash drive\trunk\src\main.cpp:548: warning: 'active_clients' may be used uninitialized in this function

Compiling: ..\src\map.cpp

C:\Users\Austin\Desktop\Flash drive\trunk\src\map.cpp: In member function 'void Map::LoadArena()':

C:\Users\Austin\Desktop\Flash drive\trunk\src\map.cpp:278: warning: 's' may be used uninitialized in this function

Compiling: ..\src\npc.cpp

Compiling: ..\src\party.cpp

Compiling: ..\src\player.cpp

Compiling: ..\src\scriptreg.cpp

C:\Users\Austin\Desktop\Flash drive\trunk\src\scriptreg.cpp:43: warning: 'script_DEBUG' defined but not used

Compiling: ..\src\sln.cpp

Linking console executable: ..\eoserv.exe

Output size is 2.12 MB

Process terminated with status 0 (1 minutes, 38 seconds)

0 errors, 3 warnings

 


---
Create your own destiny, don't let someone else do it for you.
15 years, 15 weeks ago
Post #33980 Re: Harvest System [Tutorial]


Oh, Warnings do nothing ;] There just an announce to make sure that you know about it. Sometimes those Warnings are used if a value isn't being used.

So it works fine.

did you added the harvs.ini?

---
"Pineapples and shit."
15 years, 15 weeks ago
Post #33981 Re: Harvest System [Tutorial]

Yea i added it, and heres my Harvs.ini

### Ananas Harvest System ###

# Version 1.0

#

# Location syntax;

# (int).map = (mapid)

# (int).x = (xloc)

# (int).y = (yloc)


# The Harvested Item ID

ItemID = 11


# Amount of items being gained.

ItemAmount = 1


# Amount of locations

LocationAmount = 2


# First location

1.map = 9

1.x = 29

1.y = 29


# Second Location

2.map = 5

2.x = 40

2.y = 47


# (etc)


On my server item 11 is a egg so i want harvesting to be able to give them pets. and btw could i use this for fishing also?

---
Create your own destiny, don't let someone else do it for you.
15 years, 15 weeks ago
Post #33982 Re: Harvest System [Tutorial]


Did you stand on the location which you have given in the file? Also try and see if it actually load. (Added it in config.ini?) And yes you could just change the ID. Its still version 1.0 so.

---
"Pineapples and shit."
15 years, 15 weeks ago
Post #33983 Re: Harvest System [Tutorial]

oh your supposed to stand on it? lol i was attacking it

yea ok when i stand on it it works now, but how do you make it so the item doesnt come up right away? like so everytime you attack it doesnt come up

---
Create your own destiny, don't let someone else do it for you.
15 years, 15 weeks ago
Post #33984 Re: Harvest System [Tutorial]


You want a relay between the item to be picked up? you should work with random ints etc.

---
"Pineapples and shit."
15 years, 15 weeks ago
Post #33985 Re: Harvest System [Tutorial]

yea i yea i want the relay so ill just mess around and try to get it, :]

--edit-- Ok, I can't seem to figure it out Lmao, Help me a little?


---
Create your own destiny, don't let someone else do it for you.
15 years, 15 weeks ago
Post #34462 Re: Harvest System [Tutorial]

I like it nice job.!

---
CN:BH 4 lyfe
15 years, 14 weeks ago
Post #34919 Re: Harvest System [Tutorial]

hey i got these 2 errors:




-------------- Build: DEBUG+MYSQL+SQLITE in eoserv ---------------

Compiling: ..\src\character.cpp
Compiling: ..\src\database.cpp
C:\Documents and Settings\jeroen\Bureaublad\server\trunk\src\console.hpp: In member function 'void Database::Connect(Database::Engine, std::string, std::string, std::string, std::string)':
C:\Documents and Settings\jeroen\Bureaublad\server\trunk\src\console.hpp:142: error: invalid conversion from 'unsigned int' to 'const char*'
C:\Documents and Settings\jeroen\Bureaublad\server\trunk\src\console.hpp:142: error:   initializing argument 1 of 'std::basic_string<_CharT, _Traits, _Alloc>::basic_string(const _CharT*, const _Alloc&) [with _CharT = char, _Traits = std::char_traits<char>, _Alloc = std::allocator<char>]'
Process terminated with status 1 (0 minutes, 9 seconds)
2 errors, 0 warnings
 


does maybe someone know what these 2 errors could be?

---
opensource isometric game engine ~ www.avac-engine.blogspot.com
15 years, 13 weeks ago
Post #36363 Re: Harvest System [Tutorial]

 

######
Step 1. (Making the config file)
######

We go to src\world.hpp.

Scroll down a bit and you will see the Config files as in;

Config admin_config;
Config drops_config;
Config shops_config;
Config arenas_config;
Config formulas_config;

Place under formulas the followed line;

Config harvs_config;

Done with world.hpp!
###############################################

######
Step 2. (Making the config file part 2)
######

We go to src\world.cpp.

We search for;

this->formulas_config.Read(static_cast<std::string>(this->config["FormulasFile"]));

And place under that line;

this->harvs_config.Read(static_cast<std::string>(this->config["HarvsFile"]));


Now, If you want to take the file to rehash search for;

this->formulas_config.Read(this->config["FormulasFile"]);

Place under that line;

this->harvs_config.Read(this->config["HarvsFile"]);

Done with world.cpp!
################################################

######
Step 3. (Adding (Making) The script in attack.cpp)
######

We go to src\handlers\attack.cpp.

We search for;

this->player->character->Attack(direction);

Place under that line;

int ItemID, ItemA, Map, X, Y;
for(int i = 0 ; i < static_cast<int>(this->server->world->harvs_config["LocationAmount"]) ; i++){
ItemID = static_cast<int>(this->server->world->harvs_config["ItemID"]);
ItemA = static_cast<int>(this->server->world->harvs_config["ItemAmount"]);
Map = static_cast<int>(this->server->world->harvs_config[util::to_string(i+1) + ".map"]);
X = static_cast<int>(this->server->world->harvs_config[util::to_string(i+1) + ".x"]);
Y = static_cast<int>(this->server->world->harvs_config[util::to_string(i+1) + ".y"]);
if(this->player->character->mapid == Map && this->player->character->x == X && this->player->character->y == Y)
{
   this->player->character->Attack(direction);
   this->player->character->AddItem(ItemID, ItemA);
   reply.SetID(PACKET_ITEM, PACKET_GET);
   reply.AddShort(0); // UID
   reply.AddShort(ItemID);
   reply.AddThree(ItemA);
   reply.AddChar(this->player->character->weight);
   reply.AddChar(this->player->character->maxweight);
   CLIENT_SEND(reply);
   break;
   }
}

Which is harvesting.

Done with attack.cpp!
###############################################

######
Step 4. (Adding the HarvsFile to load withing the config.ini)
######

Go to you config.ini (Which is located inside your trunk)

Search for;

FormulasFile = ./data/formulas.ini

Place under that line (Do space it up a bit);

## HarvsFile (string)
# Harvest Location File
HarvsFile = ./data/harvs.ini

Then save the config file.

Done with the config.ini!
###############################################

######
Step 5. (Adding the harvs.ini)
######

Go to the data folder (located in your trunk).

Now you can do a few things of adding a new .ini file.

1. Copy and paste lets say arena.ini and rename it to harvs.ini then clear the file.
2. Make a new txt file and remame txt to .ini
3. Make a new txt file save it as (do click save as.. all files first) harvs.ini.

Now when you got this file delete (if you copied arena.ini) the lines and add;

https://tehsausage.com/paste/Ananas%20Harvsini

(File explains what things do)

Done with the harvs.ini!
##############################################

Now once we all done this, Compile the source and test it out!


---------------------------------------------------------------------------------------------



Bold: Examples of what I like when I look at a tutorial :] I love it very well done.

15 years, 8 weeks ago
Page: << 1 2 >>
Topic is locked.
EOSERV Forum > EOSERV > Harvest System [Tutorial]