EOSERV Forum > EOSERV > pet stuff/attack/spells/stats
Topic is locked.
Page: << 1 2 3 4 5 6 >>
pet stuff/attack/spells/stats
Author Message
Post #55045 Re: heres my pet stuff/attack/spells/stats
insomniac posted: (4th Dec 2010 11:21 pm)

WOW dont tell me what i post doesnt work i always test what i post many times i have worked hard on this for over 2 months and tested every feature many times over! What is the pet doing?� What is the NPCID in your pub set to ? if you want to see it in action look here or maybe i missed somthing


A: The pet just stands there following me.

B: Aggressive.

C: Do you have Jimmyee's pet system in?


Nevermind, i recoded some things and it works now :D

---
Create your own destiny, don't let someone else do it for you.
14 years, 22 weeks ago
Post #55057 Re: heres my pet stuff/attack/spells/stats

sorry i got snappy in the last post and that my guide is sloppy,the original pet system was jimmies 

i still use the pet transfer feature but i think thats it!

If you do have jimmies pets you will want to redo the NPC::Act it will conflict with this pet system


if you dont have jimmies pet system then also add this in map.cpp in

bool Map::Walk(Character *from, Direction direction, bool admin)

find

from->Warp(warp->map, warp->x, warp->y);


and add this on top and bottom 

from->PetTransfer();


14 years, 22 weeks ago
Post #55070 Re: heres my pet stuff/attack/spells/stats

how to change the distance of pet to attack?

14 years, 22 weeks ago
Post #55084 Re: heres my pet stuff/attack/spells/stats

Not like ranged as in attacking more than 1 space away right? Cause i  think this is what your talking about

all the distances are in npc.cpp

under

NPC::Act

the different variables can be seen here

look for this part and adjust it to what you want

else if (npc->Data()->type == ENF::Aggressive && distance > 1 && distance < 5 && !attacker && npc->alive)     //?
            {


so if there is an aggressive npc between 2 and 4 distance the pet will

do this

int xdiff = this->x - npc->x;
    int ydiff = this->y - npc->y;
    int absxdiff = std::abs(xdiff);
    int absydiff = std::abs(ydiff);

if ((absxdiff == 1 && absydiff == 0) || (absxdiff == 0 && absydiff == 1) || (absxdiff == 0 && absydiff == 0))
     {
           //if(attacker != this->owner)
           //this->Attack(this->owner);
      return;
     }

        else if (absxdiff > absydiff)
        {
            if (xdiff < 0)
            {
                this->direction = DIRECTION_RIGHT;
            }
            else
            {
                this->direction = DIRECTION_LEFT;
            }
        }
        else
        {
            if (ydiff < 0)
            {
                this->direction = DIRECTION_DOWN;
            }
            else
            {
                this->direction = DIRECTION_UP;
            }
        }

        if (!this->Walk(this->direction))
        {
            this->Walk(static_cast<Direction>(util::rand(0,3)));
        }
     return;
        }

then if the distance is 1 it will do this

 if (( npc->Data()->type == ENF::Passive || npc->Data()->type == ENF::Aggressive) && distance < 2 && npc->alive)
            {
          if(distance < 2)
            {
        int xdiff = this->x - npc->x;
        int ydiff = this->y - npc->y;

        if (std::abs(xdiff) > std::abs(ydiff))
        {
            if (xdiff < 0)
            {
                this->direction = DIRECTION_RIGHT;
            }
            else
            {
                this->direction = DIRECTION_LEFT;
            }
        }
        else
        {
            if (ydiff < 0)
            {
                this->direction = DIRECTION_DOWN;
            }
            else
            {
                this->direction = DIRECTION_UP;
            }
        }

        PacketBuilder builder(PACKET_NPC, PACKET_PLAYER);
        builder.AddByte(255);
        builder.AddChar(this->index);
        builder.AddChar(1 + (character->hp == 0));
        builder.AddChar(this->direction);
        builder.AddShort(0);
        builder.AddThree(0);
        builder.AddThree(int(double(character->hp) / double(character->maxhp) * 100.0));
        builder.AddByte(255);
        builder.AddByte(255);

        UTIL_PTR_LIST_FOREACH(this->map->characters, Character, character)
        {
            if (*character == this->owner || !character->InRange(this))
            {
                continue;
            }

            character->player->client->SendBuilder(builder);
        }
        this->owner->player->client->SendBuilder(builder);
        }
          int amount = util::rand(this->Data()->mindam, this->Data()->maxdam + static_cast<int>(this->map->world->config["NPCAdjustMaxDam"]));
                        double rand = util::rand(0.0, 1.0);
                        // Checks if target is facing you
                        bool critical = std::abs(int(npc->direction) - this->owner->direction) != 2 ||rand<static_cast<double>(this->map->world->config["CriticalRate"]);

                        std::tr1::unordered_map<std::string, double> formula_vars;

                        this->owner->FormulaVars(formula_vars);
                        npc->FormulaVars(formula_vars, "target_");
                        formula_vars["modifier"] = this->map->world->config["MobRate"];
                        formula_vars["damage"] = amount;
                        formula_vars["critical"] = critical;

                        amount = rpn_eval(rpn_parse(this->map->world->formulas_config["damage"]), formula_vars);
                        double hit_rate = rpn_eval(rpn_parse(this->map->world->formulas_config["hit_rate"]), formula_vars);

                        if (rand > hit_rate)
                        {
                            amount = 0;
                        }

                        amount = std::max(amount, 0);

                        int limitamount = std::min(amount, int(npc->hp));

                        if (this->map->world->config["LimitDamage"])
                        {
                            amount = limitamount;
                        }

                        npc->Damage(this->owner, amount);

                        return;
                    }
        }

14 years, 21 weeks ago
Post #55122 Re: heres my pet stuff/attack/spells/stats

I have one error,

..\src\npc.hpp|262|error: 'LoadShopDrop' is not a member of 'NPC::_script_thistype'|
||=== Build finished: 1 errors, 0 warnings ===|

14 years, 21 weeks ago
Post #55123 Re: heres my pet stuff/attack/spells/stats

Hmmm, i downloaded your compiled rev, and the pet seems to be attacking me after it attacks a monster.?

14 years, 21 weeks ago
Post #55131 Re: heres my pet stuff/attack/spells/stats

Very epic dude no error and pet do attack passive and aggressive monster keep it up :]


 Pet do attack if you have compiled it properly.


@


in npc.hpp replace this

NPC(Map *map, short id, unsigned char x, unsigned char y, unsigned char spawn_type, short spawn_time, unsigned char index, bool temporary = false, bool pet = false, Character *owner = 0);


with


NPC(Map *map, short id, unsigned char x, unsigned char y, unsigned char spawn_type, short spawn_time, unsigned char index, bool temporary = false, bool pet = false, Character *owner = 0);        void LoadShopDrop();

14 years, 21 weeks ago
Post #55148 Re: heres my pet stuff/attack/spells/stats

all u need now is fishing and harvesting

14 years, 21 weeks ago
Post #55149 Re: heres my pet stuff/attack/spells/stats

I now want to rage you but I wont, fishing and harvesting are extremely easy to add....


Thats not what he is missing XD


EDIT:


I fixed my old error, but I "was" getting an error with this


int itemid, effectid;
for(int i = 0 ; i < static_cast<int>(this->world->effects_config["WAmount"]) ; i++){
itemid = static_cast<int>(this->world->effects_config[util::to_string(i+1) + ".ItemID"]);
effectid = static_cast<int>(this->world->effects_config[util::to_string(i+1) + ".EffectID"]);
    if(from->paperdoll[Character::Weapon] == itemid){
                npc->Effect(from, effectid, amount);
                    }
                }


said (Effect) wasn't declared

and also said

effects_config wasnt declared (I fixed that.)

14 years, 21 weeks ago
Post #55150 Re: heres my pet stuff/attack/spells/stats
perfect posted: (5th Dec 2010 04:52 pm)

Hmmm, i downloaded your compiled rev, and the pet seems to be attacking me after it attacks a monster.?

hmm it didnt attack me when i tested it but i looked around a little bit anyway and found this 

if(attacker != this->owner) // don't attack character if it's pet owner 

looks like i left it out check this out and add  in the npc.cpp NPC::ACt   so find this

and add in

if(attacker != this->owner) // don't attack character if it's pet owner


xfearlessix  you can remove those completely or add ananas wepon effect system doesnt matter either way

agent tubs ill post my harvs mining and wood cutting for you ok!

14 years, 21 weeks ago
Post #55151 Re: heres my pet stuff/attack/spells/stats

Yeah, I figured it was, I didn't want it to have anything to do with Pet spells,


And can pets cast spells? If so, Is there anyway for you to set their spells?


I'm just curious XD


EDIT:


I just got an error (Fixed it) I had declared PetOwner in npc.cpp twice,


but I also got an error with this


void NPC::Pet(NPC *npc)
{
this->pet = npc;

}

I removed it and I now have 0 errors.

14 years, 21 weeks ago
Post #55152 Re: heres my pet stuff/attack/spells/stats

I have the item spells that only can be used when a char has a pet  or this

i havnt tested this in a while but i think it works fine


14 years, 21 weeks ago
Post #55153 Re: heres my pet stuff/attack/spells/stats

I was curious, when you click a Pet does a thing pop saying (Fearless's pet -Bob pet)
then some info (What ever the server owner puts of course.

and do you happen to have #talk command for these pets?

14 years, 21 weeks ago
Post #55156 Re: heres my pet stuff/attack/spells/stats
xIFearlessIxx posted: (5th Dec 2010 08:42 pm)

I was curious, when you click a Pet does a thing pop saying (Fearless's pet -Bob pet)
then some info (What ever the server owner puts of course.

and do you happen to have #talk command for these pets?


no box pops up!! I have some more talk commands ill post! I posted some talk commands on the last page near the bottom of the tutorial!  edit/just the pet inventory command was posted
14 years, 21 weeks ago
Post #55157 Re: heres my pet stuff/attack/spells/stats

Okay, I'll take alook, Okay I was just wondering about the box thing, If I do get it i'll post it here.

14 years, 21 weeks ago
Page: << 1 2 3 4 5 6 >>
Topic is locked.
EOSERV Forum > EOSERV > pet stuff/attack/spells/stats