GetChallengeRating(object)

対象となるクリーチャーの脅威度(CR)を返します。

float GetChallengeRating(
    object oCreature
);

Parameters

oCreature

脅威度を調べたいクリーチャー。


Description

対象となるクリーチャーの脅威度(どのくらい倒し難いか)を返します。


無効なクリーチャーの場合には0.0を返します。



Remarks

脅威度は独立した値です。

言い換えると何かと比較をしているわけではありませんが、かなり正直な値です。


Version

1.22

Example

// Example 1 - Get the challenge rating of the creature that last
// attacked me (whatever creature this script is called by) and 
// check it against my challenge rating to see if I should be 
// worried or not.

void main(){

  // Make sure script isn't misplace...will only work on creatures.
  if (GetObjectType(OBJECT_SELF) != OBJECT_TYPE_CREATURE) return;
  // Get the creature that last attacked me.
  object oCreature = GetLastAttacker(OBJECT_SELF);
  // Get out if it is not a creature (PC or mob)
  if (GetObjectType(oCreature) != OBJECT_TYPE_CREATURE) return;
  // Get the challenge rating of the creature.
  float fChallenge = GetChallengeRating(oCreature);
  // Get my challenge rating.
  float fMe = GetChallengeRating(OBJECT_SELF);
  // Just for fun...
  if (fMe <= fChallenge)
  {
    SpeakString("Ok, I'm scared!",TALKVOLUME_TALK);
  }
  else
  {
    SpeakString("I'm gonna whoop 'em good!",TALKVOLUME_TALK);
  }
}

See Also

categories: Get Data from Creature Functions


author: Brett Lathrope, JP team: marshall
Send comments on this topic.