Tile Target
Entity Target Sample
using System.Collections.Generic; using ScriptSDK; using ScriptSDK.Engines; using ScriptSDK.Items; using ScriptSDK.Mobiles; namespace ScriptNet.Sample { public class BaseOre : Item { public BaseOre(uint ObjectID) : base(ObjectID) { } public BaseOre(Serial serial) : base(serial) { } public virtual bool Smelt() { // If the double click succeed we assign it a Target Handler if (DoubleClick()) return new SmeltTarget(this, 1000).Action(); return false; } private class SmeltTarget : EntityTarget { public SmeltTarget(UOEntity source) : base(source) { } public SmeltTarget(UOEntity source, int Delay) : base(source, Delay) { } public override bool Action(params object[] args) { //In our case we want to find the Target ourself. But we also could had passed it. //So we delete all old arguments to keep sure args = new object[]{}; // Now we search for the forge by calling FindForge Item i = FindForge(); // We double check if we found a forge and if this is true, we assign it to args if(i != null) args = new object[]{i}; //Now this calls the core, if the targetcursor appeared within time it will try to handle the Target Cursor and return the state. return base.Action(args); } private Item FindForge() { var list = new List<ushort>(); // All Graphic ID´s of Forges based on RunUO for(ushort e = 6522;e <= 6569;e++) list.Add(e); list.Add(4017); //We assign the Scanner Scanner.Initialize(); //And only want to scan Forges in range of 2 Tiles Scanner.Range = 2; //Scans for Forges and pass results back var resultlist = Scanner.Find<Item>(list, 0xFFFF, 0x0000, false); //If we found any result we pass the first back if(resultlist.Count > 0) return resultlist[0]; //Else we pass null back (So no Result found). return null; } } } }
This sample shows how to make Ore available and let the handler smelt the ore to Ingot on Fly