Author Topic: Charges/Recharges and Weapon Breaking.  (Read 375 times)

Legacy_JerrodAmolyan

  • Full Member
  • ***
  • Posts: 175
  • Karma: +0/-0
Charges/Recharges and Weapon Breaking.
« on: November 13, 2013, 10:56:48 am »


               Hey guys !

So I'm looking at doing something like this: 

Weapons have quality ranks, and the easiest way to do that in my opinion, would be to make poor weapons withstand little, while good weapons withstand alot. AND the charges would be good for that.

So my idea would be to have a script in place, that randomly takes 1 charge out of a weapon (Poor: 10, average 20, good 30, etc. Charges per weapon) and when it reaches 0, it breaks and either disappears or becomes unusable. (Both are good for me, whatever's less work I suppose), 
This is supposed to be run for the equipped weapon and armor (armor should break too.) if the PC wearing them is in combat. It doesn't have to be per hit, just as long as it checks a certain randomness dice every round. (per hit would be better of course.) 

When the charges are below max, You could go to a blacksmith to have it repaired for a price. Through a conversation perhaps, and it'd recharge the weapon you have equipped. (OR if that's too hard to do, maybe removes the old weapon, and gives you a fully charged same weapon.)

As far as I know, you can even put in a quality property on a weapon, in the editor. That could ease things out a lot, if you could check for the property quality of the weapon/armor equipped to go forward with this. 

Thanks in advance, I'd do this myself, but my scripting skill is too meager to tackle something like this, and I haven't been able to find any decent tutorials for charges and recharges of magical equipment. 

I have seen this sort of system used in other PWs (Arelith for example) and know it CAN be done, just don't know how. '<img'>

(Naturally, better weapons should be more expensive to repair. Would be cool to be able to check for the quality property of the weapon in the conversation for repairing, and determine the price based on that quality.)
               
               

               


                     Modifié par JerrodAmolyan, 13 novembre 2013 - 10:59 .
                     
                  


            

Legacy_Squatting Monk

  • Hero Member
  • *****
  • Posts: 776
  • Karma: +0/-0
Charges/Recharges and Weapon Breaking.
« Reply #1 on: November 13, 2013, 04:06:25 pm »


               How about this for a starting point?
               
               

               
            

Legacy_JerrodAmolyan

  • Full Member
  • ***
  • Posts: 175
  • Karma: +0/-0
Charges/Recharges and Weapon Breaking.
« Reply #2 on: November 13, 2013, 07:58:57 pm »


               Yeah, that's pretty much what I'm after. Thanks. Now I just need to tackle the thing to make it more fitting for what I want...

//on monsters on_damaged event

void main()
{
//Weapon Loosing charges

//////////////////////////////////////////
//USER CONFIGURATION
//////////////////////////////////////////

int nChancesToLooseACharge = 8; // (8%)

//////////////////////////////////////////
//END USER CONFIGURATION
//////////////////////////////////////////


int iDamage = GetTotalDamageDealt();
object oDamager = GetLastDamager();



if (iDamage > (GetHitDice(oDamager)/2))
{
   object oWeapond = GetLastWeaponUsed(oDamager);
   if (Random(100) < nChancesToLooseACharge )
   {
       SetItemCharges(oWeapond,GetItemCharges(oWeapond) -1);
       FloatingTextStringOnCreature("weapon damaged !", oDamager, FALSE);
   }
}

}

Here's the script, now... How do I apply it to work on armor aswell ? And is there some way to put this on PCs aswell, so monster / npc weapons would also get damaged ? ^^
               
               

               


                     Modifié par JerrodAmolyan, 13 novembre 2013 - 07:59 .