L2Tower Discord Let's keep the community alive with discord. Discussions about plugins and scripts L2Tower Discord

Post Reply 
 
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Script for Attack NPC Mob
Author Message
canaldextiger Offline
Goblin Grave Robber
*

Posts: 12
Joined: Aug 2015
Reputation: 0
Version: 1.4.2.133
Post: #1
Question Script for Attack NPC Mob

Hello, I need a script that targets a specific NPC.
Example: On the server I play, you kill a certain mob, and have a chance to spawn it a "Dwarf" (NPC name) or a "LittleTiny" (NPC name). You only get the coin you're trading if you kill those mobs, I think it's to avoid bots. So I need when spawning any of these NPCs, my character targets him.

I've tried a script like this:

Code:
repeat
Sleep(2500);
Command("/target Dwarf");
until false;

But it's not very effective, since that NPC fades in a few seconds if you do not kill. So I need a very precise script that when the mob spawns, my character targets it so I can use the skills (I use a Spellhowler).

I also tried a script like this:

Code:
repeat
me = GetMe()

function HowManyMobsAround(range)
    isAnyOfMobsTargetingMe = false;
    local Npclist = GetNpcList();
    local count = 0;
    for npc in Npclist.list do
        if (npc:GetDistance() < range) then
            count = count +1;
            if not (isAnyOfMobsTargetingMe) and (me:GetId() == npc:GetTarget()) then
                isAnyOfMobsTargetingMe = true;
            end;
        end;
    end;
    isAnyOfMobsTargetingMe = true;
    return count;
end;

if  
    (HowManyMobsAround(700)>1) then
    Sleep(700);
    TargetNpc("Dwarf");
    Sleep(600);
    Command("/attack");
    repeat
           until
    (GetTarget():IsAlikeDeath() == true);
    end;
    until false;

And also without the line "Command ("/attack");"
I tried the command "/recstart_npcid" and "/recstop" however in the generated file it does not say the NPC ID.

I'm glad if anyone can help me!

EDIT:

- Server: L2 Peniel (http://www.l2peniel.com)
- Chronicle: High Five
(This post was last modified: 08-22-2018 21:33 PM by canaldextiger.)
08-22-2018 00:10 AM
Find all posts by this user Quote this message in a reply
fastkill22 Offline
Elpy
*

Posts: 2
Joined: Dec 2012
Reputation: 0
Version: 1.4.1.112
Post: #2
RE: Script for Attack NPC Mob

I need same script but i need to speak in npc and after press the 1st option.
01-26-2019 19:55 PM
Find all posts by this user Quote this message in a reply
Post Reply 


Possibly Related Threads...
Thread: Author Replies: Views: Last Post
  bot will target but not attack. elvis8925 3 3,772 04-09-2018 00:19 AM
Last Post: elvis8925
  please help me bot not attack. botasbotas123 0 2,140 12-12-2017 23:40 PM
Last Post: botasbotas123
  Bot Dont Attack mobs ;/ AtraX69 10 9,039 12-30-2016 21:35 PM
Last Post: sebi7
  Nuke attack - AOE doesnt work GoodLuck777 4 4,954 09-23-2015 17:29 PM
Last Post: vanesitaxd
Information pet auto attack alexanderkalm 0 2,787 07-09-2015 06:14 AM
Last Post: alexanderkalm
Information Nuke Attack in Feoh Wizard godeus 2 3,600 04-14-2015 18:19 PM
Last Post: FML
  Nuke attack problem. K1mimaro 6 6,750 04-10-2015 02:06 AM
Last Post: l2tiger
  Problem with attack on L2Tower Haniack 6 4,447 02-03-2015 23:41 PM
Last Post: Haniack
  pls help with mage (it attack just once every 2 secods) ninjasoman 3 3,643 12-15-2014 20:50 PM
Last Post: ninjasoman
  How to set Action Attack by GUI? rORUMI 2 2,369 10-10-2014 08:03 AM
Last Post: rORUMI



User(s) browsing this thread: 1 Guest(s)