Jump to content
  • 0

How to make a autosweep skill?


Question

Posted (edited)

I'm looking to make a new passive skill and attach it to an item. The skill sweeps automatically when the creature is dead.

I'm not sure how to capture the creature dying from the xml file. Am I missing something or does this need to be done in code not config?

Edited by Vision

5 answers to this question

Recommended Posts

  • 0
Posted (edited)
package l2s.gameserver.handler.effects.impl.trigger;

import l2s.gameserver.handler.effects.EffectHandler;
import l2s.gameserver.listener.actor.OnKillListener;
import l2s.gameserver.model.Creature;
import l2s.gameserver.model.actor.instances.creature.Abnormal;
import l2s.gameserver.model.instances.MonsterInstance;
import l2s.gameserver.templates.skill.EffectTemplate;

public class p_auto_sweeper extends EffectHandler
{
	private final int _minDist;
	private final int _maxDist;

	public p_auto_sweeper(EffectTemplate template) {
		super(template);
		_minDist = getParams().getInteger("min_dist", -1);
		_maxDist = getParams().getInteger("max_dist", 400);
	}

	private class impl extends EffectHandler
	{
		private ImplListener _listener;

		public impl(EffectTemplate template) {
			super(template);
		}

		@Override
		public void onStart(Abnormal abnormal, Creature effector, Creature effected) {
			if (getSkill().isPassive())
				return;
			_listener = new ImplListener();
			effected.addListener(_listener);
		}

		@Override
		public void onExit(Abnormal abnormal, Creature effector, Creature effected, boolean cancelled) {
			if (getSkill().isPassive())
				return;
			effected.removeListener(_listener);
			_listener = null;
		}

		private class ImplListener implements OnKillListener
		{
			@Override
			public void onKill(Creature actor, Creature victim) {
				if (actor == null || victim == null || !victim.isMonster() || !actor.isPlayer() || actor.isDead() || !victim.isDead())
					return;
				if (!getSkill().isPassive() && !actor.getAbnormalList().contains(p_auto_sweeper.this.getSkill().getId())) {
					actor.removeListener(_listener);
					return;
				}
				if (actor.getDistance(victim) > _minDist && actor.getDistance(victim) < _maxDist) {
					final MonsterInstance mob = victim.asMonster();
					if (mob != null && !mob.isSweeped() && mob.isSpoiled(actor.getPlayer())) {
						mob.takeSweep(actor.getPlayer());
						mob.endDecayTask();
					}
				}
			}

			@Override
			public boolean ignorePetOrSummon() {
				return false;
			}
		}
	}

	@Override
	public EffectHandler getImpl() {
		return new impl(getTemplate());
	}
}

 


			<effect name="p_auto_sweeper">
				<def name="min_dist" value="-1"/>
				<def name="max_dist" value="300"/>
			</effect>

 

i just did this blind (on l2script) so its not tested but this is how i see the logic working

Edited by eMommy
  • Like 1
  • 0
Posted (edited)
On 10/15/2022 at 8:40 AM, redsky9 said:

wow. what great help.

you asked if you can do it from xml files , i answer your question. did you encounter any errors in your code , posted here and no one help you ? i think not.

 

