Author Topic: [WB][Script] Weapon breaking trigger  (Read 4426 times)

0 Members and 1 Guest are viewing this topic.

Gaunt

  • Knight at Arms
  • *
    • View Profile
  • Faction: Khergit
  • NW
Re: Weapon breaking trigger [Open Source]
« Reply #15 on: August 15, 2010, 09:49:09 PM »
Module Mission Templates,

You can add it before

multiplayer_server_check_belfry_movement

And then add

common_weapon_break,

to all mission templates you want it in.

In my own module I just put it after every

common_battle_tab_press,

I think that add's it to pretty much all the fights in Singleplayer apart from custom battles.




« Last Edit: August 19, 2010, 03:11:55 AM by Baron Conrad »

Peit

  • Regular
  • *
    • View Profile
  • Faction: Neutral
  • WBNW
Re: Weapon breaking trigger [Open Source]
« Reply #16 on: August 16, 2010, 10:06:40 AM »
nice work!

I am implementing this into my own mod as we speak


Caba`drin

  • Administrator
  • *
  • It's time to toss the dice.
    • View Profile
  • Faction: Nord
  • MP nick: Caba_drin
  • M&BWBWF&SNW
Re: Weapon breaking trigger [Open Source]
« Reply #17 on: August 17, 2010, 05:20:08 PM »
This is a great idea--always seemed odd that a Shield could break, but weapons were invulnerable. Yet, a Tempered sword shattering with equal likelihood as a cracked one doesn't seem to have the same feel as the degrees of shield quality, etc. This brings me to my question...

Is there something to get what "imodbits_" the wielded weapon has? That way, if the weapon was "Balanced" or "Tempered" it could get damaged to normal...from normal to "Chipped" and from Chipped to "Cracked" and from "Cracked" to broken and taken away. The probability for the weapon to break could similarly change with the modifier--Balanced/Tempered/Masterwork items would be less likely to break than normal ones, and Cracked ones would be very likely to break.

Just a thought...I'll be looking around more still, but figured I'd put it out there to see if others knew if it were possible.

EDIT: I think messing with "troop_get_inventory_slot_modifier" something like this might be accomplished. I might start playing around with that...
« Last Edit: August 17, 2010, 06:14:00 PM by Caba`drin »



JethroKirby

  • Knight at Arms
  • *
  • He who defends everything defends nothing.
    • View Profile
  • Faction: Swadian
  • MP nick: Wappaw_JethroKirby
  • WB
Re: Weapon breaking trigger [Open Source]
« Reply #18 on: August 17, 2010, 05:47:11 PM »
This is a great idea--always seemed odd that a Shield could break, but weapons were invulnerable. Yet, a Tempered sword shattering with equal likelihood as a cracked one doesn't seem to have the same feel as the degrees of shield quality, etc. This brings me to my question...

Is there something to get what "imodbits_" the wielded weapon has? That way, if the weapon was "Balanced" or "Tempered" it could get damaged to normal...from normal to "Chipped" and from Chipped to "Cracked" and from "Cracked" to broken and taken away. The probability for the weapon to break could similarly change with the modifier--Balanced/Tempered/Masterwork items would be less likely to break than normal ones, and Cracked ones would be very likely to break.

Just a thought...I'll be looking around more still, but figured I'd put it out there to see if others knew if it were possible.

I was wondering something similar, but instead of lowering them a level, they are just more resistant to breaking and more able to break another weapon. Is it also possible to handle weapons just as shields? As in, if it breaks in battle you have to find another weapon but you have enough time to repair the weapon between battles. Is this possible?

All religions must be tolerated... for every man must get to heaven in his own way.
- Frederick II

Caba`drin

  • Administrator
  • *
  • It's time to toss the dice.
    • View Profile
  • Faction: Nord
  • MP nick: Caba_drin
  • M&BWBWF&SNW
Re: Weapon breaking trigger [Open Source]
« Reply #19 on: August 18, 2010, 05:16:43 AM »
I don't have WB installed on the computer I've access to for the rest of the week, but tried to think through this the best I could.

This is based on the following bit of code to capture the modifier for the currently equipped weapon, which I believe will do the trick, but please let me know if I totally missed something...

(click to show/hide)

The following code is marked with 'imod...' comments to denote my additions to Baron Conrad's original code.

(click to show/hide)

And below, the script checks the imod to determine how drastically to damage the weapon. Better weapons just lose their improvements, normal weapons get chipped, lesser weapons break.

(click to show/hide)

« Last Edit: August 18, 2010, 05:05:46 PM by Caba`drin »



Idibil

  • Grandmaster Knight
  • *
    • View Profile
    • Nova Regula
  • Faction: Nord
  • MP nick: CeltíberoIdibil
Re: Weapon breaking trigger [Open Source]
« Reply #20 on: August 18, 2010, 06:30:55 PM »
great work here!

You have forgot a "," en try_end:

                (troop_get_inventory_slot_modifier, ":imod", "trp_player", ":i_slot"),
            (try_end),


I have try join your code with Cruger´s code, and look it work:

(click to show/hide)

« Last Edit: August 19, 2010, 11:34:20 AM by Idibil »

N0body

  • Sergeant Knight at Arms
  • *
  • Carry on living in your bubble.
    • View Profile
  • Faction: Vaegir
  • MP nick: RCC_Cpt_Nobody
  • M&BWBNW
Re: Weapon breaking trigger [Open Source]
« Reply #21 on: August 18, 2010, 10:07:29 PM »
Hey, for some reason I'm getting this syntax error:

(click to show/hide)

