1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Character Creation - Per Account

Discussion in 'Script Support' started by SwirlyImp, Dec 11, 2013.

  1. SwirlyImp
    Offline

    SwirlyImp New Member

    Joined:
    Dec 10, 2013
    Messages:
    1
    Likes Received:
    0
    I am wanting to give multiple items to players on a per account basis. So I put this in my "CharacterCreation.cs" script like this:

    Code (C#):
    1. using System;
    2. using Server.Accounting;
    3. using Server.Engines.XmlSpawner2;
    4. using Server.Items;
    5. using Server.Mobiles;
    6. using Server.Network;
    7.  
    8.  
    9.  
    10.  
    11. namespace Server.Misc
    12. {
    13.     public class CharacterCreation
    14.     {
    15.         private static readonly CityInfo m_NewHavenInfo = new CityInfo("New Haven", "The Bountiful Harvest Inn", 3503, 2574, 14, Map.Trammel);
    16.         private static Mobile m_Mobile;
    17.         public static void Initialize()
    18.         {
    19.             // Register our event handler
    20.             EventSink.CharacterCreated += new CharacterCreatedEventHandler(EventSink_CharacterCreated);
    21.             EventSink_CharacterCreated.Login += new LoginEventHandler(EventSink_GiveNewPlayerItemsOnLogin);
    22.         }
    23.  
    24.  
    25.  
    26.  
    27.         public static bool VerifyProfession(int profession)
    28.         {
    29.             if (profession < 0)
    30.                 return false;
    31.             else if (profession < 4)
    32.                 return true;
    33.             else if (Core.AOS && profession < 6)
    34.                 return true;
    35.             else if (Core.SE && profession < 8)
    36.                 return true;
    37.             else
    38.                 return false;
    39.         }
    40.  
    41.  
    42.  
    43.  
    44.         private static void AddBackpack(Mobile m)
    45.         {
    46.             Container pack = m.Backpack;
    47.  
    48.  
    49.  
    50.  
    51.             if (pack == null)
    52.             {
    53.                 pack = new Backpack();
    54.                 pack.Movable = false;
    55.  
    56.  
    57.  
    58.  
    59.                 m.AddItem(pack);
    60.             }
    61.  
    62.  
    63.  
    64.  
    65. //          PackItem(new RedBook("a book", m.Name, 20, true));
    66. //          PackItem(new Gold(1000)); // Starting gold can be customized here
    67. //          PackItem(new Candle());
    68.  
    69.  
    70.  
    71.  
    72.             if (m.Race != Race.Gargoyle)
    73.                 PackItem(new Dagger());
    74.             else
    75.                 PackItem(new GargishDagger());
    76.         }
    77.        
    78.          private static void EventSink_GiveNewPlayerItemsOnLogin( LoginEventArgs args )
    79. {
    80.             //ONE ITEM PER ACCOUNT//
    81.        
    82.             Account acct = args.Mobile.Account as Account;
    83.             if (acct.GetTag("NewPlayerItems") == "Received")
    84.             {
    85.               // They already got one...
    86.             }
    87.             else
    88.             {
    89.               PackItem( new BankCheck(50000) );
    90.               acct.SetTag("NewPlayerItems", "Received");
    91.             }
    92.        
    93.             //ONE ITEM PER ACCOUNT//
    94. }
    Here is the error I am receiving:

    Code (C#):
    1. Errors:
    2.  + Misc/CharacterCreation.cs:
    3.     CS0119: Line 18: 'Server.Misc.CharacterCreation.EventSink_CharacterCreated(S
    4. erver.CharacterCreatedEventArgs)' is a 'method', which is not valid in the given
    5.  context
    6. Scripts: One or more scripts failed to compile or no script files were found.
     
  2. Redmoon
    Offline

    Redmoon Active Member

    Joined:
    Sep 16, 2013
    Messages:
    264
    Likes Received:
    39
    Since you are wanting it to be per account and not per character, I would put this item or items in the veteran rewards. ;)
     
  3. Ravenwolfe
    Offline

    Moderator ServUO Developer

    Joined:
    Sep 7, 2013
    Messages:
    1,102
    Likes Received:
    117
    You don't need an eventsink accomplish what you are wanting to do. You can either create a method (essentially what you did in the account tag area) and call the method from the method that creates the character, or you can simply put that code directly into the method that the character is created.
     
Similar Threads: Character Creation
Forum Title Date
ServUO Discussion Server restarts on character creation Jul 9, 2017
Support SkillCodex on CharacterCreation.cs Apr 15, 2017
Script Support Adding flags to character creation... Feb 23, 2017
Archived Bug Reports Elf facial hair on character creation Dec 29, 2016
Script Support Getting a newb human/elf armor set to auto equip in charactercreation Nov 10, 2016
Script Support CharacterCreation.cs Equipped shoes Oct 8, 2016
Script Support Item Creation for First Character May 19, 2016