public static void MOVETOWORLD(TriggerObject trigObject, IEntity entity, IPoint3D loc, object map) { Map existingMap = map as Map; if (existingMap == null && map is string) { try { existingMap = Map.Parse((string)map); } catch { } } if (existingMap == null) { throw new UberScriptException("A map named " + map + " does not exist!"); } entity.MoveToWorld(new Point3D(loc.X, loc.Y, loc.Z), existingMap); }
public static bool PUTNEARBY( TriggerObject trigObject, IPoint3D target, IEntity toPut, int range, bool dupe, int amount, bool dupeContents) { if (target == null || toPut == null) { return false; } Point3D point = GETVALIDSPAWNLOCATION(trigObject, target, range); if (point == Point3D.Zero) { return false; } Map map = (target is IEntity ? ((IEntity)target).Map : Map.Felucca); if (dupe) { if (toPut is BaseCreature) { for (int i = 0; i < amount; i++) { BaseCreature copy = (BaseCreature)DUPEMOB(trigObject, (BaseCreature)toPut, 1, dupeContents); if (copy == null) { continue; } point = GETVALIDSPAWNLOCATION(trigObject, target, range, true); if (point == Point3D.Zero) { point = new Point3D(target); } copy.MoveToWorld(point, map); } } else if (toPut is Item) { for (int i = 0; i < amount; i++) { Item copy = DUPE(trigObject, (Item)toPut, false, 1, dupeContents); if (copy == null) { continue; } point = GETVALIDSPAWNLOCATION(trigObject, target, range, true); if (point == Point3D.Zero) { point = new Point3D(target); } copy.MoveToWorld(point, map); } } else { throw new UberScriptException("PUTONNEARBY dupe can only be performed on Items or BaseCreature objects!"); } } else { toPut.MoveToWorld(point, map); } return true; }
public static void MOVETOWORLD(TriggerObject trigObject, IEntity entity, IPoint3D loc) { Map map = Map.Felucca; if (loc is IEntity) { map = ((IEntity)loc).Map; } entity.MoveToWorld(new Point3D(loc.X, loc.Y, loc.Z), map); }
public static bool MOVETOSPAWNLOCATION( TriggerObject trigObject, IEntity mob, Map map, ArrayList rectangles, ArrayList weightedProbabilities, int zLevel, bool requiresSurface) { if (mob == null || map == null || map == Map.Internal || rectangles == null || rectangles.Count == 0 || weightedProbabilities == null || weightedProbabilities.Count == 0) { return false; } // try up to 4 times Point3D spawnLoc = GETVALIDSPAWNLOCATIONANDMAP( trigObject, map, rectangles, weightedProbabilities, zLevel, requiresSurface); if (spawnLoc == Point3D.Zero) { spawnLoc = GETVALIDSPAWNLOCATIONANDMAP(trigObject, map, rectangles, weightedProbabilities, zLevel, requiresSurface); if (spawnLoc == Point3D.Zero) { LOG(trigObject, "MOVETOSPAWNLOCATION", trigObject.Script.ScriptFile + " failing to find spawn loc"); spawnLoc = GETVALIDSPAWNLOCATIONANDMAP( trigObject, map, rectangles, weightedProbabilities, zLevel, requiresSurface); if (spawnLoc == Point3D.Zero) { spawnLoc = GETVALIDSPAWNLOCATIONANDMAP( trigObject, map, rectangles, weightedProbabilities, zLevel, requiresSurface); if (spawnLoc == Point3D.Zero) { return false; } } } } mob.MoveToWorld(spawnLoc, map); if (mob is BaseCreature) { ((BaseCreature)mob).Home = spawnLoc; } return true; }