Go Back   RunUO - Ultima Online Emulation > RunUO > Script Support

Script Support Get support for modifying RunUO Scripts, or writing your own!

Reply
 
Thread Tools Display Modes
Old 08-06-2008, 04:39 PM   #1 (permalink)
Lurker
 
Join Date: Apr 2006
Posts: 6
Default changing what an escortable drops

I'm attempting to change what the escortable drops, in this case change it from gold to an item. In BaseEscortable.cs around line 302 I found this peice of code

Code:
Container cont = escorter.Backpack;

if ( cont == null )
cont = escorter.BankBox;

Gold gold = new Gold( 500, 1000 );

if ( cont == null || !cont.TryDropItem( escorter, gold, false ) )
gold.MoveToWorld( escorter.Location, escorter.Map );
Now to get the npc to drop something other than gold I have tried changing
Code:
Gold gold = new Gold( 500, 1000 );
to
Code:
Item item = new Item ( item name placed here () );
I have also tried this method
Code:
Gold gold = new Item(  item name placed here ());
as well as trying this
Code:
mobile.AddToBackpack( new Item name placed here(  ) );
I have also tried changing each reference to gold in the script section up above to item as well. I know my scripting skills are not great, but we all must learn somewhere. If any one could give me a hand on this, or even point me in the right direction it would be apprieated. I have attempted to look for a quest NPC escortable that gave items as well but I did not find it, which doesn't mean its not there, just means I'm horrible at finding things on the forums.
x2man is offline   Reply With Quote
Old 08-06-2008, 05:15 PM   #2 (permalink)
Forum Novice
 
Tassyon T's Avatar
 
Join Date: Sep 2007
Posts: 173
Default

What do you mean by "drops"? Do you mean you want to change what escortables give players who successfully escort them somewhere?? Or, do you want to change what the escortable drops on death, if the player kills him/her?
Tassyon T is offline   Reply With Quote
Old 08-06-2008, 06:20 PM   #3 (permalink)
Forum Expert
 
Join Date: Dec 2006
Location: Southern Utah
Posts: 639
Send a message via Yahoo to greywolf79
Default

I like the idea of giving tokens instead of gold... know how that could be accomplished?

GreyWolf.
greywolf79 is offline   Reply With Quote
Old 08-06-2008, 11:51 PM   #4 (permalink)
Master of the Internet
 
Joeku's Avatar
 
Join Date: Feb 2005
Location: ShatteredSosaria.com
Posts: 9,226
Default

You're on the right track. You found the piece of code where the escort arrives at its destination and gives the escorter his reward:
Code:
Say( 1042809, escorter.Name ); // We have arrived! I thank thee, ~1_PLAYER_NAME~! I have no further need of thy services. Here is thy pay.

// not going anywhere
m_Destination = null;
m_DestinationString = null;

Container cont = escorter.Backpack;

if ( cont == null )
	cont = escorter.BankBox;

Gold gold = new Gold( 500, 1000 );

if ( !cont.TryDropItem( escorter, gold, false ) )
	gold.MoveToWorld( escorter.Location, escorter.Map );

StopFollow();
First, the script defines Container "cont". It sets "cont" to the escorter's Backpack, and then it checks to see if the Backpack exists. If it doesn't exist (i.e. if it's null), it sets "cont" to the escorter's BankBox.
Then, the script creates a new Gold item. Then, the script tries to drop the gold in "cont". If it can't, for whatever reason, then it moves the gold to the player's feet.

So, say you want to replace the gold with a Kryss. You'll make the following modifications:
Code:
Say( 1042809, escorter.Name ); // We have arrived! I thank thee, ~1_PLAYER_NAME~! I have no further need of thy services. Here is thy pay.

// not going anywhere
m_Destination = null;
m_DestinationString = null;

Container cont = escorter.Backpack;

if ( cont == null )
	cont = escorter.BankBox;

Kryss item = new Kryss();

if ( !cont.TryDropItem( escorter, item, false ) )
	item.MoveToWorld( escorter.Location, escorter.Map );

StopFollow();
It really doesn't matter what you define the Kryss as - in this case, I just named it "item", but you could name it "applepie" if you wanted to. Then you just have to modify the lines that give the item to the player, and - voila!

Hope that helps.
Joeku is offline   Reply With Quote
Old 08-07-2008, 09:17 AM   #5 (permalink)
Lurker
 
Join Date: Apr 2006
Posts: 6
Default

Joeku Thank you very much, with this information I was able to get it to work.
x2man is offline   Reply With Quote
Old 08-07-2008, 09:40 AM   #6 (permalink)
Lurker
 
Join Date: Apr 2006
Posts: 6
Default

greywolf79 you had mentioned wanting to be able to switch the gold for tokens. Just to try to give back a little Here is how you can do it if your using Daats Token system. Go to around line 307 of BaseEscortable.cs or better yet do a search for Gold the second one you find should be the correct location but just to make sure look back in this post for the correct area to modifiy. Any way the code would look like this.

Code:
 
Container cont = escorter.Backpack;
 
if ( cont == null )
cont = escorter.BankBox;
 
Daat99Tokens item = new Daat99Tokens( 250, 500 );
 
if ( cont == null || !cont.TryDropItem( escorter, item, false ) )
item.MoveToWorld( escorter.Location, escorter.Map );
Red stuff is the changes. The numbers in between the brackets would be the range for the value of your tokens. I take no credit for this as I didn't completly understand how to write it, so the credit goes to Joeku.

Last edited by x2man; 08-07-2008 at 09:53 AM.
x2man is offline   Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off



Powered by vBulletin® Version 3.7.0
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.2.0 RC5