Skip to content

Help ME Auto Spawn NPC

Featured Replies

help create auto Spawn  NPC time 06.00 ,09.00 ,12.30 , 14.00 ,20.00, 00.00, 03.00

spawn  60 Minutes.

 

 

You can create new TASK, take a look at tasks from:

 

\gameserver\taskmanager\tasks

 

And take a look about how does it work.

 

Also there is guide about task manager shared already aswell.

 

Use search.

  • Author

I invite you to search how mammons NPCs are spawned and removed.

 

No search not found 

 

search  for key  spawned and removed, NPCs are spawned,

package custom.Test;

import java.util.Calendar;

import com.l2jserver.Config;
import com.l2jserver.gameserver._announcements;
import com.l2jserver.gameserver.model.actor.L2Npc;
import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
import com.l2jserver.gameserver.model.quest.Quest;

public class Test extends Quest
{
  private static final boolean _announce = true; 
  private static final int _event_duration = 2;
  private static final int _event_delay = 3;

  private static final Byte _start_hour = 0;
                                                                    
  private static final Byte _start_minute = 0;

  private static final int _event_frequency = 360;

  public Test(int questId, String name, String descr)
  {
     super(questId, name, descr);

     if (loadGlobalQuestVar("") == "")
     {
        if (_start_hour > 0)
           startQuestTimer("START", setStartTime(_start_hour, _start_minute), null, null);
        else
           startQuestTimer("START", _event_delay * 60000, null, null);
     }
     else 
        startQuestTimer("RESTORE", 60000, null, null);
  }

  private long setStartTime(Byte minute, Byte hour)
  {
     Calendar starttime = Calendar.getInstance();
     if (hour > 0 && hour < 24)
        starttime.set( Calendar.HOUR_OF_DAY, hour );
     else _log.info("Skipped.");
     if (minute > 0 && minute < 60)
        starttime.set( Calendar.MINUTE, minute );
     else if (minute > 60)
        starttime.set( Calendar.MINUTE, minute % 60 );
     if ((starttime.getTimeInMillis() - Calendar.getInstance().getTimeInMillis()) > 0)
        return (starttime.getTimeInMillis() - Calendar.getInstance().getTimeInMillis());
     else return 60000L;
  }

  public String onAdvEvent(String event, L2Npc npc, L2PcInstance player)
  {
     if (event.equalsIgnoreCase("START"))
     {
        
     }

     if (event.equalsIgnoreCase("RESTORE"))
     {
        
        if (_start_hour > 0)
           startQuestTimer("START", setStartTime(_start_hour, _start_minute), null, null);
        else if (_event_frequency > 0)
           startQuestTimer("START", _event_frequency * 60000, null, null);
     }
     return "";
  }

  public static void main(String[] args)
  {
     new Test(-1, "Test", "custom");
  }
}

 

example for your spawn. now just add spawn func to it. look at event "elpys" in DP side if you use freya

public void spawnSevenSignsNPC()

 

eKo, such a big code for a little thing o_o.

public void spawnSevenSignsNPC()

 

eKo, such a big code for a little thing o_o.

 

just as an example o_o, i had it on my files was used for smth else

Create an account or sign in to comment

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.