Difference between revisions of "GetIsReactionTypeHostile"

From NWN Lexicon
Jump to: navigation, search
Line 26: Line 26:
<br />
<br />
<a href=https://loansforbadcredit.us.com/>bad credit payday loans direct lenders</a> <a href=https://writemyessay.us.com/>write my essay online</a>
Returns TRUE if oSource has a hostile reaction towards oTarget, depending on the reputation, PVP setting and (if both oSource and oTarget are PCs), oSource's Like/Dislike setting for oTarget. <br /><br /> Neutrals are not considered hostile, use GetIsReactionTypeNeutral() for that.
<br /><br />

Revision as of 09:02, 10 September 2017

GetIsReactionTypeHostile(object, object)

Determine whether a creature has a hostile reaction towards another given creature.

int GetIsReactionTypeHostile(
    object oTarget,
    object oSource = OBJECT_SELF



The target creature to test.


The source creature to test the feelings of. (Default: OBJECT_SELF)

<a href=https://loansforbadcredit.us.com/>bad credit payday loans direct lenders</a> <a href=https://writemyessay.us.com/>write my essay online</a>


If you just want to know how two objects feel about each other in terms of faction and personal reputation, use GetIsEnemy() instead.

This is used mainly for an automatic check of difficulty settings, different factions, an area (or module in general) PvP settings, and like/dislike settings for individuals.

An easy to understand example is outlined in the code example.

You use either GetIsReactionTypeFriendly() or GetIsReactionTypeHostile() in *all* spells which will cause a harmful effect - even if they do not allow saves, spell resistance, or are special monster abilities.

Why? Well, you must make sure that a PC isn't going to start killing other players while, for example, in a no-PvP starting area. Without these checks (basically for "are we meant to damage them"), they could damage the enemy, and the enemy do nothing in return (and it breaks the area rules).




// This is basically a single check for a target.
// GetIsReactionTypeHostile() is used for all spells which affect
// only enemies inside a blast, such as Slow. These spells are 
// never going to affect allies, but likewise might fail if the fact is
// PvP settings are against the caster.
// Basically, if a slow spell were to be fired against some creatures,
// several things would stop it - from this one function check (and
// this is why it is so important).
// 1. If the caster is allied with the target, there will be no effect. 
//     Note, that unless GetIsReactionTypeNeutral() is also used,
//     no neutral players will be affected either. This is the bare
//     basic of the function - it will only return TRUE if the target is
//     an enemy, unless stated below.
// 2. Depending on the PvP settings, no PvP means no enemies,
//     especially other PC's, can be affected in any way - no fighting!
//     thusly this returns FALSE.
// 3. There are other cases - party PvP and like/dislike flags state
//     if they are even an enemy at all.
// Without these basic checks, as well as, of course, Like/Dislike
// flags, personal reputations and so on, the spell could really break
// the game.
void main()
    // Get spell target
    object oTarget = GetSpellTargetObject();
    // They must be an enemy *and* they must not break PvP rules
    // * NOTE: There is no !, this is a pure "must be true" check!
        // Do 5 damage to them, if we don't break PvP and so on
        effect eDam = EffectDamage(5);
        ApplyEffectToObject(DURATION_TYPE_INSTANT, eDam, oTarget);

wh0cd766149 <a href=http://triamterene.zone/>triamterene</a> <a href=http://meloxicam.pro/>meloxicam</a> <a href=http://genericadvair.pro/>advair cost</a>