Jump to content
  • 0

Question

Posted (edited)

Hello, i have an streange idea maybe some of you can help me, im using acis pack  for c6 and i want to make that people who are using teleport will dissapear slowly not instant. Maybe someone know what code and where need to add to java to have this effect?

thanks a lot for those who help me solve this 🙂
 

hope so understand what i mean 

Edited by remigas

7 answers to this question

Recommended Posts

  • 0
Posted (edited)
33 minutes ago, remigas said:

Hello, i have an streange idea maybe some of you can help me, im using acis pack  for c6 and i want to make that people who are using teleport will dissapear slowly not instant. Maybe someone know what code and where need to add to java to have this effect?

thanks a lot for those who help me solve this 🙂
 

hope so understand what i mean 

 

Define "slowly". Like a slow motion nuclear fission ? Like entropy is affecting you in a faster way than the rest and break down your atoms? 

 

Basically if you open up the Teleporter.java (i don't really remember the instance type in aCis of teleporters), you will realise that it uses teleToLocation() now depending on what "delay" mean you have to approach this method in a different way.

 

If you want to teleport after 5 second(s) you have to use a ThreadPoolExecutor for example.

Edited by Kara
  • Haha 1
  • 0
Posted (edited)

Create one new Skill preferrably the one called during /unstuck of type

 

Modify L2SkillTeleport.java

Add this:

Quote


    private static final HashMap<L2Character, L2TeleportLocation> _values = new HashMap<>();

And this

Quote

    public static void initTeleport(L2PcInstance player, int teleId)
    {
        final L2TeleportLocation temp = TeleportLocationTable.getInstance().getTemplate(teleId);
        if (temp == null || player.isCastingNow() || player.isSitting() || player.isMovementDisabled() || player.isOutOfControl() || player.isInOlympiadMode() || player.inObserverMode() || player.isInJail())
        {
            player.sendMessage("Your current state doesn't allow you to cast a teleport!");
            return;
        }
        int id = 7066;
        if (player.isGM() || player.isInsideZone(L2Character.ZONE_PEACE))
            id = 7065;
        else if (player.isInCombat() || player.getPvpFlag() > 0 || player.getKarma() > 0)
            id = 7067;
        player.doCast(SkillTable.getInstance().getInfo(id, 1));
        _values.put(player, temp);
    }

edit useSkill

 

add this 

Quote


                final L2TeleportLocation teleport = _values.get(activeChar);

null check it, make your checks

and call this 

Quote


                        activeChar.teleToLocation(teleport.getLocX(), teleport.getLocY(), teleport.getLocZ(), 30);

 

Now, you have the logic you need to change L2TeleporterInstance

 

change your teleportTo location methods with 

Quote

L2SkillTeleport.initTeleport( ........ )

 

 

Now you have a mechanism that instead of instant teleport your character casts a skill of defined duration that will do the actual teleportation

Edited by xdem
  • 0
Posted
player.disableAllSkills();
player.sendPacket(new ShowBoard());
player.destroyItemByItemId("CB_Teleport", Config.COMMUNITYBOARD_CURRENCY, Config.COMMUNITYBOARD_TELEPORT_PRICE, player, true);
player.setInstanceById(0);
player.sendMessage("You will be teleported in 20 seconds");
ThreadPool.schedule(() -> player.teleToLocation(Config.COMMUNITY_AVAILABLE_TELEPORTS.get(teleBuypass), 0), 20000);
ThreadPool.schedule(player::enableAllSkills, 20000);

 

 

this is what i use on L2j Mobius using CB teleport. You can get an idea and there is no need to edit anything.

 

no animations though, u just stand still and tp after 20 sec.

im sure there a re better ways to write this my java knowledge is bellow beginner but i hope it helps..

 

change:

player.disableAllSkills();--- to--- player.getAI().setIntention(CtrlIntention.AI_INTENTION_IDLE);

player.doCast(SkillData.getInstance().getSkill(2013, 1));   << add this to add SoE effect. but if you Esc cancel it it will just cancel the skill animation and the tp will occur after 20sec. cant figure out how to cancel tp as well.

  • 0
Posted

If you need only delay w/o any additionally wffects then find this lines in Npc.java

 

        if (Config.FREE_TELEPORT || teleport.getPriceCount() == 0 || player.destroyItemByItemId("InstantTeleport", teleport.getPriceId(), teleport.getPriceCount(), this, true))
            player.teleportTo(teleport, 20);

 

and replace to this

 

        if (Config.FREE_TELEPORT || teleport.getPriceCount() == 0 || player.destroyItemByItemId("InstantTeleport", teleport.getPriceId(), teleport.getPriceCount(), this, true))
        {
		ThreadPool.schedule(() -> 
		{
			player.teleportTo(teleport, 20);
		}, 2000);
	}

 

Guest
This topic is now closed to further replies.


×
×
  • Create New...