Finaltwist

Member
Has this been done before?

I figure the server sends packets to the client whenever a mobile is in a certain range of the player (thats why you can't see mobs and items past a certain range). I imagine it would be a quick fix to change it so instead of being in a certain range, the packet is only sent to the client if it is inrange && in line of sight?

This would make dungeons much more fun to explore - not knowing what items or mobs are on the other side of the door...

if anyone has done this / knows how to do it, please let me know!
 
alternatively, if anyone knows where the range at which mobs are "shown/sent" to the client can be changed, that would give me a place to start sleuthing.
 
My original "slender" entity, heh.

It uses the player's visibility list to make the mob visible to that player, while it's permanently hidden for everyone else while it follows the player around.
It hides itself when it's being looked at - you can just flip it the other way.


If you want to implement this for all creatures, I would add handling to the OnMovement method override in BaseCreature and do a similar thing to how I handled OnThink with my entity.
 
thats genius!

here i thought core changes or changes to the client would be required, but you've went ahead and found a simple solution for this.

I could even make a simple change in onthink while the mob isn't in line of sigh and in range and set the mob to hidden and cantwalk = true (so they don't revel themselves when they move. they will be invisible anyways so one needs to know they aren't moving.

could this also apply to dowander in the baseai?
Post automatically merged:

another thought - wouldn't it be a great way to ease the server if the mobs could all simply "sleep" when there are no players in a certain range? im not sure if this already happens, or if the server actively has all mobs "wandering" when no players in the area.
 
Last edited:
I have a basic framework for this system now. Mobile are hidden and don't move by default, and ive added a routine to onmovement where if InLOS and CanSee, they should appear.

however the mobiles don't immediately appear when a player walks in a room. the player has to be right next to the mobile before they appear. here is my code in OnMovement in BaseCreature

C#:
                if ( m is PlayerMobile && CanSee( m ) && InLOS( m ) && this.IsSleeping)
                {
                    this.Nearby = true;
                }
                else if ( m is PlayerMobile && !CanSee( m ) && !InLOS( m ) && !this.IsSleeping && this.Combatant == null)
                {
                    this.Nearby = false;
                }

nearby and issleeping ties into an Onthink method that makes the mobile appear/hide

C#:
            if (this.Region.IsPartOf( typeof( DungeonRegion ) ) )
            {
                if (this.Nearby)
                    this.IsSleeping = false;
                else
                    this.IsSleeping = true;
               
                if (this.IsSleeping && !this.Hidden && this.Combatant == null) // Final, mobs don't appear immediately in dungeons.
                {
                    this.Hidden = true;
                    this.Frozen = true;
                }
                else if (!this.IsSleeping && this.Hidden)
                {
                    this.Hidden = false;
                    this.Frozen = false;
                    //this.CantWalk = false;
                }
       
            }

For some reason Nearby isn't set to true immediately when a player enters a small room. what am I doing wrong?
Post automatically merged:

**edit - after further consideration, i decided to add to the server load and mvoe everything to the onthink (onmovement wasn't working for me for some reason).

Everything works perfectly now - though i have every mobile doing a constant check for players in onthink which likely adds to server load. :/
 
Last edited:

Active Shards

Donations

Total amount
$50.00
Goal
$1,000.00
Back