Jump to content

Recommended Posts

Posted

 

SetTarget(const Name: string): Boolean; overload; Set target by name

const Name : string - name is a constant and naturally also a string, not an integer for example.

Boolean - true or false. See: https://en.wikipedia.org/wiki/Boolean_data_type

overload - no idea.

 

Way to use that command in your script:

begin

SetTarget('Mycharname')

end.

 

Targets whatever with name 'Mycharname'

Posted

such arg is set to read-only inside given function, you use it for safty / clarity and also optimization cuz compiler won't assume you may change these vars

Posted (edited)

EDIT: I try edit script for buy all, buff, and go to imperial tomb, but idk why dont work, i think is any problem in Buy mana part, but i read 30 times and dont know where is error :/ Char move to this coordinates: 147727, -58521, -2981, he buff and buy ss, but after just do nothing.

var MP, Shot: TL2Item;
buff: TL2Buff;
function buffCheck: Boolean;
begin
  Engine.MoveTo(147727, -58521, -2981);
        delay(1000);
  Engine.MoveTo(147746, -55697, -2742);
    if (not User.Buffs.ByID(1062, buff) or (buff.endtime<300000)) then begin //1062 wich buff id checking
        Result:=true;
        Delay(1000);
  Engine.SetTarget('buffer');                                      ///buffer
   engine.dlgopen;
    Delay(1000);
    Engine.BypassToServer('Quest 555_NPCBuffer cast 4373 x x'); 
        Delay(1000);
    end;
Result:=false;
end;

function BuyMP:boolean;
begin
if not Inventory.User.ByID(728, MP) or (MP.count<800) then begin //728 mp id ,10 or less then buy MP so probably change it for your count
result:=true;
        Delay(1000);
  Engine.SetTarget('Sellena');                                      ///gmshop
   engine.dlgopen;
    Delay(1000);
  Engine.DlgSel('Potion');
        delay(1000);
        Engine.NpcExchange(728, 1100);  //728 mp id, 2 is count how many buy it
        delay(1000);
        end;
        result:=false;
  Engine.CancelTarget;
end;

function BuyShot:boolean;
begin
if not Inventory.User.ByID(3951, Shot) or (Shot.count<4500) then begin //1463 is d grade shot id, change for your shot id, 900 or less then buy shots
result:=true;
        Delay(1000);
  Engine.SetTarget('Sellena');                                      ///gmshop
   engine.dlgopen;
        Delay(1000);
  Engine.DlgSel('Soulshots');
        Delay(1000);
        Engine.NpcExchange(3951, 12);   //3951 id, 50 is count wich buy
        delay(1000);
        end;
        result:=false;
end;


function deadCheck: Boolean;
begin
Result := false;
    if User.Dead then begin
        Result := true;
        Print('Dead. Pressing to village.');
        Delay(1000);
        Engine.FaceControl(0,false);
        Engine.GoHome;
        Delay(10000);
    end;
end;

begin
while true do begin
delay(150);
                    //town coordinates     range                 //buff id wich check                        //shot id                              //mp id
    if user.inrange(144925, -56215, -2974, 5000) and User.Buffs.ByID(1062, buffCheck) and Inventory.User.ByID(1463, BuyShot) and Inventory.User.ByID(728, BuyMP) then begin
        Print('Teleport.');
        delay(1000);
  Engine.SetTarget('Marianne');                                      ///gatekeeper
   engine.dlgopen;
        delay(1000);
  Engine.DlgSel('Towns Areas');
        delay(1000);
  Engine.DlgSel('Goddard Area');
        delay(1000);
  Engine.DlgSel('Imperial Tomb');
        delay(1000);
    end;                      
                             
    if user.inrange(-181346, -75785, -2731, 300) then begin  //coordinates after teleport
        Print('Moving');
        Engine.MoveTo(177893, -75352, -2728);      //path to spot
        Engine.MoveTo(177956, -78138, -3379);
        Engine.MoveTo(177947, -80965, -4026);
        Print('ON!');
        Delay(500);
        Engine.FaceControl(0, true);  //turn on bot
        while not deadCheck do delay(1000); //while not dead, do nothing and wait.
    end;
