EOSERV Forum > EOSERV > housing system basic
Topic is locked.
Page: << 1 2 >>
housing system basic
Author Message
Post #80878 housing system basic

I havent released anything in awhile so Id like to share the basic housing system ive been working on. Theres no npc furniture,no interchangeable gfx very basic system, that can be improved on!

This was compiled in a rev 189, do not attempt to put this in 205 + revs unless you are familiar with the new features and can modify to fit!

In character.cpp in the load function find `partner`, add `house`, `house_usage`,

a little bit lower find

this->hp = GetRow<int>(row, "hp");   and add below
this->house = GetRow<int>(row, "house");
this->house_usage = GetRow<int>(row, "house_usage");

scroll down a little bit and find bool Character::ValidName(std::string name) add above it https://tehsausage.com/paste/character-cpp-housing

if you dont have a petsystem remove anything that says this->PetTransfer(); or add your pet spawn/respawn in its place.

scoll down find these functions

bool Character::InRange(Character *other)

bool Character::InRange(NPC *other)

bool Character::InRange(Map_Item *other)

and replace all three with this https://tehsausage.com/paste/house-inrange

scroll down and find void Character::Save()  find `partner` = '$', add `house` = '#', `house_usage` = '#',

a little bit lower find this->partner.c_str(), add  this->house, this->house_usage,

Done in character.cpp go to world.cpp

find void world_timed_save(void *world_void) and add above

void world_house(void *world_void)
{
     World *world = static_cast<World *>(world_void);

       UTIL_PTR_VECTOR_FOREACH(world->characters, Character, from)
        {
        from->HousePayment();
        }
}

scroll down a bit find this->home_config.Read(this->config["HomeFile"]); and add below   this->house_config.Read(this->config["HouseFile"]);

scroll down a bit and find

TimeEvent *event = new TimeEvent(world_spawn_npcs, this, 1.0, Timer::FOREVER);
this->timer.Register(event);
event->Release();
add below
                                            
    event = new TimeEvent(world_house, this, static_cast<double>(this->config["HousePayment"]), Timer::FOREVER);
    this->timer.Register(event);
    event->Release();

scroll down a find

void World::Rehash()and this->home_config.Read(this->config["HomeFile"]);

and add this below this->house_config.Read(static_cast<std::string>(this->config["HouseFile"])); 

done in world.cppgo to character.hpp find int exp; add   int house; int house_usage;

find

void Warp(short map, unsigned char x, unsigned char y, WarpAnimation animation = WARP_ANIMATION_NONE); add below
void House();void LeaveHouse();void HousePayment();

done in character.hpp go to Item.cpp and find

if (this->player->character->HasItem(id))
    {
     EIF_Data *item = this->server->world->eif->Get(id);
     reply.SetID(PACKET_ITEM, PACKET_REPLY);
     reply.AddChar(item->type);
     reply.AddShort(id);
  add below

https://tehsausage.com/paste/item-cpp-house-key

done now go to talk.cpp to add pay rent command

https://tehsausage.com/paste/talk-cpp-pay-rent

done now go to your config.ini and config.local.ini and find

## HomeFile (string)
# Spawn point and innkeeper data
HomeFile = ./data/home.ini
and add below

## House File (string)
# House data
HouseFile = ./data/house.ini

scroll down and find ## MISC ## add below
## HouseUsage (number)
# When HouseUsage reaches 30 and you have the gold house payment will be taken
# When HouseUsage reaches 30 and you dont have the gold landlord messages begin
# If HouseUsage reaches 60 your house will be taken
# Should be equal to the amount in minutes of the house payment
HouseUsage = 3


## HousePayment (number)
# Time between landlord checkins
# 180 is 3 minutes
# Set to 0 to disable time
HousePayment = 180

done now go to your data folder and create a house.ini and add these contents https://tehsausage.com/paste/house-ini

done in your data folder now to setup your database create 2 new tables

Name house Type INT Length/Set 11 Default 0 check off Not Null

Name house_usage Type INT Length/Set 11 Default 0 check off Not Null

done in the database.

With your pub editor create a potion with icon 250 "key gfx" for each different house match the new item id to the id in your house.ini

EX: newitem id 703 will warp you to house = 192 check house.ini also make these house keys are lore! Make new maps for these houses and set the map id up in house ini dont have doors untested if someone walks in warp in warp out with the house key click like a potion.

Rent this amount will be removed after 30 minutes, if you dont have this amount the landlord hounds you for the next 30 minutes than removes your key.

I think thats it hope I remembered everything!

14 years, 4 weeks ago
Post #80883 Re: housing system basic

this looks really nice! i will try it out soon :)

One question, If you buy a house and dont spend time there, the timer still ticks?

---
Skype: izumibluuh

I sincerely apologize for my posts from when I was 12.
14 years, 4 weeks ago
Post #80884 Re: housing system basic

Yes, soon as your on line the timer starts when it reaches 30 minutes it checks for the rent money! I was thinking like 30 minutes = 30 days that can be adjusted!

14 years, 4 weeks ago
Post #80885 Re: housing system basic

Also for decoration i got idea that you put an object in a spot, then #building on/off, if on u hit the chair eg, it will change :o idk if its possible

---
Skype: izumibluuh

I sincerely apologize for my posts from when I was 12.
14 years, 4 weeks ago
Post #80886 Re: housing system basic
iSnow posted: (31st May 2011 09:12 pm)

Also for decoration i got idea that you put an object in a spot, then #building on/off, if on u hit the chair eg, it will change :o idk if its possible

Ive never got in to changing the gfx of a map this way,its most likely possible but I dont have the slightest clue! I was thinking somthing like upgrades more expensive key gets better house/modified map!

