Stackable buffs for your server

Talk about EOSERV here.
User avatar
Ryouken
General
General
Posts: 93
Joined: Mon Feb 27, 2012 3:14 pm

Stackable buffs for your server

Postby Ryouken » Thu Sep 06, 2012 11:19 pm

This here is an attempt to make a tutorial on how to add stackable stat buffs to your server code. Hope you like it. ;o I originally posted this on eoserv, but it got bumped down by another dumb lounge topic so I thought maybe it would get more appreciation here. ;.;



-First, we need to go to Character.hpp and find:

class Character : public Command_Source



-Put this above it:



struct Character_StatBuff

{

std::string label;

int time;

short str;

short intl;

short wis;

short agi;

short con;

short cha;

};



-Now we need to put something in the class. Find this:

class Character : public Command_Source

{

public:



-Put these anywhere under it (I like to keep my variables and prototypes seperate, but it doesn't matter):



std::list<Character_StatBuff *> statbuffs;



void UpdateStats();

bool Buff(std::string statname, int amount, int time, std::string label = "default");

void ClearBuffsLabeled(std::string label = "default");

void RemoveBuff(Character_StatBuff *thebuff);

void ClearBuffs();



-Ok, lets head off to character.cpp and find:

void Character::CalculateStats()



-Replace the entire function (assuming you know what a function is. o.o) with this:

http://tehsausage.com/paste/the-new-cal ... ts-ryouken



-Now put all this junk above the function we just replaced:

http://tehsausage.com/paste/functions-and-such-ryouken



-Allright, lets go to world.cpp and find:

event = new TimeEvent(world_act_npcs, this, 0.05, Timer::FOREVER);

this->timer.Register(event);



-Put this below it:

event = new TimeEvent(world_timers, this, 1.0, Timer::FOREVER);

this->timer.Register(event);



-Now for the last part, find:

void world_npc_recover(void *world_void)



-Put this above it:

http://tehsausage.com/paste/the-timer-o-ryouken





Thats all you have to do for the buff part. What you want to activate the buff is entirely up to you.

To activate a buff on a character, you simply put this line on code under whatever activates it:

character->Buff(<name of the stat|stats>, <amount>, <time>, <label string>);



The label is an optional thing you can put on the buff to identify it by incase you want to remove it later using this code:

character->ClearBuffsLabeled(<label string>);



Or if you just want to remove all buffs on the character, use this:

character->ClearBuffs();



The character pointer(character->) name varies depending on what function its in obviously, so it could be: from-> or this-> and sometimes other names.



Anyways, I'm sure this tutorial confused people more than helped them. ;.; But thats why I'm here to answer any questions. Please tell me if this works or not, because I had to remove a lot of stuff that my server uses from here, that way it wouldn't be cluttered. Also I may of missed a few thing. I'm pretty sure I got it all, but just incase. o.o
User avatar
Providence
God Like
God Like
Posts: 2314
Joined: Tue Dec 27, 2011 10:47 am
Location: Port orange, Florida

RE: Stackable buffs for your server

Postby Providence » Fri Sep 07, 2012 4:04 am

This is pointless for the users of EOSource. It's not open source.

Nothing against you or your code. So thread moved to eoserv.
Last edited by Providence on Fri Sep 07, 2012 4:15 am, edited 1 time in total.
Retired Super Moderator,
1/10/2012 - 1/6/2013

--

Getting back into the swing of EOSource, here to help.
User avatar
Ryouken
General
General
Posts: 93
Joined: Mon Feb 27, 2012 3:14 pm

RE: Stackable buffs for your server

Postby Ryouken » Fri Sep 07, 2012 6:07 am

Oh, I saw an eoserv related code in here by casoni, so I assumed this was the right place.
http://www.eosource.net/forum/thread-778.html
Also in programming it says: Post your codes or new programs you are working on here.
While in eoserv it just says to talk about eoserv, not post eoserv related items.
Last edited by Ryouken on Fri Sep 07, 2012 6:12 am, edited 1 time in total.
User avatar
Hollow
Legend
Legend
Posts: 699
Joined: Sun Oct 16, 2011 10:25 am
Location: Netherland
Contact:

RE: Stackable buffs for your server

Postby Hollow » Fri Sep 07, 2012 6:19 am

There wouldn't be such sections as ''Programming'' or ''EOSERV'' if codes / EOSERV related topics weren't allowed.
Last edited by Hollow on Fri Sep 07, 2012 6:20 am, edited 1 time in total.
User avatar
Swagdin
Legend
Legend
Posts: 901
Joined: Sat Mar 31, 2012 4:56 am
Location: Under your bed.

RE: Stackable buffs for your server

Postby Swagdin » Fri Sep 07, 2012 7:59 am

This is a sick idea/code. This makes me wanna use Eoserv. xD, but cant not much of a coder. I rather just stick with my homies.
Last edited by Swagdin on Fri Sep 07, 2012 8:00 am, edited 1 time in total.
Once a Swagdin fan, always a swaggy!

Here to help!
User avatar
Providence
God Like
God Like
Posts: 2314
Joined: Tue Dec 27, 2011 10:47 am
Location: Port orange, Florida

RE: Stackable buffs for your server

Postby Providence » Fri Sep 07, 2012 9:09 am

It fits best here as it is code for eoserv.
Retired Super Moderator,

1/10/2012 - 1/6/2013



--



Getting back into the swing of EOSource, here to help.

Return to “EOSERV”

Who is online

Users browsing this forum: No registered users and 2 guests