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)

jenco420 05-24-2008 05:04 PM

well fear is up and running on CKV_EQ if anyone wants to look at it.. The client side (i.e i get feared by naggy but nothing happens)is still not working but i'm sure one of us will figure it out eventually >.<

Maybe i'll just add back in the stun portion for PC fear /shrug

Wiz 05-28-2008 06:15 PM

Quote:

Originally Posted by Derision (Post 149232)
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.

SOD has player fear, the packet is an apperancepacket that toggles "player loses control" on, but this is for an old client version, so I don't know if its applicable.

Code:

        void        LoseControl(bool interrupt_spells) { if (interrupt_spells) { InterruptSpell(); StopSong(); } Message_StringID(0,1461); SendAppearancePacket(14, 102); }
        void        RegainControl(bool interrupt_spells) { if (interrupt_spells) { InterruptSpell(); StopSong(); } SendAppearancePacket(14, 100); }

We've disabled the actual fear movement for the moment because its a lot more troublesome to keep players from going through walls than it is to do npcs, but if anyone wants to toy with it, it basically uses the same code with this movement function:

Code:

bool Client::FearMovement(float x, float y, float z)
{
        if (IsRooted() || Casting())
        {
        SetRunAnimSpeed(0);
        return true;
        }
        float nx = this->x_pos;
    float ny = this->y_pos;
    float nz = this->z_pos;
    float vx, vy, vz;
    float vb;
        float speed = 0.35f;
        float speed_mod = ((float)(speed*spellbonuses->movementspeed))/100.0f;
        speed += speed_mod;

        if (x_pos == x && y_pos == y)
        {
        SetRunAnimSpeed(0);
        return false;
        }

        bool ret = true;

        SetHeading(CalculateHeadingToTarget(x, y) * 8);

    // --------------------------------------------------------------------------
    // 1: get Vector AB (Vab = B-A)
    // --------------------------------------------------------------------------
    vx = x - nx;
    vy = y - ny;
    vz = z - nz;

        speed *= 30; //First we recalc into clientside units. 1.2 = 36, etc.
    SetRunAnimSpeed(speed);

        //Now we recalc it into units per second moved.
        speed *= 0.76;

        //Divide by ten to account for movement happening every 0.1
        speed /= 10;

    // --------------------------------------------------------------------------
    // 2: get unit vector
    // --------------------------------------------------------------------------
    vb = speed / sqrt (vx*vx + vy*vy);

    if (vb >= 0.5) //Stop before we've reached the point in case it's too close to a wall
    {
                /*
                x_pos = x;
        y_pos = y;
                if (zone->map == 0)
                {
                        z_pos = z;
                }
                else
                {
                        NodeRef pnode = zone->map->SeekNode( zone->map->GetRoot(), x_pos, y_pos );
                        if (pnode == NODE_NONE)
                        {
                                z_pos = z;
                        }
                        else
                        {
                                VERTEX me;
                                me.x = x_pos;
                                me.y = y_pos;
                                me.z = z + GetHeight();
                                VERTEX hit;
                                FACE *onhit;
                                float best_z = zone->map->FindBestZ(pnode, me, &hit, &onhit);
                                if (best_z != -999999 && fdiff(best_z,GetZ())<=12.0)
                                {
                                        z_pos = best_z + 1;
                                }
                                else
                                {
                                        z_pos = z;
                                }
                        }
                }
                */
                fear_walkto_x = x_pos;
                fear_walkto_y = y_pos;
                fear_walkto_z = z_pos;
                ret = false;
    }
    else
    {
        // --------------------------------------------------------------------------
        // 3: destination = start plus movementvector (unitvektor*speed)
        // --------------------------------------------------------------------------
        x_pos = x_pos + vx*vb;
        y_pos = y_pos + vy*vb;
                if (zone->map == 0)
                {
                        z_pos = z_pos + vz*vb;
                }
                else
                {
                        NodeRef pnode = zone->map->SeekNode( zone->map->GetRoot(), x_pos, y_pos );
                        if (pnode == NODE_NONE)
                        {
                                z_pos = z_pos + vz*vb;
                        }
                        else
                        {
                                VERTEX me;
                                me.x = x_pos;
                                me.y = y_pos;
                                me.z = z_pos + vz*vb + GetHeight();
                                VERTEX hit;
                                FACE *onhit;
                                float best_z = zone->map->FindBestZ(pnode, me, &hit, &onhit);
                                if (best_z != -999999 && fdiff(best_z,GetZ())<=12.0)
                                {
                                        z_pos = best_z + 1;
                                }
                                else
                                {
                                        z_pos = z_pos + vz*vb;
                                }
                        }
                }
    }
        APPLAYER* app = new APPLAYER(OP_MobUpdate, sizeof(SpawnPositionUpdate_Struct));
        SpawnPositionUpdate_Struct* spu = (SpawnPositionUpdate_Struct*)app->pBuffer;
        MakeSpawnUpdate(spu);
        app->priority = 6;
        entity_list.QueueClients(this,app);
        safe_delete(app);
        return ret;
}

