EOSERV Forum > EOSERV > Is an NPC Effect possible?
Page: << 1 >>
Is an NPC Effect possible?
Author Message
Post #203031 Is an NPC Effect possible?

I'd like to have a constant effect on an NPC, like how in Diablo 3, the Elite monsters have specific effects. Having a timed/constant effect is trivial, so that's not the problem. I can't find a solid solution to show an effect on an NPC.

For a character, you can have a direct character effect, or you can do a tile effect.

For an npc, I see that you can do a spell effect directly on the npc, or you can also do a tile effect.

What I would like is an effect that behaves exactly like a character effect.

If I use a spell effect, the drawback is that it will show the HP bar and the damage on the NPC. Ontop of that, I am forced to create a spell in the pub file to do a specific effect.

Code:

void NPC::SpellEffect(int spellID)
{
    PacketBuilder builder(PACKET_CAST, PACKET_REPLY, 14);
    builder.AddShort(spellID);
    builder.AddShort(0);
    builder.AddChar(0);
    builder.AddShort(this->index);
    builder.AddThree(0);
    builder.AddShort(util::clamp<int>(double(this->hp) / double(this->ENF().hp) * 100.00100));
    builder.AddShort(0);

    UTIL_FOREACH(this->map->characters, character)
    {
        if (character->InRange(this))
        {
            character->Send(builder);
        }
    }
}

Result:


If I use a tile effect, there are other drawbacks:

- The effect behaves differently for some effects

- Some effects don't show, I assume because they are shown under the tile (like effect #6).

- Since they are tile based, they don't move with the NPC.


Code:

void NPC::TileEffect(int effect)
{
    PacketBuilder builder(PACKET_EFFECT, PACKET_AGREE);
    builder.AddChar(this->x);
    builder.AddChar(this->y);
    builder.AddShort(effect);

    UTIL_FOREACH(this->map->characters, character)
    {
        if (character->InRange(this))
        {
            character->Send(builder);
        }
    }
}

Results:



Any clue what workaround I can do on server side or client side to achieve a more acceptable effect? If not, I will just use a tile effect.

---
Just your friendly neighborhood Programmer-Man!
7 years, 6 weeks ago
Post #203032 Re: Is an NPC Effect possible?

Have you tried removing the lines with the npc health? I don't know how thatll work but its worth a shot.

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

Programmer, Web Developer, and Graphics Designer
7 years, 6 weeks ago
Post #203033 Re: Is an NPC Effect possible?
Wildsurvival posted: (22nd Mar 2017, 11:23 pm)

Have you tried removing the lines with the npc health? I don't know how thatll work but its worth a shot.


Good question. I did try that. If I set the value to 0, it will still show the HP bar and have the HP at 0%.
---
Just your friendly neighborhood Programmer-Man!
7 years, 6 weeks ago
Post #203034 Re: Is an NPC Effect possible?
Shilo posted: (23rd Mar 2017, 12:46 am)

Wildsurvival posted: (22nd Mar 2017, 11:23 pm)

Have you tried removing the lines with the npc health? I don't know how thatll work but its worth a shot.


Good question. I did try that. If I set the value to 0, it will still show the HP bar and have the HP at 0%.

Try removing that from the packet in general and the rest after that
---
Andrewbob - I would be on the fucking copter of rofls

Programmer, Web Developer, and Graphics Designer
7 years, 6 weeks ago
Post #203035 Re: Is an NPC Effect possible?

I would also love to be able to do this as well, but I don't know if it's possible. 

My current NPC passive effects use tile effect packets due to the same issue you've run into. Sadly it means that it looks quite odd on moving NPCs, and so I don't use it for them.

---
Want to learn to pixel?
Pixelsource.org
7 years, 6 weeks ago
Post #203037 Re: Is an NPC Effect possible?

I would strongly advise against using the "tile effect" packet, especially so frequently. The client leaks memory every time it play an effect using this packet. (This is why your client would often be taking up 100's of MB of RAM after the Halloween event) It also has other drawbacks like the client-side lag that is created by trying to play multiple sounds, although that isn't such a problem on modern computer as it was years ago.

7 year old reference =P

---
http://sordie.co.uk
http://twitter.com/@SordieEO
7 years, 5 weeks ago
Post #203038 Re: Is an NPC Effect possible?
Sordie posted: (23rd Mar 2017, 04:03 pm)

I would strongly advise against using the "tile effect" packet, especially so frequently. The client leaks memory every time it play an effect using this packet. (This is why your client would often be taking up 100's of MB of RAM after the Halloween event) It also has other drawbacks like the client-side lag that is created by trying to play multiple sounds, although that isn't such a problem on modern computer as it was years ago.

7 year old reference =P


Great info!

I am a bit confused. You mentioned that "tile effect" leaks. But in the post you linked, it seems you are saying that the character effect leaks and you suggest to use a "tile effect" instead. Am I misunderstanding? Do both of them leak?

Great post too, I have be interested in a weather system, and I didn't think about using tile effects to create a weather system!

---
Just your friendly neighborhood Programmer-Man!
7 years, 5 weeks ago
Page: << 1 >>

EOSERV Forum > EOSERV > Is an NPC Effect possible?