Jump to content

Basic Event Drop Monsters


Recommended Posts

mini event to let the happy friends! rsrs ^^
 
info:
set //dropmonsters and wait 60secs to start
 
==========================================================
 
go to com.seuprojeto.gameserver.model.event
new DropMonstersEvent.java
package com.l2jdemonniac.gameserver.model.event;
 
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.SQLException;
import java.util.List;
 
import javolution.util.FastList;
 
import com.l2jdemonniac.Config;
import com.l2jdemonniac.gameserver.datatables.sql.NpcTable;
import com.l2jdemonniac.gameserver.datatables.sql.SpawnTable;
import com.l2jdemonniac.gameserver.model.L2World;
import com.l2jdemonniac.gameserver.model.actor.instance.L2ItemInstance;
import com.l2jdemonniac.gameserver.model.actor.instance.L2PcInstance;
import com.l2jdemonniac.gameserver.model.entity.Announcements;
import com.l2jdemonniac.gameserver.model.spawn.L2Spawn;
import com.l2jdemonniac.gameserver.templates.L2NpcTemplate;
import com.l2jdemonniac.gameserver.thread.ThreadPoolManager;
import com.l2jdemonniac.util.database.L2DatabaseFactory;
import com.l2jdemonniac.util.random.Rnd;
 
/**
 * @author allanalcantara
 *         
 */
 
