Hello so i am messing around with the runecrafting system im changing each rune around to be able to create its on intesities (ie hit fire area 20 40 60 80 100 %) it was all going according to plan except it goes past 100% on the weapon say you put fire area 100 rune on weapon and a fire area rune 20 on weapon it goes to 120 total i want it to max out at 100 can anyone help ?? here is one of the scripts thanks in advance
 

Attachments

  • HitColdAreaRune20%.cs
    4.3 KB · Views: 0
i can't look at your script right now but you'll want something like this

if(target is BaseWeapon)
{
if ( ((BaseWeapon)target).WeaponAttributes.HitColdArea + AddedPropertyNumber > MaxPropertyNumber )
{
sendmessage("that can't go past 100");
}
else
{
((BaseWeapon)target).WeaponAttributes.HitColdArea += AddedPropertyNumber;
}
}
 
haha it was truth im new to coding so iv had lots of problems very greatful to those who can help out when all my searching fails ya know
 
So I guess your best bet would be to go with zerodowned's approach but since you are new to coding this may help you in the long run.
So you could also make it so if you are at 80% that you could still use whatever rune but it caps it at 100% while not allowing that if you are already at the cap. In that case it would look something like this.
Code:
if(target is BaseWeapon)
{
	Baseweapon _targ = target as BaseWeapon;
	if (_targ.WeaponAttributes.HitColdArea >= MaxPropertyNumber )
	{
		Sendmessage("that can't go past 100");
	}
	else
	{
		_targ.WeaponAttributes.HitColdArea = Math.Min(MaxPropertyNumber, _targ.WeaponAttributes.HitColdArea + AddedPropertyNumber);
	}
}
 
Back