TurnsToSeconds

From NWN Lexicon
Revision as of 01:51, 26 August 2012 by Dood (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search



TurnsToSeconds(int)

Convert turns into seconds.

float TurnsToSeconds(
    int nTurns
);

Parameters

nTurns

The number of turns to convert into seconds.


Description

Returns the value of nTurns converted into seconds. A single turn is always 60 seconds.

This value never changes due to the game clock - it is real time.



Remarks

Great way to apply a turn-based effect to an object when ApplyEffectToObject expects seconds instead of turns. Used mostly for spell effects in the game.

Note that a turn, in the P&P D&D books, is what we call a round (6 second) in NwN. Do not get confused if it says "2 turns", which means 12 seconds, not 120.


Version

1.62

Example

// Simple custom spell cast by an NPC.  The spell should last 1 turn per level of the caster.
 
void main(){
    int nDurationOfSpell = GetCasterLevel(OBJECT_SELF);
    effect eBonusToApply = EffectAttackIncrease(1);
    object oTargetOfSpell = GetSpellTargetObject();
    ApplyEffectToObject(DURATION_TYPE_TEMPORARY, eBonusToApply, oTargetOfSpell, TurnsToSeconds(nDurationOfSpell));
}

See Also

functions: 

RoundsToSeconds



 author: Charles Feduke, editor: Jasperre, additional contributor(s): John Shuell, Kirk McDonald