Jump to content
  • 0

Spawn one monster after anothers death


Benskis

Question

5 answers to this question

Recommended Posts

  • 0

It is exactly what does the script SummonMinions (can be named differently on different pack than aCis, but it exists on every L2J server normally). Simply add your own entry on MINIONS Map.

 

About the chance aspect, you have to edit it slightly to add such stuff, since it's 100% chance for now. That's a matter of 5 lines : make your own class holding the int[] and the int chance and feed Map with this class model instead of int[], then you Rnd.get( your chance.

Edited by Tryskell
Link to comment
Share on other sites

  • 0

Toi angels works like that. You kill monster x, and angel appears, simply do the same stuff and add chance. 

 

https://xp-dev.com/svn/aCis_public/aCis_gameserver/java/net/sf/l2j/gameserver/scripting/scripts/ai/group/PolymorphingAngel.java

Link to comment
Share on other sites

  • 0
1 hour ago, SweeTs said:

Toi angels works like that. You kill monster x, and angel appears, simply do the same stuff and add chance. 

 

https://xp-dev.com/svn/aCis_public/aCis_gameserver/java/net/sf/l2j/gameserver/scripting/scripts/ai/group/PolymorphingAngel.java

 

Right, SummonMinions is only on attack.

Link to comment
Share on other sites

  • 0

I want to modify acis packet to spawn 5 mobs of the same type in FoG with a chance after a mob uses the skill 'NPC Death Bomb'

This is actually what happen on retail. Any ideas how to achieve that?

Link to comment
Share on other sites

  • 0

I found the solution and share it

I added this new Class into  net.sf.l2j.gameserver.scripting.scripts.ai.group

/*
 * This program is free software: you can redistribute it and/or modify it under
 * the terms of the GNU General Public License as published by the Free Software
 * Foundation, either version 3 of the License, or (at your option) any later
 * version.
 * 
 * This program is distributed in the hope that it will be useful, but WITHOUT
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
 * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
 * details.
 * 
 * You should have received a copy of the GNU General Public License along with
 * this program. If not, see <http://www.gnu.org/licenses/>.
 */
package net.sf.l2j.gameserver.scripting.scripts.ai.group;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import net.sf.l2j.Config;
import net.sf.l2j.commons.random.Rnd;
import net.sf.l2j.gameserver.model.L2Skill;
import net.sf.l2j.gameserver.model.actor.L2Attackable;
import net.sf.l2j.gameserver.model.actor.L2Npc;
import net.sf.l2j.gameserver.model.actor.instance.L2PcInstance;
import net.sf.l2j.gameserver.scripting.EventType;
import net.sf.l2j.gameserver.scripting.QuestState;
import net.sf.l2j.gameserver.scripting.scripts.ai.L2AttackableAIScript;

/**
 * Forge of the Gods spawns... When one mob dies, there is a chance to spawn 5 other mobs of the same type.
 */
public class ForgeOfTheGods extends L2AttackableAIScript
{
	private static final Map<Integer, Integer> FOG_SPAWNS = new HashMap<>();
	
	static
	{
		FOG_SPAWNS.put(21376, 21376);
		FOG_SPAWNS.put(21377, 21377);
		FOG_SPAWNS.put(21378, 21378);
		FOG_SPAWNS.put(21379, 21379);
		FOG_SPAWNS.put(21380, 21380);
		FOG_SPAWNS.put(21381, 21381);
		FOG_SPAWNS.put(21382, 21382);
		FOG_SPAWNS.put(21383, 21383);
		FOG_SPAWNS.put(21384, 21384);
		FOG_SPAWNS.put(21385, 21385);
		FOG_SPAWNS.put(21386, 21386);
		FOG_SPAWNS.put(21387, 21387);
//		FOG_SPAWNS.put(21388, 21388); // Archer type
		FOG_SPAWNS.put(21389, 21389);
		FOG_SPAWNS.put(21390, 21390);
		FOG_SPAWNS.put(21391, 21391);
		FOG_SPAWNS.put(21392, 21392);
		FOG_SPAWNS.put(21393, 21393);
//		FOG_SPAWNS.put(21394, 21394); // Lavasaurus
//		FOG_SPAWNS.put(21395, 21395); // Elder Lavasaurus
		FOG_SPAWNS.put(21652, 21652);
		FOG_SPAWNS.put(21653, 21653);
		FOG_SPAWNS.put(21654, 21654);
		FOG_SPAWNS.put(21655, 21655);
		FOG_SPAWNS.put(21656, 21656);
		FOG_SPAWNS.put(21657, 21657);
	}
	
	public ForgeOfTheGods()
	{
		super("ai/group");
	}
	
	@Override
	protected void registerNpcs()
	{
		addEventIds(FOG_SPAWNS.keySet(), EventType.ON_SPELL_FINISHED);
	}
	
	@Override
	public String onSpellFinished(L2Npc npc, L2PcInstance player, L2Skill skill)
	{		
		if (skill.getId() == 4614)
		{	
			for (int i = 0; i < 5; i++)
			{
				final L2Attackable newNpc = (L2Attackable) addSpawn(FOG_SPAWNS.get(npc.getNpcId()), npc, false, 0, false);
				attack(newNpc, player);
			}
			
			if (player != null) {
				// Output list.
				final List<L2PcInstance> candidates = new ArrayList<>();
				int torch = 7264;
				String qn = "Q617_GatherTheFlames";
				QuestState st = null;
				if (player.isInParty())
				{
					// Filter candidates from player's party.
					for (L2PcInstance partyMember : player.getParty().getPartyMembers())
					{
						st = partyMember.getQuestState(qn);
						// Check party members' quest state and range from npc.
						if (st.isStarted() && partyMember.isInsideRadius(npc, Config.ALT_PARTY_RANGE, true, false))
							candidates.add(partyMember);
					}
					if (!candidates.isEmpty())
						Rnd.get(candidates).getQuestState(qn).dropItemsAlways(torch, 1, 0);
				}
				else
				{
					st = player.getQuestState(qn);
					if (st.isStarted())
						st.dropItemsAlways(torch, 1, 0);
				}
			}
		}
		
		return null;
	}
}

and the following line into gameserver/data/xml/scipts.xml

	<script path="scripts.ai.group.ForgeOfTheGods"/>

 

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

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...