From NWN Lexicon
Jump to navigationJump to search

Returns the resref (TILESET_RESREF_*) constant of the tileset used to create the area.


The area for which the tileset was used.


Returns the resref (TILESET_RESREF_*) of the tileset used to create the area.

Returns an empty string ("") on an error.


If the area was created from a custom tileset added to the module in a hak pak, it returns the resref defined for that set by the tileset's author.




// Area OnEnter event script
// If the area being entered was created from the Rural Winter or Frozen Wastes
// tilesets, the entering creature must make a DC 20 reflex save vs. Cold or
// fall down taking 2d6 bludgeoning damage which is reduced by 1/2 if he makes a
// successful tumble skill check at DC 18.

void main()
    object oArea = OBJECT_SELF;
    // Determine the tileset used to create the area being entered.
    string sTilesetResref = GetTilesetResRef(oArea);
    // If the area was created using the Rural Winter or Frozen Wastes tilesets...
    if((sTilesetResref == TILESET_RESREF_RURAL_WINTER) || (sTilesetResref == TILESET_RESREF_FROZEN_WASTES))
        // Determine who is entering the area.
        object oCreature = GetEnteringObject();

        // Creature must make a DC 20 reflex save vs. Cold...
        if(!ReflexSave(oCreature, 20, SAVING_THROW_TYPE_COLD))
            // The creature failed the check and will fall down. Determine if he
            // falls on his face or on his back (random 50-50 chance either way)
            int nFaceOrBack = ((d2() == 1) ? ANIMATION_LOOPING_DEAD_FRONT : ANIMATION_LOOPING_DEAD_BACK);

            // Make the creature fall down for 2 rounds. SetCommandable() is
            // used to  ensure the animation cannot be cancelled until the 2
            // rounds have passed. ActionPlayAnimation() is used instead of
            // applying a Knockdown effect in order to bypass Knockdown immunity.
            AssignCommand(oCreature, ClearAllActions(TRUE));
            AssignCommand(oCreature, ActionPlayAnimation(nFaceOrBack, 1.0, RoundsToSeconds(2)));
            AssignCommand(oCreature, ActionDoCommand(SetCommandable(TRUE, oCreature)));
            AssignCommand(oCreature, SetCommandable(FALSE, oCreature));

            // Determine how much damage is taken in the fall (2d6).
            int nFallDownDamage = d6(2);

            // Reduce damage by 1/2 if the creature successfully passes a DC 18
            // tumble check.
            if(GetIsSkillSuccessful(oCreature, SKILL_TUMBLE, 18))
                nFallDownDamage /= 2;

            // Apply the bludgeoning damage to the creature.
            effect eFallDownDamage = EffectDamage(nFallDownDamage, DAMAGE_TYPE_BLUDGEONING, DAMAGE_POWER_ENERGY);
            ApplyEffectToObject(DURATION_TYPE_INSTANT, eFallDownDamage, oCreature);

See Also

constants:  TILESET_RESREF_*

author: bernosky, editor: Mistress, contributor: Axe Murderer