public class DropMonstersEvent implements Runnable
{
 
public static L2Spawn _mobsSpawn;
public static boolean TownMonsterAtivo = false;
public static int _bossHeading = 0;
@SuppressWarnings("unused")
public List<L2Spawn> _MonsterSpawn = new FastList<L2Spawn>();
 
static int[] mobs={ 21162, 21253, 21184, 21205, 21163, 21254, 21206, 21185, 21255, 21207, 21165, 21186 };
 
 
public void eventomanager()
{
TownMonsterAtivo = true;
Announcements.getInstance().gameAnnouncetoEvents("The event will start at 60 Seconds.");
waitSecs(60);
spawnMonstersEvent();
Announcements.getInstance().gameAnnouncetoEvents("The event will finish in 30 Minutes.");
wait(30);
ThreadPoolManager.getInstance().scheduleGeneral(new unspawnMonstersrun(), 1);
waitSecs(10);
TownMonsterAtivo = false;
Announcements.getInstance().gameAnnouncetoEvents("The event ended.");
}
 
class unspawnMonstersrun implements Runnable
{
@Override
public void run()
{
unspawnMonsters();
}
}
 
private void SpawnMonster1()
{
L2NpcTemplate tmpl = NpcTable.getInstance().getTemplate(mobs[Rnd.get(0, 11)]);// ID do mob
 
try
{
int valorr = 1;
 
while (valorr < 25)
{
_mobsSpawn = new L2Spawn(tmpl);
 
_mobsSpawn.setLocx(149013 + Rnd.get(950) - Rnd.get(350) + Rnd.get(150)); // loc x
_mobsSpawn.setLocy(16694 + Rnd.get(950) - Rnd.get(250) + Rnd.get(140)); // loc y
_mobsSpawn.setLocz(-1541); // loc z
 
_mobsSpawn.setAmount(1);
_mobsSpawn.setHeading(0);
_mobsSpawn.setRespawnDelay(150000);
_mobsSpawn.setLocation(0);
 
//SpawnTable.getInstance().addNewSpawn(_mobsSpawn, false); 
_MonsterSpawn.add(_mobsSpawn);
_mobsSpawn = null;
 
valorr++;
 
}
}
catch (Exception e)
{
System.out.println("Error in event");
}
}
 
private void SpawnMonster01()
{
L2NpcTemplate tmpl = NpcTable.getInstance().getTemplate(mobs[Rnd.get(0, 11)]);// ID do mob
 
try
{
int valorr = 1;
Announcements.getInstance().gameAnnouncetoEvents("The boxes are in Aden Castle.");
 
while (valorr < 30)
{
_mobsSpawn = new L2Spawn(tmpl);
 
_mobsSpawn.setLocx(145885 + Rnd.get(950) + (Rnd.get(50) * 2) - Rnd.get(350) + Rnd.get(150)); // loc x
_mobsSpawn.setLocy(16830 + Rnd.get(950) + (Rnd.get(30) * 2) - Rnd.get(310) + Rnd.get(130)); // loc y
_mobsSpawn.setLocz(-1560); // loc z
 
_mobsSpawn.setAmount(1);
_mobsSpawn.setHeading(0);
_mobsSpawn.setRespawnDelay(150000);
_mobsSpawn.setLocation(0);
 
//SpawnTable.getInstance().addNewSpawn(_mobsSpawn, false); 
_MonsterSpawn.add(_mobsSpawn);
_mobsSpawn = null;
 
valorr++;
 
}
}
catch (Exception e)
{
System.out.println("Error in event");
}
}
 
private void SpawnMonster2()
{
L2NpcTemplate tmpl = NpcTable.getInstance().getTemplate(mobs[Rnd.get(0, 11)]);// ID do mob
 
try
{
int valorr = 1;
 
while (valorr < 25)
{
_mobsSpawn = new L2Spawn(tmpl);
 
_mobsSpawn.setLocx(87054 + Rnd.get(950) + (Rnd.get(50) * 2) - Rnd.get(350) + Rnd.get(150)); // loc x
_mobsSpawn.setLocy(148844 + Rnd.get(950) - (Rnd.get(30) * 2) + Rnd.get(200) + Rnd.get(110)); // loc y
_mobsSpawn.setLocz(-3061); // loc z
 
_mobsSpawn.setAmount(1);
_mobsSpawn.setHeading(0);
_mobsSpawn.setRespawnDelay(150000);
_mobsSpawn.setLocation(0);
 
//SpawnTable.getInstance().addNewSpawn(_mobsSpawn, false); 
_MonsterSpawn.add(_mobsSpawn);
_mobsSpawn = null;
 
valorr++;
 
}
}
catch (Exception e)
{
System.out.println("Error in event");
}
}
 
private void SpawnMonster02()
{
L2NpcTemplate tmpl = NpcTable.getInstance().getTemplate(mobs[Rnd.get(0, 11)]);// ID do mob
 
try
{
int valorr = 1;
Announcements.getInstance().gameAnnouncetoEvents("The boxes are in entrance of Monastery.");
 
while (valorr < 30)
{
_mobsSpawn = new L2Spawn(tmpl);
 
_mobsSpawn.setLocx(124109 + Rnd.get(950) + (Rnd.get(50) * 2) - Rnd.get(350) + Rnd.get(150)); // loc x
_mobsSpawn.setLocy(-74952 + Rnd.get(950) + (Rnd.get(30) * 2) - Rnd.get(310) + Rnd.get(130)); // loc y
_mobsSpawn.setLocz(-2915); // loc z
 
_mobsSpawn.setAmount(1);
_mobsSpawn.setHeading(0);
_mobsSpawn.setRespawnDelay(150000);
_mobsSpawn.setLocation(0);
 
//SpawnTable.getInstance().addNewSpawn(_mobsSpawn, false); 
_MonsterSpawn.add(_mobsSpawn);
_mobsSpawn = null;
 
valorr++;
 
}
}
catch (Exception e)
{
System.out.println("Error in event");
}
}
 
private void SpawnMonster3()
{
L2NpcTemplate tmpl = NpcTable.getInstance().getTemplate(mobs[Rnd.get(0, 11)]);// ID do mob
 
try
{
int valorr = 1;
 
while (valorr < 25)
{
_mobsSpawn = new L2Spawn(tmpl);
 
_mobsSpawn.setLocx(124860 + Rnd.get(950) + (Rnd.get(50) * 2) - Rnd.get(350) + Rnd.get(150)); // loc x
_mobsSpawn.setLocy(-75504 + Rnd.get(950) + (Rnd.get(20) * 2) - Rnd.get(200) + Rnd.get(110)); // loc y
_mobsSpawn.setLocz(-2912); // loc z
 
_mobsSpawn.setAmount(1);
_mobsSpawn.setHeading(0);
_mobsSpawn.setRespawnDelay(150000);
_mobsSpawn.setLocation(0);
 
//SpawnTable.getInstance().addNewSpawn(_mobsSpawn, false); 
_MonsterSpawn.add(_mobsSpawn);
_mobsSpawn = null;
 
valorr++;
 
}
}
catch (Exception e)
{
System.out.println("Error in event");
}
}
 
private void SpawnMonster03()
{
L2NpcTemplate tmpl = NpcTable.getInstance().getTemplate(mobs[Rnd.get(0, 11)]);// ID do mob
 
try
{
int valorr = 1;
Announcements.getInstance().gameAnnouncetoEvents("The boxes are in Giran.");
 
while (valorr < 20)
{
_mobsSpawn = new L2Spawn(tmpl);
 
_mobsSpawn.setLocx(82732 + Rnd.get(950) + (Rnd.get(50) * 2) - Rnd.get(350) + Rnd.get(150)); // loc x
_mobsSpawn.setLocy(148723 + Rnd.get(950) + (Rnd.get(30) * 2) - Rnd.get(310) + Rnd.get(130)); // loc y
_mobsSpawn.setLocz(-3471); // loc z
 
_mobsSpawn.setAmount(1);
_mobsSpawn.setHeading(0);
_mobsSpawn.setRespawnDelay(150000);
_mobsSpawn.setLocation(0);
 
//SpawnTable.getInstance().addNewSpawn(_mobsSpawn, false); 
_MonsterSpawn.add(_mobsSpawn);
_mobsSpawn = null;
 
valorr++;
 
}
}
catch (Exception e)
{
System.out.println("Error in event");
}
}
 
private void SpawnMonster4()
{
L2NpcTemplate tmpl = NpcTable.getInstance().getTemplate(mobs[Rnd.get(0, 11)]);// ID do mob
 
try
{
int valorr = 1;
 
while (valorr < 25)
{
_mobsSpawn = new L2Spawn(tmpl);
 
_mobsSpawn.setLocx(81948 + Rnd.get(950) + (Rnd.get(30) * 2) - Rnd.get(350) + Rnd.get(150)); // loc x
_mobsSpawn.setLocy(147837 + Rnd.get(950) + (Rnd.get(30) * 2) - Rnd.get(200) + Rnd.get(110)); // loc y
_mobsSpawn.setLocz(-3471); // loc z
 
_mobsSpawn.setAmount(1);
_mobsSpawn.setHeading(0);
_mobsSpawn.setRespawnDelay(150000);
_mobsSpawn.setLocation(0);
 
//SpawnTable.getInstance().addNewSpawn(_mobsSpawn, false); 
_MonsterSpawn.add(_mobsSpawn);
_mobsSpawn = null;
 
valorr++;
 
}
}
catch (Exception e)
{
System.out.println("Error in event");
}
}
 
private void SpawnMonster04()
{
L2NpcTemplate tmpl = NpcTable.getInstance().getTemplate(mobs[Rnd.get(0, 11)]);// ID do mob
 
try
{
int valorr = 1;
Announcements.getInstance().gameAnnouncetoEvents("The boxes are in Near the Town of Dion.");
 
while (valorr < 15)
{
_mobsSpawn = new L2Spawn(tmpl);
 
_mobsSpawn.setLocx(19023 + Rnd.get(950) + (Rnd.get(50) * 2) - Rnd.get(350) + Rnd.get(150)); // loc x
_mobsSpawn.setLocy(141199 + Rnd.get(950) - (Rnd.get(30) * 2) + Rnd.get(200) + Rnd.get(110)); // loc y
_mobsSpawn.setLocz(-3340); // loc z
 
_mobsSpawn.setAmount(1);
_mobsSpawn.setHeading(0);
_mobsSpawn.setRespawnDelay(150000);
_mobsSpawn.setLocation(0);
 
//SpawnTable.getInstance().addNewSpawn(_mobsSpawn, false); 
_MonsterSpawn.add(_mobsSpawn);
_mobsSpawn = null;
 
valorr++;
 
}
}
catch (Exception e)
{
System.out.println("Error in event");
}
}
 
private void SpawnMonster5()
{
L2NpcTemplate tmpl = NpcTable.getInstance().getTemplate(mobs[Rnd.get(0, 11)]);// ID do mob
 
try
{
int valorr = 1;
 
while (valorr < 25)
{
_mobsSpawn = new L2Spawn(tmpl);
 
_mobsSpawn.setLocx(20781 + Rnd.get(950) + (Rnd.get(50) * 2) - Rnd.get(350) + Rnd.get(150)); // loc x
_mobsSpawn.setLocy(140355 + Rnd.get(950) - (Rnd.get(30) * 2) + Rnd.get(200) + Rnd.get(110)); // loc y
_mobsSpawn.setLocz(-3464); // loc z
 
_mobsSpawn.setAmount(1);
_mobsSpawn.setHeading(0);
_mobsSpawn.setRespawnDelay(150000);
_mobsSpawn.setLocation(0);
 
//SpawnTable.getInstance().addNewSpawn(_mobsSpawn, false); 
_MonsterSpawn.add(_mobsSpawn);
_mobsSpawn = null;
 
valorr++;
 
}
}
catch (Exception e)
{
System.out.println("Error in event");
}
}
 
private void SpawnMonster05()
{
L2NpcTemplate tmpl = NpcTable.getInstance().getTemplate(mobs[Rnd.get(0, 11)]);// ID do mob
 
try
{
int valorr = 1;
Announcements.getInstance().gameAnnouncetoEvents("The boxes are in west of gludin, Near the harbor.");
 
while (valorr < 20)
{
_mobsSpawn = new L2Spawn(tmpl);
 
_mobsSpawn.setLocx(-86372 + Rnd.get(950) + (Rnd.get(50) * 2) - Rnd.get(350) + Rnd.get(150)); // loc x
_mobsSpawn.setLocy(150012 + Rnd.get(950) - (Rnd.get(30) * 2) + Rnd.get(200) + Rnd.get(110)); // loc y
_mobsSpawn.setLocz(-3061); // loc z
 
_mobsSpawn.setAmount(1);
_mobsSpawn.setHeading(0);
_mobsSpawn.setRespawnDelay(150000);
_mobsSpawn.setLocation(0);
 
//SpawnTable.getInstance().addNewSpawn(_mobsSpawn, false); 
_MonsterSpawn.add(_mobsSpawn);
_mobsSpawn = null;
 
valorr++;
 
}
}
catch (Exception e)
{
System.out.println("Error in event");
}
}
 
public static void waitSecs(int i)
{
try
{
Thread.sleep(i * 1000);
}
catch (InterruptedException ie)
{
ie.printStackTrace();
}
}
 
public static void wait(int i)
{
try
{
Thread.sleep(i * 60000);
}
catch (InterruptedException ie)
{
ie.printStackTrace();
}
}
 
public final List<L2Spawn> getMonsterIds()
{
return _MonsterSpawn;
}
 
public void unspawnMonsters()
{
for (L2Spawn spawn : getMonsterIds())
{
spawn.stopRespawn();
spawn.getLastSpawn().doDie(spawn.getLastSpawn());
}
 
getMonsterIds().clear();
}
 
public void spawnMonstersEvent()
{
int city = Rnd.get(5) + 1;
if (city == 1)
{
SpawnMonster1();
SpawnMonster01();
}
else if (city == 2)
{
SpawnMonster2();
SpawnMonster02();
}
else if (city == 3)
{
SpawnMonster3();
SpawnMonster03();
}
else if (city == 4)
{
SpawnMonster4();
SpawnMonster04();
}
else if (city == 5)
{
SpawnMonster5();
SpawnMonster05();
}
for (L2Spawn spawn : getMonsterIds())
if (spawn != null)
{
spawn.init();
}
}
 
@Override
public void run()
{
if (TownMonsterAtivo == true)
{
return;
}
 
eventomanager();
 
} 
}
 
