Jump to content
  • 0

Question

6 answers to this question

Recommended Posts

  • 0
Posted

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.

  • 0
Posted

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

  • 0
Posted

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

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


×
×
  • 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