Jump to content

Recommended Posts

Posted

well i will share with you something funny when the registration of a event will finish like tvt as you know players got teleported but with this it will be something like scroll of escape just the animation nothing else XD btw create a new at file net.sf.l2j.gameserver.model.entity;

call it GlobalEventTeleAnimation.java

/*
* This program is free software: you can redistribute it and/or modify it under
* the terms of the GNU General Public License as published by the Free Software
* Foundation, either version 3 of the License, or (at your option) any later
* version.
* 
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
* details.
* 
* You should have received a copy of the GNU General Public License along with
* this program. If not, see <http://www.gnu.org/licenses/>.
*/
package net.sf.l2j.gameserver.model.entity;

import java.util.Vector;

import net.sf.l2j.gameserver.ai.CtrlIntention;
import net.sf.l2j.gameserver.model.actor.instance.L2PcInstance;
import net.sf.l2j.gameserver.network.serverpackets.MagicSkillUse;
import net.sf.l2j.gameserver.network.serverpackets.SetupGauge;

/**
* @author  Administrator
*/
public class GlobalEventTeleAnimation implements Runnable
{
private Vector<L2PcInstance> _players;
private int _hittime;

public GlobalEventTeleAnimation(Vector<L2PcInstance> players, int hittime)
{
	_players = players;
	_hittime = hittime;
}

/**
    * @see java.lang.Runnable#run()
    */
   @Override
   public void run()
   {
   	for(L2PcInstance activeChar : _players)
   	{
   		activeChar._inEventTeleport = true;
   		activeChar.setIsImmobilized(true);
        activeChar.getAI().setIntention(CtrlIntention.AI_INTENTION_IDLE);
        activeChar.setTarget(activeChar);
        activeChar.disableAllSkills();
        MagicSkillUse msu = new MagicSkillUse(activeChar, 2013, 1, _hittime, 0);
        activeChar.broadcastPacket(msu);
        SetupGauge sg = new SetupGauge(1, _hittime);
        activeChar.sendPacket(sg);
        activeChar.enableAllSkills();
        activeChar.getAI().setIntention(CtrlIntention.AI_INTENTION_ACTIVE);
   	}
   }
}

you will go at your event example tvt and the code will be (net.sf.l2j.gameserver.model.entinity.TvTEventTeleporter.java)something like that

/*
* This program is free software: you can redistribute it and/or modify it under
* the terms of the GNU General Public License as published by the Free Software
* Foundation, either version 3 of the License, or (at your option) any later
* version.
* 
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
* details.
* 
* You should have received a copy of the GNU General Public License along with
* this program. If not, see <http://www.gnu.org/licenses/>.
*/
package net.sf.l2j.gameserver.model.entity;

import java.util.Vector;

import net.sf.l2j.Config;
import net.sf.l2j.gameserver.ThreadPoolManager;
import net.sf.l2j.gameserver.model.actor.L2Summon;
import net.sf.l2j.gameserver.model.actor.instance.L2PcInstance;
import net.sf.l2j.gameserver.model.entity.events.GlobalEventTeleAnimation;
import net.sf.l2j.util.Rnd;

