► Show Spoiler
to drop_table:
Code: Select all
"ids": "6026,6027,6028,6029,6030,6031,6032,6033,6034,6035,6036,6037,6038,6039,6040,6041,6042,6043,6044,6045",
"description": "Canifis npcs",
► Show Spoiler
Code: Select all
package content.region.morytania.npc.canifis
import core.api.*
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.game.node.entity.player.Player
import core.game.system.task.Pulse
import core.game.world.GameWorld.Pulser
import core.game.world.update.flag.context.Animation
private val WEREWOLF_NPCS = intArrayOf(6026,6027,6028,6029,6030,6031,6032,6033,6034,6035,6036,6037,6038,6039,6040,6041,6042,6043,6044,6045)
private val ANIMATION = Animation(6543)
private const val TRANSFORM_ID = 6006
class WerewolfBehavior : NPCBehavior(*WEREWOLF_NPCS) {
override fun afterDamageReceived(self: NPC, attacker: Entity, state: BattleState) {
if (attacker is Player)
if (!attacker.equipment.contains(2952, 1)) {
attacker.lock(2)
val werewolf = NPC.create(TRANSFORM_ID, self.location)
werewolf.init()
werewolf.animate(ANIMATION)
self.clear()
werewolf.lock(2)
werewolf.isRespawn = false
setAttribute(werewolf,"original", self.id)
setAttribute(werewolf,"loc", self.properties.spawnLocation)
Pulser.submit(object : Pulse(2) {
override fun pulse(): Boolean {
werewolf.properties.combatPulse.attack(attacker)
return true
}
})
} else {
attacker.getProperties().combatPulse.attack(self)
}
return
}
}
its work like this