go com.seuprojeto.gameserver.handler.admincommandhandlers
new AdminDropMonstersEvent.java
package com.l2jdemonniac.gameserver.handler.admincommandhandlers;
 
import com.l2jdemonniac.Config;
import com.l2jdemonniac.gameserver.handler.IAdminCommandHandler;
import com.l2jdemonniac.gameserver.model.actor.instance.L2PcInstance;
import com.l2jdemonniac.gameserver.model.entity.event.DropMonstersEvent;
import com.l2jdemonniac.gameserver.thread.ThreadPoolManager;
 
public class AdminDropMonstersEvent implements IAdminCommandHandler
{
 
public AdminDropMonstersEvent()
{
}
 
@Override
public boolean useAdminCommand(String command, L2PcInstance activeChar)
{
if (command.startsWith("admin_dropmonsters"))
{
ThreadPoolManager.getInstance().scheduleGeneral(new DropMonstersEvent(), 1);
}
return true;
}
 
@Override
public String[] getAdminCommandList()
{
return ADMIN_COMMANDS;
}
 
private static final String ADMIN_COMMANDS[] =
{
"admin_dropmonsters"
};
 
}
 
dont forget:
 
AdminCommandHandler:
import com.l2jdemonniac.gameserver.handler.admincommandhandlers.AdminRandomFight;
+import com.l2jdemonniac.gameserver.handler.admincommandhandlers.AdminDropMonstersEvent;
======
registerAdminCommandHandler(new AdminRandomFight());
+registerAdminCommandHandler(new AdminDropMonstersEvent());

 

