Jump to content
  • 0

Question

Posted (edited)

Hello i made an event and i try once the player go there and transform after this the mobs spawn or npc's whatever

and i use this code:

public List<L2Spawn> _MonsterSpawn = new FastList<L2Spawn>();
private int[] mobs={ 21162, 21253, 21184, 21205, 21163, 21254, 21206, 21185, 21255, 21207, 21165, 21186 };
public static L2Spawn _mobsSpawn;

.
.
.
.
.
.
.

private void spawnGuards(final EventPlayer player)
	{

		L2NpcTemplate tmpl = NpcTable.getInstance().getTemplate(mobs[Rnd.get(0, 11)]);// ID do mob
		
		try
		{
			_mobsSpawn = new L2Spawn(tmpl);
			 
			_mobsSpawn.setLocx(player.getX() + Rnd.get(650) - Rnd.get(350) + Rnd.get(150)); // loc x
			_mobsSpawn.setLocy(player.getY() + Rnd.get(650) - Rnd.get(250) + Rnd.get(140)); // loc y
			_mobsSpawn.setLocz(player.getZ()); // loc z			
			 
			_mobsSpawn.setAmount(1);
			_mobsSpawn.setHeading(0);
			_mobsSpawn.setRespawnDelay(150000);
			_mobsSpawn.setLocation(0);
			_mobsSpawn.setInstanceId(player.getInstanceId());
			 
			_MonsterSpawn.add(_mobsSpawn);
			_mobsSpawn = null;
		
		
		}
		catch (Exception e)
		{
		System.out.println("Error in event");
		}

	}
	
	private void transformPlayer(final EventPlayer player)
	{
		player.setNameColor(255, 0, 0);
		player.transform(303);
		player.setStatus(1);
		untransformMutant();
		player.broadcastUserInfo();
		mutant = player;
		spawnGuards(player);
		
	}
 

So player transform but mobs no spawn... 

I though maybe is because inside the event engine where  player.teleToEventArea(); 

is instance and yes it was so i used 

_mobsSpawn.setInstanceId(player.getInstanceId());

 

to be in same instance with player

but still i cant see them or i dont see if they spawn... (ps no errors in GS)

Edited by VideoCopilot

11 answers to this question

Recommended Posts

  • 0
Posted (edited)

I don't know how the instances works, probably you too... but what exactly you trying to do with that?

private void spawnGuards(final EventPlayer player)
	{
 
		L2NpcTemplate tmpl = NpcTable.getInstance().getTemplate(mobs[Rnd.get(0, 11)]);// ID do mob
		
		try
		{
			_mobsSpawn = new L2Spawn(tmpl);
			 
			_mobsSpawn.setLocx(player.getX() + Rnd.get(650) - Rnd.get(350) + Rnd.get(150)); // loc x
			_mobsSpawn.setLocy(player.getY() + Rnd.get(650) - Rnd.get(250) + Rnd.get(140)); // loc y
			_mobsSpawn.setLocz(player.getZ()); // loc z			
			 
			_mobsSpawn.setAmount(1);
			_mobsSpawn.setHeading(0);
			_mobsSpawn.setRespawnDelay(150000);
			_mobsSpawn.setLocation(0);
			_mobsSpawn.setInstanceId(player.getInstanceId());
			 
			_MonsterSpawn.add(_mobsSpawn);
			_mobsSpawn = null;
		
		
		}
		catch (Exception e)
		{
		System.out.println("Error in event");
		}
 
	}
Edited by Tessa
  • 0
Posted (edited)

Hello,
I don't know much about spawning yet,so I can't help you there,but if I am correct,if it throws error,you can't see it,because you have System.out.println,you should use _log.log(Level.WARNING,"Error in event"); but first create: protected static Logger _log = Logger.getLogger(YourClassName.class.getName());
EDIT:Tessa,I believe he is trying to spawn mob near player position.

Edited by StealthyS4m
  • 0
Posted

Hello,

I don't know much about spawning yet,so I can't help you there,but if I am correct,if it throws error,you can't see it,because you have System.out.println,you should use _log.log(Level.WARNING,"Error in event"); but first create: protected static Logger _log = Logger.getLogger(YourClassName.class.getName());

EDIT:Tessa,I believe he is trying to spawn mob near player position.

According to this code, he tries to do nothing...

  • 0
Posted

Hello,

I don't know much about spawning yet,so I can't help you there,but if I am correct,if it throws error,you can't see it,because you have System.out.println,you should use _log.log(Level.WARNING,"Error in event"); but first create: protected static Logger _log = Logger.getLogger(YourClassName.class.getName());

EDIT:Tessa,I believe he is trying to spawn mob near player position.

ye you are right about error message too i forgot to add it

  • 0
Posted

Tessa i just try spawn mob  at the position of the player isnt that code right?

Take a look at the already existing instances and you will find everything you need.

  • 0
Posted

Take a look at the already existing instances and you will find everything you need.

can you add me on skype a bit i wanna share you screen to show you the code about instance to see that its the same -.- still no work im not idiot

  • 0
Posted

can you add me on skype a bit i wanna share you screen to show you the code about instance to see that its the same -.- still no work im not idiot

Ok, tell me which instance you take as a example and I will take a look! :)

  • 0
Posted (edited)

I am not sure,but I think it should have something like that at the end of the method:
SpawnTable.getInstance().addNewSpawn(_mobSpawn, false);
_mobSpawn.init();

Edited by StealthyS4m

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.



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