Any idea why or how I can fix it (I'm new to this stuff, sorry for being a Noob)

Gaunt

  • Knight at Arms
  • *
    • View Profile
  • Faction: Khergit
  • NW
Re: Weapon breaking trigger [Open Source]
« Reply #22 on: August 19, 2010, 03:12:53 AM »
N0body, did you alter it in any way?


Caba ' drin, I did think about doing that, just never got round to it.

Glad that you guys are taking it even further!
« Last Edit: August 19, 2010, 03:18:24 AM by Baron Conrad »

N0body

  • Sergeant Knight at Arms
  • *
  • Carry on living in your bubble.
    • View Profile
  • Faction: Vaegir
  • MP nick: RCC_Cpt_Nobody
  • M&BWBNW
Re: Weapon breaking trigger [Open Source]
« Reply #23 on: August 19, 2010, 09:44:39 AM »
N0body, did you alter it in any way?


Caba ' drin, I did think about doing that, just never got round to it.

Glad that you guys are taking it even further!

Nope, I did use Idibil's version of the code and I put it right after every common_battle_tab_press,
I'm going to try using the original now, and see if that works.

EDIT:
Managed to get it working, as I was a bit stupid and misread you post (Top of this page) and was putting the entire code after each common_battle_tab_press, :roll:
Sorry about that :? maybe I should make sure I read everything properly next time  :P
It still gets a 'minor' error though: ERROR: Usage of unassigned local variable: :playeraction
EDIT:
Ingame weapons don't seem to break, so I'm guessing that error is actually breaking the script?
« Last Edit: August 19, 2010, 11:03:04 AM by N0body »

Idibil

  • Grandmaster Knight
  • *
    • View Profile
    • Nova Regula
  • Faction: Nord
  • MP nick: CeltíberoIdibil
Re: Weapon breaking trigger [Open Source]
« Reply #24 on: August 19, 2010, 11:35:00 AM »
N0body, you try now, i had paste code that i am using in Brytenwalda.


Ah, and remmenber add: common_weapon_break, --->lead_charge and mission where you want weapon break.

N0body

  • Sergeant Knight at Arms
  • *
  • Carry on living in your bubble.
    • View Profile
  • Faction: Vaegir
  • MP nick: RCC_Cpt_Nobody
  • M&BWBNW
Re: Weapon breaking trigger [Open Source]
« Reply #25 on: August 19, 2010, 12:09:18 PM »
N0body, you try now, i had paste code that i am using in Brytenwalda.


Ah, and remmenber add: common_weapon_break, --->lead_charge and mission where you want weapon break.

Thanks!  :D Looks like it has worked, no errors. Now to test it.  :)

Edit:
Hmmm.... I had 3 weapons on me (Ranging from cracked to tempered) and none of them broke - I was on horseback too.
I didn't notice and NPC's weapons breaking either  :|
Am I doing something wrong? I've put Idibil's version of the code before the very first multiplayer_server_check_belfry_movement and then put common_weapon_break, after every common_battle_tab_press,
« Last Edit: August 19, 2010, 12:49:43 PM by N0body »

Gaunt

  • Knight at Arms
  • *
    • View Profile
  • Faction: Khergit
  • NW
Re: Weapon breaking trigger [Open Source]
« Reply #26 on: August 19, 2010, 04:32:50 PM »
Ibdil, I think your changes to the numbers may have been a little too drastic, that is why N0body never had his weapons break.

The way the system works right now is this:

First it picks a random number 1-100, the higher it is the more likely a weapon is to break.

Then it does the math things depending on weapon type, mounted, and modifers (what you added)

So in your code for a one handed weapon it multiplies by 81 and divides by 100, in other words, it multiplies by .81

Even if the random chance earlier in the  script is a 100 then the result is 100 * .81 = 81

At the end you notice that the weapon will only break if the result is 98 or higher.

Average one handed weapons would never break.


My numbers may have been to high to start with but when you lower them you need to lower them very slightly because if you lower them too much then they may never break.


Idibil

  • Grandmaster Knight
  • *
    • View Profile
    • Nova Regula
  • Faction: Nord
  • MP nick: CeltíberoIdibil
Re: Weapon breaking trigger [Open Source]
« Reply #27 on: August 19, 2010, 05:00:14 PM »
Yes, i am tested it. Brytenwalda betatester complained that the weapons are very easily broken, even in a first encounter. I am looking for equilibrate break, a sword could for generations, or break a particularly aggressive encounter.

I can change result of 98 to 95  :D

N0body

  • Sergeant Knight at Arms
  • *
  • Carry on living in your bubble.
    • View Profile
  • Faction: Vaegir
  • MP nick: RCC_Cpt_Nobody
  • M&BWBNW
Re: Weapon breaking trigger [Open Source]
« Reply #28 on: August 19, 2010, 05:20:38 PM »
I'm wondering why the code isn't doing anything - I've had no errors either.  :|
I set the chance for each Imod bits to 135, the weapons still didn't break.
I even set the chance from 98 to 28, still nothing. I'm guessing this code doesn't like me  :(

Gaunt

  • Knight at Arms
  • *
    • View Profile
  • Faction: Khergit
  • NW
Re: Weapon breaking trigger [Open Source]
« Reply #29 on: August 19, 2010, 05:50:45 PM »
I can change result of 98 to 95  :D

It will make more difference to change the multipliers.

Also I don't think having the multiplier smaller than the divider is a good idea unless the requirement is something that would make the weapon stronger, for example, masterwork.

To N0body, how many weapons did you have in your inventory, Crugers additions make it so your weapon only breaks if you have more than one weapon, I personally wouldn't use that.

Also, I hope you added

common_weapon_break,

to the mission templates you wanted it in.