Edited by arm4729

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now


  • Posts

    • https://www.4shared.com/s/fyGGySJVvfa  
    • PAYPAL& BINANCE PAYPAL& BINANCE
    • SOCNET STORE — is a unique place where you can find everything you need for your work on the Internet!   We offer the following range of products and services: Verified accounts with blue tick marks and confirmed documents in Instagram, Facebook, Twitter (X), LinkedIn; Gift cards and premium subscriptions for your services (Instagram Meta, Facebook Meta, Discord Nitro, Telegram Premium, YouTube Premium, Spotify Premium, ChatGPT, Netflix Premium, LinkedIn Premium, Twitter Premium, etc.); Telegram bot for purchasing Telegram Stars with a minimum markup with automatic delivery; Replenishment of your advertising accounts (in TikTok ADS, Facebook ADS, Google ADS, Bing ADS) + linking a bank card; Payment for any other service or subscription with a markup from 5 to 25% (depending on the cost of the subscription) Available payment methods: via PayPal, any cryptocurrency (+Binance Pay), Telegram Stars, Cash App, or any bank card.    Our online store  SOCNET.STORE  Our Telegram Stars Bot  SOCNET.CC  Our SMM-Panel for social media promotion  SOCNET.PRO  Telegram store  SOCNET.SHOP    News:  ➡ Telegram channel ➡ WhatsApp channel ➡ Discord server  Contacts and support:  ➡ Telegram support ➡ WhatsApp support ➡ Discord support: socnet_support ➡ Email support: solomonbog@socnet.store We have been operating for a long time and have gathered a huge list of reviews about our work! Our large list of positive and honest reviews is presented on our website!   VERIFIED ACCOUNTS    Verified old Instagram Meta account (2010-2020) with an active blue checkmark | Subscription has already been paid for 1 month in advance, account confirmed by documents: from $70 Verified old Facebook Meta account (2010-2023) with an active blue checkmark | Subscription has already been paid for 1 month in advance, account confirmed by documents: from $70 Verified Linkedin account (2010-2024) with an active checkmark and confirmed documents | Checkmark does not require renewal: from $80 Verified old Twitter (X) account (2010-2022) with an active blue checkmark | GEO: Tier 1-3 (your choice) | Subscription has already been paid for 1 month in advance: from $16    TELEGRAM STARS    Telegram Stars | 1 star from $0.0175 | Discounts for bulk orders | Delivery within 1-2 minutes automatically    GIFT SERVICES & PREMIUM SUBSCRIPTIONS  DISCORD NITRO Discord Nitro Classic (Basic) GIFT | 1/12 MONTHS | NO LOGIN OR PASSWORD NEEDED | Full subscription guarantee | Price from: $3.15 Discord Nitro FULL | 1/12 MONTHS | NO LOGIN OR PASSWORD NEEDED | Full subscription guarantee | Price from: $6.8 SPOTIFY PREMIUM Individual Spotify Premium plan for 1 month ON YOUR ACCOUNT | Available worldwide | Price from: $2.49 Family Spotify Premium plan for 1 month ON YOUR ACCOUNT | Works in any country | Price from: $3.75 Personal YouTube Premium Music on your account | 1 month | Ad-free YouTube | Price from: $3.75 Family YouTube Premium Music on your account | 1 month | Ad-free YouTube | Price from: $4.35 TELEGRAM PREMIUM Telegram Premium subscription for 1 month on your account | Authorization required (via TDATA or phone number) | Price from: $6 Telegram Premium subscription for 3 months on your account | No account authorization required | Guaranteed for full period | Price from: $17 Telegram Premium subscription for 6 months on your account | No account authorization required | Guaranteed for full period | Price from: $22 Telegram Premium subscription for 12 months on your account | No account authorization required | Guaranteed for full period | Price from: $37 GOOGLE VOICE • Google Voice Accounts (GMAIL US NEW) | Age/Year: Random 2024 | Phone Verified: Yes | Price from: $13 TWITTER(X) PREMIUM • Twitter Premium X subscription on your Twitter account for 1 month/1 year (your choice). Authorization in your Twitter account is required. Price from: $13 per month • Twitter X Premium Plus subscription with GROK AI on your Twitter account for 1 month/1 year (your choice). Authorization in your Twitter account is required. Price from: $55 NETFLIX PREMIUM • Netflix Premium subscription for 1 month on your personal account for any country, renewable after expiration | Price from: $10 CANVA PRO • CANVA PRO subscription for 1 month via invitation to your email | Price from: $1 CHATGPT 5 • Shared ChatGPT 5 Plus account FOR 2/5 USERS | Price from: $5 / $10 • Group ChatGPT 5 Plus subscription on your own email address for 1 month | Price from: $5 • Personal ChatGPT 5 Plus account FOR 1 USER or CHAT GPT PLUS subscription on your own account | Price from: $18 • ChatGPT 5 PRO account with UNLIMITED REQUESTS | Dedicated personal account FOR 1 USER ONLY or ON YOUR ACCOUNT | Works in any country or region | Price from: $220 Payment for any other subscription and replenishment of advertising accounts: Additional 5–20% to the cost of the subscription on the site or to the replenishment amount depending on the total purchase amount.   Attention: This text block does not represent our full product range; for more details, please visit the relevant links below! If you have any questions, our support team is always ready to help!       Our online store  SOCNET.STORE  Our Telegram Stars Bot  SOCNET.CC  Our SMM-Panel for social media promotion  SOCNET.PRO  Telegram store  SOCNET.SHOP    News:  ➡ Telegram channel ➡ WhatsApp channel ➡ Discord server  Contacts and support:  ➡ Telegram support ➡ WhatsApp support ➡ Discord support: socnet_support ➡ Email support: solomonbog@socnet.store We have been operating for a long time and have gathered a huge list of reviews about our work! Our large list of positive and honest reviews is presented on our website!  10% – 20% Discount or $1 BONUS for your registration  If you’d like to receive a $1 BONUS for your registration OR a DISCOUNT of 10% – 20% on your first purchase, simply leave a comment: "SEND ME MY BONUS, MY USERNAME IS..." You can also use the ready promo code across all our stores: "SOCNET" (15% discount!)  We invite you to COOPERATE and EARN with us  Want to sell your product or service in our stores and earn money? Want to become our partner or propose a mutually beneficial collaboration? You can contact us through the CONTACTS listed in this thread. Frequently Asked Questions and Refund Policy If you have any questions or issues, our fast customer support is always ready to respond to your requests! Refunds for services that do not fully meet the stated requirements or quality will only be issued if a guarantee and duration are explicitly mentioned in the product description. In all other cases, refunds will not be fully processed! By purchasing such services, you automatically agree to our refund policy for non-provided services. We currently accept CRYPTOMUS, Payeer, NotPayments, Perfect Money, Russian and Ukrainian bank cards, AliPay, BinancePay, CryptoBot, credit cards, and PayPal. The $1 registration bonus can only be used for purchases and only once after your first registration in any SOCNET project. We value every customer and provide replacements in case of invalid accounts through our contact methods! p.s.: Purchase bonuses can be used across any SOCNET projects: web store or Telegram bots.
  • 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