basically its a event where you choose the id of the monsters " make some specials ones or w.e"  setup a spawner, with random spawn " X coordinate - randomly generated number etc.) From what the code states there are 4 different spawner's, and it gets picked at random, so for example if it rolls aden castle, like the coordinates suggests then it will spawn the monsters there, and so on.

People have X amount of time to kill them and get special rewards, then after that X amount of time mobs disappear and then you can set the timer or set them manually from the admin commands.

events by me

 
thx, enjoy!
Edited by allanalcantara
Link to comment
Share on other sites

From reading the code, 

 

basically its a event where you choose the id of the monsters " make some specials ones or w.e"  setup a spawner, with random spawn " X coordinate - randomly generated number etc.) From what the code states there are 4 different spawner's, and it gets picked at random, so for example if it rolls aden castle, like the coordinates suggests then it will spawn the monsters there, and so on.

 

People have X amount of time to kill them and get special rewards, then after that X amount of time mobs disappear and then you can set the timer or set them manually from the admin commands.

Link to comment
Share on other sites

Maybe you could add a description ?

What the hell is that event .. ?!

¬¬'

 

From reading the code, 

 

basically its a event where you choose the id of the monsters " make some specials ones or w.e"  setup a spawner, with random spawn " X coordinate - randomly generated number etc.) From what the code states there are 4 different spawner's, and it gets picked at random, so for example if it rolls aden castle, like the coordinates suggests then it will spawn the monsters there, and so on.

 

People have X amount of time to kill them and get special rewards, then after that X amount of time mobs disappear and then you can set the timer or set them manually from the admin commands.

thx you for informing! :]

Link to comment
Share on other sites

  • 4 months later...

can you make it for Hi5 please

 

 Revision 6670 server
Revision 10490:DataPack_BETA

 

how and where i need to put  DropMonstersEvent.java

and were i need to put

registerAdminCommandHandler(new AdminDropMonstersEvent());

 

thanks

Edited by Attila
Link to comment
Share on other sites

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


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