EQEmulator Forums

EQEmulator Forums (https://www.eqemulator.org/forums/index.php)
-   General::Server Discussion (https://www.eqemulator.org/forums/forumdisplay.php?f=601)
-   -   So you're server doesn't have fear (https://www.eqemulator.org/forums/showthread.php?t=25137)

Cvinion 04-29-2008 05:58 PM

So you're server doesn't have fear
 
So as it stands now Fear is the most overpowered spell in terms of EQEMU, and from my experience I have had multiple servers remove fear from the game, I was wondering what does the community think is a good fix for this fear problem that stands as a daunting task for the necromancer community.

Also I'de love to hear what other servers have done to fix, re-mold, or change the necromancer and his fear ability to better round off the class, I know some servers have some pretty amazing things working and im trying to brainstorm ideas.

So thank you in advance, to the community who is always there to help.

ChaosSlayer 04-29-2008 06:26 PM

from what I know there is no fixing to fear unless world wide (all zones) fear nodes pathing is implemented, which is at beast very tideious work.
or some algoritm is writen which would cuase to mobs to intelegently "run way" wihotu goign throw walls

as far as necros go - on my server necro is redesigned in such way that it is not a class who makes its power stand on fear kiting :cool:

Cvinion 04-29-2008 07:05 PM

Thanks, would you mind extrapolating a little on that so i can get some ideas?

Wiz 04-29-2008 08:00 PM

On Shards of Dalaya we have fear code that only uses the base map files and will work in any zone with one. It would require a good deal of adaptation to work on non-SoD EQEmu but I'm willing to share it if you like.

jenco420 04-29-2008 08:09 PM

dude that woulld be awsome as hell ~.~

Wiz 04-29-2008 08:32 PM

Here are all the vital snippets. Like I said though, it'll take a good bit of adaption, but this contains everything you need to get fear working. With it a feared creature will flee in a random direction, avoiding walls, cliffs and pits.

Code:

void Mob::CalculateNewFearpoint()
{
        int loop = 0;
        float ranx, rany, ranz;
        curfp = false;
        while (loop < 100) //Max 100 tries
        {
                int ran = 250 - (loop*2);
                loop++;
                ranx = GetX()+rand()%ran-rand()%ran;
                rany = GetY()+rand()%ran-rand()%ran;
                ranz = FindGroundZ(ranx,rany);
                if (ranz == -999999)
                        continue;
                float fdist = ranz - GetZ();
                if (fdist >= -12 && fdist <= 12 && CheckCoordLosNoZLeaps(GetX(),GetY(),GetZ(),ranx,rany,ranz))
                {
                        curfp = true;
                        break;
                }
        }
        if (curfp)
        {
                fear_walkto_x = ranx;
                fear_walkto_y = rany;
                fear_walkto_z = ranz;
        }
        else //Break fear
        {
                BuffFadeByEffect(SE_Fear);
        }
}

Code:

float Mob::FindGroundZ(float new_x, float new_y, float z_offset)
{
        float ret = -999999;
        if (zone->map != 0)
        {
                NodeRef pnode = zone->map->SeekNode( zone->map->GetRoot(), new_x, new_y );
                if (pnode != NODE_NONE)
                {
                        VERTEX me;
                        me.x = new_x;
                        me.y = new_y;
                        me.z = z_pos+z_offset;
                        VERTEX hit;
                        FACE *onhit;
                        float best_z = zone->map->FindBestZ(pnode, me, &hit, &onhit);
                        if (best_z != -999999)
                        {
                                ret = best_z;
                        }
                }
        }
        return ret;
}

Code:

bool Entity::CheckCoordLosNoZLeaps(float cur_x, float cur_y, float cur_z, float trg_x, float trg_y, float trg_z, float perwalk)
{
        if(zone->map == NULL) {
                return(true);
        }
        VERTEX myloc;
        VERTEX oloc;
        VERTEX hit;

        myloc.x = cur_x;
        myloc.y = cur_y;
        myloc.z = cur_z+5;

        oloc.x = trg_x;
        oloc.y = trg_y;
        oloc.z = trg_z+5;

        if (myloc.x == oloc.x && myloc.y == oloc.y && myloc.z == oloc.z)
                return true;

        FACE *onhit;

        if (!zone->map->LineIntersectsZoneNoZLeaps(myloc,oloc,perwalk,&hit,&onhit))
                return true;
        return false;
}

Code:

bool Map::LineIntersectsZoneNoZLeaps(VERTEX start, VERTEX end, float step_mag, VERTEX *result, FACE **on) {
        float z = -999999;
        VERTEX step;
        VERTEX cur;
        cur.x = start.x;
        cur.y = start.y;
        cur.z = start.z;
       
        step.x = end.x - start.x;
        step.y = end.y - start.y;
        step.z = end.z - start.z;
        float factor = step_mag / sqrt(step.x*step.x + step.y*step.y + step.z*step.z);

        step.x *= factor;
        step.y *= factor;
        step.z *= factor;

        int steps = 0;

        if (step.x > 0 && step.x < 0.001f)
                step.x = 0.001f;
        if (step.y > 0 && step.y < 0.001f)
                step.y = 0.001f;
        if (step.z > 0 && step.z < 0.001f)
                step.z = 0.001f;
        if (step.x < 0 && step.x > -0.001f)
                step.x = -0.001f;
        if (step.y < 0 && step.y > -0.001f)
                step.y = -0.001f;
        if (step.z < 0 && step.z > -0.001f)
                step.z = -0.001f;
       
        NodeRef cnode, lnode;
        lnode = NULL;
        int i = 0;
        //while we are not past end
        //always do this once, even if start == end.
        while(cur.x != end.x || cur.y != end.y || cur.z != end.z)
        {
                steps++;
                cnode = SeekNode(GetRoot(), cur.x, cur.y);
                if (cnode == NODE_NONE)
                {
                        return(true);
                }               
                VERTEX me;
                me.x = cur.x;
                me.y = cur.y;
                me.z = cur.z;
                VERTEX hit;
                FACE *onhit;
                float best_z = zone->map->FindBestZ(cnode, me, &hit, &onhit);
                float diff = best_z-z;
                diff *= sign(diff);
                if (z == -999999 || best_z == -999999 || diff < 12.0)
                        z = best_z;
                else
                        return(true);
                //look at current location
                if(cnode != NODE_NONE && cnode != lnode) {
                        if(LineIntersectsNode(cnode, start, end, result, on))
                        {
                                return(true);
                        }
                        lnode = cnode;
                }
               
                //move 1 step
                if (cur.x != end.x)
                        cur.x += step.x;
                if (cur.y != end.y)
                        cur.y += step.y;
                if (cur.z != end.z)
                        cur.z += step.z;
               
                //watch for end conditions
                if ( (cur.x > end.x && end.x >= start.x) || (cur.x < end.x && end.x <= start.x) || (step.x == 0) ) {
                        cur.x = end.x;
                }
                if ( (cur.y > end.y && end.y >= start.y) || (cur.y < end.y && end.y <= start.y) || (step.y == 0) ) {
                        cur.y = end.y;
                }
                if ( (cur.z > end.z && end.z >= start.z) || (cur.z < end.z && end.z < start.z) || (step.z == 0) ) {
                        cur.z = end.z;
                }
        }
       
        //walked entire line and didnt run into anything...
        return(false);
}


krusher 04-29-2008 10:08 PM

Wiz !!!!
 
Long time no see man... How ya been?

Hope your well.

Krusher

TheLieka 04-29-2008 10:25 PM

Thanks for the code Wiz. I can't wait to play with it. If I can get it "adapted", I'll post it up for everyone.

Thanks again!

Dax

GeorgeS 04-30-2008 07:33 AM

Please have a look at the code - and see if it can be adapated to current, then this would be a great addition to base code.

Thanks Wiz

GeorgeS

moydock 04-30-2008 06:39 PM

Yeah this would be incredible! Good luck on the adaption.

Derision 05-24-2008 08:09 AM

I don't know if anyone has already integrated Wiz's fear code, however I spent a few hours last night
and this morning on it.

Patch against 1108: http://www.rama.demon.co.uk/wizfear.patch

Full 1108 source with Wiz's fear code: http://www.rama.demon.co.uk/EQEmu-0....WizFear.tar.gz

I only did limited testing on it, so use at your own risk :)

Any bugs are my fault. Kudos to Wiz for releasing his source.

jenco420 05-24-2008 10:29 AM

This works great acually =). Testing it out now on my server. Thanks man.

jenco420 05-24-2008 11:25 AM

the only thing i'm having trouble with atm, is players acually getting feared. I'm looking into that now.

Derision 05-24-2008 01:49 PM

Quote:

Originally Posted by jenco420 (Post 149227)
the only thing i'm having trouble with atm, is players acually getting feared. I'm looking into that now.

I never tested PVP fear, but I've looked at the code a bit more. There is some
code to disallow client-to-client fear, however with that commented out, you get
a message saying your are feared, but you actually aren't.

I'm speculating that that the server needs to send an OP_Fear packet to the
client to tell it it's feared, however I don't see such an opcode anywhere in
the source or .conf files.

Maybe if someone had a packet trace of a player being feared from back when the 6.2 client or Titanium where the live clients, that may help, or maybe it is not an opcode issue at all.

xxarthurxx 05-24-2008 04:07 PM

Wiz, i would just like to thank you for your generosity, really very kind :D


All times are GMT -4. The time now is 12:24 PM.

Powered by vBulletin®, Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.