VideoCopilot Posted February 6, 2015 Posted February 6, 2015 (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 February 6, 2015 by VideoCopilot Quote
0 Tessa Posted February 6, 2015 Posted February 6, 2015 (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 February 6, 2015 by Tessa Quote
0 StealthyS4m Posted February 6, 2015 Posted February 6, 2015 (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 February 6, 2015 by StealthyS4m Quote
0 Tessa Posted February 6, 2015 Posted February 6, 2015 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... Quote
0 VideoCopilot Posted February 6, 2015 Author Posted February 6, 2015 Tessa i just try spawn mob at the position of the player isnt that code right? Quote
0 VideoCopilot Posted February 6, 2015 Author Posted February 6, 2015 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 Quote
0 Tessa Posted February 6, 2015 Posted February 6, 2015 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. Quote
0 VideoCopilot Posted February 6, 2015 Author Posted February 6, 2015 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 Quote
0 Tessa Posted February 6, 2015 Posted February 6, 2015 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! :) Quote
0 VideoCopilot Posted February 6, 2015 Author Posted February 6, 2015 Ok, tell me which instance you take as a example and I will take a look! :) i send you as private the whole code >.> thx Quote
0 StealthyS4m Posted February 6, 2015 Posted February 6, 2015 (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 February 6, 2015 by StealthyS4m Quote
0 Tryskell Posted February 7, 2015 Posted February 7, 2015 If you use quest scripting, you can do it easily with addSpawn. Quote
Question
VideoCopilot
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:
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 VideoCopilot11 answers to this question
Recommended Posts
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.