public class DialogActionNPCCommand : DialogActionAddBuff { public override void PerformAction(EntityPlayer player) { //Log.Out("DialogActionNPCCommand-PerformAction START"); var entityId = -1; if (player.Buffs.HasCustomVar("CurrentNPC")) { //Log.Out("DialogActionNPCCommand-PerformAction 1"); entityId = (int)player.Buffs.GetCustomVar("CurrentNPC"); } if (entityId == -1) { //Log.Out("DialogActionNPCCommand-PerformAction 2"); return; } //Log.Out("ENTITY ID: " + entityId); var entity = GameManager.Instance.World.GetEntity(entityId) as EntityAliveV2; if (entity) { switch (ID) { case "follow": //Log.Out("DialogActionNPCCommand-PerformAction entity: " + entity.EntityClass.entityClassName); float flMode = player.Buffs.GetCustomVar("varNPCModMode"); float flHalt = player.Buffs.GetCustomVar("varNPCModStopAttacking"); if (flMode == 0) { //Log.Out("DialogActionNPCCommand-PerformAction 1"); entity.Buffs.AddBuff("buffNPCModFullControlMode"); } else { //Log.Out("DialogActionNPCCommand-PerformAction 2"); entity.Buffs.RemoveBuff("buffNPCModFullControlMode"); } if (flHalt == 1) { //Log.Out("DialogActionNPCCommand-PerformAction 3"); entity.Buffs.AddBuff("buffNPCModStopAttacking"); } else { //Log.Out("DialogActionNPCCommand-PerformAction 4"); entity.Buffs.RemoveBuff("buffNPCModStopAttacking"); } //Log.Out("DialogActionNPCCommand-PerformAction SET TO FOLLOW"); entity.Buffs.SetCustomVar("CurrentOrder", (int)EntityUtilities.Orders.Follow); break; } } ////Log.Out("DialogActionNPCCommand-PerformAction END"); } }