end;
end.

Think problem is i need buy from same npc ss/mana.

Edited by CristianPascual
Posted

Correct me if I'm wrong, but where do you call functions: buyShot, buyMp and buffCheck in your loop???

 

 

At first: put Result:= false after "begin" in each function. Change range from 5000 to like 15000(if still won't work make path to get closer to the teleport NPC).

 

Also I recommend to put this:

delay(150);
                    //town coordinates     range                 //buff id wich check                        //shot id                              //mp id
    if user.inrange(144925, -56215, -2974, 5000) and User.Buffs.ByID(1062, buffCheck) and Inventory.User.ByID(1463, BuyShot) and Inventory.User.ByID(728, BuyMP) then begin
        Print('Teleport.');
        delay(1000);
  Engine.SetTarget('Marianne');                                      ///gatekeeper
   engine.dlgopen;
        delay(1000);
  Engine.DlgSel('Towns Areas');
        delay(1000);
  Engine.DlgSel('Goddard Area');
        delay(1000);
  Engine.DlgSel('Imperial Tomb');
        delay(1000);
    end;   

in a function, and call this function after rbf or shopping is done.

Posted

i guess he play interlude

 

Nope, is L2 H5, server is l2stars. Dont know what l2pack use this server.

 

 

Correct me if I'm wrong, but where do you call functions: buyShot, buyMp and buffCheck in your loop???

 

 

At first: put Result:= false after "begin" in each function. Change range from 5000 to like 15000(if still won't work make path to get closer to the teleport NPC).

 

Also I recommend to put this:

delay(150);
                    //town coordinates     range                 //buff id wich check                        //shot id                              //mp id
    if user.inrange(144925, -56215, -2974, 5000) and User.Buffs.ByID(1062, buffCheck) and Inventory.User.ByID(1463, BuyShot) and Inventory.User.ByID(728, BuyMP) then begin
        Print('Teleport.');
        delay(1000);
  Engine.SetTarget('Marianne');                                      ///gatekeeper
   engine.dlgopen;
        delay(1000);
  Engine.DlgSel('Towns Areas');
        delay(1000);
  Engine.DlgSel('Goddard Area');
        delay(1000);
  Engine.DlgSel('Imperial Tomb');
        delay(1000);
    end;   

in a function, and call this function after rbf or shopping is done.

 

 

I put result=false after begin, and range is now 15000 but same problem.

 

I cant make this function and call function after rebuff or shopping done, cause shopping dont work do you understand what want i do? If i remove me berseker buff and i if dont have ss/mana potions, char just rebuff, buy ss, and returns to the coordinates of the beginning (Engine.MoveTo(147746, -55697, -2742) [;)] .

 

If i have berseker and soulshots, char do nothing, just move to coordinates all time.

Sorry for this english.

Posted

in buyshot function i see you change id so need change here too 

if user.inrange(144925, -56215, -2974, 5000) and User.Buffs.ByID(1062, buffCheck) and Inventory.User.ByID(1463, BuyShot) and Inventory.User.ByID(728, BuyMP) then begin
  • 10 months later...
Posted

 

change Engine.BypassToServer to your server or use Engine.DlgSel this script works l2blaze/l2neo i think

begin
while true do begin
  Engine.SetTarget(31521);                                      ///jeremy
  Engine.DlgOpen;
  Engine.DlgSel('Quest');
  Delay(500);
  Engine.DlgSel('Egg Delivery');
  Delay(500);
  Engine.bypasstoserver('Quest 621_EggDelivery 31521-1.htm');
  Engine.MoveTo(150404,-113188,-2141);
  Engine.MoveTo(150533,-114686,-1779);
  Engine.MoveTo(151344,-115006,-1611);
  Engine.CancelTarget;
  Engine.MoveTo(154492,-114995,-1567);
  Engine.MoveTo(157224,-115436,-1922);
  Engine.MoveTo(157381,-115407,-1896);
  Engine.MoveTo(157358,-115501,-1921);
  Engine.MoveTo(157598,-115486,-1927);
  Engine.SetTarget(31543);                                    ////pulin
  Engine.DlgOpen;
  Engine.DlgSel('Quest');
  Delay(500);
  Engine.DlgSel('Egg Delivery');
  delay(500) ;
  Engine.bypasstoserver('Quest 621_EggDelivery 31543-1.htm');
  Delay(500);
  Engine.MoveTo(156803, -115366, -1880);
  Engine.MoveTo(155365, -114559, -1625);
  Engine.CancelTarget;
  Engine.MoveTo(154269, -113957, -1604);
  Engine.MoveTo(152599, -113547, -1658);
  Engine.MoveTo(152072, -113343, -1626);
  Engine.MoveTo(151519, -112861, -1999);
  Engine.MoveTo(151244, -112937, -2124);
  Engine.MoveTo(151203, -112241, -2287);
  Engine.MoveTo(153632, -110383, -2675);
  Engine.MoveTo(154994, -107157, -2697);
  Engine.MoveTo(155599, -105710, -2755);
  Engine.SetTarget(31544);                                      /// naff
  Engine.DlgOpen;
  Engine.DlgSel('Quest');
  Delay(500);
  Engine.DlgSel('Egg Delivery');
  Delay(500);
  Engine.bypasstoserver('Quest 621_EggDelivery 31544-1.htm');
  Delay(500);            
  Engine.MoveTo(155621,-105697,-2780);
  Engine.MoveTo(154776,-104491,-2810);
  Engine.CancelTarget;
  Engine.MoveTo(153253,-101918,-2757);
  Engine.MoveTo(152601,-101212,-2943);
  Engine.MoveTo(149277,-100863,-2943);
  Engine.MoveTo(148429,-100919,-2994);
  Engine.MoveTo(146268,-101937,-2872);
  Engine.MoveTo(144957,-102812,-3556);
  Engine.MoveTo(141104,-105238,-3650);
  Engine.MoveTo(140773,-105450,-3659);
  Engine.MoveTo(140748,-105458,-3625);
  Engine.SetTarget(31545);                                      ///crocus
  Engine.DlgOpen;
  Engine.DlgSel('Quest');
  Delay(500);
  Engine.DlgSel('Egg Delivery');
  Delay(500);
  engine.bypasstoserver('Quest 621_EggDelivery 31545-1.htm');
  Delay(500);
  Engine.MoveTo(140722,-105729,-3654);
  Engine.MoveTo(140862,-108560,-3654);
  Engine.CancelTarget;
  Engine.MoveTo(141469,-109301,-3616);
  Engine.SetTarget(31546);                                    ////kuber
  Engine.DlgOpen;
  Engine.DlgSel('Quest');
  Delay(500);
  Engine.DlgSel('Egg Delivery');
  Delay(500);
  Engine.bypasstoserver('Quest 621_EggDelivery 31546-1.htm');
  Delay(500);
  Engine.MoveTo(142274, -109216, -3587);
  Engine.MoveTo(143990, -108702, -3503);
  Engine.CancelTarget;
  Engine.MoveTo(146375, -108965, -3252);
  Engine.MoveTo(147727, -108871, -2899);
  Engine.MoveTo(148785, -108902, -2639);
  Engine.MoveTo(149347, -109226, -2515);
  Engine.MoveTo(149506, -110728, -2294);
  Engine.MoveTo(147948, -113046, -2157);
  Engine.MoveTo(147899, -113372, -2150);
  Engine.MoveTo(147528, -113301, -2112);
  Engine.SetTarget(31547);                                    /////beolin
  Engine.DlgOpen;
  Engine.DlgSel('Quest');
  Delay(500);
  Engine.DlgSel('Egg Delivery');
  Delay(500);
  engine.bypasstoserver('Quest 621_EggDelivery 31547-1.htm');
  Delay(500);
  Engine.MoveTo(147591,-113304,-2108);
  Engine.MoveTo(148037,-113126,-2163);
  Engine.MoveTo(148908,-112712,-2096);
  Engine.MoveTo(149508,-112634,-2090);
  Engine.SetTarget(31521);                                  ///jeremy
  Engine.DlgOpen;
  Engine.DlgSel('Quest');
  Delay(500);
  Engine.DlgSel('Egg Delivery');
  Delay(500);
  engine.bypasstoserver('Quest 621_EggDelivery 31521-3.htm');
  Delay(500);
  end;
 end.

This one is working on todays l2neo but after he deliver eggs and finish the quest he cant take a new one and hes just running the course w/o the quest taken. Any help with that?

  • Vision locked this topic
Guest
This topic is now closed to further replies.



  • Posts

    • what pack you use  send me on discord for it
    • package custom.events.RandomZoneEvent; import java.io.File; import java.util.ArrayList; import java.util.List; import java.util.Random; import java.util.concurrent.ScheduledFuture; import org.w3c.dom.Document; import org.w3c.dom.Node; import org.l2jmobius.commons.threads.ThreadPool; import org.l2jmobius.commons.time.SchedulingPattern; import org.l2jmobius.commons.time.TimeUtil; import org.l2jmobius.commons.util.IXmlReader; import org.l2jmobius.gameserver.managers.ZoneManager; import org.l2jmobius.gameserver.model.StatSet; import org.l2jmobius.gameserver.model.actor.Creature; import org.l2jmobius.gameserver.model.actor.Npc; import org.l2jmobius.gameserver.model.actor.Player; import org.l2jmobius.gameserver.model.quest.Event; import org.l2jmobius.gameserver.model.zone.ZoneId; import org.l2jmobius.gameserver.model.zone.ZoneType; import org.l2jmobius.gameserver.model.zone.type.RandomZone; import org.l2jmobius.gameserver.util.Broadcast; /** * Random Zone Event - Activates one random PvP zone temporarily. No modifica la clase de la zona: usa flags PvP en runtime. * @author Juan */ public class RandomZoneEvent extends Event { private static final String CONFIG_FILE = "data/scripts/custom/events/RandomZoneEvent/config.xml"; private static int EVENT_DURATION_MINUTES = 15; private static boolean _isActive = false; private ScheduledFuture<?> _eventTask = null; private final List<ZoneType> _availableZones = new ArrayList<>(); private ZoneType _activeZone = null; public RandomZoneEvent() { loadConfig(); loadZones(); registerZoneListeners(); } /** * Registra listeners a TODAS LAS ZONAS random */ private void registerZoneListeners() { for (ZoneType zone : _availableZones) { addEnterZoneId(zone.getId()); addExitZoneId(zone.getId()); LOGGER.info("[RandomZoneEvent] Registered listener for zone: " + zone.getName()); } } private void loadConfig() { new IXmlReader() { @Override public void load() { parseDatapackFile(CONFIG_FILE); } @Override public void parseDocument(Document doc, File file) { forEach(doc, "event", eventNode -> { final StatSet att = new StatSet(parseAttributes(eventNode)); final String name = att.getString("name"); for (Node node = eventNode.getFirstChild(); node != null; node = node.getNextSibling()) { if ("schedule".equals(node.getNodeName())) { final StatSet attributes = new StatSet(parseAttributes(node)); final String pattern = attributes.getString("pattern"); final SchedulingPattern schedulingPattern = new SchedulingPattern(pattern); final StatSet params = new StatSet(); params.set("Name", name); params.set("SchedulingPattern", pattern); final long delay = schedulingPattern.getDelayToNextFromNow(); getTimers().addTimer("Schedule_" + name, params, delay + 5000, null, null); LOGGER.info("[RandomZoneEvent] Event " + name + " scheduled at " + TimeUtil.getDateTimeString(System.currentTimeMillis() + delay)); } } }); } }.load(); } private void loadZones() { for (ZoneType zone : ZoneManager.getInstance().getAllZones(RandomZone.class)) { if ((zone.getName() != null) && zone.getName().toLowerCase().startsWith("random_zone")) { _availableZones.add(zone); LOGGER.info("[RandomZoneEvent] Loaded zone: " + zone.getName() + " (id=" + zone.getId() + ")"); } } LOGGER.info("[RandomZoneEvent] Total random zones loaded: " + _availableZones.size()); } @Override public void onTimerEvent(String event, StatSet params, Npc npc, Player player) { if (event.startsWith("Schedule_")) { eventStart(null); final SchedulingPattern schedulingPattern = new SchedulingPattern(params.getString("SchedulingPattern")); final long delay = schedulingPattern.getDelayToNextFromNow(); getTimers().addTimer(event, params, delay + 5000, null, null); LOGGER.info("[RandomZoneEvent] Rescheduled for " + TimeUtil.getDateTimeString(System.currentTimeMillis() + delay)); } } @Override public boolean eventStart(Player eventMaker) { if (_isActive) { if (eventMaker != null) { eventMaker.sendMessage("RandomZoneEvent already active."); } return false; } if (_availableZones.isEmpty()) { Broadcast.toAllOnlinePlayers("[RandomZoneEvent] No zones configured."); return false; } _isActive = true; Broadcast.toAllOnlinePlayers("⚔️ Random Zone Event has started!"); _eventTask = ThreadPool.schedule(this::activateRandomZone, 5_000); return true; } private void activateRandomZone() { _activeZone = _availableZones.get(new Random().nextInt(_availableZones.size())); _activeZone.setEnabled(true); Broadcast.toAllOnlinePlayers("🔥 Random Zone Event: " + _activeZone.getName() + " is now PvP for " + EVENT_DURATION_MINUTES + " minutes!"); _eventTask = ThreadPool.schedule(this::eventStop, EVENT_DURATION_MINUTES * 60 * 1000L); } @Override public boolean eventStop() { if (!_isActive) { return false; } _isActive = false; if (_eventTask != null) { _eventTask.cancel(true); _eventTask = null; } if (_activeZone != null) { _activeZone.setEnabled(false); Broadcast.toAllOnlinePlayers("🏁 Random Zone Event ended. " + _activeZone.getName() + " is back to normal."); _activeZone = null; } else { Broadcast.toAllOnlinePlayers("🏁 Random Zone Event ended."); } return true; } @Override public void onEnterZone(Creature creature, ZoneType zone) { if (!_isActive || (_activeZone == null)) { return; } if ((zone == _activeZone) && creature.isPlayable()) { creature.setInsideZone(ZoneId.PVP, true); if (creature.isPlayer()) { creature.sendMessage("Esta zona está en modo PvP temporalmente."); } } } @Override public void onExitZone(Creature creature, ZoneType zone) { if (!_isActive || (_activeZone == null)) { return; } if ((zone == _activeZone) && creature.isPlayable()) { creature.setInsideZone(ZoneId.PVP, false); if (creature.isPlayer()) { creature.sendMessage("Abandonaste la zona PvP temporal."); } } } @Override public boolean eventBypass(Player player, String bypass) { return true; } @Override public String onEvent(String event, Npc npc, Player player) { return super.onEvent(event, npc, player); } @Override public String onFirstTalk(Npc npc, Player player) { return null; } public static void main(String[] args) { new RandomZoneEvent(); } } i have this but its not working
    • ZonePvPSpawnBossRadio=0 ZonePvPSpawnBossBarakiel=0 at the Customs.ini in L2Server folder. Im prety sure this is it because i had the same problem with you in cruma 1 floor for example and i couldn't fix it but i fixed it finally by changing these 2 lines
    • Siege Reward Start PM Msg Rework Config root BossDieAnnounce and BossDieSound in the L24Team.properties and Config.java files for global raid boss death notifications and sounds. Adds a new reward_list table to the DB.sql file to track castle rewards. Improves character creation logic for thread safety and validation. Adds extensive state checks to the RequestEnchantItem method to prevent enchantments during inappropriate player states. Fixed auto-attack animation bug (there was no attack animation, only damage animation) Clean Code Other fixes I forgot to list! Java 14 Fixed issue where deleting a character would prevent it from leaving the screen or being removed, or even after a delete CD (it would only exit when re-logging in or creating a new character). Added Premium System from the other C2 project (Needs testing and improvement). Added the "Improved" Community Board (incomplete).
  • 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