14 years, 4 weeks ago
Post #80888 Re: housing system basic
insomniac posted: (31st May 2011 09:17 pm)

iSnow posted: (31st May 2011 09:12 pm)

Also for decoration i got idea that you put an object in a spot, then #building on/off, if on u hit the chair eg, it will change :o idk if its possible

Ive never got in to changing the gfx of a map this way,its most likely possible but I dont have the slightest clue! I was thinking somthing like upgrades more expensive key gets better house/modified map!


Yeah my idea is that if #building on the player can hit an object and it swaps till the player find something he or she likes. (I think Refresh() is a good thing to add to refresh the map or something)
---
Skype: izumibluuh

I sincerely apologize for my posts from when I was 12.
14 years, 4 weeks ago
Post #80889 Re: housing system basic
iSnow posted: (31st May 2011 09:21 pm)

insomniac posted: (31st May 2011 09:17 pm)

iSnow posted: (31st May 2011 09:12 pm)

Also for decoration i got idea that you put an object in a spot, then #building on/off, if on u hit the chair eg, it will change :o idk if its possible

Ive never got in to changing the gfx of a map this way,its most likely possible but I dont have the slightest clue! I was thinking somthing like upgrades more expensive key gets better house/modified map!


Yeah my idea is that if #building on the player can hit an object and it swaps till the player find something he or she likes. (I think Refresh() is a good thing to add to refresh the map or something)
Any idea how to go about that?

14 years, 4 weeks ago
Post #80890 Re: housing system basic
insomniac posted: (31st May 2011 09:24 pm)

iSnow posted: (31st May 2011 09:21 pm)

insomniac posted: (31st May 2011 09:17 pm)

iSnow posted: (31st May 2011 09:12 pm)

Also for decoration i got idea that you put an object in a spot, then #building on/off, if on u hit the chair eg, it will change :o idk if its possible

Ive never got in to changing the gfx of a map this way,its most likely possible but I dont have the slightest clue! I was thinking somthing like upgrades more expensive key gets better house/modified map!


Yeah my idea is that if #building on the player can hit an object and it swaps till the player find something he or she likes. (I think Refresh() is a good thing to add to refresh the map or something)
Any idea how to go about that?


Nope XD but Rena had something on her server to get her clothes equipment changed
---
Skype: izumibluuh

I sincerely apologize for my posts from when I was 12.
14 years, 4 weeks ago
Post #80891 Re: housing system basic
iSnow posted: (31st May 2011 09:29 pm)

insomniac posted: (31st May 2011 09:24 pm)

iSnow posted: (31st May 2011 09:21 pm)

insomniac posted: (31st May 2011 09:17 pm)

iSnow posted: (31st May 2011 09:12 pm)

Also for decoration i got idea that you put an object in a spot, then #building on/off, if on u hit the chair eg, it will change :o idk if its possible

Ive never got in to changing the gfx of a map this way,its most likely possible but I dont have the slightest clue! I was thinking somthing like upgrades more expensive key gets better house/modified map!


Yeah my idea is that if #building on the player can hit an object and it swaps till the player find something he or she likes. (I think Refresh() is a good thing to add to refresh the map or something)
Any idea how to go about that?


Nope XD but Rena had something on her server to get her clothes equipment changed
Ill look around a bit and see if i can find anything!

14 years, 4 weeks ago
Post #80906 Re: housing system basic

Rena used # commands to change the players' items. it just goes up a list. #armor would give me a armor, and save it in the database, refresh the character. If i did #armor again, it would give me the next armor that she put, and save it to the database, refresh the character. It's nothing to do with GFX.

---
Create your own destiny, don't let someone else do it for you.
14 years, 3 weeks ago
Post #80910 Re: housing system basic

Yeah good call AustinB I think this will be a little more intense than switching armors and storing id's + refreshing, but similar in a over all scale. Would need something like a set of gfx stored in a config that can be i swapped EX:dresser, cabinet, table! chair, stool, bench!

Instance maps for each player that would be tough thats why I think simple house upgrades would be nice same house base, 1basic house map, 2house with a couple more things, 3bomb house best stuff. etc

14 years, 3 weeks ago
Post #80911 Re: housing system basic
insomniac posted: (31st May 2011 11:50 pm)

Yeah good call AustinB I think this will be a little more intense than switching armors and storing id's + refreshing, but similar in a over all scale. Would need something like a set of gfx stored in a config that can be i swapped EX:dresser, cabinet, table! chair, stool, bench!

Instance maps for each player that would be tough thats why I think simple house upgrades would be nice same house base, 1basic house map, 2house with a couple more things, 3bomb house best stuff. etc


Yeah thats a smart idea too xD After what i saw at your server
---
Skype: izumibluuh

I sincerely apologize for my posts from when I was 12.
14 years, 3 weeks ago
Post #80913 Re: housing system basic

This is why I left it bland so people can really do what they want with it. This should be simple EX: say instead of gfx swapping I make #upgrade command to view the houses before you buy the key, would also have to link the houses alt maps in the house.ini

14 years, 3 weeks ago
Post #80915 Re: housing system basic


30 seconds to pay rent would be kinda a money parasite. Maybe like every 8 hours of gametime?

---
Andrewbob - I would be on the fucking copter of rofls

Programmer, Web Developer, and Graphics Designer
14 years, 3 weeks ago
Post #80916 Re: housing system basic
Wildsurvival posted: (1st Jun 2011 12:29 am)


30 seconds to pay rent would be kinda a money parasite. Maybe like every 8 hours of gametime?


It's 30 mins? Either way you can edit
---
Skype: izumibluuh

I sincerely apologize for my posts from when I was 12.
14 years, 3 weeks ago
Page: << 1 2 >>
Topic is locked.
EOSERV Forum > EOSERV > housing system basic