Jump to content
  • 0

Question

Posted

Hello, i want make an event that when monsters spawn somewhere (i set), they automatical start walking and attack something (a target)

So the idea is to spawn something like Flag and monsters once they spawn they try to attack flag and kill it (players try defend flag)

 

So my question is how i set mobs or something to Attack something that is far away? example the mob walk outside giran castle -> inside giran castle

or point to point ?

 

Thanks in advance

8 answers to this question

Recommended Posts

  • 0
Posted (edited)

By Pa'agrio, my eyes are bleeding.

 

Avoid to create so much methods until they are used in another location. It becomes unreadable.

 

I guess "npc" is the NPC to attack (let's called him "victim") ? He must walk and reach a position, meanwhile mobs are spawning and must kill it ?

 

If you want an hint try to make steps...

 

Step 1 : spawn your victim and make it walk.

Step 2 : spawn monsters at interval X. We don't care about anything else.

Step 3 : monsters must run and follow a path. Probably you have to create that path, until monsters spawn around the NPC, which is far easier to handle (no need to care about a lot of thing, you just have to reuse current victim position and spawn monsters).

Step 4 : monsters must attack the NPC.

 

Do your stuff in that order and don't go on another step until you reached previous step.

 

A generic, one time spawn is handled by following :

NpcTemplate template = NpcTable.getInstance().getTemplate(npcId);
if (template != null)
{
	if (randomOffset)
	{
		x += Rnd.get(-100, 100);
		y += Rnd.get(-100, 100);
	}
				
	L2Spawn spawn = new L2Spawn(template);
	spawn.setHeading(heading);
	spawn.setLocx(x);
	spawn.setLocy(y);
	spawn.setLocz(z + 20);
	spawn.stopRespawn();
	L2Npc result = spawn.doSpawn(isSummonSpawn);
				
	if (despawnDelay > 0)
		result.scheduleDespawn(despawnDelay);

        // Affect the newly spawned NPC "result" here
        result.doSomething();
}

Where parameters are following :

 

* @param npcId : the NPC template to spawn.
* @param x
* @param y
* @param z
* @param heading
* @param randomOffset : if true, set a random position
* @param despawnDelay : despawn delay, if any (0 means permanent).
* @param isSummonSpawn : if true, spawn with animation (if any exists).
 
If you want to affect the newly spawned npc, then affect "result", like :
result.setWalking();

PS : methods names are perhaps different on your pack, I checked on my own pack, aCis.

 

The above code should be put in a method, and can be reused on your event. Or simply see addSpawn from Quest.java.

Edited by Tryskell
  • 0
Posted

Tryskell i did this

 

 

public void spawnMonstersEvent(final L2Npc npc)

{
 
 
SpawnMonster1();
SpawnMonster01();
waitSecs(2);
 
npc.setWalking();
npc.getAI().setIntention(CtrlIntention.AI_INTENTION_MOVE_TO, new L2CharPosition(82238, 147903, -3471, 0));
 
 
 
 
for (L2Spawn spawn : getMonsterIds())
if (spawn != null)
{
spawn.init();
}
}

 

i was not sure... but again it give error and mobs does not spawn with these extra lines

 

npc.setWalking();
npc.getAI().setIntention(CtrlIntention.AI_INTENTION_MOVE_TO, new L2CharPosition(82238, 147903, -3471, 0));
  • 0
Posted

By Pa'agrio, my eyes are bleeding.

 

Avoid to create so much methods until they are used in another location. It becomes unreadable.

 

I guess "npc" is the NPC to attack (let's called him "victim") ? He must walk and reach a position, meanwhile mobs are spawning and must kill it ?

 

If you want an hint try to make steps...

 

Step 1 : spawn your victim and make it walk.

Step 2 : spawn monsters at interval X. We don't care about anything else.

Step 3 : monsters must run and follow a path. Probably you have to create that path, until monsters spawn around the NPC, which is far easier to handle (no need to care about a lot of thing, you just have to reuse current victim position and spawn monsters).

Step 4 : monsters must attack the NPC.

 

Do your stuff in that order and don't go on another step until you reached previous step.

 

A generic, one time spawn is handled by following :

NpcTemplate template = NpcTable.getInstance().getTemplate(npcId);
if (template != null)
{
	if (randomOffset)
	{
		x += Rnd.get(-100, 100);
		y += Rnd.get(-100, 100);
	}
				
	L2Spawn spawn = new L2Spawn(template);
	spawn.setHeading(heading);
	spawn.setLocx(x);
	spawn.setLocy(y);
	spawn.setLocz(z + 20);
	spawn.stopRespawn();
	L2Npc result = spawn.doSpawn(isSummonSpawn);
				
	if (despawnDelay > 0)
		result.scheduleDespawn(despawnDelay);

        // Affect the newly spawned NPC "result" here
        result.doSomething();
}

Where parameters are following :

 

* @param npcId : the NPC template to spawn.
* @param x
* @param y
* @param z
* @param heading
* @param randomOffset : if true, set a random position
* @param despawnDelay : despawn delay, if any (0 means permanent).
* @param isSummonSpawn : if true, spawn with animation (if any exists).
 
If you want to affect the newly spawned npc, then affect "result", like :
result.setWalking();

PS : methods names are perhaps different on your pack, I checked on my own pack, aCis.

 

The above code should be put in a method, and can be reused on your event. Or simply see addSpawn from Quest.java.

Thank u so much Tryskell

Guest
This topic is now closed to further replies.


  • Posts

    • 🏰 L2EXALTA LEGACY — Interlude x45 📅 Grand Opening: 31/07/2026 — 21:30 (GMT+3) 🌐 Website: https://l2exalta.org/ 💬 Discord: https://discord.gg/zNTCZD4AcT 📌 Wiki: https://l2exalta.org/en/wiki.html#progression   ⚙️ MAIN INFO Chronicle : Interlude Rates : x45 Adena : x50 Spoil : x1 Drop : x5 Safe Enchant : +3 Files : L2OFF   💰 ECONOMY EX Coin : dynamic market currency, mined from monsters, Raid Bosses and Grand Bosses value fluctuates over time Exalta Vouchers : premium currency used for store, donations and EX Coin exchange Exchange : convert EX Coin into Exalta Vouchers Investment options : choose safer or riskier market strategies with EX Coin   ⚔️ PROGRESSION & GEAR Exalta Armors : signature top-tier gear line Forge System : upgrade weapons, armor and jewels with risk/reward mechanics Raid Boss progression tied to materials and prestige   🤖 AUTOFARM Access : Auto Hunting button, bottom-right UI Duration : controlled via tickets or in-game currency Route Mode : record custom farm routes Support Mode : healer/support builds auto-follow, heal and assist party Smart targeting logic with class-specific behavior (mage/archer/melee/support) Captcha designed not to interrupt legitimate AutoFarm sessions   🧪 BUFFER Exalta Buffer NPC/interface Scheme Buffer : save multiple buff loadouts Class presets for mage, fighter, support, PvP   🛠️ SMART GADGETS / QOL Autoloot filter Drop value tracker Boss timer tools Farm stats tracker Auto-consume system In-game server assistant   🗺️ DUNGEON FINDER / PVE Party matching with roles (Tank / Healer / DPS) Ready-check before teleport Monastery of Silence custom PvE zone Party-based reward structure   🎟️ DAILY PROGRESS / EXALTA PASS Daily and weekly tasks (farm, PvP, boss, check-in) Premium Pass track with extra rewards Monastery Daily Quest Reward boards for claiming progress   🏠 HOUSING & EXPEDITIONS Player residences with service NPCs Exalta Spirit Expeditions to themed territories Rewards vary by territory Owner-only access   🏆 PVP / TOURNAMENT Scheduled Tournament system Ranking points from wins/participation Spectator Mode for watching live matches PvP Statues for top-ranked players Anti-feed protections   🛡️ CLAN CONTENT Clan Civil War battlefield event Clan Dungeon Raid content DPS Meter for contribution tracking Support Credit system Classic siege/clan politics preserved   🏪 AUCTION / SHOPS Auction House with seller fee Black Market Dealer (limited-time special offers) Custom shops and multisells Confirmation prompts on purchases/sales   💳 DONATIONS / VIP Donation rewards linked to Exalta Vouchers VIP tiers with comfort/cosmetic bonuses Premium store Gift/promo codes for events   🎥 STREAMER / COMMUNITY Streamer Panel with visible stream links Viewer rewards system Streamer Points for cosmetics/vouchers In-game voice chat (global/party/clan/alliance/command)   🔒 FAIR PLAY Strong Anti-Bot protection Reward protection tied to valid client state Captcha on suspicious activity Staff investigation tools No bots, packet tools or modified clients allowed   👑 GRANDBOSS SPAWNS Orfen : 1 day + 1h random Core : 1 day + 1h random Queen Ant : 1 day 6h + 1h random Zaken : 2 days 12h + 1h random Baium : 5 days + 1h random Antharas : 8 days + 1h random Valakas : 11 days + 1h random   🏅 OLYMPIAD Runs Thursday, Friday, Saturday Heroes change monthly Balanced and fair matchmaking
    • yup basically another one just in case https://drive.google.com/file/d/1UtccbD9e50x3WEnQBab2PTZnBHwpcGYM/view?usp=sharing LineageWarrior.FMagic (CollideActors = True; > False) LineageWarrior.FOrc (CollideActors = True; > False) LineageWarrior.FShaman (CollideActors = True; > False) LineageWarrior.MDarkElf (CollideActors = True; > False) LineageWarrior.MDwarf (CollideActors = True; > False) LineageWarrior.MElf (CollideActors = True; > False) LineageWarrior.MFighter (CollideActors = True; > False) LineageWarrior.MMagic (CollideActors = True; > False) LineageWarrior.MOrc (CollideActors = True; > False) LineageWarrior.MShaman (CollideActors = True; > False) LineageWarrior.FDwarf (CollideActors = True; > False) LineageWarrior.FElf (CollideActors = True; > False) LineageWarrior.FFighter (CollideActors = True; > False)
    • @l2naylondev Requiring a player to log in just for the sake of logging  seems exploitable. Someone could log in only to claim the reward and immediately leave, or repeatedly change their ip. So i guess  are there are additional protections in place ? such as locking the reward by account, character , and ip. It would also be useful to add a playtime requirement. For example, after logging in, the player would need to remain active for at least x playtime  before getting the reward or other parameters configurable by the xml.  I suggest improving the system before selling it. 
  • Topics

×
×
  • Create New...

Important Information

This community uses essential cookies to function properly. Non-essential cookies and third-party services are used only with your consent. Read our Privacy Policy and We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue..