Jump to content

Sabrent

Members
  • Content Count

    20
  • Joined

  • Last visited

  • Feedback

    0%

Community Reputation

0 Neutral

About Sabrent

  • Rank
    Vassal

Profile Information

  • Gender
    Male
  • Country
    Israel
  • Location
    Yisrael

Recent Profile Visitors

176 profile views
  1. What I want is that when the item is finished, the player is teleport to another site. my script /** * MyNpc AI. */ public final class MyNpc extends AbstractNpcAI { // NPC private static final int NPC1 = 36655; private static final int NPC2 = 36656; // Item private static final int ITEM_NAME = 47811; private static final Location DIMENSIONAL = new Location(-190313, -112464, -7752); private MyNpc() { addStartNpc(NPC1, NPC2); addTalkId(NPC1, NPC2); addFirstTalkId(NPC1, NPC2); } @Override public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { String htmltext = null; if (npc.getId() == NPC1) { switch (event) { case "36655.htm": { htmltext = event; break; } case "give_coin": { if (hasQuestItems(player, ITEM_NAME)) { return "haveitem_b.htm"; }else { giveItems(player, ITEM_NAME, 1); playSound(player, QuestSound.ITEMSOUND_QUEST_ITEMGET); } } } break; } } if (npc.getId() == NPC2) { switch (event) { case "36656.htm": { htmltext = event; break; } case "give_coin": { if (hasQuestItems(player, ITEM_NAME)) { return "haveitem_s.htm"; } else { giveItems(player, ITEM_NAME, 1); playSound(player, QuestSound.ITEMSOUND_QUEST_ITEMGET); } } } break; } } return htmltext; } @Override public String onFirstTalk(L2Npc npc, L2PcInstance player) { String htmltext = null; switch (npc.getId()) { case NPC1: { htmltext = "36655.htm"; break; } case NPC2: { htmltext = "36656.htm"; break; } } return htmltext; } public void onItemExpire(L2Item item) { L2PcInstance player = null; if (item.getId() == ITEM_NAME) { if (item.getId() == -1) { player.teleToLocation(DIMENSIONAL); } } } public static void main(String[] args) { new MyNpc(); } } try custom item and skill and it not work <skill id="55032" displayId="770" toLevel="1" name="Dimensional"> <magicLvl>1</magicLvl> <operateType>P</operateType> <targetType>SELF</targetType> <affectScope>SINGLE</affectScope> <conditions> <condition name="OpCanEscape" /> </conditions> <effects> <effect name="Teleport"> <x>-120313</x> <y>-182464</y> <z>-6752</z> </effect> </effects> </skill> <item id="47811" name="Dimensional" type="EtcItem"> <set name="is_tradable" val="false" /> <set name="immediate_effect" val="true" /> <set name="is_oly_restricted" val="true" /> <set name="handler" val="ItemSkills" /> <set name="is_dropable" val="false" /> <set name="is_destroyable" val="false" /> <set name="is_depositable" val="false" /> <set name="is_sellable" val="false" /> <set name="is_clan_depositable" val="false" /> <set name="is_mailable" val="false" /> <set name="is_commissionable" val="false" /> <set name="is_private_storeable" val="false" /> <set name="is_stackable" val="false" /> <set name="time" val="60" /><!-- Mints --> <skills> <skill id="55032" level="1" /> <!-- Dimensional --> </skills> </item>
  2. Yeah! I was observing the examples in L2ItemInstance and L2Item on the getTime and getDuration of the mana, I also observed the behavior of the shadows weapons and cursed weapons, try to do a method, but I am not an expert in Java but I am a student and I am not ashamed to ask. Thx friend
  3. Hi friends. I'm doing a method where when the item expires teleport the player to another site. public void onItemExpire(L2Item item) { L2PcInstance player = null; if (item.getId() == ITEM_NAME) { if (item.getId() == -1) { player.teleToLocation(DIMENSIONAL_CRACK); } } } some developer colleague can give me some suggestion? thx
  4. L2Character (2729) public boolean updatePosition() { // Get movement data MoveData m = _move; if (m == null) { return true; } if (!isSpawned()) { _move = null; return true; } // Check if this is the first update if (m._moveTimestamp == 0) { m._moveTimestamp = m._moveStartTime; m._xAccurate = getX(); m._yAccurate = getY(); } int gameTicks = GameTimeManager.getInstance().getGameTicks(); // Check if the position has already been calculated if (m._moveTimestamp == gameTicks) { return false; } double xPrev = getX(); double yPrev = getY(); double zPrev = getZ(); // the z coordinate may be modified by coordinate synchronizations double dx, dy, dz; if (GeoDataConfig.COORD_SYNCHRONIZE == 1) // the only method that can modify x,y while moving (otherwise _move would/should be set null) { dx = m._xDestination - xPrev; dy = m._yDestination - yPrev; } else // otherwise we need saved temporary values to avoid rounding errors { dx = m._xDestination - m._xAccurate; dy = m._yDestination - m._yAccurate; } final boolean isFloating = isFlying() || isInsideZone(ZoneId.WATER); // Z coordinate will follow geodata or client values if ((GeoDataConfig.COORD_SYNCHRONIZE == 2) && !isFloating && !m.disregardingGeodata && ((GameTimeManager.getInstance().getGameTicks() % 10) == 0 // once a second to reduce possible cpu load ) && GeoData.getInstance().hasGeo(xPrev, yPrev)) { double geoHeight = GeoData.getInstance().getSpawnHeight(xPrev, yPrev, zPrev); dz = m._zDestination - geoHeight; // quite a big difference, compare to validatePosition packet if (isPlayer() && (Math.abs(getActingPlayer().getClientZ() - geoHeight) > 200) && (Math.abs(getActingPlayer().getClientZ() - geoHeight) < 1500)) { dz = m._zDestination - zPrev; // allow diff } else if (isInCombat() && (Math.abs(dz) > 200) && (((dx * dx) + (dy * dy)) < 40000)) // allow mob to climb up to pcinstance { dz = m._zDestination - zPrev; // climbing } else { zPrev = geoHeight; } } else { dz = m._zDestination - zPrev; } double delta = (dx * dx) + (dy * dy); if ((delta < 10000) && ((dz * dz) > 2500) // close enough, allows error between client and server geodata if it cannot be avoided && !isFloating) { delta = Math.sqrt(delta); } else { delta = Math.sqrt(delta + (dz * dz)); } double distFraction = Double.MAX_VALUE; if (delta > 1) { final double distPassed = (getMoveSpeed() * (gameTicks - m._moveTimestamp)) / GameTimeManager.TICKS_PER_SECOND; distFraction = distPassed / delta; } // if (Config.DEVELOPER) LOGGER.warn("Move Ticks:" + (gameTicks - m._moveTimestamp) + ", distPassed:" + distPassed + ", distFraction:" + distFraction); if (distFraction > 1) { // Set the position of the L2Character to the destination final double x = m._xDestination; final double y = m._yDestination; final double z = m._zDestination; super.setXYZ(x, y, z); if (isDebug()) { final ExShowTrace trace = new ExShowTrace(); trace.addLocation(x, y, z); sendDebugPacket(trace, DebugType.MOVEMENT); } } else { m._xAccurate += dx * distFraction; m._yAccurate += dy * distFraction; final double x = m._xAccurate; final double y = m._yAccurate; final double z = zPrev + ((dz * distFraction) + 0.5); // Set the position of the L2Character to estimated after partial move super.setXYZ(x, y, z); // HERE LINE 2729 if (isDebug()) { final ExShowTrace trace = new ExShowTrace(); trace.addLocation(x, y, z); sendDebugPacket(trace, DebugType.MOVEMENT); } } revalidateZone(false); // Set the timer of last position update to now m._moveTimestamp = gameTicks; if (distFraction > 1) { if (isDebug()) { Position.drawPosition(this); } ThreadPool.execute(() -> getAI().notifyEvent(CtrlEvent.EVT_ARRIVED)); return true; } return false; }
  5. Hello friends. I have a doubt with this Exception: Null, in my knowledge, which is not much, I am looking for the object that has not been initialized, i has it took several days looking how to solve it. L2Object.java:780 @Override public void setXYZ(double x, double y, double z) { _x = x; _y = y; _z = z; if (_isSpawned) { final WorldRegion oldRegion = getWorldRegion(); final WorldRegion newRegion = World.getInstance().getRegion(this); if (newRegion != oldRegion) { if (oldRegion != null) { oldRegion.removeVisibleObject(this); } newRegion.addVisibleObject(this); World.getInstance().switchRegion(this, newRegion); setWorldRegion(newRegion); } } }
  6. Hi all. I ve been all day looking for the way to do it but I could not, cans give me a suggestion on how to do it? I want an NPC that when spawn, the zone becomes debuff and when the NPC is death, the debuff disappears. L2jServer HF
  7. sorry session wrong, delete post.
×