Aller au contenu

Photo

Save character widget .


  • Veuillez vous connecter pour répondre
2 réponses à ce sujet

#1
Knight_Shield

Knight_Shield
  • Members
  • 444 messages
I found this on the vault.Cant get it to work for some reason. It is a save character widget. The tag is the same as script.

void i_save_char(){    // The object that activated the item    object oActivator = GetItemActivator();
    // The object that oActivator aimed the item at    object oTarget = GetItemActivatedTarget();
    // Only worry about saving players    if(TRUE == GetIsPC(oTarget))    {        // Do the save        ExportSingleCharacter(oTarget);
        // Notify the players that the save has taken place        if(oTarget == oActivator)        {            SendMessageToPC(oActivator, "Your player file has been saved.");        }        else        {            SendMessageToPC(oActivator, GetName(oTarget) + "'s player file has been saved.");            SendMessageToPC(oTarget, GetName(oActivator) + " has forced a save of your player file.");        }    }
    // Sass them just a bit if they do something silly    else    {        SendMessageToPC(oActivator, "Somehow I don't think " + GetName(oTarget) + " has a player file since ohhhhh... they are not a PLAYER.");    }}  // END ofvoid main()

#2
Evelath

Evelath
  • Members
  • 56 messages
Well, for one, your code is completely commented out...  I'll assume it's a formatting issue:

void main()
{


    // The object that activated the item
    object oActivator = GetItemActivator();
    // The object that oActivator aimed the item at
    object oTarget = GetItemActivatedTarget();
    // Only worry about saving players
    if(FALSE == !GetIsPC(oTarget))
    {
    // Do the save

    if(oTarget == oActivator)
    {
    ExportSingleCharacter(oActivator);
    SendMessageToPC(oActivator, "Your player file has been saved.");
    }
    else
    {
    SendMessageToPC(oActivator, GetName(oTarget) + "'s player file has been saved.");
    SendMessageToPC(oTarget, GetName(oActivator) + " has forced a save of your player file.");
    }
    }
    // Sass them just a bit if they do something silly
    else
    {
    SendMessageToPC(oActivator, "Somehow I don't think " + GetName(oTarget) + " has a player file since ohhhhh... they are not a PLAYER.");
    }
    }  // END ofvoid main()

This script is essentially overwritting the character file that you are currently using, rather than making a new entry.  That is what you want, yes?

EDIT: I made some minor adjustments, but it still works.

Modifié par Evelath, 04 mai 2011 - 02:58 .


#3
Knight_Shield

Knight_Shield
  • Members
  • 444 messages
Thanks Evelath