mirror of
https://github.com/KAMKEEL/CustomNPC-Plus.git
synced 2026-11-18 14:59:05 +00:00
Added Scheduled Tasks system for NPC scripting.
Allows for scripting the scheduling of runnable methods in sequence within the NPC's AI An example sequence of tasks: 1. Dashes towards player (might take 3-5 seconds, doesn't matter, task durations are dynamic so it can take as long as it needs). 2. Punches player away 3. Waits 10 ticks - Fires a ki blast 4. Teleports behind player 5. Knocks player out
This commit is contained in:
1 parent
a8e8566e7d
commit
0033413235
4 files changed
+199
-4
No files matched your search
@@ -74,6 +74,7 @@ import noppes.npcs.controllers.data.*;
|
||||
import noppes.npcs.entity.data.DataTimers;
|
||||
import noppes.npcs.roles.*;
|
||||
import noppes.npcs.scripted.NpcAPI;
|
||||
import noppes.npcs.scripted.ScriptedActionManager;
|
||||
import noppes.npcs.scripted.entity.ScriptNpc;
|
||||
import noppes.npcs.scripted.event.NpcEvent;
|
||||
import noppes.npcs.util.GameProfileAlt;
|
||||
@@ -96,7 +97,7 @@ public abstract class EntityNPCInterface extends EntityCreature implements IEnti
|
||||
public DataTimers timers;
|
||||
|
||||
public CombatHandler combatHandler = new CombatHandler(this);
|
||||
//public ScriptedActionManager actionManager = new ScriptedActionManager();
|
||||
public ScriptedActionManager actionManager = new ScriptedActionManager();
|
||||
|
||||
public String linkedName = "";
|
||||
public long linkedLast = 0;
|
||||
@@ -362,7 +363,7 @@ public abstract class EntityNPCInterface extends EntityCreature implements IEnti
|
||||
combatHandler.update();
|
||||
onCollide();
|
||||
|
||||
// actionManager.tick(ticksExisted);
|
||||
actionManager.tick(ticksExisted);
|
||||
}
|
||||
|
||||
if (wasKilled != isKilled() && wasKilled) {
|
||||
@@ -1150,7 +1151,7 @@ public abstract class EntityNPCInterface extends EntityCreature implements IEnti
|
||||
setHealth(getMaxHealth());
|
||||
dataWatcher.updateObject(14, 0); // animation Normal
|
||||
dataWatcher.updateObject(15, 0);
|
||||
//actionManager.clear();
|
||||
actionManager.clear();
|
||||
combatHandler.reset();
|
||||
this.setAttackTarget(null);
|
||||
this.setRevengeTarget(null);
|
||||
|
||||
Reference in new issue
Block a user