No guarantees on whether any of those packets will work with newer versions than 0.5.3

Wiz 05-28-2008 06:24 PM

We also do player charm in a similar way, by toggling 'client loses control' and forcing movement with MobUpdate packets. I haven't found any other way to move a player, and while it isn't entirely smooth, it works fine.

Derision 05-28-2008 06:27 PM

Quote:

Originally Posted by Wiz (Post 149505)

We've disabled the actual fear movement for the moment because its a lot more troublesome to keep players from going through walls than it is to do npcs,

Thanks Wiz. I'll have a look to see if those AppearancePackets work with 6.2/Titanium. Why is it more troublesome to keep players from going through walls than it is for NPCs ?

Wiz 05-28-2008 06:31 PM

Quote:

Originally Posted by Derision (Post 149508)
Thanks Wiz. I'll have a look to see if those AppearancePackets work with 6.2/Titanium. Why is it more troublesome to keep players from going through walls than it is for NPCs ?

Client movement is more unpredictable, partly because of lag / sync and partly because of the forced client physics - if a npc goes halfway into a wall it wont be affected, but a player might be teleported to the safe spot or fall through the world. The problem gets worse when you have .map files with LOS glitches that can send a player through a solid object.

I've got it working in 99% of all areas, but we still had some problem places, particularily in zones with imperfect .map files.

EDIT: Oh, in case it's not obvious, that movement function is meant to be called every 100ms. It gives a player roughly the same speed you get using the movement keys.

KingMort 05-30-2008 04:07 PM

Wiz actually giving something back to the eqemu community ?

*BOGGLE*

*GASP*

Scorpious2k 05-30-2008 04:22 PM

Quote:

Originally Posted by KingMort (Post 149618)
*GASP*

It's not the first time, nor is it a rare occurance. He just doesn't make a big deal about it when he does.

As for the fixes, has Derision's implementation been tested enough to put into the server code?

Wiz 05-30-2008 04:24 PM

Quote:

Originally Posted by KingMort (Post 149618)
Wiz actually giving something back to the eqemu community ?

*BOGGLE*

*GASP*

Fly away, little troll.

KLS 05-30-2008 04:58 PM

Yeah I tested it, changed a few things. It works surprisingly well on non eqg maps. Something is seriously wrong with the way we make the eqg .maps though.

Scorpious2k 05-30-2008 06:40 PM

Quote:

Originally Posted by KLS (Post 149626)
Yeah I tested it, changed a few things. It works surprisingly well on non eqg maps. Something is seriously wrong with the way we make the eqg .maps though.

OK, then I'll move it to source unless you have already done it.

Derision 06-01-2008 01:33 PM

Quote:

Originally Posted by Wiz (Post 149505)
SOD has player fear, the packet is an apperancepacket that toggles "player loses control" on, but this is for an old client version, so I don't know if its applicable.

The same approach works with the 6.2 and Titanium clients:

http://www.rama.demon.co.uk/playerfear.patch

I'm posting this patch for anyone who wants to test and develop it some more (as I'm a bit burned out at the moment), and not suggesting it is ready to put on a 'live' server, as I really just hacked it in in what seemed appropriate places.

Movement is a little jerky, and player animations don't look right (they tend to walk very fast rather than running).

I tested by casting fear (as a GM) on another player, and also by putting Dragon Roar in Naggy's spell list and getting feared by him.

The patch is against version 1110

trevius 06-01-2008 05:21 PM

So, fear was added into the 1110 eqemu code update. So far, it looks very well done. Also, mobs are now running at 20% health.

I notice that some mobs run everytime and some never run. What is it that decides wether a mob will run or not? I can't seem to find any particular common setting on the npc_types that say whether they should run or not. I do like the option of being able to set NPCs to run like live, but I don't think it is very good if I can't figure out how to turn it off lol. I have some zones with mobs that have high run speeds and having them run away could get quite messy.

And, if there isn't already an option to enable or disable running, maybe one could be added in similar to the "f" immune to fleeing or "D" immune to fear special attack codes.

Overall though, this looks like some excellent work! I had fear disabled in many zones because of it's previous exploitablility, but now I can finally enable it and let the chaos begin lol!

Throttle 06-01-2008 05:30 PM

Certain types of mobs never run, such as undead and summoned-type mobs. I don't know if that's what you meant.

trevius 06-01-2008 05:41 PM

I was thinking that body-type may have been what was deciding whether they should run or not. That may very well be the case. If so, it would be nice to still have another option other than changing the body type on all NPCs I don't want to run. I definitely don't want to have to set them all to summoned/undead.

I will have to do some more testing with it. Otherwise, I will have to consider either finding a way to disable running or add in a freebie item with clickie snare on it. Adding in running can completely change how much of my content was designed. Not that it is a bad thing, but it would be good to have an option imo.

John Adams 06-01-2008 05:59 PM

I believe there's a combat rule for FleeHPRatio, default 25? Not sure if you are looking to stop fleeing altogether, but that might do it.

Otherwise, there used to be some defines in features.h in regards to fleeing you can disable and recompile.


All times are GMT -4. The time now is 09:18 AM.

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