Jump to content

[SHARE] Global Event Teleport Animation


Recommended Posts

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

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.


  • Posts

    • (862)4337118 Psychic Lost Love Spell in Laredo,TX   Psychic love spells ☎️ +1 (862) 4337118 in Dallas, TX To Get Back Ex Lover Black magic cleansing. Psychic love spells in Dallas, TX if you want to reunite with your ex, this spell is for you. This spell is best for people who break up with someone and realize they wish they hadn't, and it won't force the other person to get back into the relationship. Instead, it removes the negative energy. Expert love spells to renew your relationship & make your relationship stronger. love spells to bring back the feelings of love for ex-lovers. Increase the intimacy, affection & love between you and your lover using voodoo relationship love spells in the USA. Black Magic Spells Removal Money spells, easy love spells with just words, think of me spell, powerful love spell, spells of love, spells that work, love potion to attract a man, easy love spells with just words, pink candle prayer, white magic spells, call me spell, manifestation spell, gay love spells, commitment spells, business spells and, how to bring back lost love in a relationship, Witchcraft love spells that work immediately to increase love & intimacy in your relationship. Attraction love spells to attract someone, stop a divorce, prevent a breakup & get your ex back. Get back your ex-lover If your lover is gone, don't be desperate anymore! You are a few clicks away from a prompt resolution of your problem: We will bring our spiritual powers to bring him/her back.
    • (862)4337118 Psychic Lost Love Spell in Lubbock,TX   Psychic love spells ☎️ +1 (862) 4337118 in Dallas, TX To Get Back Ex Lover Black magic cleansing. Psychic love spells in Dallas, TX if you want to reunite with your ex, this spell is for you. This spell is best for people who break up with someone and realize they wish they hadn't, and it won't force the other person to get back into the relationship. Instead, it removes the negative energy. Expert love spells to renew your relationship & make your relationship stronger. love spells to bring back the feelings of love for ex-lovers. Increase the intimacy, affection & love between you and your lover using voodoo relationship love spells in the USA. Black Magic Spells Removal Money spells, easy love spells with just words, think of me spell, powerful love spell, spells of love, spells that work, love potion to attract a man, easy love spells with just words, pink candle prayer, white magic spells, call me spell, manifestation spell, gay love spells, commitment spells, business spells and, how to bring back lost love in a relationship, Witchcraft love spells that work immediately to increase love & intimacy in your relationship. Attraction love spells to attract someone, stop a divorce, prevent a breakup & get your ex back. Get back your ex-lover If your lover is gone, don't be desperate anymore! You are a few clicks away from a prompt resolution of your problem: We will bring our spiritual powers to bring him/her back.
    • (862)4337118 Psychic Lost Love Spell in Plano,TX   Psychic love spells ☎️ +1 (862) 4337118 in Dallas, TX To Get Back Ex Lover Black magic cleansing. Psychic love spells in Dallas, TX if you want to reunite with your ex, this spell is for you. This spell is best for people who break up with someone and realize they wish they hadn't, and it won't force the other person to get back into the relationship. Instead, it removes the negative energy. Expert love spells to renew your relationship & make your relationship stronger. love spells to bring back the feelings of love for ex-lovers. Increase the intimacy, affection & love between you and your lover using voodoo relationship love spells in the USA. Black Magic Spells Removal Money spells, easy love spells with just words, think of me spell, powerful love spell, spells of love, spells that work, love potion to attract a man, easy love spells with just words, pink candle prayer, white magic spells, call me spell, manifestation spell, gay love spells, commitment spells, business spells and, how to bring back lost love in a relationship, Witchcraft love spells that work immediately to increase love & intimacy in your relationship. Attraction love spells to attract someone, stop a divorce, prevent a breakup & get your ex back. Get back your ex-lover If your lover is gone, don't be desperate anymore! You are a few clicks away from a prompt resolution of your problem: We will bring our spiritual powers to bring him/her back.
    • (862)4337118 Psychic Lost Love Spell in Corpus Christi,TX   Psychic love spells ☎️ +1 (862) 4337118 in Dallas, TX To Get Back Ex Lover Black magic cleansing. Psychic love spells in Dallas, TX if you want to reunite with your ex, this spell is for you. This spell is best for people who break up with someone and realize they wish they hadn't, and it won't force the other person to get back into the relationship. Instead, it removes the negative energy. Expert love spells to renew your relationship & make your relationship stronger. love spells to bring back the feelings of love for ex-lovers. Increase the intimacy, affection & love between you and your lover using voodoo relationship love spells in the USA. Black Magic Spells Removal Money spells, easy love spells with just words, think of me spell, powerful love spell, spells of love, spells that work, love potion to attract a man, easy love spells with just words, pink candle prayer, white magic spells, call me spell, manifestation spell, gay love spells, commitment spells, business spells and, how to bring back lost love in a relationship, Witchcraft love spells that work immediately to increase love & intimacy in your relationship. Attraction love spells to attract someone, stop a divorce, prevent a breakup & get your ex back. Get back your ex-lover If your lover is gone, don't be desperate anymore! You are a few clicks away from a prompt resolution of your problem: We will bring our spiritual powers to bring him/her back.  Corpus Christi,TX
    • (862)4337118 Psychic   Lost Love Spell     in     Arlington,TX   Psychic love spells ☎️ +1 (862) 4337118 in Dallas, TX To Get Back Ex Lover Black magic cleansing. Psychic love spells in Dallas, TX if you want to reunite with your ex, this spell is for you. This spell is best for people who break up with someone and realize they wish they hadn't, and it won't force the other person to get back into the relationship. Instead, it removes the negative energy. Expert love spells to renew your relationship & make your relationship stronger. love spells to bring back the feelings of love for ex-lovers. Increase the intimacy, affection & love between you and your lover using voodoo relationship love spells in the USA. Black Magic Spells Removal Money spells, easy love spells with just words, think of me spell, powerful love spell, spells of love, spells that work, love potion to attract a man, easy love spells with just words, pink candle prayer, white magic spells, call me spell, manifestation spell, gay love spells, commitment spells, business spells and, how to bring back lost love in a relationship, Witchcraft love spells that work immediately to increase love & intimacy in your relationship. Attraction love spells to attract someone, stop a divorce, prevent a breakup & get your ex back. Get back your ex-lover If your lover is gone, don't be desperate anymore! You are a few clicks away from a prompt resolution of your problem: We will bring our spiritual powers to bring him/her back.
  • Topics

×
×
  • Create New...