Jump to content

Question

Posted

Hello I'm improving this part more always of this error !!

 

elTD9PC.png

 

modified code

try
		{
			NpcTemplate template = NpcData.getInstance().getTemplate(Config.CTF_EVENT_TEAM_1_HEADQUARTERS);
			L2Spawn spawn = new L2Spawn(template);
			spawn.setLoc(Config.CTF_EVENT_TEAM_1_FLAG_COORDINATES[0], Config.CTF_EVENT_TEAM_1_FLAG_COORDINATES[1], Config.CTF_EVENT_TEAM_1_FLAG_COORDINATES[2], 0);
			
			SpawnTable.getInstance().addNewSpawn(spawn, false);
			Npc npc = spawn.doSpawn(true);
			npc.scheduleDespawn(Config.CTF_EVENT_RUNNING_TIME * 1000 * 60);
			npc.broadcastPacket(new MagicSkillUse(npc, npc, 1034, 1, 1, 1));
			
			template = NpcData.getInstance().getTemplate(Config.CTF_EVENT_TEAM_2_HEADQUARTERS);
			spawn = new L2Spawn(template);
			spawn.setLoc(Config.CTF_EVENT_TEAM_2_FLAG_COORDINATES[0], Config.CTF_EVENT_TEAM_2_FLAG_COORDINATES[1], Config.CTF_EVENT_TEAM_2_FLAG_COORDINATES[2], 0);
			
			SpawnTable.getInstance().addNewSpawn(spawn, false);
			npc = spawn.doSpawn(true);
			npc.scheduleDespawn(Config.CTF_EVENT_RUNNING_TIME * 1000 * 60);
			npc.broadcastPacket(new MagicSkillUse(npc, npc, 1034, 1, 1, 1));
		}
		catch (Exception e)
		{
			_log.log(Level.WARNING, "CaptureTheFlag > spanwnFlags: " + e.getMessage(), e);
		}

 

Code original

 

try
		{
			NpcTemplate tmpl = NpcData.getInstance().getTemplate(Config.CTF_EVENT_TEAM_1_HEADQUARTERS);
			_flag1Spawn = new L2Spawn(tmpl);
			_flag1Spawn.setLoc(Config.CTF_EVENT_TEAM_1_FLAG_COORDINATES[0], Config.CTF_EVENT_TEAM_1_FLAG_COORDINATES[1], Config.CTF_EVENT_TEAM_1_FLAG_COORDINATES[2], MathUtil.calculateHeadingFrom(new Location(Config.CTF_EVENT_TEAM_1_FLAG_COORDINATES[0], Config.CTF_EVENT_TEAM_1_FLAG_COORDINATES[1], Config.CTF_EVENT_TEAM_1_FLAG_COORDINATES[2]), new Location(Config.CTF_EVENT_TEAM_2_FLAG_COORDINATES[0], Config.CTF_EVENT_TEAM_2_FLAG_COORDINATES[1], Config.CTF_EVENT_TEAM_2_FLAG_COORDINATES[2])));
			_flag1Spawn.setRespawnDelay(1);
			
			SpawnTable.getInstance().addNewSpawn(_flag1Spawn, false);
			_flag1Spawn.setRespawnState(true);
			_flag1Spawn.doSpawn(false);
			_lastFlag1Spawn = _flag1Spawn.getNpc();
			_lastFlag1Spawn.setCurrentHp(_lastFlag1Spawn.getMaxHp());
			_lastFlag1Spawn.setTitle(Config.CTF_EVENT_TEAM_1_NAME);
			_lastFlag1Spawn.isAggressive();
			_lastFlag1Spawn.decayMe();
			_lastFlag1Spawn.spawnMe(_flag1Spawn.getNpc().getX(), _flag1Spawn.getNpc().getY(), _flag1Spawn.getNpc().getZ());
			_lastFlag1Spawn.setIsInvul(true);
			
			NpcTemplate tmpl2 = NpcData.getInstance().getTemplate(Config.CTF_EVENT_TEAM_2_HEADQUARTERS);
			_flag2Spawn = new L2Spawn(tmpl2);
			_flag2Spawn.setLoc(Config.CTF_EVENT_TEAM_2_FLAG_COORDINATES[0], Config.CTF_EVENT_TEAM_2_FLAG_COORDINATES[1], Config.CTF_EVENT_TEAM_2_FLAG_COORDINATES[2], MathUtil.calculateHeadingFrom(new Location(Config.CTF_EVENT_TEAM_2_FLAG_COORDINATES[0], Config.CTF_EVENT_TEAM_2_FLAG_COORDINATES[1], Config.CTF_EVENT_TEAM_2_FLAG_COORDINATES[2]), new Location(Config.CTF_EVENT_TEAM_1_FLAG_COORDINATES[0], Config.CTF_EVENT_TEAM_1_FLAG_COORDINATES[1], Config.CTF_EVENT_TEAM_1_FLAG_COORDINATES[2])));
			_flag2Spawn.setRespawnDelay(1);
			
			SpawnTable.getInstance().addNewSpawn(_flag2Spawn, false);
			_flag2Spawn.setRespawnState(true);
			_flag2Spawn.doSpawn(false);
			_lastFlag2Spawn = _flag2Spawn.getNpc();
			_lastFlag2Spawn.setCurrentHp(_lastFlag2Spawn.getMaxHp());
			_lastFlag2Spawn.setTitle(Config.CTF_EVENT_TEAM_2_NAME);
			_lastFlag2Spawn.isAggressive();
			_lastFlag2Spawn.decayMe();
			_lastFlag2Spawn.spawnMe(_flag2Spawn.getNpc().getX(), _flag2Spawn.getNpc().getY(), _flag2Spawn.getNpc().getZ());
			_lastFlag2Spawn.setIsInvul(true);
			_lastFlag2Spawn.setTarget(_lastFlag2Spawn);
		}
		catch (Exception e)
		{
			_log.log(Level.WARNING, "CTFEventEngine[CTFEvent.spanwnFlags]: exception: " + e.getMessage(), e);
		}

 

1 answer to this question

Recommended Posts

Guest
This topic is now closed to further replies.
×
×
  • Create New...