RunUO Community

This is a sample guest message. Register a free account today to become a member! Once signed in, you'll be able to participate on this site by adding your own topics and posts, as well as connect with other members through your own private inbox!

How To ... create race(Tutorial)

Ra'Thine

Wanderer
I almost forgot about a couple things, since I was so pleased about my new attributes working with my race gates that I was only making changes with those. but here are some of the things I would still like to do.

I will write it out in a word problem for for what I want for this first one.
[code:1]
if character has a beard then;
shave beard;
[/code:1]

in the second case, I want to give a character a long beard. with a hues, and I want this to happen even if the character is a woman. I want this to take place in the Dwarf Gate.

In the last case. I know how to give a character stats, and to make the cap for each stat, strcap, intcap, dexcap.
What I still need help on is with the skills. I can add a +10 to a skill. but don't know how to add the same +10 to that skillcap just for that skill. would it work in the same way as it does with str, dex, and int? such as...
tactics and tacticscap ???
 

David

Moderate
thema said:
Wheehee!

I have succeeded in making a BaseRaceGate class.

Great work! I like that approach enough to go muck with the perfectly fine Gates I already have! If I mess things up though, I'm going to blame you... ;)

Ra'Thine, kirros posted this snippet not too long ago...
[code:1]newChar.Skills[SkillName.Magery].Cap = 120.0;[/code:1]

and this is from the ShaveBeard command...
[code:1]e.Mobile.Target = new DeleteItemByLayerTarget( Layer.FacialHair );[/code:1]

and as long as I'm on a roll, this is more or less taken from WarriorGuard.cs...
[code:1]Item beard = new Item( 0x203E ); //Long Beard
beard.Hue = hair.Hue;
beard.Layer = Layer.FacialHair;
beard.Movable = false;
AddItem( beard );
[/code:1]

have fun!
 

Phantom

Knight
Any future people comming to this post Beta 18 introduced a Player Mobile class where you can make new properties for your players. Be sure charactercreation.cs creates new player using this class. You can read the rest of the thread for more information about how to do races and get ideas.
 

David

Moderate
Very good point Phantom. It does change the whole basis of this modification, for the better I think.
 

Ra'Thine

Wanderer
Thank you david. between that and the changes I need to make for beta 18. I should have my first race gate done the way I like and share it.

Guess all I need to do now. is change all my entries for MyMobile to PlayerMobile. thats easy enough.

Hopefully I won't screw things up to bad, that they can't be fixed. LOL
 

calgar

Wanderer
Gates don't work after update.

After I updated to Beta 18 and changed MyMobile to PlayerMobile, my gates don't work at all. I get no errors, just nothing happens when I walk into them :? Please help :). Here are the 3 scripts.

ElfGate.cs
[code:1]
namespace Server.Scripts
{
public class ElfGate : Item
{
private Point3D newLocation;


[Constructable]
public ElfGate() : base(0x0F6D)
{
Name = "An Elf Race Gate";
this.Movable = false;
}

public ElfGate( Serial serial ) : base( serial )
{
}

public override bool OnMoveOver(Mobile from)
{
Mobile somemobile = from;
PlayerMobile someperso = somemobile as PlayerMobile;

if ( someperso != null )
{

someperso.Hue = 0x224; //gives the player their race's skin colour if different from human's
someperso.InitStats(50, 120, 90); //here are the stats for the race str, dex, intell
someperso.PgRace = RaceType.Elf; //gives the character stats for the gate
Item hair = new Item( Utility.RandomList( 0x203C, 0x203D ) );
hair.Hue = Utility.RandomNondyedHue();
hair.Layer = Layer.Hair;
hair.Movable = false;
someperso.AddItem( hair );
someperso.SendMessage("You are now an Elf");
switch ( Utility.Random( 2 ) )
{
case 0:
from.Location = new Point3D( 1432, 1695, 0 ); //in front of britain bank
break;
case 1:
from.Location = new Point3D( 1434, 1688, 20 ); //on top of britain bank
break;
}


}

return false;
}

public override void Serialize( GenericWriter writer )
{
base.Serialize( writer );

writer.Write( (int) 0 ); // version
}

public override void Deserialize( GenericReader reader )
{
base.Deserialize( reader );

int version = reader.ReadInt();
}
}
}
[/code:1]

MyOwnMobile.cs
[code:1]
using System;
using Server;
using Server.Items;
using System.Collections;
using Server.Mobiles;
using Server.Network;

