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!

changing what an escortable drops

x2man

Sorceror
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.
 

Tassyon T

Wanderer
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?
 

Joeku

Lord
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;

[COLOR="Red"]Kryss item = new Kryss();[/COLOR]

if ( !cont.TryDropItem( escorter, [COLOR="red"]item[/COLOR], false ) )
	[COLOR="red"]item[/COLOR].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.
 

x2man

Sorceror
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;
 
[COLOR=red]Daat99Tokens item[/COLOR] = [COLOR=red]new Daat99Tokens[/COLOR][COLOR=red]( 250, 500 );[/COLOR]
 
if ( cont == null || !cont.TryDropItem( escorter, [COLOR=red]item[/COLOR], false ) )
[COLOR=red]item[/COLOR].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.
 
Top