1. BOSS相关
控制副本中门或者开关
HandleGameObject(GUID, true); // 开启对象 门、开关
副本内玩家进入战斗
me->SetInCombatWithZone();
攻击状态
me->SetReactState(REACT_AGGRESSIVE); // 主动
enum ReactStates
{
REACT_PASSIVE = 0, // 被动
REACT_DEFENSIVE = 1, // 防御
REACT_AGGRESSIVE = 2 // 侵略性
};
移除标志
移除不可以选的效果,不能攻击,不能移动
me->RemoveFlag(
UNIT_FIELD_FLAGS,
// 不可攻击 // 不可选 // 不能移动
UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_NOT_SELECTABLE | UNIT_FLAG_DISABLE_MOVE
);
设置可见性
可设置只有GM可见
me->SetVisible(true);
是否在视线内
IsWithinLOSInMap(who)
攻击目标
AttackStart(who)
判断距离
me->IsWithinDistInMap(who, 60.0f) // 是否在60码之内
获取目标距离
me->GetDistance()
me->GetDistanceZ(who) // 高度距离
me->GetDistance(who) // 直线距离
me->GetDistance2d(who) // 直线具体 减去自身及目标体积
选择目标
SelectTarget(SELECT_TARGET_NEAREST, 0)
SelectTarget(SELECT_TARGET_NEAREST, 0) // 选择最远的目标
enum SelectAggroTarget
{
SELECT_TARGET_RANDOM = 0, //Just selects a random target
SELECT_TARGET_TOPAGGRO, //Selects targes from top aggro to bottom
SELECT_TARGET_BOTTOMAGGRO, //Selects targets from bottom aggro to top
SELECT_TARGET_NEAREST,
SELECT_TARGET_FARTHEST
};
控制移动
me->GetMotionMaster()->MovePoint()
if (Turn_Timer <= diff)
{
uint32 waypoint = (Fly_Timer/10000)%2;
if (!me->IsWithinDist3d(VazrudenRing[waypoint][0], VazrudenRing[waypoint][1], VazrudenRing[waypoint][2], 5))
me->GetMotionMaster()->MovePoint(0, VazrudenRing[waypoint][0], VazrudenRing[waypoint][1], VazrudenRing[waypoint][2]); // here
Turn_Timer = 10000;
}
修改移动速度
me->SetSpeed(MOVE_RUN, 5.0f);
me->SetSpeed(MOVE_RUN, 5.0f); // 修改奔跑速度
enum UnitMoveType
{
MOVE_WALK = 0,
MOVE_RUN = 1,
MOVE_RUN_BACK = 2,
MOVE_SWIM = 3,
MOVE_SWIM_BACK = 4,
MOVE_TURN_RATE = 5,
MOVE_FLIGHT = 6,
MOVE_FLIGHT_BACK = 7,
MOVE_PITCH_RATE = 8
};
2. 世界对象
pDefiasCannon->SetGoState(GO_STATE_ACTIVE);
enum GOState
{
GO_STATE_ACTIVE = 0, // show in world as used and not reset (closed door open)
GO_STATE_READY = 1, // show in world as ready (closed door close)
GO_STATE_ACTIVE_ALTERNATIVE = 2 // show in world as used in alt way and not reset (closed door open by cannon fire)
};