FANDOM


function GetNearestCreature (int nFirstCriteriaType, int nFirstCriteriaValue, object oTarget=OBJECT_SELF, int nNth=1, int nSecondCriteriaType=-1, int nSecondCriteriaValue=-1, int nThirdCriteriaType=-1, int nThirdCriteriaValue=-1 )

Get the creature nearest to oTarget, subject to all the criteria specified.

  • nFirstCriteriaType: CREATURE_TYPE_*
  • nFirstCriteriaValue:
    • PROFILE_TYPE_* if nFirstCriteriaType was CREATURE_TYPE_CLASS
    • SPELL_* if nFirstCriteriaType was CREATURE_TYPE_DOES_NOT_HAVE_SPELL_EFFECT or CREATURE_TYPE_HAS_SPELL_EFFECT
    • TRUE or FALSE if nFirstCriteriaType was CREATURE_TYPE_IS_ALIVE
    • PERCEPTION_* if nFirstCriteriaType was CREATURE_TYPE_PERCEPTION
    • PLAYER_CHAR_IS_PC or PLAYER_CHAR_NOT_PC if nFirstCriteriaType was CREATURE_TYPE_PLAYER_CHAR
    • RACIAL_TYPE_* if nFirstCriteriaType was CREATURE_TYPE_RACIAL_TYPE
    • REPUTATION_TYPE_* if nFirstCriteriaType was CREATURE_TYPE_REPUTATION For example, to get the nearest PC, use (CREATURE_TYPE_PLAYER_CHAR, PLAYER_CHAR_IS_PC)
  • oTarget: We're trying to find the creature of the specified type that is nearest to oTarget
  • nNth: We don't have to find the first nearest we can find the Nth nearest...
  • nSecondCriteriaType: This is used in the same way as nFirstCriteriaType to further specify the type of creature that we are looking for.
  • nSecondCriteriaValue: This is used in the same way as nFirstCriteriaValue to further specify the type of creature that we are looking for.
  • nThirdCriteriaType: This is used in the same way as nFirstCriteriaType to further specify the type of creature that we are looking for.
  • nThirdCriteriaValue: This is used in the same way as nFirstCriteriaValue to further specify the type of creature that we are looking for.
  • Return value on error: OBJECT_INVALID


  • Return type: object
  • Include file: nwscriptdefn

Ad blocker interference detected!


Wikia is a free-to-use site that makes money from advertising. We have a modified experience for viewers using ad blockers

Wikia is not accessible if you’ve made further modifications. Remove the custom ad blocker rule(s) and the page will load as expected.