Lineage 2 Tower Forum

Full Version: Script for Attack NPC Mob
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
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
I need same script but i need to speak in npc and after press the 1st option.
Reference URL's