Magic Reflect charge consumption

For ideas on how to make Second Age a better shard. Can it get any better? Maybe.
Forum rules
Posts in this forum are expected to be constructive, realistic and civil. Inflamatory or off topic posts will be removed.
Post Reply
Mikel123
UOSA Subscriber!
UOSA Subscriber!
Posts: 4607
Joined: Wed Jun 24, 2009 7:44 pm

Magic Reflect charge consumption

Post by Mikel123 »

Charge consumption on Magic Reflect items is still a little wonky. I quickly dressed and undressed an item of MR three separate times. The first time, it used 0 charges. The second time, it used 2 charges. The third time, it used 1 :-)

What got me thinking about this in the first place was that I thought it didn't make sense that it would immediately use a charge upon arming, since in that very instant it cannot possibly reflect a spell. It would make more sense if the first charge was used after 5 seconds had passed.

I also am not certain that it should use a charge when it actually reflects a spell. (it's nearly impossible for me to tell if it does currently, but I thought it did). Derrick pasted the code for it from the demo:

Code: Select all

ONEVENT( unequip )(object unequippedfrom)
{
  detachScript(unequippedfrom, "reflctor");  // Remove effect
  return(0x01);
}

ONEVENT( time , "min:**" )()  // once per UO minute, or 5 seconds realtime, 20 ticks
{
  if(isEquipped(this))
  {
    object Q4E2 = containedBy(this);
    if(Q4E2 == NULL())
    {
      return(0x01);
    }
    if(!Q53Z())   // Failed to consume charge?
    {
      detachScript(Q4E2, "reflctor");
      detachScript(this, "wearrflct");
    }
    else  // Charge was consumed
    {
      attachScript(Q4E2, "reflctor");  // apply (or reapply) effect
    }
  }
  return(0x01);
}
Anyways, two questions:

1) Does this code above state that a charge is used upon equipping?
2) Does this code above state that a charge is used upon actually reflecting a spell?

Kaivan
UOSA Donor!!
UOSA Donor!!
Posts: 2923
Joined: Wed Aug 13, 2008 11:07 pm

Re: Magic Reflect charge consumption

Post by Kaivan »

To answer your questions:

1. Yes, a charge is consumed upon equipping an item, but it is not shown in the code that you pasted (its part of the equip event).
2. No, a charge is used every 5 seconds. All this code does is attach the reflect script to a player, while they are wearing an item that has reflect charges. It will continually use a reflect charge every 5 seconds, reapplying the script as necessary, until all charges have been exhausted. At the 5 second interval just after the last last charge is used, it will remove the reflect script from the player.
UOSA Historian and former staff member: August 11, 2008 - June 19, 2016

Useful links for researching T2A Mechanics

Stratics - UO Latest Updates - Newsgroup 1 - Noctalis - UO98.org

Mikel123
UOSA Subscriber!
UOSA Subscriber!
Posts: 4607
Joined: Wed Jun 24, 2009 7:44 pm

Re: Magic Reflect charge consumption

Post by Mikel123 »

Got it, OK thanks for the clarification.

Makes sense to use an initial charge for every other item but this one; I guess the programmers got lazy :-)

So, my items of spell reflection with 1 charge are essentially useless, right?

dren
UOSA Donor!!
UOSA Donor!!
Posts: 1145
Joined: Tue Aug 17, 2010 11:42 pm
Location: Britain

Re: Magic Reflect charge consumption

Post by dren »

Reflect items should only use charges when a spell is reflected. I've noticed that this is bugged here also...
Fit: Alderman, Merchants of Britannia: Proudly serving UOSA for more than 160 Sosarian years.

Image

Kaivan
UOSA Donor!!
UOSA Donor!!
Posts: 2923
Joined: Wed Aug 13, 2008 11:07 pm

Re: Magic Reflect charge consumption

Post by Kaivan »

Actually, magic reflect items should use a charge once every 5 seconds regardless of whether a spell has been reflected or not. This is reflected in the OSI code, and is reflected in newsgroup postings from the era that consistently show magic reflect items to be essentially useless.
UOSA Historian and former staff member: August 11, 2008 - June 19, 2016

Useful links for researching T2A Mechanics

Stratics - UO Latest Updates - Newsgroup 1 - Noctalis - UO98.org

User avatar
Faust
Posts: 6247
Joined: Mon Sep 22, 2008 7:01 pm

Re: Magic Reflect charge consumption

Post by Faust »

