TurnsToSeconds

From NWN Lexicon



Contents

[edit] TurnsToSeconds(int)

Convert turns into seconds.

float TurnsToSeconds(
    int nTurns
);

[edit] Parameters

nTurns

The number of turns to convert into seconds.


[edit] 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.



[edit] 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.


[edit] Version

1.62

[edit] 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));
}

[edit] See Also

functions: 

RoundsToSeconds



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

Personal tools
Categories