Spawned in all NPCs for the GFI and ensured they fought with eachother.

This commit is contained in:
ceikry 2021-07-12 09:40:45 -05:00
parent ec930d50b3
commit 171cac23f2
3 changed files with 72 additions and 1 deletions

View file

@ -10686,5 +10686,37 @@
{
"npc_id": "5463",
"loc_data": "{2324,3809,0,1,0}-{2317,3802,0,1,0}"
},
{
"npc_id": "5521",
"loc_data": "{2324,3832,0,1,0}-{2350,3859,0,1,0}-{2375,3892,0,1,0}-{2388,3867,0,1,0}-{2384,3863,0,1,0}-{2387,3859,0,1,0}-{2350,3862,0,1,0}-{2352,3857,0,1,0}"
},
{
"npc_id": "5523",
"loc_data": "{2367,3832,0,1,0}-{2319,3854,0,1,0}-{2324,3891,0,1,0}-{2406,3854,0,1,0}-{2405,3863,0,1,0}-{2400,3856,0,1,0}"
},
{
"npc_id": "5522",
"loc_data": "{2362,3893,0,1,0}-{2390,3861,0,1,0}-{2395,3859,0,1,0}-{2323,3857,0,1,0}-{2331,3860,0,1,0}"
},
{
"npc_id": "5524",
"loc_data": "{2340,3830,0,1,0}-{2338,3860,0,1,0}-{2339,3895,0,1,0}-{2411,3886,0,1,0}-{2396,3854,0,1,0}"
},
{
"npc_id": "5514",
"loc_data": "{2337,3831,0,1,0}-{2399,3852,0,1,0}-{2321,3833,0,1,0}"
},
{
"npc_id": "5515",
"loc_data": "{2327,3858,0,1,0}-{2321,3860,0,1,0}-{2343,3862,0,1,0}"
},
{
"npc_id": "5516",
"loc_data": "{2393,3861,0,1,0}-{2347,3890,0,1,0}-{2347,3890,0,1,0}"
},
{
"npc_id": "5517",
"loc_data": "{2403,3853,0,1,0}-{2328,3830,0,1,0}-{2405,3860,0,1,0}-{2335,3894,0,1,0}"
}
]

View file

@ -600,7 +600,7 @@ object ContentAPI {
*/
@JvmStatic
fun findLocalNPCs(entity: Entity, ids: IntArray): List<NPC>{
return RegionManager.getSurroundingNPCs(entity).filter { it.id in ids }.toList()
return RegionManager.getLocalNpcs(entity).filter { it.id in ids }.toList()
}
/**

View file

@ -0,0 +1,39 @@
package rs09.game.node.entity.npc.other
import api.ContentAPI
import core.game.node.entity.npc.AbstractNPC
import core.game.world.map.Location
import core.plugin.Initializable
import core.tools.RandomFunction
import org.rs09.consts.NPCs
import rs09.game.system.SystemLogger
@Initializable
class IceTrollGFI : AbstractNPC {
//Constructor spaghetti because Arios I guess
constructor() : super(NPCs.ICE_TROLL_MALE_5522, null, true) {}
private constructor(id: Int, location: Location) : super(id, location) {}
override fun construct(id: Int, location: Location, vararg objects: Any?): AbstractNPC {
return IceTrollGFI(id, location)
}
override fun getIds(): IntArray {
return intArrayOf(NPCs.ICE_TROLL_FEMALE_5523, NPCs.ICE_TROLL_MALE_5522, NPCs.ICE_TROLL_RUNT_5521, NPCs.ICE_TROLL_GRUNT_5524)
}
override fun tick() {
if(!inCombat() && RandomFunction.roll(20)){
val localGuards = ContentAPI.findLocalNPCs(this, intArrayOf(NPCs.HONOUR_GUARD_5514,NPCs.HONOUR_GUARD_5515,NPCs.HONOUR_GUARD_5516,NPCs.HONOUR_GUARD_5517))
localGuards.forEach{guard ->
SystemLogger.logInfo("Looping guards...")
if(guard.location.withinDistance(location,6)) {
attack(guard)
return super.tick()
}
}
}
return super.tick()
}
}