RunUO Community

This is a sample guest message. Register a free account today to become a member! Once signed in, you'll be able to participate on this site by adding your own topics and posts, as well as connect with other members through your own private inbox!

Critical Hit System

sailor

Wanderer
Critical Hit System

Critical Hit System
Author: Sailor
E-Mail: [email protected]

Details: This package allows you to have a completed critical hit system. Every mobile has %5 base critical chance and there are "critical chance increase" items (like hit chance increase it is a attribute). Total critical chance is %(5+itembonuses)..Item's bonus is capped at 15. So for example i have a shield with %3 critical chance increase and a bracelet with %4 critical chance increase. I have total %5+3+4=%12 chance to stike critical. Criticals also work with spells. Critical chance increase items can be dropped by monsters or crafted by runic tools, enhanced like other attributes (damage increase etc.) Ah i almost forget, critical strikes add %100 damage bonus but that doesn't mean doubling the damage. The %100 damage bonus will added to other bonusses like skill bonusses or damage inc item bonusses. If a player have a %150 total damage bonus, he will have %250 bonus when strikes critical. I hope you find this document useful.

INSTALLATION:
-Extract the files to your Scripts/custom directory
-Find your old scripts (AOS.cs, BaseWeapon.cs, BaseArmor.cs, BaseClothing.cs, BaseJewel.cs, Spell.cs, BaseRunicTools.cs) and backup&delete them.

VERSION INFO:

v1.1: Critical strike chance is now affected by luck. Luck/100 will be added to players critical strike chance.


NOTES: Feel free to use, modify and fix the scripts. I will take no responsibility if these scripts causes damages. (I don't think it can cause problems but who knows :) ) If you find a bug please post here, i will help as much as i can.
 

Attachments

  • Critical System 1.1.zip
    46.6 KB · Views: 413

Joeku

Lord
This seems like a GREAT script. Suggestion: make luck attribute to the critical strikes, either in congruency with the new property on wearables or instead of the new property (Critical Chance).
 

sailor

Wanderer
thanks for the idea!!
Now in version 1.1: Critical strike chance is now affected by luck. Luck/100 will be added to players critical strike chance.
 

Joeku

Lord
Another idea!
In a game I play (Warcraft 3), when a critical hit is made, the damage shows above the unit's head in a special color.

Perhaps you could make it show above the players' head "*Critical Strike*" (PublicOverheadMessage) or something to that effect...
 

Ludovic

Sorceror
WOW amazing! You rock man! You are my new God!
Last week I start a project like this and well, no need now!
Thanks for sharing!
 

sailor

Wanderer
yeah, i added a AosAttribute to weapons, shield etc.. and Luck is alse important which means you need AOS enabled.
i dont think to make a pre aos version, but it can be done with a few changes.
 

warduke

Wanderer
message above players head.

I got the message working above player. But what I would like to see is it appear above the monster you attacked. I have tried several ways with no luck. Here is the one I made that makes it appear above players head.

Code:
            //critical hit attack bonus here
            int baseCritChance = 5;
            if (baseCritChance + critChanceBonus > Utility.Random(100) && m_Caster.Combatant != null && damage > 0)
            {
		m_Caster.LocalOverheadMessage( MessageType.Emote, 0x3F, true,
		"* CRITICAL *" );
                damageBonus += 100;
            }

and for weapons

Code:
            if (baseCritChance + critChanceBonus > Utility.Random(100) && attacker.Combatant != null && damage > 0)
            {
		attacker.LocalOverheadMessage( MessageType.Emote, 0x3F, true,
		"* CRITICAL *" );
                damageBonus += 100;
            }

Not sure how to add to the monster but this is better then the journal message.
 

Jarrod

Sorceror
very nice. I have modified it a bit so that the crit hits are not useable against players.

PvM = players can crit monsters
MvM = monsters can crit monsters
MvP = monsters can not crit players
PvP = players can not crit players

that way I dont get a hatemail asking why some dorko with a great weapon is crit-instakilling people ;)
 

warduke

Wanderer
Love the crits!

My sever is so PVP balanced that crits are one of the only ways players have a chance at killing each other. I love the CRITS!:D
 

Anvil

Wanderer
I am seeing one small problem with this...

To test this, I set critical to 50 on a player via [props just as a test to determine if the system is working in game. Player A attacks Monster A. In keeping both status bars up for both Player and Mob. I have the critical mod added so it displays overhead. It's saying the player has a critical hit yet no HP are taken from the monster (a miss). Same with archery, player given Critical Hit, but no damage done and arrow misses and falls to the ground. Any idea why? Is there a check in the system to make sure critical can only be given on an actual hit?
 

sailor

Wanderer
warduke, i thought about your code but i could only find m_caster.Combatant .. but that would be no good idead when casting area effect spells. or what will happen when i select a person instead of previous target? will caster.Combatant switch to the new target before this check? So i couldn't find a good solution.

anvil, making items critical chance increase props 50 will make no difference, it will be capped. you can give 10000 luck to have (10000/100=100) %100 chance to strike critical. but you are right there is a problem, even crafting an item, it can say Critical Strike! I couldn't solve it; i searched in my scripts directory but i coulnd't find any lines which uses the function that i modified (except spells and weapon hit thing). maybe there can be a core function or something else?
i tried to add a check if attacker has a combatant to prevent this bug, but still you can get wrong "Critical Strike!" messages when you have a combatant and making something else than fighting.

any suggestions will be fine for me :)
 
Top