- Хроники
- Shadow of the Kamael
 
- Исходники
- Присутствуют
- Сборка
- L2jMobius Master class ch3
Посмотрите видео ниже, чтобы узнать, как установить наш сайт в виде веб-приложения на главном экране.
Примечание: Эта функция может быть недоступна в некоторых браузерах.
use geodataHello guys.
I'm facing a strange bug for a few months. I have add custom npcs to npc: grp and name. So far ok, work etc... problem is always they spawn invisible. I believe its just a visual issue cause after 1 hit using next target, the npc appear. Always after 1 hit he appear.
Посмотреть вложение 52544
Lf any help ty!!!

World.java -> switchRegion(). Have fun

I take a look at this but, my low knowledge dont make me found the problem in there.World.java -> switchRegion(). Have fun
world.spawnGroup("operatives");<group name="operatives" spawnByDefault="false">
            <!-- Operative - 1 Room -->
            <npc id="22998" x="47909" y="248350" z="-6300" heading="0" />
            <npc id="22998" x="47983" y="248607" z="-6300" heading="0" />
            <npc id="22998" x="47844" y="248568" z="-6300" heading="0" />
            <npc id="22998" x="47873" y="248432" z="-6300" heading="0" />
            <npc id="22998" x="47632" y="248406" z="-6300" heading="0" />
            <npc id="22998" x="47843" y="248461" z="-6300" heading="0" />
        </group>I take a look at this but, my low knowledge dont make me found the problem in there.
OBS: i realese that the only problem is with
Java:world.spawnGroup("operatives");
that push a group in instance XML
XML:<group name="operatives" spawnByDefault="false"> <!-- Operative - 1 Room --> <npc id="22998" x="47909" y="248350" z="-6300" heading="0" /> <npc id="22998" x="47983" y="248607" z="-6300" heading="0" /> <npc id="22998" x="47844" y="248568" z="-6300" heading="0" /> <npc id="22998" x="47873" y="248432" z="-6300" heading="0" /> <npc id="22998" x="47632" y="248406" z="-6300" heading="0" /> <npc id="22998" x="47843" y="248461" z="-6300" heading="0" /> </group>
in the Java instance file, normal addspawn works just fine without problem. Only the mobs in this group from xml looks be bugged.
public void switchRegion(WorldObject object, WorldRegion newRegion)
    {
        final WorldRegion oldRegion = object.getWorldRegion();
        if ((oldRegion == null) || (oldRegion == newRegion))
        {
            return;
        }
        
        final WorldRegion[] oldSurroundingRegions = oldRegion.getSurroundingRegions();
        for (int i = 0; i < oldSurroundingRegions.length; i++)
        {
            final WorldRegion worldRegion = oldSurroundingRegions[i];
            if (newRegion.isSurroundingRegion(worldRegion))
            {
                continue;
            }
            
            final Collection<WorldObject> visibleObjects = worldRegion.getVisibleObjects();
            if (visibleObjects.isEmpty())
            {
                continue;
            }
            
            for (WorldObject wo : visibleObjects)
            {
                if (wo == object)
                {
                    continue;
                }
                
                if (object.isCreature())
                {
                    final Creature objectCreature = (Creature) object;
                    final CreatureAI ai = objectCreature.getAI();
                    if (ai != null)
                    {
                        ai.notifyEvent(CtrlEvent.EVT_FORGET_OBJECT, wo);
                    }
                    
                    if (objectCreature.getTarget() == wo)
                    {
                        objectCreature.setTarget(null);
                    }
                    
                    if (object.isPlayer())
                    {
                        object.sendPacket(new DeleteObject(wo));
                    }
                }
                
                if (wo.isCreature())
                {
                    final Creature woCreature = (Creature) wo;
                    final CreatureAI ai = woCreature.getAI();
                    if (ai != null)
                    {
                        ai.notifyEvent(CtrlEvent.EVT_FORGET_OBJECT, object);
                    }
                    
                    if (woCreature.getTarget() == object)
                    {
                        woCreature.setTarget(null);
                    }
                    
                    if (wo.isPlayer())
                    {
                        wo.sendPacket(new DeleteObject(object));
                    }
                }
            }
        }
        
        final WorldRegion[] newSurroundingRegions = newRegion.getSurroundingRegions();
        for (int i = 0; i < newSurroundingRegions.length; i++)
        {
            final WorldRegion worldRegion = newSurroundingRegions[i];
            if (oldRegion.isSurroundingRegion(worldRegion))
            {
                continue;
            }
            
            final Collection<WorldObject> visibleObjects = worldRegion.getVisibleObjects();
            if (visibleObjects.isEmpty())
            {
                continue;
            }
            
            for (WorldObject wo : visibleObjects)
            {
                if ((wo == object) || (wo.getInstanceWorld() != object.getInstanceWorld()))
                {
                    continue;
                }
                
                if (object.isPlayer() && wo.isVisibleFor((Player) object))
                {
                    wo.sendInfo((Player) object);
                    if (wo.isCreature())
                    {
                        final CreatureAI ai = ((Creature) wo).getAI();
                        if (ai != null)
                        {
                            ai.describeStateToPlayer((Player) object);
                            if (wo.isMonster() && (ai.getIntention() == CtrlIntention.AI_INTENTION_IDLE))
                            {
                                ai.setIntention(CtrlIntention.AI_INTENTION_ACTIVE);
                            }
                        }
                    }
                }
                
                if (wo.isPlayer() && object.isVisibleFor((Player) wo))
                {
                    object.sendInfo((Player) wo);
                    if (object.isCreature())
                    {
                        final CreatureAI ai = ((Creature) object).getAI();
                        if (ai != null)
                        {
                            ai.describeStateToPlayer((Player) wo);
                            if (object.isMonster() && (ai.getIntention() == CtrlIntention.AI_INTENTION_IDLE))
                            {
                                ai.setIntention(CtrlIntention.AI_INTENTION_ACTIVE);
                            }
                        }
                    }
                }
            }
        }
 }