Discussion about the technical aspects of scripting. Ask about all issues involving your freelance projects here.
OldManAlewar
Legendary Scribe
Posts: 408 Joined: Sun Jan 06, 2008 3:42 pm
Post
by OldManAlewar » Thu Oct 09, 2008 12:49 pm
every google i try returns timeSTAMP information or the equivalent i end up with a sloppy bucket of FAIL.
Code: Select all
timespan ts = new timespan();
ts. ????????? <-- what do i do here ?
QuestMarker.DecayTime = ts;
also, will it even decay while in the backpack ? i'm rigging it so a completed quest can be redone when x amount of time has passed.
this belongs in "coding talk": i suck rooster
LordGaav
Adept Scribe
Posts: 49 Joined: Fri Sep 12, 2008 4:09 pm
Post
by LordGaav » Thu Oct 09, 2008 12:55 pm
TimeSpan is part of the C# System namespace, use it like this:
Code: Select all
Timespan ts = System.Timespan.FromDays(1);
Timespan has various From* methods that create a Timespan object for the values given.
You can also just use the constructor:
Code: Select all
public TimeSpan(int hours, int minutes, int seconds);
public TimeSpan(int days, int hours, int minutes, int seconds);
OldManAlewar
Legendary Scribe
Posts: 408 Joined: Sun Jan 06, 2008 3:42 pm
Post
by OldManAlewar » Thu Oct 09, 2008 1:07 pm
sadly, its a read only property of Item/BaseItem for which there is no set()
OldManAlewar
Legendary Scribe
Posts: 408 Joined: Sun Jan 06, 2008 3:42 pm
Post
by OldManAlewar » Mon Oct 13, 2008 3:29 am
Code: Select all
public override TimeSpan DecayTime
{
get
{
return TimeSpan.FromDays(7);
}
}
public bool Decays
{
get { return true; }
}
but the question remains ... can items even decay INSIDE a backpack?
(in this case, players could do the quest once per character, per week )
+Colibri
Administrator
Posts: 4068 Joined: Sat Feb 25, 2006 4:08 pm
Location: static void Main
Post
by +Colibri » Mon Oct 13, 2008 5:24 am
Please don't trash the backpacks of our poor players
If you have a regular Quest typeof QuestSystem with QuestObjective-s, then in your
MyQuest : QuestSystem
{
put:
public override TimeSpan RestartDelay{ get{ return TimeSpan.FromMinutes( 30.0 ); } }
}
You can check how it's done in the grave digging quest:
http://www.runuo.com/forums/attachments ... st-2.0.zip
+Colibri, Administrator of UO Excelsior Shard
Don't know what the purpose of your life is? Well then make something up!
(Old Colibrian proverb)
OldManAlewar
Legendary Scribe
Posts: 408 Joined: Sun Jan 06, 2008 3:42 pm
Post
by OldManAlewar » Mon Oct 13, 2008 8:25 am
+Colibri wrote: Please don't trash the backpacks of our poor players
If you have a regular Quest typeof QuestSystem with QuestObjective-s, then in your
MyQuest : QuestSystem
{
put:
public override TimeSpan RestartDelay{ get{ return TimeSpan.FromMinutes( 30.0 ); } }
}
You can check how it's done in the grave digging quest:
http://www.runuo.com/forums/attachments ... st-2.0.zip
the decay is on the quest marker, not on the BACKPACK
OldManAlewar
Legendary Scribe
Posts: 408 Joined: Sun Jan 06, 2008 3:42 pm
Post
by OldManAlewar » Mon Oct 13, 2008 11:13 am
also, i couldnt find what you pointed me to. (i found the file, just not where they set that little snippet of code )
either i fix this or i have to redo the logic of the quest :S
+Colibri
Administrator
Posts: 4068 Joined: Sat Feb 25, 2006 4:08 pm
Location: static void Main
Post
by +Colibri » Mon Oct 13, 2008 11:32 am
Aha, as for the question itself. Just looking at the source Item.cs (you can download it from runuo), there's a function there:
Code: Select all
public virtual bool OnDecay()
{
return ( Decays && Parent == null && Map != Map.Internal && Region.Find( Location, Map ).OnDecay( this ) );
}
So i guess you need to put in your script something like this:
Code: Select all
public override bool OnDecay()
{
return ( Decays && Map != Map.Internal && Region.Find( Location, Map ).OnDecay( this ) );
}
(just removed the parent==null and made it so it's an override)
+Colibri, Administrator of UO Excelsior Shard
Don't know what the purpose of your life is? Well then make something up!
(Old Colibrian proverb)
OldManAlewar
Legendary Scribe
Posts: 408 Joined: Sun Jan 06, 2008 3:42 pm
Post
by OldManAlewar » Tue Oct 14, 2008 6:03 am
i solved it with a trashbarrel timer
(i still exist, and the .delete is called ONLY on the invisible marker)
now for some slight debugging of the quest .... (been saying that for 2 weeks now)
Harabakc
Legendary Scribe
Posts: 467 Joined: Thu Jun 22, 2006 2:43 pm
Post
by Harabakc » Tue Oct 14, 2008 6:05 am
The peerless quests have decay timers in them, I'm fairly sure that my stacks of adam's ribs decay 1 at a time even though it's in a stack. When the 30 days is up it just disappears out of the pile.
LordGaav
Adept Scribe
Posts: 49 Joined: Fri Sep 12, 2008 4:09 pm
Post
by LordGaav » Tue Oct 14, 2008 12:19 pm
Harabakc wrote: The peerless quests have decay timers in them, I'm fairly sure that my stacks of adam's ribs decay 1 at a time even though it's in a stack. When the 30 days is up it just disappears out of the pile.
Yup, the timers simply have a method that gets called when the specified duration is up. You can do basically anything in that method.