public class TvTEventTeleporter implements Runnable
{
/** The instance of the player to teleport */
private L2PcInstance _playerInstance = null;
/** Coordinates of the spot to teleport to */
private int[] _coordinates = new int[3];
/** Admin removed this player from event */
private boolean _adminRemove = false;
private Vector<L2PcInstance> _players;

/**
 * Initialize the teleporter and start the delayed task<br><br>
 *
 * @param playerInstance as L2PcInstance<br>
 * @param coordinates as int[]<br>
 * @param fastShedule as boolean<br>
 * @param adminRemove as boolean<br>
 */
public TvTEventTeleporter(L2PcInstance playerInstance, int[] coordinates, boolean fastSchedule, boolean adminRemove)
{
	_playerInstance = playerInstance;
	_coordinates = coordinates;
	_adminRemove = adminRemove;


	AnnounceToPlayers(false, "Teleport to team spot in 20 seconds!");
	ThreadPoolManager.getInstance().executeTask(new GlobalEventTeleAnimation(_players, 20000));
	long delay = (TvTEvent.isStarted() ? Config.TVT_EVENT_RESPAWN_TELEPORT_DELAY : Config.TVT_EVENT_START_LEAVE_TELEPORT_DELAY) * 1000;

	ThreadPoolManager.getInstance().scheduleGeneral(this, fastSchedule ? 0 : delay);
}

/**
     * @param b
     * @param string
     */
    private void AnnounceToPlayers(boolean b, String string)
    {
    // TODO Auto-generated method stub
    
    }

/**
 * The task method to teleport the player<br>
 * 1. Unsummon pet if there is one<br>
 * 2. Remove all effects<br>
 * 3. Revive and full heal the player<br>
 * 4. Teleport the player<br>
 * 5. Broadcast status and user info<br><br>
 *
 * @see java.lang.Runnable#run()<br>
 */
public void run()
{
	if (_playerInstance == null)
		return;

	L2Summon summon = _playerInstance.getPet();

	if (summon != null)
		summon.unSummon(_playerInstance);

	if (Config.TVT_EVENT_EFFECTS_REMOVAL == 0
			|| (Config.TVT_EVENT_EFFECTS_REMOVAL == 1 && _playerInstance.getTeam() == 0))
		_playerInstance.stopAllEffectsExceptThoseThatLastThroughDeath();

	_playerInstance.doRevive();

	_playerInstance.setInstanceId(0);
	_playerInstance.teleToLocation( _coordinates[ 0 ] + Rnd.get(101)-50, _coordinates[ 1 ] + Rnd.get(101)-50, _coordinates[ 2 ], false );

	if (TvTEvent.isStarted() && !_adminRemove)
		_playerInstance.setTeam(TvTEvent.getParticipantTeamId(_playerInstance.getObjectId()) + 1);
	else
		_playerInstance.setTeam(0);

	_playerInstance.setCurrentCp(_playerInstance.getMaxCp());
	_playerInstance.setCurrentHp(_playerInstance.getMaxHp());
	_playerInstance.setCurrentMp(_playerInstance.getMaxMp());

	_playerInstance.broadcastStatusUpdate();
	_playerInstance.broadcastUserInfo();
}
}

the code where you need to add is

AnnounceToPlayers(false, "Teleport to team spot in 20 seconds!");

ThreadPoolManager.getInstance().executeTask(new GlobalEventTeleAnimation(_players, 20000));

btw for any problem leave a reply to find a solution

NOTE: it's not tested

Guest
This topic is now closed to further replies.


  • Posts

    • Hello everyone, we are one of the top gaming currency stores. We work exclusively with top projects. If you are interested in anything like Adena, Coins, Equip, write to us Discord - pchelacoin Telegram - https://t.me/ipchelacoin BOHPTS, KETRAWARS, EURO-PVP, L2REBORN, E-GLOBAL, LA2DREAM TOP PRICE !!!!!!!
    • L2Elixir – Patch 4 Is Live!   We’re working non-stop, day and night, to deliver the best possible quality and bring back what made L2Elixir special. This project is built with passion, not shortcuts — for the old-school players who remember, and the new ones who want to experience it properly. Thank you for being part of the journey. Together, we’re making L2Elixir great again ❤️ The legends never fade.    ⚙️ General Enabled Class Change service (same class type only) ALT + B → Services → Character Development Enabled Shift + Click on Treasure Chests Players can now identify real chests (Adena, scroll drops) and use Key / Unlock Event deaths now cancel only debuffs, All self buffs are preserved, fixes issues with Root and similar effects Bladedancer class can now log in even when Max Clients (2) is reached. Since an active Bladedancer is not available for every damage dealer and some players tried to abuse this via VPN or a second PC, this feature was added to keep things fair. protections applies, requires testing!    🎒 Items Crystallizing enchanted items now gives the correct increased crystal amount (retail-like behavior) Removed Agathion Seal Bracelet: Rudolph from Santa rewards (Gracia Final item) Added Dualsword Craft Stamp into Milestone Exchange list    🧙 Skills Fixed Banish Undead lethal chance Hot Springs Malaria and similar effects now level up faster while being attacked
    • thats new SEO level tricks you know nothing of noob - bottom line: exposed.
  • Topics

×
×
  • Create New...

AdBlock Extension Detected!

Our website is made possible by displaying online advertisements to our members.

Please disable AdBlock browser extension first, to be able to use our community.

I've Disabled AdBlock