EOSERV Forum > EOSERV > Npc spells,poison
Topic is locked.
Page: << 1 >>
Npc spells,poison
Author Message
Post #60321 Npc spells,poison

This is cool stuff, a spell casting npc type!

Edit: Have added poisonous nps type

Edited 1/31/11 fixed the map.cpp poison, so server wont crash at the last hp, and removed the freeze in the spell casters it wasnt fair and gltchy Ill try and work on

a freeze type npc.

Edited 2/1/11 the last of the glitches are fixed if you added before the edit please replace the part in npc act and the void map poison both are updated!

In character.cpp under Character::Character(std::string name, World *world) find poisoned dont copy and paste add it to yours just like it is here

Database_Result res = this->world->db.Query("SELECT `name`, `title`, `home`, `fiance`, `partner`, `admin`, `hidden`, `invincible`, `poisoned`, `class`, `gender`, `race`, `hairstyle`, `haircolor`,"
    "`map`, `x`, `y`, `direction`, `level`, `exp`, `hp`, `tp`, `str`, `int`, `wis`, `agi`, `con`, `cha`, `statpoints`, `skillpoints`, "
    "`karma`, `sitting`, `bankmax`, `goldbank`, `usage`, `inventory`, `bank`, `paperdoll`, `spells`, `guild`, `guild_rank`, `quest`, `vars` FROM `characters` "
    "WHERE `name` = '$'", name.c_str());
    std::tr1::unordered_map<std::string, util::variant> row = res.front();

scroll down a little bit and find

this->hidden = GetRow<bool>(row, "hidden");
  add this here
 this->poisoned = GetRow<bool>(row, "poisoned");

now way down at the bottom in void Character::Save() find poisoned and this->poisoned and add them to yours just like it is here

#ifdef DEBUG
    Console::Dbg("Saving character '%s' (session lasted %i minutes)", this->name.c_str(), int(std::time(0) - this->login_time) / 60);
#endif // DEBUG
    this->world->db.Query("UPDATE `characters` SET `title` = '$', `home` = '$', `fiance` = '$', `partner` = '$', `admin` = #, `hidden` = #, `invincible` = #, `poisoned` = #, `class` = #, `gender` = #, `race` = #, "
        "`hairstyle` = #, `haircolor` = #, `map` = #, `x` = #, `y` = #, `direction` = #, `level` = #, `exp` = #, `hp` = #, `tp` = #, "
        "`str` = #, `int` = #, `wis` = #, `agi` = #, `con` = #, `cha` = #, `statpoints` = #, `skillpoints` = #, `karma` = #, `sitting` = #, "
        "`bankmax` = #, `goldbank` = #, `usage` = #, `inventory` = '$', `bank` = '$', `paperdoll` = '$', "
        "`spells` = '$', `guild` = '$', guild_rank = #, `quest` = '$', `vars` = '$' WHERE `name` = '$'",
        this->title.c_str(), this->home.c_str(), this->fiance.c_str(), this->partner.c_str(), this->admin, this->hidden, this->invincible, this->poisoned, this->clas, this->gender, this->race,
        this->hairstyle, this->haircolor, this->mapid, this->x, this->y, this->direction, this->level, this->exp, this->hp, this->tp,
        this->str, this->intl, this->wis, this->agi, this->con, this->cha, this->statpoints, this->skillpoints, this->karma, this->sitting,
        this->bankmax, this->goldbank, this->Usage(), ItemSerialize(this->inventory).c_str(), ItemSerialize(this->bank).c_str(),
        DollSerialize(this->paperdoll).c_str(), SpellSerialize(this->spells).c_str(), (this->guild ? this->guild->tag.c_str() : ""), this->guild_rank, QuestSerialize(this->quests).c_str(), "", this->name.c_str());

In eodata.cpp under void ENF::Read(std::string filename)find

 newdata->hp = PacketProcessor::Number(buf[11], buf[12], buf[13]);

add here
newdata->spells = PacketProcessor::Number(buf[14], buf[15]);   

now go to map.cpp and add this in anywhere

here  if you dont have invincibility use this 1


also make sure to add/replace this part in to your map attack and attack spell

