Hostile random events now take the player's summoning level into account

Random event combat level is now selected authentically resulting in more difficult hostile random events
This commit is contained in:
Player Name
2025-02-17 10:44:44 +00:00
committed by Ryan
parent 50ba3682b5
commit 45fb89ec73
6 changed files with 10 additions and 25 deletions
@@ -9,9 +9,8 @@ import core.tools.RandomFunction
import org.rs09.consts.Items
import content.global.ame.RandomEventNPC
import core.api.utils.WeightBasedTable
import java.lang.Integer.max
val ids = 2463..2468
val ids = (2463..2468).toList()
class EvilChickenNPC(override var loot: WeightBasedTable? = null) : RandomEventNPC(2463) {
val phrases = arrayOf("Bwuk","Bwuk bwuk bwuk","Flee from me, @name!","Begone, @name!","Bwaaaauuuk bwuk bwuk","MUAHAHAHAHAAA!")
@@ -19,8 +18,7 @@ class EvilChickenNPC(override var loot: WeightBasedTable? = null) : RandomEventN
override fun init() {
super.init()
val index = max(0, (player.properties.combatLevel / 20) - 1)
val id = ids.toList()[index]
val id = idForCombatLevel(ids, player)
this.transform(id)
this.attack(player)
sendChat(phrases.random().replace("@name",player.username.capitalize()))
@@ -4,17 +4,14 @@ import core.game.node.entity.Entity
import core.game.node.entity.npc.NPC
import content.global.ame.RandomEventNPC
import core.api.utils.WeightBasedTable
import java.lang.Integer.max
val ids = 391..396
val ids = (391..396).toList()
class RiverTrollRENPC(override var loot: WeightBasedTable? = null) : RandomEventNPC(391){
override fun talkTo(npc: NPC) {}
override fun init() {
super.init()
val index = max(0, (player.properties.combatLevel / 20) - 1)
val id = ids.toList()[index]
val id = idForCombatLevel(ids, player)
this.transform(id)
this.attack(player)
sendChat("Fishies be mine, leave dem fishies!")
@@ -4,17 +4,14 @@ import core.game.node.entity.Entity
import core.game.node.entity.npc.NPC
import content.global.ame.RandomEventNPC
import core.api.utils.WeightBasedTable
import kotlin.math.max
val ids = 413..418
val ids = (413..418).toList()
class RockGolemRENPC(override var loot: WeightBasedTable? = null) : RandomEventNPC(413){
override fun talkTo(npc: NPC) {}
override fun init() {
super.init()
val index = max(0,(player.properties.combatLevel / 20) - 1)
val id = ids.toList()[index]
val id = idForCombatLevel(ids, player)
this.transform(id)
this.attack(player)
sendChat("Raarrrgghh! Flee human!")
@@ -4,15 +4,13 @@ import core.game.node.entity.Entity
import core.game.node.entity.npc.NPC
import content.global.ame.RandomEventNPC
import core.api.utils.WeightBasedTable
import kotlin.math.*
class ShadeRENPC(override var loot: WeightBasedTable? = null) : RandomEventNPC(425){
val ids = (425..430).toList()
override fun talkTo(npc: NPC) {}
override fun init() {
super.init()
val index = max(0, min(ids.size, (player.properties.combatLevel / 20) - 1))
val id = ids[index]
val id = idForCombatLevel(ids, player)
this.transform(id)
this.attack(player)
sendChat("Leave this place!")
@@ -4,17 +4,14 @@ import core.game.node.entity.Entity
import core.game.node.entity.npc.NPC
import content.global.ame.RandomEventNPC
import core.api.utils.WeightBasedTable
import kotlin.math.max
val ids = 438..443
val ids = (438..443).toList()
class TreeSpiritRENPC(override var loot: WeightBasedTable? = null) : RandomEventNPC(438){
override fun talkTo(npc: NPC) {}
override fun init() {
super.init()
val index = max(0,(player.properties.combatLevel / 20) - 1)
val id = ids.toList()[index]
val id = idForCombatLevel(ids, player)
this.transform(id)
this.attack(player)
sendChat("Leave these woods and never return!")
@@ -4,15 +4,13 @@ import core.game.node.entity.Entity
import core.game.node.entity.npc.NPC
import content.global.ame.RandomEventNPC
import core.api.utils.WeightBasedTable
import kotlin.math.*
class ZombieRENPC(override var loot: WeightBasedTable? = null) : RandomEventNPC(419){
val ids = (419..424).toList()
override fun talkTo(npc: NPC) {}
override fun init() {
super.init()
val index = max(0, min(ids.size, (player.properties.combatLevel / 20) - 1))
val id = ids[index]
val id = idForCombatLevel(ids, player)
this.transform(id)
this.attack(player)
sendChat("Brainsssss!")