Pulse Control+D para no olvidar este enlace.
Pagina principal­Índice­Portal­FAQ­Buscar­Registrarse­Conectarse­Pagina principal
Publicar nuevo tema   Responder al temaCompartir | 
 

 Guardar conjuros de jugador al salir

Ver el tema anterior Ver el tema siguiente Ir abajo 
AutorMensaje
Jastro
Aprendiz
Aprendiz


Masculino
Edad: 24
Localización: Islas Canarias
¿Que me Gusta?: Todo y Nada
Puntos de Actividad: 1144

Cantidad de envíos: 40
Fecha de inscripción: 11/08/2008

Nº. de Miembro: 11
Respeto por el Foro:
100 / 100100 / 100


MensajeTema: Guardar conjuros de jugador al salir   Sáb 18 Abr 2009, 12:58 pm

Este script lo que hace es guardar los ultimos conjuros que ha hecho, asi si un jugador sale y entra, tiene la posiblidad de tener los mismos hechizos gastados, hasta que descanse, (si no me equivoco deberia funcionar asi). Igualmente revisare por si me dejo algo, son 2 partes uno en el onenter del modulo y otro en el onleave




Esto se debe poner en Onenter del modulo ^^


Código:
#include "nw_i0_plot"

int index, iLev;
string sLevels = "HP=" + IntToString( iLev ) + ";";
object oPC = GetEnteringObject();


int FindPreviousLevel( string sVar )
{
    iLev = GetCurrentHitPoints( oPC );
    string sTmp;
    int iPos = FindSubString( sLevels, sVar );
    if ( iPos > -1 )
    {
        iPos += GetStringLength( sVar);
        while ( GetSubString( sLevels, iPos, 1 ) != ";" )
            sTmp += GetSubString( sLevels, iPos++, 1 );
        if ( sTmp != "" )
        {
            return StringToInt( sTmp );
        }
    }
    return -100;
}




void RestauraConjuros(object oPC)
{
    int iCurHP = GetCurrentHitPoints( oPC );

    int index, iLev, iCurLev;
    sLevels = GetCampaignString(GetModuleName(), GetName( oPC ) + "Levels" );
    if ( sLevels != "" )
    {
        iCurLev = GetCurrentHitPoints( oPC );
        iLev = FindPreviousLevel( "HP=" );
        /*if ( iLev > -100 && iCurLev > iLev )
        {
            effect eDamage = EffectDamage( iCurLev - 1, DAMAGE_TYPE_DIVINE, DAMAGE_POWER_ENERGY );
            ApplyEffectToObject( DURATION_TYPE_INSTANT, eDamage, oPC );
        }*/
        for( index = 0; index < 622; index++ )
        {
            iCurLev = GetHasSpell( index, oPC );
            if ( iCurLev > 0 )
            {
                iLev = FindPreviousLevel( "S" + IntToString( index ) + "=" );
                if ( iLev == -100 )
                    iLev = 0;
                while ( iLev < iCurLev )
                {
                    DecrementRemainingSpellUses( oPC, index );
                    iLev++;
                }
            }
        }
        for( index = 0; index < 480; index++ )
        {
            iCurLev = GetHasFeat( index, oPC );
            if ( iCurLev > 0 )
            {
                iLev = FindPreviousLevel( "F" + IntToString( index ) + "=" );
                if ( iLev == -100 )
                    iLev = 0;
                while ( iLev < iCurLev )
                {
                    DecrementRemainingFeatUses( oPC, index );
                    iLev++;
                }
            }
        }
    }
}


void main()
{
object oPC = GetEnteringObject();

RestauraConjuros(oPC);
}


en el onclienleave del modulo.

Código:
#include "nw_i0_plot"

int index, iLev;
string sLevels = "HP=" + IntToString( iLev ) + ";";

void SalvaConjuros(object oPC)
{
    iLev = GetCurrentHitPoints( oPC );
    for( index = 0; index < 622; index++ )
    {
    iLev = GetHasSpell( index, oPC );
    if ( iLev > 0 )
    sLevels += "S" + IntToString( index ) + "=" + IntToString( iLev ) + ";";
    }
    for( index = 0; index < 480; index++ )
    {
    iLev = GetHasFeat( index, oPC );
    if ( iLev > 0 )
    sLevels += "F" + IntToString( index ) + "=" + IntToString( iLev ) + ";";
    }
    SetCampaignString(GetModuleName(), GetName( oPC ) + "Levels", sLevels );
}

void main()
{
    object oPC = GetExitingObject();
    string sRIP = ObjectToString(GetModule());
    RemoveEffect(oPC, EffectPolymorph(SPELL_POLYMORPH_SELF));
    SetCampaignInt(sRIP, GetName(oPC), GetCurrentHitPoints(oPC));

    SalvaConjuros(oPC);
}

_________________
Volver arriba Ir abajo
Ender
Patos@
Patos@


Masculino
Edad: 18
Puntos de Actividad: 442

Cantidad de envíos: 11
Fecha de inscripción: 31/08/2009

Nº. de Miembro: 100
Respeto por el Foro:
100 / 100100 / 100


MensajeTema: Re: Guardar conjuros de jugador al salir   Lun 31 Ago 2009, 1:55 am

Este está muy bien, pero desgraciadamente no sirve si reinicias el módulo.

Creo que este tenía un fallo con los conjuros de clérigo, por el tema de los dominios, ya que no se se ciñen al spells típico del juego. No sé si bioware lo ha solucionado.
Volver arriba Ir abajo
 

Guardar conjuros de jugador al salir

Ver el tema anterior Ver el tema siguiente Volver arriba 
Página 1 de 1.

Permiso de este foro:No puedes responder a temas en este foro.
Neverwinter Nights, modding - scripts - manuales, todo sobre el NWN :: NWToolSet (Aurora) :: Scripting NWN :: Baul de Scripts-
Publicar nuevo tema   Responder al tema