|
||
|
|
#1 (permalink) |
|
Forum Expert
Join Date: Apr 2003
Age: 28
Posts: 395
|
I got sick of the crappy AOS armor defenses ( wearing plate didnt really DO anything anymore ). I dont know if this has ever been done before, so if it has, dont scream at me.
I spent 15 minutes just now creating and testing this, and it seems to work fine for what I want on my shard. You can play around with the numbers if you want to modify the damage reduction. This is a VERY simple script, and Im sure anyone will be able to modify it to their personal needs. It takes a look at what the defending player is wearing on all the relevant Armor layers ( including the shield ), adds up their total ArmorBase, divides it by 10, and then subtracts that from the initial damage done. It does all this before the AOS/skill/resistance calculations are completed, so it doesnt affect those. it simply drops the initial damage done, so the overall damage is reduced as well. Since it analyzes each piece of armor individually, it also comes up with the correct damage reduction if you are wearing a combo-set ( for instance, chain chest with plate legs and leather arms ). The ArmorBase for platemail items is 40, so if a player is wearing a full set of platemail ( which is 6 items ), their total armorbase will be 240. Divide that by ten, and the initial damage is reduced by 24. Just find the OnHit method in your BaseWeapon.cs, locate the line that says "int damage = ComputeDamage( attacker, defender );", and paste this in right below it: Code:
//Trying to undo some of the stupid AOS bullshit damage calculations
if ( defender.Player )
{
int armor = 0;
PlayerMobile Pm = defender as PlayerMobile;
Item aa = Pm.FindItemOnLayer(Layer.Helm);
Item bb = Pm.FindItemOnLayer(Layer.Gloves);
Item cc = Pm.FindItemOnLayer(Layer.Neck);
Item dd = Pm.FindItemOnLayer(Layer.InnerTorso);
Item ee = Pm.FindItemOnLayer(Layer.Pants);
Item ff = Pm.FindItemOnLayer(Layer.Arms);
Item gg = Pm.FindItemOnLayer(Layer.TwoHanded);
if ( aa != null && aa is BaseArmor )
{
armor += ((BaseArmor)aa).ArmorBase;
}
if ( bb != null && bb is BaseArmor )
{
armor += ((BaseArmor)bb).ArmorBase;
}
if ( cc != null && cc is BaseArmor )
{
armor += ((BaseArmor)cc).ArmorBase;
}
if ( dd != null && dd is BaseArmor )
{
armor += ((BaseArmor)dd).ArmorBase;
}
if ( ee != null && ee is BaseArmor )
{
armor += ((BaseArmor)ee).ArmorBase;
}
if ( ff != null && ff is BaseArmor )
{
armor += ((BaseArmor)ff).ArmorBase;
}
if ( gg != null && gg is BaseArmor )
{
armor += ((BaseArmor)gg).ArmorBase;
}
damage -= ( armor / 10 );
if ( damage < 1 )
{
damage = 1;
}
}
//End stupid AOS Bullshit undo.
__________________
I reserve the right to be wrong or mistaken about anything at any time, and hereby exercise my constitutional right to never be flamed by anyone :) http://pix2.hotornot.com/pics/HQ/KY/...RUORSFGBLU.jpg |
|
|
|
|
|
#2 (permalink) |
|
Forum Expert
|
yes, i just read about loops from my C# book, and a loop would make this alot better looking and effecient.
im debating whether this would be good or not.....it is pretty much damage resistance ala D&D right? cause the damage never makes it too you what about characters that can't even deal that much damage? at least normally, they would stand a slight chance of dealing damage, but now.....there would be none but i am guessing the max damage resistance would be 24 for full plate then? either way, good thing here....just may not be for everyone |
|
|
|
|
|
#3 (permalink) |
|
Forum Expert
Join Date: Apr 2003
Age: 28
Posts: 395
|
Yes I understand. But I like alot of the features of AOS. So I did this instead. And your right, I DO need to learn how to use loops ( and alot more ). I do everything longhand.
I never said I was a great scripter. But I can get done what I need to get done with the limited knowledge that I have. I am still learning (slowly).
__________________
I reserve the right to be wrong or mistaken about anything at any time, and hereby exercise my constitutional right to never be flamed by anyone :) http://pix2.hotornot.com/pics/HQ/KY/...RUORSFGBLU.jpg |
|
|
|
|
|
#4 (permalink) |
|
Forum Expert
Join Date: Apr 2003
Age: 28
Posts: 395
|
I sat there for about 20 minutes trying to decide whether I should enumerate everything and access it that way, or perhaps create an Item array and add the items to that, and THEN check the ArmorBase of each one using a foreach() loop. But then i realized that in the time I had spent trying to figure out how to do it the RIGHT way, I could have just gotten it done the long, hard and wrong way.
So thats what I did .As soon as I become more proficient at this stuff, Ill start making all my scripts pretty, compact and super functional.
__________________
I reserve the right to be wrong or mistaken about anything at any time, and hereby exercise my constitutional right to never be flamed by anyone :) http://pix2.hotornot.com/pics/HQ/KY/...RUORSFGBLU.jpg |
|
|
|
|
|
#5 (permalink) | |
|
Forum Expert
Join Date: Apr 2003
Age: 28
Posts: 395
|
Quote:
Yes, the max damage resistance offered by the method above would be 24 for a full set of plate. If you divided by 5 instead of 10, it would be 48. If a character cant even deal as much damage as this script reduces it by, then the damage is 1, period. thats what Code:
if ( damage < 1 )
{
damage = 1;
}
__________________
I reserve the right to be wrong or mistaken about anything at any time, and hereby exercise my constitutional right to never be flamed by anyone :) http://pix2.hotornot.com/pics/HQ/KY/...RUORSFGBLU.jpg |
|
|
|
|
|
|
#6 (permalink) |
|
Forum Expert
Join Date: Apr 2003
Age: 28
Posts: 395
|
If it does nothing, then how come it works precisely as I thought it would when i tested it in-game? an archer with 100 skill, str, and dex using a regular bow before I did this modification was doing 28 damage to a player wearing full plate mail will all skills set to 50.
Now he does 3 to 9 damage to the same player wearing full platemail *edit:* thats with AOS enabled
__________________
I reserve the right to be wrong or mistaken about anything at any time, and hereby exercise my constitutional right to never be flamed by anyone :) http://pix2.hotornot.com/pics/HQ/KY/...RUORSFGBLU.jpg |
|
|
|
|
|
#7 (permalink) |
|
Forum Expert
Join Date: Apr 2003
Age: 28
Posts: 395
|
Oh, ok I see what your saying. It does this by default with AOS disabled. But thats not what I wanted. I wanted armor to have the old effect even with AOS. Thats why I did this.
I suppose I could have just cut-and-pasted the non-AOS code into the proper AOS function, but isnt it better that I thought of a solution on my own instead of standing on the shoulders of the devs and ripping off their code? ![]()
__________________
I reserve the right to be wrong or mistaken about anything at any time, and hereby exercise my constitutional right to never be flamed by anyone :) http://pix2.hotornot.com/pics/HQ/KY/...RUORSFGBLU.jpg |
|
|
|
|
|
#8 (permalink) |
|
Forum Expert
Join Date: Apr 2003
Age: 28
Posts: 395
|
bah, fuckit. Ill just delete the post. Its simple and retarded anyway, and anyone who knows anything at all about scripting could have made it. Ill refrain from posting anything in the future unless it has profound significance.
__________________
I reserve the right to be wrong or mistaken about anything at any time, and hereby exercise my constitutional right to never be flamed by anyone :) http://pix2.hotornot.com/pics/HQ/KY/...RUORSFGBLU.jpg |
|
|
|
|
|
#9 (permalink) | |
|
Account Terminated
|
Quote:
|
|
|
|
|
|
|
#10 (permalink) | |
|
Forum Expert
Join Date: Apr 2003
Age: 28
Posts: 395
|
Quote:
But you should know that I ALWAYS listen to what you have to say, and I have never spoken ill of you ( in fact, I can remember defending you more than once, whether you knew it or not ). I respect your opinion and understand your way of doing things. Ill repost the script, even though it IS very simple. But you should know that without you, I would never have progressed as far as I have, and I would never have been able to write the following code, which is just a VERY small part of my Vampire/Werewolf race system: There is no need to critique it. Im just showing you that I can do slightly more than miniscule BaseWeapon mods, and I have you to thank for it. So please, dont ever assume that I dont listen to what you have to say. Code:
using System;
using Server;
using Server.Mobiles;
using Server.Network;
using Server.Items;
namespace Server.Races
{
public class VampireTimer
{
public Mobile Vampire, Victim;
public int HoursRemaining = 0;
public int MinutesRemaining = 0;
public int hours, minutes;
public int DayHoursRemaining = 0;
public static int mod = 0;
public static DateTime restime = DateTime.MinValue;
public static DateTime agetime = DateTime.MinValue;
public static void Initialize()
{
EventSink.ServerStarted += new ServerStartedEventHandler( EventSink_ServerStarted );
}
public static void EventSink_ServerStarted()
{
new NightTimer().Start();
Console.WriteLine("Vampire timers started");
}
public void IntMod()
{
if ( hours > 6 && hours < 16 )
{
mod = 1;
}
else
{
mod = 2;
}
}
public bool Time = false;
public void GetRemaining()
{
Time = false;
if ( !Time && hours >= 8 && hours < 16 )
{
DayHoursRemaining = 15 - hours;
Time = true;
}
if ( !Time && hours < 8 )
{
HoursRemaining = 7 - hours;
Time = true;
}
if ( !Time && hours > 16 )
{
HoursRemaining = (( 23 - hours ) + 8 );
Time = true;
}
MinutesRemaining = ( 60 - minutes );
}
public void SendVampireWarnings( Mobile mobile )
{
string ess1 = ",";
string ess2 = ".";
if ( HoursRemaining > 1 || HoursRemaining == 0 )
{
ess1 = "s,";
}
if ( MinutesRemaining > 1 || MinutesRemaining == 0 )
{
ess2 = "s.";
}
if (mobile.Player && (((PlayerMobile)mobile).IsVampire))
{
if ( hours == 16 )
{
mobile.SendMessage("The sun has gone down. it is now safe to leave the graveyard.");
}
if ( hours == 7 )
{
mobile.SendMessage("The sun will rise in {0} Hour{1} {2} Minute{3} Sunrise is imminent! Get to a graveyard immediately!", HoursRemaining, ess1, MinutesRemaining, ess2 );
}
if ( hours < 7 || hours > 16 )
{
if ( mobile.Player && ((PlayerMobile)mobile).IsVampire )
{
PlayerMobile vampire = mobile as PlayerMobile;
vampire.HasAged = false;
}
if ( HoursRemaining <= 3 )
{
mobile.SendMessage("The sun will rise in {0} Hour{1} {2} Minute{3} You should start looking for a graveyard.", HoursRemaining, ess1, MinutesRemaining, ess2 );
}
if ( HoursRemaining > 3 )
{
mobile.SendMessage("The sun will rise in {0} Hour{1} {2} Minute{3}", HoursRemaining, ess1, MinutesRemaining, ess2 );
}
}
if ( hours >= 8 && hours < 16 )
{
{
mobile.SendMessage("Sunset will come in {0} Hour{1} {2} Minute{3}.", DayHoursRemaining, ess1, MinutesRemaining, ess2 );
}
}
}
}
public void Immolate( PlayerMobile pm )
{
try
{
foreach ( Mobile player in pm.GetMobilesInRange( 20 ) )
{
Effects.PlaySound( pm.Location, pm.Map, 837 );
Effects.PlaySound( pm.Location, pm.Map, 520 );
Effects.PlaySound( pm.Location, pm.Map, 1248 );
Effects.SendLocationEffect( new Point3D( pm.X, pm.Y, pm.Z + 1 ), pm.Map, 0x3709, 15 );
Effects.SendLocationEffect( new Point3D( pm.X, pm.Y, pm.Z + 1), pm.Map, 0x36BD, 15 );
Effects.SendLocationEffect( new Point3D( pm.X + 1, pm.Y, pm.Z ), pm.Map, 0x36BD, 15 );
Effects.SendLocationEffect( new Point3D( pm.X + 1, pm.Y + 1, pm.Z ), pm.Map, 0x36BD, 15 );
Effects.SendLocationEffect( new Point3D( pm.X, pm.Y + 1, pm.Z ), pm.Map, 0x36BD, 15 );
if ( pm.IsWereWolf )
{
player.SendMessage("The Werewolf {0} has been struck down by GOD", pm.Name );
}
else if ( pm.IsVampire && pm.Region.Priority == 56 )
{
player.SendMessage("The Vampire {0} has been struck down by GOD", pm.Name );
}
else
{
player.SendMessage("The Vampire {0} has been immolated by the sun", pm.Name);
}
}
}
catch
{
Console.WriteLine("Exception caught while playing vampire Immolate sequence");
}
pm.Kill();
}
public class NightTimer : Timer
{
public static KillTimer kill = new KillTimer();
public static VampireTimer Core = new VampireTimer();
public static AgeTimer age = new AgeTimer();
public static HolyTimer holy = new HolyTimer();
public NightTimer() : base( TimeSpan.FromMinutes( VampireTimer.mod ), TimeSpan.FromMinutes( VampireTimer.mod ) )
{
Priority = TimerPriority.OneMinute;
}
protected override void OnTick()
{
Messages();
}
public static void Messages()
{
foreach ( NetState state in NetState.Instances )
{
if ( state.Mobile != null && state.Mobile.Player && state.Mobile.Map != null && (((PlayerMobile)state.Mobile).IsVampire ))
{
Clock.GetTime( state.Mobile.Map, state.Mobile.X, state.Mobile.Y, out Core.hours, out Core.minutes );
kill.Stop();
age.Stop();
holy.Stop();
if ((Core.hours > 15 && Core.hours < 17) || (Core.hours > 7 && Core.hours < 9))
{
if( !state.Mobile.Alive && state.Mobile.Region.Priority == 55 && DateTime.Now > restime )
{
state.Mobile.Resurrect();
state.Mobile.PlaySound( 0x214 );
state.Mobile.FixedEffect( 0x376A, 10, 16 );
state.Mobile.SendMessage("You have risen!");
restime = ((DateTime.Now).AddHours( 2 ));
}
}
if ( Core.hours >= 8 && Core.hours < 16 )
{
kill.Start();
}
if ( Core.hours > 15 && Core.hours < 17 )
{
age.Start();
}
holy.Start();
Core.IntMod();
Core.GetRemaining();
if ( state.Mobile.Alive )
{
Core.SendVampireWarnings( state.Mobile );
}
}
}
}
public class KillTimer : Timer
{
public static VampireTimer Core = new VampireTimer();
public KillTimer() : base( TimeSpan.FromSeconds( 1 ), TimeSpan.FromSeconds( 3 ) )
{
Priority = TimerPriority.OneSecond;
}
protected override void OnTick()
{
Kills();
}
public static void Kills()
{
foreach ( NetState state in NetState.Instances )
{
if ( state.Mobile != null && state.Mobile.Player)
{
PlayerMobile pm = state.Mobile as PlayerMobile;
if ( pm.IsVampire && pm.Alive && ( pm.Region.Name == null || pm.Region.Priority != 55))
{
Core.Immolate(pm);
}
}
}
}
}
public class AgeTimer : Timer
{
public AgeTimer() : base( TimeSpan.FromSeconds( 1 ), TimeSpan.FromSeconds( 3 ) )
{
Priority = TimerPriority.OneSecond;
}
protected override void OnTick()
{
Age();
}
public static void Age()
{
foreach ( NetState state in NetState.Instances )
{
PlayerMobile pm = state.Mobile as PlayerMobile;
if ( pm.IsVampire && !pm.HasAged )
{
if ( state.Mobile.Region.Priority == 55 && pm.HasDrunk > 0 && ( agetime < DateTime.Now ))
{
if ( pm.Alive && pm.HasDrunk > 0 && pm.Age < 60 )
{
pm.HasDrunk = 0;
pm.Age += 1;
pm.HasAged = true;
pm.BloodPoolMax = pm.Age * 3;
pm.SendMessage("Your age has increased.");
agetime = ( (DateTime.Now).AddHours( 22 ));
}
else if ( pm.Age >= 60 )
{
pm.SendMessage("You cannot age any further");
}
}
else if ( pm.HasDrunk == 0 )
{
pm.SendMessage("You did not drink any human blood in the past 24 hours. You have not aged");
}
}
}
}
}
public class HolyTimer : Timer
{
public HolyTimer() : base( TimeSpan.FromSeconds( 1 ), TimeSpan.FromSeconds( 3 ) )
{
Priority = TimerPriority.OneSecond;
}
protected override void OnTick()
{
Check();
}
public static void Check()
{
foreach ( NetState state in NetState.Instances )
{
if ( state != null && state.Mobile != null && state.Mobile.Player )
{
PlayerMobile pm = state.Mobile as PlayerMobile;
if ( pm.IsVampire || pm.IsWereWolf && pm.Region.Priority == 56 )
{
if ( pm.Alive )
{
Core.Immolate( pm );
}
}
}
}
}
}
}
}
}
__________________
I reserve the right to be wrong or mistaken about anything at any time, and hereby exercise my constitutional right to never be flamed by anyone :) http://pix2.hotornot.com/pics/HQ/KY/...RUORSFGBLU.jpg |
|
|
|
|
|
|
#11 (permalink) | |
|
Forum Expert
|
Quote:
and i didn't see the 1 point thing....oops ![]() All phantom was trying to say (i think) was that this could be done by disabling AOS, but that wasn't the point of the script.....it was meant as a work around AOS to leave it turned on, and still have the damage reduction and as for longhand compared to pretty and compact, i could care less.....it was just a suggestion to someone learning scripting, i know that if i did a script and their was a better or easier way, i would like osmeone to tell me......when i mentioned it, i had just coincidentally got done reading how to do them and what not in this book im trying to learn out of.......so sorry to have made you upset there is alot that i don't like in AOS, and at the same time, there is alot that i do like in aos.....so any kind of AOS work around will be good, and for me, it was debatable for whether this would be worth or not for my shard was all i was stating.....alot would prolly like this and i will actually prolly use......i was just trying to compare damages dealt to how much damage is negated.....most players deal only 17-40/something per hit it seems......40 something being some of the best fighters with best skills/stats..........so i was just thinking aloud i guess either way like i said, good script..........and if your learning your learning......take critisism just like you do the congrats |
|
|
|
|
|
|
#12 (permalink) |
|
Forum Expert
Join Date: Mar 2003
Location: England
Age: 35
Posts: 986
|
I think phantom was pointing out that there is code in baseweapon.cs that is used when aos is disabled, why not see how it is done there or enable this code in baseweapon despite aos being active. Ie removing the if ( Core.Aos ) check.
|
|
|
|
|
|
#13 (permalink) | ||
|
Forum Expert
|
Quote:
Quote:
where does it get the base values for the armor?? i was looking at it and i don't see where it decides any of that |
||
|
|
|
|
|
#14 (permalink) |
|
Join Date: Oct 2002
Age: 22
Posts: 4,689
|
Code:
int totaldefense = 0;
foreach( BaseArmor armor in defender.Items )
totaldefense += armor.ArmorBase;
|
|
|
|
|
|
#15 (permalink) |
|
Forum Expert
Join Date: Apr 2003
Age: 28
Posts: 395
|
I know how to do that, my problem was that I didnt even know a defender.Items array existed.
I am just not familiar enough with all of the little ins and outs of the RunUO classes yet.
__________________
I reserve the right to be wrong or mistaken about anything at any time, and hereby exercise my constitutional right to never be flamed by anyone :) http://pix2.hotornot.com/pics/HQ/KY/...RUORSFGBLU.jpg |
|
|
|
|
|
#16 (permalink) | |
|
Account Terminated
|
Quote:
It doesn't unless defender is a Mobile reference ![]() |
|
|
|
|
|
|
#17 (permalink) |
|
Forum Expert
Join Date: Apr 2003
Age: 28
Posts: 395
|
Obviously.
A Server.Mobile.Items array.
__________________
I reserve the right to be wrong or mistaken about anything at any time, and hereby exercise my constitutional right to never be flamed by anyone :) http://pix2.hotornot.com/pics/HQ/KY/...RUORSFGBLU.jpg |
|
|
|
![]() |
| Bookmarks |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|