169 object->getPosition(x, y, z);
174 #define SQR(x) ((x) * (x)) 180 if (!object1 || !object2)
219 while ((
object = search->next())) {
239 size_t nth = MAX<int32>(ctx.
getParams()[2].getInt() - 1, 0);
244 std::list<Object *> objects;
245 while ((
object = search->next())) {
248 if (!nwn2Object || (nwn2Object == target) || (nwn2Object->
getArea() != target->
getArea()))
256 if (type & objectType)
257 objects.push_back(nwn2Object);
262 std::list<Object *>::iterator it = objects.begin();
263 for (
size_t n = 0; (n < nth) && (it != objects.end()); ++n)
266 if (it != objects.end())
281 size_t nth = MAX<int32>(ctx.
getParams()[2].getInt() - 1, 0);
286 std::list<Object *> objects;
287 while ((
object = search->next())) {
290 if (!nwn2Object || (nwn2Object == target) || (nwn2Object->
getArea() != target->
getArea()))
293 objects.push_back(nwn2Object);
298 std::list<Object *>::iterator it = objects.begin();
299 for (
size_t n = 0; (n < nth) && (it != objects.end()); ++n)
302 if (it != objects.end())
313 size_t nth = MAX<int32>(ctx.
getParams()[3].getInt() - 1, 0);
328 std::list<Object *> creatures;
329 while ((
object = search->next())) {
332 if (creature && (creature != target) && (creature->
getArea() == target->
getArea()))
333 creatures.push_back(creature);
338 std::list<Object *>::iterator it = creatures.begin();
339 for (
size_t n = 0; (n < nth) && (it != creatures.end()); ++n)
342 if (it != creatures.end())
350 if (!
object || !moveTo)
356 jumpTo(
object, moveTo->getArea(), x, y, z);
366 if (!
object || !moveTo)
370 moveTo->getPosition(x, y, z);
372 jumpTo(
object, moveTo->getArea(), x, y, z);
A class able to sort objects by distance to a target object.
void getNearestObjectByTag(Aurora::NWScript::FunctionContext &ctx)
The context handling the gameplay in Neverwinter Nights 2.
Object * getTriggerer() const
static NWN2::Object * toObject(::Aurora::NWScript::Object *object)
void getLocalFloat(Aurora::NWScript::FunctionContext &ctx)
A class holding an UTF-8 string.
Area * getArea() const
Return the area this object is currently in.
void getClickingObject(Aurora::NWScript::FunctionContext &ctx)
void getArea(Aurora::NWScript::FunctionContext &ctx)
void getObjectByTag(Aurora::NWScript::FunctionContext &ctx)
Context of an NWScript function.
void setLocalObject(Aurora::NWScript::FunctionContext &ctx)
void getEnteringObject(Aurora::NWScript::FunctionContext &ctx)
Object * getCaller() const
void getObjectType(Aurora::NWScript::FunctionContext &ctx)
void getTag(Aurora::NWScript::FunctionContext &ctx)
void setLocalInt(Aurora::NWScript::FunctionContext &ctx)
static Creature * toCreature(Aurora::NWScript::Object *object)
An object within a NWN2 area.
void getLocalString(Aurora::NWScript::FunctionContext &ctx)
void jumpTo(NWN2::Object *object, Area *area, float x, float y, float z)
void getLocalInt(Aurora::NWScript::FunctionContext &ctx)
A simple scoped smart pointer template.
void getPosition(float &x, float &y, float &z) const
Return the location's position.
void setLocalString(Aurora::NWScript::FunctionContext &ctx)
The context needed to run a Neverwinter Nights 2 module.
Neverwinter Nights 2 engine functions.
A creature in a Neverwinter Nights 2 area.
A container of Neverwinter Nights 2 objects.
Utility templates and functions.
Basic Neverwinter Nights 2 type definitions.
static Location * toLocation(Aurora::NWScript::EngineType *engineType)
void getLocation(Aurora::NWScript::FunctionContext &ctx)
void getPosition(Aurora::NWScript::FunctionContext &ctx)
void setVector(float x, float y, float z)
void getName(Aurora::NWScript::FunctionContext &ctx)
ObjectSearch * findObjectsByTag(const Common::UString &tag) const
Return a search context to iterate over all objects with this tag.
ObjectSearch * findObjects() const
Return a search context to iterate over all objects.
bool empty() const
Is the string empty?
void setLocalFloat(Aurora::NWScript::FunctionContext &ctx)
A scoped plain pointer, allowing pointer-y access and normal deletion.
void getExitingObject(Aurora::NWScript::FunctionContext &ctx)
Common::UString & getString()
void jumpToLocation(Aurora::NWScript::FunctionContext &ctx)
void getWaypointByTag(Aurora::NWScript::FunctionContext &ctx)
void getNearestObject(Aurora::NWScript::FunctionContext &ctx)
virtual void getPosition(float &x, float &y, float &z) const
Return the object's position within its area.
static Aurora::NWScript::Object * getParamObject(const Aurora::NWScript::FunctionContext &ctx, size_t n)
An object in a Neverwinter Nights 2 area.
void getDistanceToObject(Aurora::NWScript::FunctionContext &ctx)
Creature * getPC()
Return the currently playing PC.
void jumpToObject(Aurora::NWScript::FunctionContext &ctx)
void getLocalObject(Aurora::NWScript::FunctionContext &ctx)
void getNearestCreature(Aurora::NWScript::FunctionContext &ctx)
Module & getModule()
Return the module context.
void getIsObjectValid(Aurora::NWScript::FunctionContext &ctx)
void clear()
Clear the string's contents.
ObjectType getType() const
Return the exact type of the object.
static Waypoint * toWaypoint(Aurora::NWScript::Object *object)