|
||
|
|||||||
| Script Support Get support for modifying RunUO Scripts, or writing your own! |
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 (permalink) |
|
Forum Novice
|
Is there a way to make all new characters have 100str 100dex and 100int right when they join?
Also Is there a way to make them start with the same stuff no matter what template they choose? Please aim me to help.
__________________
AIM - nolliepoper |
|
|
|
|
|
#2 (permalink) |
|
Forum Novice
Join Date: Jan 2003
Location: Rochester NY
Age: 27
Posts: 208
|
Use the Set STR, Set DEX, and Set INT directives in the playermobile.cs "x:\runUO\Scripts\Mobiles\". You can find the proper usage in there already, just change the values. Alternatively, they can be altered in CharacterCreation.cs
As for adding items: Here's a good link with an explanation. How to make players start with a full rune book Basically in CharacterCreation.cs find the add entries and append your item to the list by creating a new variable for it, Setting any properties (like durability, requirement etc.) and then telling it to add the item described in that variable to the player's backpack. PsudoCode: Item NewVariableName = new (ItemName); VariableName.PropertyToSet = PropertyValue; PackItem( VariableName ); I would be careful setting beginning stats so high initially. It's great for a test shard and troubleshooting new scripts, but it won't attract real players to join. I've joined dozens of shards posted here over the years. Those who focus on maintaining a challenging game and release scripts will real creative innovation are a success. Those who buff every player, item stat etc die out quickly. It gets boring and achievement means nothing so there is no incentive to continue playing. Unless you have severely buffed new monsters or a large player base focused solely on PvP, I would be careful modifying any starting values. Good luck.
__________________
•¤•¤•Arkryal •¤•¤• |
|
|
|
|
|
#3 (permalink) |
|
Forum Novice
|
You seem to know a lot about scripting but you really didn't answer any of my questions.
I never asked how to add item to a pack or runebook and you never explained how to make all new chars have 100 each stat instead you just said that is not a good idea be careful.
__________________
AIM - nolliepoper |
|
|
|
|
|
#4 (permalink) |
|
Forum Novice
Join Date: Jan 2003
Location: Rochester NY
Age: 27
Posts: 208
|
I misunderstood. My assumption was that you wanted X item added to everyone's pack regardless of profession. If you want to override the template, there are several ways of going about it. You can either remove the items in the templates so they are not added to the pack, then set your default equipment for all characters exactly like the runebook example, or alternatively, you can leave the template code in tact and simply remove all items at creation time, then add what you want them to have, again as in the runebook example. To preserve some of code (since it may be called by other scripts) I would do the latter.
Set an integer variable to 0 begin a counting For loop based on that integer find each item in the pack and delete it add one to integer and continue the count until the pack is empty. terminate the loop then add your default items I don't write the code for you, but the psudocode should give you an idea of what to look for and modify. the sticky discussions have examples of all this, just adapt their example to your purpose, the logic and method are the same. As for setting the stats, it's the exact procedure I described in the first line of my original response. I'll walk you through that one: Open Scripts/Misc/CharacterCreation.cs Search for the EventSink_CharacterCreated function. You'll see something like this: Code:
private static void EventSink_CharacterCreated( CharacterCreatedEventArgs args )
{
if ( !VerifyProfession( args.Profession ) )
args.Profession = 0;
Mobile newChar = CreateMobile( args.Account as Account );
if ( newChar == null )
{
Console.WriteLine( "Login: {0}: Character creation failed, account full", args.State );
return;
}
args.Mobile = newChar;
m_Mobile = newChar;
newChar.Player = true;
newChar.AccessLevel = args.Account.AccessLevel;
newChar.Female = args.Female;
//newChar.Body = newChar.Female ? 0x191 : 0x190;
if( Core.Expansion >= args.Race.RequiredExpasnion )
newChar.Race = args.Race; //Sets body
else
newChar.Race = Race.DefaultRace;
//newChar.Hue = Utility.ClipSkinHue( args.Hue & 0x3FFF ) | 0x8000;
newChar.Hue = newChar.Race.ClipSkinHue( args.Hue & 0x3FFF ) | 0x8000;
newChar.Hunger = 20;
bool young = false;
if ( newChar is PlayerMobile )
{
PlayerMobile pm = (PlayerMobile) newChar;
pm.Profession = args.Profession;
if ( pm.AccessLevel == AccessLevel.Player && ((Account)pm.Account).Young )
young = pm.Young = true;
}
This is the variable that becomes the character. We handle this in exactly the same way as the runebook example: VariableName.AttributeToSet = Value; In this case the Variable name is newChar, you want to set the STR and the value is 100. We'll use the SetSTR directive, you can see an example of it in nearly any Mobile script (monsters, animals etc) so your code would be: Code:
newChar.SetSTR(Low number,Max number); Code:
newChar.STR = 100; This should override everything. Depending on the version you're using, the "Advanced Character creation" gump allows players to set Str, Dex, and Int. In that case (again depending on client and RunUO version) this may override your settings. If in running the game you don't see the changes, look for: Code:
private static void SetStats( Mobile m, int str, int dex, int intel )
{
FixStats( ref str, ref dex, ref intel );
if ( str < 10 || str > 60 || dex < 10 || dex > 60 || intel < 10 || intel > 60 || (str + dex + intel) != 80 )
{
str = 10;
dex = 10;
intel = 10;
}
m.InitStats( str, dex, intel );
}
Take out: Code:
if ( str < 10 || str > 60 || dex < 10 || dex > 60 || intel < 10 || intel > 60 || (str + dex + intel) != 80 )
{
str = 10;
dex = 10;
intel = 10;
}
Code:
m.InitStats( 100, 100, 100 ); Remember to backup the file before modifying incase you make a mistake. That way you can always return to a working copy. Just make sure your backup is saved in a directory above the scripts folder so the compiler doesn't see 2 conflicting versions. Now every new character you make should have 100 str, int, & dex. Existing characters will not be changed since the code is only applied when the character is created and never again afterward. If you want to update existing characters all at once you'll have to write a new script all togeather. It would search for plaers in the world exactly as you search for items to delete in a backpack from the above instruction, you're just changing the search criteria, but the method is the same. cycle through each one resetting the stats and terminate when everyone is updated. Both of your requests have been answered in detail with code multiple times by many other people in this forum, so a search will turn up some samples to compare with. That's the easy way out, I recommend you look at the code and try to understand it, it may take a minute, but once it clicks, you'll be able to do a lot more on your own with minimal effort. Copying and pasting someone else's code doesn't help you understand and only leads to repeat questions, thus I don't write the full script for people. You'll get it easily enough and if you hit any snags, PM me and I'll help.
__________________
•¤•¤•Arkryal •¤•¤• |
|
|
|
|
|
#5 (permalink) |
|
Forum Novice
|
you messed up a bit
newChar.RawStr = 100; but anyways I got my new chars to 100 each stat but if you still want to help me maybe you could explain how to make all chars start with the same stuff no matter what template they choose ps. I wouldn't have posted this thread if I could have found the answer in my searches do you have aim?
__________________
AIM - nolliepoper |
|
|
|
|
|
#6 (permalink) |
|
Forum Novice
Join Date: Jan 2003
Location: Rochester NY
Age: 27
Posts: 208
|
You have variables and functions of 3 different categories, Mobiles, Items, and an array, so make sure your includes contain:
Code:
using System.Collections.Generic.List; using Server.Items; using Server.Mobiles; Code:
if (newChar.Backpack !=null)
{
Container emptypack = newChar.Backpack;
ArrayList delitems = new ArrayList(emptypack.Items);
foreach (Item item in delitems)
{
if (item.Movable != false)
{
item.Delete();
}
}
}
Directly below it, add your new items to the backpack. Look at the runbook example. They are adding a runebook, but you would change the code to represent any item you want, the process is the same. Now when you load a new character they will be created with all the default items, those items will be deleted immediately (before the character is even accessible to the player) and new items you define will be added in after the mass delete. I haven't tested the code on my end, but it should work. It is imperative you place the code in the correct area of the script or it will execute before the items are added. if needed, create a new function (public void MyFunction(...) ) etc, and call it at the very end of the script. Again how you put the code in is dependent on version, so I can't tell you exactly. You can also look for: switch ( prof ) That is basically a case statement, or array of (if this...do this). "prof " is a variable containing the professions. Below that you'll see the word "case" followed by a profession type. Each case is an if statement. If Profession(prof) equals case Necromancer then do this. in there you will find each profession listed and each case for the profession will have the items that are added for them. Simply delete them. In fact, you can delete the whole switch statement as long and you are mindful of which {brackets} you take out. This add the items to the pack that are unique for each profession. There is another section that adds items to the body (like an alchemist starts wearing a red robe), delete those. Then there is one more section that has backpack items that everyone gets. The starting gold, candle, dagger, and blank book. You can remove those if you like. That is also where you would add your items, just look at their example.
__________________
•¤•¤•Arkryal •¤•¤• |
|
|
|
|
|
#7 (permalink) | |
|
Forum Novice
Join Date: Sep 2007
Posts: 367
|
Quote:
Changing Starting Equipment: (1) New player's starting equipment (2) how to add stuff in a new char bank or pack (3) Add Spellbook to New Players (4) how to set starting items in player bank and pack (5) Make Items Come in Pack (6) Starting Items. (7) Placing item in charactercreation.cs ONLY FOR FIRST CHAR Changing Starting Stats: (1) Edit Starting Stats (2) Modifying starting stats |
|
|
|
|
|
|
#8 (permalink) |
|
Forum Novice
Join Date: Jan 2003
Location: Rochester NY
Age: 27
Posts: 208
|
Here's a good tip for searching:
Never use the forum search.. Instead go to Google.com and type "site:http://www.runuo.comWhatever you're looking for" That will bring up page indexes only from this site, but will search by groups of words instead of each word individually, so it's much more accurate. Also, make use of quotation marks when looking for exact lines of code. That means it will only return results containing the exact match of whatever you put within the quotations. I may screw around with a custom search for the site at some point. A lot of people have trouble locating meaningful results with the vBullitin crap search that's built in. If I do get to it, I'll post a new thread. Edit: Go here: http://mycroft.mozdev.org/search-eng...e=RunUO+Search for a runUO custom search plugin for firefox 2.0 - 3.0 Here is the site if you want to use it directly: http://www.google.com/coop/cse?cx=00...29:cqb26g200kq It's not pretty, but it works 1000 times better than the forum search.
__________________
•¤•¤•Arkryal •¤•¤• Last edited by Arkryal; 08-15-2008 at 12:43 PM. |
|
|
|
|
|
#9 (permalink) | |
|
Forum Novice
|
Quote:
__________________
AIM - nolliepoper Last edited by nolliepoper; 08-15-2008 at 01:14 PM. |
|
|
|
|
|
|
#10 (permalink) |
|
Forum Novice
Join Date: Jan 2003
Location: Rochester NY
Age: 27
Posts: 208
|
Okay, we'll go through this again:
You have CharacterCreation.cs This script tells the game how to make new characters, what items to give them, what stats and skills to set etc. It is in there that you will find everything related to making new characters. As I understand it, you want every characters to start with the same items and stats. The first part of this is removing the old code that defines the default items and stats. With out that, everyone starts with nothing instead of everyone having different equipment etc. Now we're working from a clean slate, so simply add the items you DO want them to start with and compile. Now everyone starts with the same items, same stats etc. Copy your script and paste it into the code brackets so we can see what you have so far. Add // marks at the end of the lines you've already modified so we can see what your doing, and list specifically what you want each character to have, the stats of the items your giving them etc. From there we can help you with specific examples. We also need to know what version server you're running, what client, and are there any client mods. The links Tassyon provided, as well as the runebook example I showed you should be adequate for this. They show you how to add an item to a new character, so logically, it stands to reason if there is an item being added you DON'T want given to new players (for example the candle), you would look for similar code in that script, identical except that it says Candle instead of runebook, and delete it. Once that line is removed, the script isn't being told to generate a Candle, so naturally, one wont be created when the character is. Actually read the code and try to see what it does. This exerpt is clearly understandable to those with no programming experience: Code:
private static void PackInstrument()
{
switch ( Utility.Random( 6 ) )
{
case 0: PackItem( new Drums() ); break;
case 1: PackItem( new Harp() ); break;
case 2: PackItem( new LapHarp() ); break;
case 3: PackItem( new Lute() ); break;
case 4: PackItem( new Tambourine() ); break;
case 5: PackItem( new TambourineTassel() ); break;
}
}
Below that you see "Switch". As we discussed, this is basically saying IF x Then do This. Its condition is one of 6 random numbers, 0-5. So the compiler hits this line and makes a random number 0-5. In the case statement "case 0:" we see what it will do if that random number is 0. If it picks a 1 instead, it jumps to "Case 1:" Lets focus on case one. It says "PackItem( new Harp());" Pack item implies that this is an item that will be placed in... You guessed it, Their Pack! That item is a Harp. In fact, all items being created are instruments, and since you know not every player begins with an instrument, you can assume this whole section of code is only used if the new player is a Bard. You will find similar functions for each profession. Each function defines what characters of that profession will start with. You'll see one for the Alchemist, NecroMancer, Mage etc... Each will contain such an entry. But for now we'll just focus on the Bards. Let's say you wanted a bard to start with no instruments initally. We just remove the whole block of code that makes the instruments. It would look like this: Code:
private static void PackInstrument()
{
}
All we did was remove the code that said "Hey this is a bard, give him an instrument". You will find similar sections for scribes, blacksmiths... basically any profession that starts with some unique equipment. Look for them and do the same thing. You'll find some line Use "EquipItem" instead of "PackItem". As the name suggests, these items are equipped, not placed in the pack, so you may wish to remove them as well. The procedure is the same. Around line 30 or so you'll find this code as well: Code:
PackItem( new RedBook( "a book", m.Name, 20, true ) ); PackItem( new Gold( 1000 ) ); // Starting gold can be customized here PackItem( new Dagger() ); PackItem( new Candle() ); Lets say you want to remove just the dagger, delete that line Code:
PackItem( new RedBook( "a book", m.Name, 20, true ) ); PackItem( new Gold( 1000 ) ); // Starting gold can be customized here PackItem( new Candle() ); Code:
PackItem( new RedBook( "a book", m.Name, 20, true ) ); PackItem( new Gold( 5000 ) ); // Starting gold can be customized here PackItem( new Candle() ); Code:
PackItem( new RedBook( "a book", m.Name, 20, true ) ); PackItem( new Gold( 5000 ) ); // Starting gold can be customized here PackItem( new Scimitar() ); It is worth mentioning that you will almost NEVER find an example of the exact code you are looking for. If you want to modify something, begin by asking your self "What steps do I need to take to get what I want?" From there you can find other code that may serve a different purpose but functions logically the same. In this case, the "How to add new items" should by an extension of logic also tell you how to remove items you don't want people to start with. Thus if you remove all items, then add in only the ones you want, everyone will have the same items.
__________________
•¤•¤•Arkryal •¤•¤• Last edited by Arkryal; 08-15-2008 at 02:09 PM. |
|
|
|
![]() |
| Bookmarks |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|