Jump to content
  • 0

[Help] NPC Attacking help


Question

Posted

Hello.. I am making a mod, where you can get territories... but i have a small problem. I have some NPC which are guards, and they hit the enemies... the problem is that when i hit the flag, and i take the territorry, the guards still hit me.. if i go back to the base, and go again, they won't hit me... the same with the enemies, if they go near guards, while near the flag, if they go near the guards the guards does not hit him. Also it takes a lil bit time to attack...

 

I used code like this:

 

int hating2 = npc.getHating(target);
	                				if (hating2 == 0)
	                					npc.addDamageHate(target, 5000, 5000);

	                				setIntention(CtrlIntention.AI_INTENTION_ATTACK, target);

 

this code in L2AttackableAI.java, in ThinkActive...

 

maybe another idea to make it faster and work as I want? thanks in advance.

6 answers to this question

Recommended Posts

  • 0
Posted

Basically guards should be spawn at same time than territorie capture. That's the only mean to do same action on one group of NPCs without hurting others.

 

Except that previous method which is the best, you can improve guard IA to act differently according to flag owner. It has to switch when flag cast is over so at same time you got "blabla took bubu territorie", you should have a IA related action.

 

That means guards are linked to that place somehow (unique name, unique title, unique... something has to be unique in order to make checks on it and retrieve some NPCs on the total amount of NPCs).

 

Not the best solution for sure.

  • 0
Posted

Hey Tryskell... I am actually using your pack, and i tried to do it with AI.. right now my problem is that, if i attack the crystal, and capture the place, if i go near the guards they hit me. if i die and i go again, they dont hit me... I need something like a timer to fix it.. but I am not damn sure how to make it.

  • 0
Posted

I told you, you have to create a "switch IA button" once flag is taken.

 

Basically, clean aggro of any guard you need and put their intentions to idle. About the "any guard you need" part, you have to find a mean to create a group linked to the flag. You have to control spawns and behavior of a whole group according to flag/zone.

 

For more infos about how to spawn things, you can check Four sepulchers (where opening a chest spawn an entire room), castle guards aswell is a good thing to leech on.

 

The pack has nothing to do on it (for one time :P). Except some russian packs, AI system looks the same from a pack to another.

  • 0
Posted

Im not really sure if i can make it.. i thought of changing ittention to attack when he sees a player, and then check again, and if the player is friendly player change to active again... or something like.. it could work...

 

EDIT: I made some changes and looks fine now, but i still have a small problem, if there is for example giran is under control by good faction, and there is a member of good faction near the guards, and an evil faction member come near the guards, the guards wont hit him unless good member goes away... if someone has any idea about this, please let me know.

 

2nd EDIT: Fixed, please lock the thread. Thanks everyone for the help.

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

    • There is a ready-made option and the possibility to work according to "Wishlist"
    • Contact me, Discord: xbaus
    • WTB GRACIA FINAL INTERFACE
    • Dear partners! At the moment we are in great need of the following positions: — Snapchat old and new accounts | With snapscores | Geo: Europe/USA | Full access via email/phone number — Reddit old (brute or hacked origin, self-registered) accounts with post and comment karma from 100 to 100,000+ | Full email access included — LinkedIn old accounts with real connections | Geo: Europe/USA | Full email access + active 2FA password — Instagram old accounts (2010–2023) | Full email access (possibly with active 2FA password) — Facebook old accounts (2010–2023) | Full email access (possibly with active 2FA password) | With friends or without friends | Geo: Europe/USA/Asia — Threads accounts | Full email access (possibly with active 2FA password) — TikTok/Facebook/Google ADS Agency advertising accounts — Email accounts: mail.ru, yahoo.com, gazeta.pl, gmx.ch / gmx.de / gmx.net (BUT NOT gmx.com) — Google ADS Manual Farm accounts (verified via email and phone number) | GEO: USA/Europe, mostly USA. — WhatsApp OLD Accounts — Twitter accounts with followers and posts (old accounts) Contact us via the details below. We will be glad to cooperate! We are also ready to consider other partnership and collaboration options. Active links to our projects: Digital goods store (Website): Go to Store Telegram bot: Go to – convenient access to the store via the Telegram messenger. Virtual numbers service: Go to Telegram bot for purchasing Telegram Stars: Go to – fast and profitable purchase of Stars in Telegram. SMM Panel: Go to – promotion of your social media accounts. Contacts and support: ➡ Telegram: https://t.me/socnet_support ➡ WhatsApp: https://wa.me/79051904467 ➡ Discord: socnet_support ➡ ✉ Email: solomonbog@socnet.store
  • 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