mirror of
https://gitlab.com/2009scape/2009scape.git
synced 2025-12-09 16:45:44 -07:00
Fixed pyramid spawns not despawning
Relaxed getting thrown out of the pyramid to rates that appear more authentic
This commit is contained in:
parent
0e65f20223
commit
f0ee476e42
3 changed files with 75 additions and 34 deletions
|
|
@ -0,0 +1,18 @@
|
||||||
|
package content.region.desert.quest.deserttreasure
|
||||||
|
|
||||||
|
import core.api.*
|
||||||
|
import core.game.node.entity.npc.NPC
|
||||||
|
import core.game.node.entity.npc.NPCBehavior
|
||||||
|
import org.rs09.consts.NPCs
|
||||||
|
|
||||||
|
class MummyNPC : NPCBehavior(NPCs.MUMMY_1958) {
|
||||||
|
var clearTime = 0
|
||||||
|
|
||||||
|
override fun tick(self: NPC): Boolean {
|
||||||
|
if (clearTime++ > 100) {
|
||||||
|
clearTime = 0
|
||||||
|
poofClear(self)
|
||||||
|
}
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -109,7 +109,7 @@ class PyramidArea {
|
||||||
Location(3259, 9313, 0),
|
Location(3259, 9313, 0),
|
||||||
)
|
)
|
||||||
|
|
||||||
val safeZone = ZoneBorders(3227, 3239, 9310, 9320)
|
val safeZone = ZoneBorders(3227, 9310, 3239, 9320)
|
||||||
|
|
||||||
// Direction.NORTH - LEFT
|
// Direction.NORTH - LEFT
|
||||||
// rot 0 - LEFT
|
// rot 0 - LEFT
|
||||||
|
|
@ -150,12 +150,15 @@ class PyramidArea {
|
||||||
/** Trapdoor randomly throws you out of the Pyramid. */
|
/** Trapdoor randomly throws you out of the Pyramid. */
|
||||||
fun trapdoorTrap(player: Player) {
|
fun trapdoorTrap(player: Player) {
|
||||||
stopWalk(player)
|
stopWalk(player)
|
||||||
|
player.walkingQueue.reset()
|
||||||
|
forceWalk(player, Location(3233, 2887, 0), "")
|
||||||
lock(player, 8)
|
lock(player, 8)
|
||||||
sendMessage(player, "You accidentally trigger a trap...")
|
sendMessage(player, "You accidentally trigger a trap...")
|
||||||
// addScenery(6521, location) -> animateScenery(scenery, 1939), but 6522 does it for you.
|
// addScenery(6521, location) -> animateScenery(scenery, 1939), but 6522 does it for you.
|
||||||
val pitfallScenery = addScenery(6522, player.location) // Scenery - Trapdoor Scenery
|
val pitfallScenery = addScenery(6522, player.location) // Scenery - Trapdoor Scenery
|
||||||
animate(player, 1950) // Anim - Player Falling Animation
|
animate(player, 1950) // Anim - Player Falling Animation
|
||||||
queueScript(player, 4, QueueStrength.SOFT) { stage ->
|
queueScript(player, 4, QueueStrength.SOFT) { stage ->
|
||||||
|
player.walkingQueue.reset()
|
||||||
when (stage) {
|
when (stage) {
|
||||||
0 -> {
|
0 -> {
|
||||||
sendGraphics(354, player.location) // Gfx - Puff of Smoke
|
sendGraphics(354, player.location) // Gfx - Puff of Smoke
|
||||||
|
|
@ -169,7 +172,14 @@ class PyramidArea {
|
||||||
sendMessage(player, "...and tumble unharmed outside the pyramid.")
|
sendMessage(player, "...and tumble unharmed outside the pyramid.")
|
||||||
closeOverlay(player)
|
closeOverlay(player)
|
||||||
openOverlay(player, Components.FADE_FROM_BLACK_170)
|
openOverlay(player, Components.FADE_FROM_BLACK_170)
|
||||||
|
stopWalk(player)
|
||||||
|
player.walkingQueue.reset()
|
||||||
// animate(player, ??) // Anim - Player Getting Up https://www.youtube.com/watch?v=95OvIPFYCwg
|
// animate(player, ??) // Anim - Player Getting Up https://www.youtube.com/watch?v=95OvIPFYCwg
|
||||||
|
return@queueScript delayScript(player, 3)
|
||||||
|
}
|
||||||
|
2 -> {
|
||||||
|
player.walkingQueue.reset()
|
||||||
|
forceWalk(player, Location(3233, 2887, 0), "")
|
||||||
return@queueScript stopExecuting(player)
|
return@queueScript stopExecuting(player)
|
||||||
}
|
}
|
||||||
else -> return@queueScript stopExecuting(player)
|
else -> return@queueScript stopExecuting(player)
|
||||||
|
|
@ -179,8 +189,6 @@ class PyramidArea {
|
||||||
|
|
||||||
/** Mummies randomly spawns out of a sarcophagus. */
|
/** Mummies randomly spawns out of a sarcophagus. */
|
||||||
fun spawnMummy(player: Player, sarcophagusLocation: Location) {
|
fun spawnMummy(player: Player, sarcophagusLocation: Location) {
|
||||||
stopWalk(player)
|
|
||||||
lock(player, 3)
|
|
||||||
val sarcophagusScenery = getScenery(sarcophagusLocation) ?: return
|
val sarcophagusScenery = getScenery(sarcophagusLocation) ?: return
|
||||||
val locationInFront = sarcophagusScenery.location.transform(getNewLocation(sarcophagusScenery.direction))
|
val locationInFront = sarcophagusScenery.location.transform(getNewLocation(sarcophagusScenery.direction))
|
||||||
// There are 6 sarcophagus, 6512 - 6517 with different door designs.
|
// There are 6 sarcophagus, 6512 - 6517 with different door designs.
|
||||||
|
|
@ -201,6 +209,7 @@ class PyramidArea {
|
||||||
mummyNpc.init()
|
mummyNpc.init()
|
||||||
mummyNpc.walkingQueue.addPath(locationInFront.x, locationInFront.y)
|
mummyNpc.walkingQueue.addPath(locationInFront.x, locationInFront.y)
|
||||||
sendChat(mummyNpc, "Rawr!")
|
sendChat(mummyNpc, "Rawr!")
|
||||||
|
lock(player, 1)
|
||||||
stopWalk(player)
|
stopWalk(player)
|
||||||
queueScript(player, 2, QueueStrength.SOFT) { stage ->
|
queueScript(player, 2, QueueStrength.SOFT) { stage ->
|
||||||
stopWalk(player)
|
stopWalk(player)
|
||||||
|
|
@ -252,21 +261,18 @@ class PyramidAreaFirstThree: MapArea {
|
||||||
getRegionBorders(11597),
|
getRegionBorders(11597),
|
||||||
getRegionBorders(11341),
|
getRegionBorders(11341),
|
||||||
getRegionBorders(11085),
|
getRegionBorders(11085),
|
||||||
getRegionBorders(12945),
|
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun entityStep(entity: Entity, location: Location, lastLocation: Location) {
|
override fun entityStep(entity: Entity, location: Location, lastLocation: Location) {
|
||||||
if (entity is Player) {
|
if (entity is Player) {
|
||||||
|
|
||||||
if (!PyramidArea.safeZone.insideBorder(entity.location)) { // Safezone is talking to Azzanadra.
|
|
||||||
val averageLevel = (
|
val averageLevel = (
|
||||||
getDynLevel(entity, Skills.AGILITY) +
|
getDynLevel(entity, Skills.AGILITY) +
|
||||||
getDynLevel(entity, Skills.THIEVING)
|
getDynLevel(entity, Skills.THIEVING)
|
||||||
) / 2
|
) / 2.0
|
||||||
val randomValue = RandomFunction.randomDouble(99.5)
|
val randomValue = RandomFunction.randomDouble(99.5)
|
||||||
|
|
||||||
if ((1..10).random() == 1) {
|
if ((1..20).random() == 1) {
|
||||||
// A mummy would jump out if you walk near a sarcophagus of 2 radius.
|
// A mummy would jump out if you walk near a sarcophagus of 2 radius.
|
||||||
val sarcoph = PyramidArea.nearSarcophagus(entity.location)
|
val sarcoph = PyramidArea.nearSarcophagus(entity.location)
|
||||||
if (sarcoph != null) {
|
if (sarcoph != null) {
|
||||||
|
|
@ -274,15 +280,14 @@ class PyramidAreaFirstThree: MapArea {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((1..60).random() == 1) {
|
if ((1..80).random() == 2) {
|
||||||
PyramidArea.spawnScarabs(entity)
|
PyramidArea.spawnScarabs(entity)
|
||||||
}
|
}
|
||||||
if (randomValue > averageLevel) {
|
if (randomValue > averageLevel && (1..128).random() == 1) {
|
||||||
PyramidArea.trapdoorTrap(entity)
|
PyramidArea.trapdoorTrap(entity)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
class PyramidAreaFinal: MapArea {
|
class PyramidAreaFinal: MapArea {
|
||||||
|
|
@ -295,18 +300,18 @@ class PyramidAreaFinal: MapArea {
|
||||||
|
|
||||||
override fun entityStep(entity: Entity, location: Location, lastLocation: Location) {
|
override fun entityStep(entity: Entity, location: Location, lastLocation: Location) {
|
||||||
if (entity is Player) {
|
if (entity is Player) {
|
||||||
|
if (!PyramidArea.safeZone.insideBorder(entity.location)) { // Safezone is talking to Azzanadra.
|
||||||
if ((1..30).random() == 1) {
|
if ((1..20).random() == 1) {
|
||||||
PyramidArea.spawnScarabs(entity)
|
|
||||||
}
|
|
||||||
|
|
||||||
if ((1..15).random() == 1) {
|
|
||||||
// A mummy would jump out if you walk near a sarcophagus of 2 radius.
|
// A mummy would jump out if you walk near a sarcophagus of 2 radius.
|
||||||
val sarcoph = PyramidArea.nearSarcophagus(entity.location)
|
val sarcoph = PyramidArea.nearSarcophagus(entity.location)
|
||||||
if (sarcoph != null) {
|
if (sarcoph != null) {
|
||||||
PyramidArea.spawnMummy(entity, sarcoph)
|
PyramidArea.spawnMummy(entity, sarcoph)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if ((1..80).random() == 2) {
|
||||||
|
PyramidArea.spawnScarabs(entity)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// No Trapdoor For The Final Level
|
// No Trapdoor For The Final Level
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,18 @@
|
||||||
|
package content.region.desert.quest.deserttreasure
|
||||||
|
|
||||||
|
import core.api.*
|
||||||
|
import core.game.node.entity.npc.NPC
|
||||||
|
import core.game.node.entity.npc.NPCBehavior
|
||||||
|
import org.rs09.consts.NPCs
|
||||||
|
|
||||||
|
class ScarabNPC : NPCBehavior(NPCs.SCARABS_1969) {
|
||||||
|
var clearTime = 0
|
||||||
|
|
||||||
|
override fun tick(self: NPC): Boolean {
|
||||||
|
if (clearTime++ > 100) {
|
||||||
|
clearTime = 0
|
||||||
|
poofClear(self)
|
||||||
|
}
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
}
|
||||||
Loading…
Add table
Add a link
Reference in a new issue