Full Version : H E L P
xmlspawner >>Scripting Support >>H E L P


<< Prev | Next >>

semolo- 09-21-2006
Help how to make a limit of time for items?



ArteGordon- 09-21-2006
QUOTE (semolo @ September 21, 2006 11:12 am)
Help how to make a limit of time for items?

I'm not exactly sure what you mean. Do you want to create items that will be automatically deleted after a certain time?

You can use the TemporaryQuestObject attachment to do this.

QUOTE

- added the new TemporaryQuestObject attachment that allows you to tag items/mobiles so that they are automatically deleted after some period of time, or whenever the quest they are associated with is completed (when the questholder associated with the quest deleted). (thanks to Eymerich for the idea).
The syntax is
TemporaryQuestObject,questname[,expiration]

To use this simply put the attachment on an object, and assign the questname, owner.
You can also use it to make temporary objects that are not associated with a quest by just specifying an expiration time.
The way it works is When the attachment is deleted, the object it is attached to is also deleted.

Typically you would probably create the object with the attachment using a spawn entry like this

GIVE/<questholder/name/MyQuest/objective1/KILL,orc/autoreward/true/rewardstring/gold,100>
GIVE/<longsword/name/Quest Sword/ATTACH/<temporaryquestobject,MyQuest/questowner/TRIGMOB>>

This would hand out a quest named MyQuest, and then give the triggering player a longsword named "Quest Sword" that was associated with MyQuest.
Note that the mobile who is the questowner of the temporaryquestobject must be manually specified by setting the QuestOwner property on the attachment.

To make a general temporary object independent of any quests, just use the attachment with an expiration time like this

longsword/name/poof/ATTACH/temporaryquestobject,tempsword,3

which would make a sword that would autodelete after 3 minutes (the name "tempsword" could be anything since it it isnt really used for autodeletion and is just to identify the attachment).

- added an example of the use of the temporaryquestobject attachment in tempobject.xml

semolo- 09-21-2006
I do not understand instead of could lay out or show a script as to correct?
Please unsure.gif

semolo- 09-21-2006
About also will not prompt where to take .msf a file for settling Tokuno?

ArteGordon- 09-21-2006
QUOTE (semolo @ September 21, 2006 11:53 am)
I do not understand instead of could lay out or show a script as to correct?
Please unsure.gif

if you want to code this into a script, then you could do it like this

CODE

using System;
using Server;
using Server.Engines.XmlSpawner2;

namespace Server.Items
{
   public class TestMace : Mace
   {

       [Constructable]
       public TestMace()
       {
           // this weapon will delete itself in 10 minutes after being created
           XmlAttach.AttachTo(this, new TemporaryQuestObject("temporarymace", 10));
       }

       [Constructable]
       public TestMace(double minutes)
       {
           // this weapon will delete itself after the specified number of minutes
           XmlAttach.AttachTo(this, new TemporaryQuestObject("temporarymace", minutes));
       }

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

       public override void Serialize(GenericWriter writer)
       {
           base.Serialize(writer);
           writer.Write((int)0);
       }

       public override void Deserialize(GenericReader reader)
       {
           base.Deserialize(reader);
           int version = reader.ReadInt();
       }
   }
}

ArteGordon- 09-21-2006
QUOTE (semolo @ September 21, 2006 11:58 am)
About also will not prompt where to take .msf a file for settling Tokuno?

I'm not sure exactly what you mean.

If you want to import a .msf file, use the

[xmlimportmsf filename

command. You can specify the full path to the file like "C:\data\tokuno\spawns.msf" where you would substitute the actual file and path that you wanted to import.

semolo- 09-22-2006
thn =))