namespace Server.Scripts
{
public enum RaceType
{
None, Human, Elf, Orc //all the races available
}

public class PlayerMobile : Mobile
{
private RaceType Elf; //Create a private RaceType variable it will countain the race of you're character

public PlayerMobile()
{
PgRace = RaceType.Elf; //don't forget to init the private variable
}

public PlayerMobile( Serial serial ) : base( serial )
{
}

[CommandProperty( AccessLevel.GameMaster )]
public RaceType PgRace
{
get {return Elf;}
set {Elf = value;}
}

public override void OnSingleClick( Mobile from )
{
from.LocalOverheadMessage( MessageType.Regular, 0, false, String.Format( "{0} the {1}", Name, PgRace ) );
}



public override void Serialize( GenericWriter writer )
{
base.Serialize( writer );

writer.Write( (int) 0 );

writer.Write((int) Elf ); // don't forget to save you're characters race
}

public override void Deserialize( GenericReader reader )
{
base.Deserialize( reader );

int version = reader.ReadInt();

switch ( version )
{
case 0:
{
Elf = (RaceType)reader.ReadInt(); //neither to load it
break;
}
}
}
}
}
[/code:1]

CharacterFunction.cs
[code:1]
using System;
using Server;
using Server.Network;

namespace Server.Scripts
{

public class RaceFunction
{


public static void Initialize()
{
Server.Commands.Register( "MyCommand", AccessLevel.Player, new CommandEventHandler( MyCommand_OnCommand ) ); //register the function and is access
}

private static void MyCommand_OnCommand( CommandEventArgs e )
{
Mobile somemobile = e.Mobile;
PlayerMobile from = somemobile as PlayerMobile;

if ( from != null )
{
if (from.PgRace == RaceType.Human) //check you're character race
{
//Put you're action code here
}else{
from.SendMessage("You can not use it.");
}
}
}
}
}
[/code:1]
 

Ra'Thine

Wanderer
I need some help with a couple things. first this. and wouldn't mind adding an allcap to set the total stat cap with the below lines, the total would be 315 and I would like to something like STATCAP = 315;
[code:1]
someperso.STR -= 5;
someperso.MaxSTR = 95;
someperso.DEX += 10;
someperso.MaxDEX = 110;
someperso.INT += 10;
someperso.MaxINT = 110;
[/code:1]

The next thing is I had had trouble removing a beard. and this needs to be for any beard type.
[code:1]
someperso.Target = new DeleteItemByLayerTarget( Layer.FacialHair );
[/code:1]
 

David

Moderate
While looking in CharacterCreation.cs, I found a much better example of removing something from a Layer. In this case it is shoes but you should be able to take what you have and use this technique.
[code:1] Item shoes = m_Mobile.FindItemOnLayer( Layer.Shoes );
if ( shoes != null ) shoes.Delete();
[/code:1]

calgar, I'm still looking at your question.
 

Ra'Thine

Wanderer
Thanks david, I modified what you posted to the code below.
[code:1]
Item beard = someperso.FindItemOnLayer( Layer.FacialHair );
if ( beard != null ) beard.Delete();
[/code:1]
I have not tested this yet, but it does not result in errors. so this is promising.

Can you help out at all with my stats code I posted?
 

David

Moderate
*grin* you know, I would. But I have a headache and that requires more thought than I can handle right now. I'll give it a shot tomorrow... :D
 

David

Moderate
Man, no problem at all :) I can take 'em as well as I dish 'em out.

What worries me is that I actually attempted to make a joke in C#...
*goes off to check his temp*





(476 btw)
 

thema

Wanderer
Ra'Thine said:
I need some help with a couple things. first this. and wouldn't mind adding an allcap to set the total stat cap with the below lines, the total would be 315 and I would like to something like STATCAP = 315;
Code:
[/quote]

I can't see why not. It should work just as easily as any other alteration to the player's stats. Obviously you would need to take care of any powerscroll that might come along later and alter it again.


Thema
 
C

CoHuK

Guest
Skills

Why when I'm setting skills with [code:1]person.Skills[SkillName.Wrestling].Base = 30;[/code:1] it only adds to the skill! I wanted a "Perfect 30"! :) Plz help me!
And one more question! Describe plzz how can I set Skillcap and where i need to write command/function
 

braincrash

Sorceror
Hi i'm not managing to get the scripts working i'm trying to add a function that teleports the mobile(player) to another place but i don't want a switch function i just want to send him to a location.


Can you guys help me out.


thanks
 
Top