diff --git a/Server/data/configs/npc_configs.json b/Server/data/configs/npc_configs.json index 8dc3860f0..ced86ddae 100644 --- a/Server/data/configs/npc_configs.json +++ b/Server/data/configs/npc_configs.json @@ -5395,6 +5395,7 @@ "examine": "Insects buzzing around.", "melee_animation": "0", "range_animation": "0", + "combat_audio": "819,821,820", "defence_animation": "0", "magic_animation": "0", "death_animation": "0", @@ -5404,7 +5405,7 @@ "lifepoints": "10", "strength_level": "1", "id": "411", - "aggressive": "true", + "aggressive": "false", "range_level": "1", "attack_level": "1" }, diff --git a/Server/src/main/content/global/ame/RandomEvents.kt b/Server/src/main/content/global/ame/RandomEvents.kt index 9afadba57..d60132753 100644 --- a/Server/src/main/content/global/ame/RandomEvents.kt +++ b/Server/src/main/content/global/ame/RandomEvents.kt @@ -14,6 +14,7 @@ import content.global.ame.events.rivertroll.RiverTrollRENPC import content.global.ame.events.rockgolem.RockGolemRENPC import content.global.ame.events.sandwichlady.SandwichLadyRENPC import content.global.ame.events.shade.ShadeRENPC +import content.global.ame.events.swarm.SwarmNPC import content.global.ame.events.treespirit.TreeSpiritRENPC import content.global.ame.events.zombie.ZombieRENPC @@ -43,6 +44,7 @@ enum class RandomEvents(val npc: RandomEventNPC, val loot: WeightBasedTable? = n )), DRILL_DEMON(npc = SeargentDamienNPC()), EVIL_CHICKEN(npc = EvilChickenNPC()), + SWARM(npc = SwarmNPC()), EVIL_BOB(npc = EvilBobNPC(), skillIds = intArrayOf(Skills.FISHING, Skills.MAGIC)), DRUNKEN_DWARF(npc = DrunkenDwarfNPC()), RICK_TURPENTINE(npc = RickTurpentineNPC(), loot = CERTER.loot), diff --git a/Server/src/main/content/global/ame/events/swarm/SwarmNPC.kt b/Server/src/main/content/global/ame/events/swarm/SwarmNPC.kt new file mode 100644 index 000000000..30b29815f --- /dev/null +++ b/Server/src/main/content/global/ame/events/swarm/SwarmNPC.kt @@ -0,0 +1,28 @@ +package content.global.ame.events.swarm + +import content.global.ame.RandomEventNPC +import core.api.playGlobalAudio +import core.api.utils.WeightBasedTable +import core.game.node.entity.npc.NPC +import core.tools.minutesToTicks +import org.rs09.consts.NPCs +import org.rs09.consts.Sounds + +class SwarmNPC(override var loot: WeightBasedTable? = null) : RandomEventNPC(NPCs.SWARM_411) { + override fun init() { + super.init() + this.setAttribute("no-spawn-return", true) + this.attack(player) + playGlobalAudio(this.location, Sounds.SWARM_APPEAR_818) + this.ticksLeft = minutesToTicks(60) + } + + override fun tick() { + super.tick() + if (!this.inCombat()) + this.attack(player) + } + + override fun talkTo(npc: NPC) { + } +} \ No newline at end of file diff --git a/Server/src/main/content/global/ame/events/swarm/SwarmNPCBehavior.kt b/Server/src/main/content/global/ame/events/swarm/SwarmNPCBehavior.kt new file mode 100644 index 000000000..3cf390747 --- /dev/null +++ b/Server/src/main/content/global/ame/events/swarm/SwarmNPCBehavior.kt @@ -0,0 +1,14 @@ +package content.global.ame.events.swarm + +import core.game.node.entity.Entity +import core.game.node.entity.combat.BattleState +import core.game.node.entity.npc.NPC +import core.game.node.entity.npc.NPCBehavior +import core.tools.RandomFunction +import org.rs09.consts.NPCs + +class SwarmNPCBehavior : NPCBehavior(NPCs.SWARM_411) { + override fun beforeAttackFinalized(self: NPC, victim: Entity, state: BattleState) { + state.estimatedHit = RandomFunction.getRandom(1) + } +} \ No newline at end of file