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 #55160 Re: heres my pet stuff/attack/spells/stats

Im curious about those command(s) that you had in your inventory while you we're running the video.  Using those skull heads.  Can you post like 1 of them for a basic idea on how u made it?

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

I don't think this has anything to do with the pets, but oddly Pets/NPCs/ Myself can't inflect any damage on on an other I have no idea why, I added stats etc Pubs..

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

I don't think this has anything to do with the pets, but oddly Pets/NPCs/ Myself can't inflect any damage on on an other I have no idea why, I added stats etc Pubs..


will you post your void Map::Attack(Character *from, Direction direction)
so i can look

perfect ill post #abomb for you! the skulls are an item gfx those are the spells in item.cpp
14 years, 21 weeks ago
Post #55169 Re: heres my pet stuff/attack/spells/stats

void Map::Attack(Character *from, Direction direction)
{
    PacketBuilder builder;

    from->direction = direction;

    if (from->arena)
    {
    from->arena->Attack(from, direction);

    }

    if (this->pk || (this->world->config["GlobalPK"] && !this->world->PKExcept(this->id)))
    {
        if (this->AttackPK(from, direction))
        {
            return;
        }
    }

    builder.SetID(PACKET_ATTACK, PACKET_PLAYER);
    builder.AddShort(from->player->id);
    builder.AddChar(direction);

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

        character->player->client->SendBuilder(builder);
    }

    int target_x = from->x;
    int target_y = from->y;

    int range = 1;

    if (this->world->eif->Get(from->paperdoll[Character::Weapon])->subtype == EIF::Ranged)
    {
        range = static_cast<int>(this->world->config["RangedDistance"]);
    }

    for (int i = 0; i < range; ++i)
    {
        switch (from->direction)
        {
            case DIRECTION_UP:
                target_y -= 1;
                break;

            case DIRECTION_RIGHT:
                target_x += 1;
                break;

            case DIRECTION_DOWN:
                target_y += 1;
                break;

            case DIRECTION_LEFT:
                target_x -= 1;
                break;
        }

        if (!this->Walkable(target_x, target_y, true))
  {
   break;
  }

        UTIL_PTR_LIST_FOREACH(this->characters, Character, character)
        {
            UTIL_PTR_VECTOR_FOREACH(this->npcs, NPC, npc)
            {
                if ((npc->pet || npc->Data()->type == ENF::Pet || 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)
                {
                    if(from->clas == 9)
                    {

                        int amount = util::rand(from->mindam + 0, from->maxdam + 0);
                        double rand = util::rand(0.0, 1.0);
                        // Checks if target is facing you
                        bool critical = std::abs(int(npc->direction) - from->direction) != 2 || rand < static_cast<double>(this->world->config["CriticalRate"]);

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

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

                        amount = rpn_eval(rpn_parse(this->world->formulas_config["damage"]), formula_vars);
                        double hit_rate = rpn_eval(rpn_parse(this->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->world->config["LimitDamage"])
                        {
                            amount = limitamount;
                        }


                        npc->Damage(from, amount);
                    }
                    else if(from->clas != 9)
                    {
                        int amount = util::rand(from->mindam, from->maxdam);
                        double rand = util::rand(0.0, 1.0);
                        // Checks if target is facing you
                        bool critical = std::abs(int(npc->direction) - from->direction) != 2 || rand < static_cast<double>(this->world->config["CriticalRate"]);

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

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

                        amount = rpn_eval(rpn_parse(this->world->formulas_config["damage"]), formula_vars);
                        double hit_rate = rpn_eval(rpn_parse(this->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->world->config["LimitDamage"])
                        {
                            amount = limitamount;
                        }



                        npc->Damage(from, amount);

                        return;
                    }
                }
            }
        }
    }
}

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

I don't think this has anything to do with the pets, but oddly Pets/NPCs/ Myself can't inflect any damage on on an other I have no idea why, I added stats etc Pubs..


your attack looks fine!

did the thing with the damage happen after adding in this pet system?
if so post all the parts you added to and ill check um out

perfect heres the #Abomb command as seen in the vid put with admin commands you wouldnt want players to get a hold of this

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

Not that I know of, I will look and see tho, and make sure nothing has occured.

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

What are the commands and what item spawns the pet?

---
stay tuned.
14 years, 21 weeks ago
Post #55236 Re: heres my pet stuff/attack/spells/stats
andrewbob1 posted: (6th Dec 2010 05:22 pm)

What are the commands and what item spawns the pet?

potions spawn pets and if you used jimmees pets its the same #sp name #dp name, I posted #Abomb which is an attack spell for pets!!    here is a pet heal  and follow command
EX:
                if(id == 9)
{
 
this->player->character->Save(); //this may be unnessasary
this->player->character->AddItem(id, 1);//adds back the item after it's use
this->player->character->Save();
 
 
if(!this->player->character->has_pet)
{
 
unsigned char index = this->player->character->map->GenerateNPCIndex();
if (index > 250)
 
{
 
break;
 
}
 
  this->player->character->pet = new NPC(this->player->character->map, 345, this->player->character->x + 1,this->player->character->y, 1, 1, index,true,true);
this->player->character->pet->Spawn();
this->player->character->pet->SetOwner(this->player->character);
this->player->character->has_pet = true;
//this->player->character->AddItem(682, 1);
this->player->character->map->npcs.push_back(this->player->character->pet);
this->player->character->str += 500;
this->player->character->con += 500;
                 this->player->character->CalculateStats();
 
                this->player->character->StatSkill();
this->player->character->Save();
 
}
 
else if(this->player->character->has_pet == true)
{
UTIL_PTR_LIST_FOREACH(this->player->character->map->characters, Character, character)
{
if (this->player->character->InRange(*character))
{
this->player->character->pet->RemoveFromView(*character);
}
}
erase_first(this->player->character->map->npcs, this->player->character->pet);
this->player->character->pet->Release();
this->player->character->has_pet = false;
this->player->character->con -= 500;
this->player->character->str -= 500;
                this->player->character->CalculateStats();
                this->player->character->StatSkill();
}
}
14 years, 21 weeks ago
Post #55237 Re: heres my pet stuff/attack/spells/stats
insomniac posted: (6th Dec 2010 05:30 pm)

andrewbob1 posted: (6th Dec 2010 05:22 pm)

What are the commands and what item spawns the pet?


EX
                if(id == 9)
{
 
this->player->character->Save(); //this may be unnessasary
this->player->character->AddItem(id, 1);//adds back the item after it's use
this->player->character->Save();
 
 
if(!this->player->character->has_pet)
{
 
unsigned char index = this->player->character->map->GenerateNPCIndex();
if (index > 250)
 
{
 
break;
 
}
 
  this->player->character->pet = new NPC(this->player->character->map, 345, this->player->character->x + 1,this->player->character->y, 1, 1, index,true,true);
this->player->character->pet->Spawn();
this->player->character->pet->SetOwner(this->player->character);
this->player->character->has_pet = true;
//this->player->character->AddItem(682, 1);
this->player->character->map->npcs.push_back(this->player->character->pet);
this->player->character->str += 500;
this->player->character->con += 500;
                 this->player->character->CalculateStats();
 
                this->player->character->StatSkill();
this->player->character->Save();
 
}
 
else if(this->player->character->has_pet == true)
{
UTIL_PTR_LIST_FOREACH(this->player->character->map->characters, Character, character)
{
if (this->player->character->InRange(*character))
{
this->player->character->pet->RemoveFromView(*character);
}
}
erase_first(this->player->character->map->npcs, this->player->character->pet);
this->player->character->pet->Release();
this->player->character->has_pet = false;
this->player->character->con -= 500;
this->player->character->str -= 500;
                this->player->character->CalculateStats();
                this->player->character->StatSkill();
}
}

what file is that in (sorry i do NOT code XDDDD)
+ how do i set which npc it is
---
stay tuned.
14 years, 21 weeks ago
Post #55240 Re: heres my pet stuff/attack/spells/stats

this would go in Item.cpp


ok so

        if(id == 376)  //this is the item id
{

this->player->character->Save(); //this may be unnessasary
this->player->character->AddItem(id, 1);//adds back the item after it's use
this->player->character->Save();


if(!this->player->character->has_pet)
{

unsigned char index = this->player->character->map->GenerateNPCIndex();
if (index > 250)

{

break;

}

  this->player->character->pet = new NPC(this->player->character->map, 346,  this->player->character->x + 1,this->player->character->y, 1, 1, index, true, true);// see the 346 that is the npc that will spawn
this->player->character->pet->Spawn();
this->player->character->pet->SetOwner(this->player->character);
this->player->character->has_pet = true;
//this->player->character->AddItem(682, 1);
this->player->character->map->npcs.push_back(this->player->character->pet);
this->player->character->con += 300;
                this->player->character->CalculateStats();
                this->player->character->StatSkill();

this->player->character->Save();

}

else if(this->player->character->has_pet == true)
{
UTIL_PTR_LIST_FOREACH(this->player->character->map->characters, Character, character)
{
if (this->player->character->InRange(*character))
{
this->player->character->pet->RemoveFromView(*character);
}
}
erase_first(this->player->character->map->npcs, this->player->character->pet);
this->player->character->pet->Release();
this->player->character->has_pet = false;
this->player->character->con -= 300;
                this->player->character->CalculateStats();
                this->player->character->StatSkill();
}
}


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

You're better off using Klutz "Extended Items"
https://eoserv.net/forum/topic/10747

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

I agree its easier to understand and more organized than this mess although it doesnt have the added stats bonus for spawned pets ill try and see if i can mess with it and add um in!

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

Yeah, If you don't I might take alook.

14 years, 21 weeks ago
Post #55246 Re: heres my pet stuff/attack/spells/stats
insomniac posted: (6th Dec 2010 06:10 pm)

I agree its easier to understand and more organized than this mess although it doesnt have the added stats bonus for spawned pets ill try and see if i can mess with it and add um in!


hey how can i change which pet it spawns?

EDIT: OOPS didnt see your post haha sorry
#SP dosnt work and im using ur rev
---
stay tuned.
14 years, 21 weeks ago
Post #55247 Re: heres my pet stuff/attack/spells/stats

Maybe he didn't add it, and use $sp bob npcid

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