dren wrote:Reflect items should only use charges when a spell is reflected. I've noticed that this is bugged here also...
Only during UOR and forward.

Jester
Posts: 66
Joined: Fri May 01, 2009 3:00 pm

Re: Magic Reflect charge consumption

Post by Jester »

Kaivan wrote:Actually, magic reflect items should use a charge once every 5 seconds regardless of whether a spell has been reflected or not. This is reflected in the OSI code, and is reflected in newsgroup postings from the era that consistently show magic reflect items to be essentially useless.
Wait a second I might be misunderstanding here... If I have an item with 100 charges equipped and 5 seconds pass so it uses 1 of them up, I'm left with 99, doesn't that mean that I have a charge of SR on me at that time? Or does a mob/player have to cast a spell at me at the exact time that the item uses a charge for it to work?

Kaivan
UOSA Donor!!
UOSA Donor!!
Posts: 2923
Joined: Wed Aug 13, 2008 11:07 pm

Re: Magic Reflect charge consumption

Post by Kaivan »

Every 5 seconds, the item uses up a reflect charge and attempts to apply magic reflect to you. If you already have magic reflect on you, the charge is effectively wasted. This means that if a person shoots a spell at you, as long as magic reflect is applied, the spell is reflected. To give you some examples, lets assume that someone casts harm on you while wearing a reflect item.

When you equip a reflect item, the reflect spell is automatically added to you and a charge is used, so if a person casts harm on you right after you equip the item, the spell is reflected. The same case is true if he waits 2 or 3 seconds to hit you as well. Now, supposing that the person cast harm on you right after you equipped the item and pulled down your reflect as a result, if he waits another 5 seconds and then casts harm on you again that spell will also be reflected. This is because 5 seconds after you equipped the item, another charge is used reapplying the reflect to you as necessary. So, in any general situation, if the second spell hits you after a new reflect is applied by the item, it too will be reflected. Finally, if we now suppose that after pulling down your reflect a second time (which is now about 5.5 seconds after equipping the item in the first place), 2 seconds later your opponent casts another harm. In this case, since it has not been 5 seconds since the last time that the reflect spell was applied to you, the spell is not reflected back because you do not have the spell adhering to you in the first place.

I hope that covers how the actual item works in enough detail.
UOSA Historian and former staff member: August 11, 2008 - June 19, 2016

Useful links for researching T2A Mechanics

Stratics - UO Latest Updates - Newsgroup 1 - Noctalis - UO98.org

Jester
Posts: 66
Joined: Fri May 01, 2009 3:00 pm

Re: Magic Reflect charge consumption

Post by Jester »

Thanks Kaivan, I get it now :>

But imo, it doesn't make SR items useless, I think they sound pretty nifty :)

User avatar
nightshark
UOSA Subscriber!
UOSA Subscriber!
Posts: 4550
Joined: Mon Apr 20, 2009 10:47 pm

Re: Magic Reflect charge consumption

Post by nightshark »

Jester wrote:Thanks Kaivan, I get it now :>

But imo, it doesn't make SR items useless, I think they sound pretty nifty :)
magic reflect items are amazing when used correctly

and kaivan i think theres an error in what you said. currently reflect items renew themselves if your reflect is pulled off.

eg:
Harm
Harm
Harm
Harm

all casted in succession, will be reflected while a MR item is equipped, regardless of whether there is 5 seconds between harms. It seems to take about 0.5s for magic reflect items to reapply themselves when reflect is removed.
<green> grats pink and co. .... the 3 of you f---ing scrubs together can blow up a bard. IMPRESSIVE

Kaivan
UOSA Donor!!
UOSA Donor!!
Posts: 2923
Joined: Wed Aug 13, 2008 11:07 pm

Re: Magic Reflect charge consumption

Post by Kaivan »

If that's currently the case, that shouldn't be happening. In this post, Batlin outlines the time scale for UO time to real time. Every UO minute is equivalent to 5 real seconds, and in any script with the following line of code

Code: Select all

#on time<"min:**">
the script will trip every time the UO minute changes (the * signifies any change in that column). This means that every 5 seconds the script should attempt to re-apply the reflect script to you. This should give you an open window where a player can pull down your reflect and then hit you with spells in between 5 second intervals.
UOSA Historian and former staff member: August 11, 2008 - June 19, 2016

Useful links for researching T2A Mechanics

Stratics - UO Latest Updates - Newsgroup 1 - Noctalis - UO98.org

Post Reply