if ((npc->Data()->type == ENF::Unknown3 || npc->Data()->type == ENF::Unknown4 || npc->Data()->type == ENF::Passive || npc->Data()->type == ENF::Aggressive || from->admin > static_cast<int>(this->world->admin_config["killnpcs"]))
                 && npc->alive && npc->x == target_x && npc->y == target_y)
                {


In npc.cpp under void NPC::Spawn(NPC *parent) find

this->hp = this->Data()->hp;

add here

this->spells = this->Data()->spells;  //?test

now scroll down to void NPC::Act() find

Character *attacker = 0;

add this here

if you dont have invincibility dont use the one above use this one

now go down to world.cpp and add this in under voidworld_timed_save(void *world_void)
void world_poisoned(void *world_void)
{
  World *world = static_cast<World *>(world_void);

 UTIL_PTR_VECTOR_FOREACH(world->maps, Map, map)
   {
map->Poisoned();
   }
}

scroll down a little bit and add in this timer with the others

event = new TimeEvent(world_poisoned, this, 5.00, Timer::FOREVER);
    this->timer.Register(event);
    event->Release();
in character.hpp find
bool hidden;
     and add here
 bool poisoned;

now go to eodata.hpp under struct ENF_Data : public Shared find

 short type_index;

add here

unsigned short spells; //?

scroll down a little bit you will see this dont copy and paste just add spells(0),were it is to yours!

ENF_Data() : id(0), graphic(0), boss(0), child(0), type(ENF::NPC), spells(0), hp(0), exp(0), mindam(0), maxdam(0), accuracy(0), evade(0), armor(0), weakness1(0) { }

scroll a little bit more find

SCRIPT_REGISTER_VARIABLE("uint16", type_index);

add here

SCRIPT_REGISTER_VARIABLE("uint16", spells);    //?

now go to map.hpp and find

void Effect(int effect, int param);
and add
void Poisoned();

now go to npc.hpp and find

 bool attack;

add

unsigned short spells; //?test


now got to Item.cpp and find replace your case EIF::CureCurse: with this one

here

should be set to compile

Now in your pub select the npc you want to have spells and set their npc type to unknown 5 and then set the unkA: to the spell id you want them to cast >.< To use the poisonous npcs set their npc type to the one right after inn, Hope you like it and also if anyone canhelpdebuganyglitches they find or help make this better, or condense this code,Thanks.I will update later with a poisonous npc type!

In your database create a row named poisoned, type tinyint, length/set 1, default 0

13 years, 16 weeks ago
Post #60322 Re: Npc spells,freeze

I don't really mess with eoserv much anymore but this is something I always wanted to see on main/test server for a very long time.  Just wanted to say good job if this actually works.  Might download a rev just to play around with it for a bit.  Did you test it out yourself before releasing? 

13 years, 16 weeks ago
Post #60323 Re: Npc spells,freeze

Yes its tested,and works ,still searching for glitches none yet!

Edit: A minor glitch found multiple spell casting npcs can mess with the walk packets!

not bad though just unfreezes you sooner than it should!

 



13 years, 16 weeks ago
Post #60329 Re: Npc spells,freeze

server crashes when you are on your last hp when getting poison with out the npc attacking you

Great Work to come's in handy


EDIT: one more thing when you die you are still getting poison :P just forgot about it :D

lags the client when taking life away using poison i'll see what i can do to help.

13 years, 16 weeks ago
Post #60347 Re: Npc spells,freeze
maori posted: (31st Jan 2011 04:58 am)

server crashes when you are on your last hp when getting poison with out the npc attacking you

Great Work to come's in handy


EDIT: one more thing when you die you are still getting poison :P just forgot about it :D

lags the client when taking life away using poison i'll see what i can do to help.

   Ill try and fix the poison npc damage thanks for the feedback!

Edit: I fixed the crashing on last hp replace the map.cpp part, and if you die while poisoned you will no longer be poisoned!

I also removed the freeze on the spell casting npcs it didnt seem fair and was pretty glitchy replace the part in the npc::Act!

seems to be working 100% now.

13 years, 16 weeks ago
Post #60637 Re: Npc spells,poison

One glitch i found was that even after the npc dies, and even after you reboot it, the map still has "poison"

---
Create your own destiny, don't let someone else do it for you.
13 years, 15 weeks ago
Post #60707 Re: Npc spells,poison
AustinB posted: (2nd Feb 2011 02:54 pm)

One glitch i found was that even after the npc dies, and even after you reboot it, the map still has "poison"


  I made to where you are poisoned entell you die or use a cure potion. is that what your talking about austin?
13 years, 15 weeks ago
Post #63435 Re: Npc spells,poison

I'm a bit confused about this part

I've been working with the database (as I use sqlite)

"

In your database create a row named poisoned, type tinyint, length/set 1, default 0"

 

13 years, 12 weeks ago
Post #63455 Re: Npc spells,poison
xIFearlessIxx posted: (27th Feb 2011 01:29 am)

I'm a bit confused about this part

I've been working with the database (as I use sqlite)

"

In your database create a row named poisoned, type tinyint, length/set 1, default 0"

 


try this    `poisoned`    tinyint(1)  DEFAULT 0,
13 years, 12 weeks ago
Post #63562 Re: Npc spells,poison

Ive found a glitch, so ill be updateing this in the next couple days when someone dies on a poison map "sometimes" all characters warp to their home. Hopefully an easy fix.

If youve added this and found any glitches please post so i can debug.

13 years, 12 weeks ago
Post #64158 Re: Npc spells,poison

So far I've found Two glitches..


#1. I don't belive your health even lowers when you get poisoned

#2. I'm pretty sure my level was just raised by like 100(something like that) it's happened to tow of us as of now.


Maybe I haven't added something maybe you can find out for me.

I'll post my map.cpp click "map.cpp" or here XD

If you find any errors... Can you post em and re-most my map.cpp (I have a feeling I messed something up. NOTE: I never got any errors.. Thats why I'm guessing it's a bug, I've also looked it over myself but I'm not use to others work in my source.


Thanks.

13 years, 11 weeks ago
Post #118591 Re: Npc spells,poison

Check out this topic for an updated paralized system! https://eoserv.net/forum/topic/16978

Edit: Im also going to add an updated version of the npc spell casters and poison for use/test/review!

Known glitches = lag, if to many spell casters are are active, "random hp/tp glitches ,Im not even sure if its from this system" but yeah, I think its from the effect packet it self?

12 years, 23 weeks ago
Page: << 1 >>
Topic is locked.
EOSERV Forum > EOSERV > Npc spells,poison