Skip to content

Item Properties & Weapons scripting

Sorry if this has been asked before, but doing a search on this forum for weapons scripting , has yield no results.

My question is, is there a way to script when a PC attacks using a certain weapon (in particular a certain ammo type)? I know that on items you can select under properties the type of MATERIAL they are made of but does this add (behind the scenes so to speak) the actually modification to the item?
For example:

Bullets DO NOT offer a check box/selection under properties for Attack Bonus. True Masterwork Bullets will give you a +1 Attack bonus to the bullet (not the weapon being used) according to D&D 3.0. Since I can not add this through the toolset, is there a way to script it? Or is it hard-coded and can not be modified?

I there a way to change what happens every time a PC attacks something. I know you can do it on each individual creature or item, but I'm looking for something more general. Unfortunately I see nothing under the Module Event tab so I was wondering if there is another place where it may be?

Comments

  • MelkiorMelkior Member Posts: 204
    Bullets don't have an attack bonus property because that property belongs on the sling instead of on the bullet. This is hard-coded afaik but it might be possible to simulate what you want through the OnEquipItem/OnUnequipItem module events.
    Put a variable on the bullets in the blueprint for them so that they are always created with that variable attached.

    In OnEquipItem, check what was equipped. If it was either bullets with a sling already equipped or a sling with bullets already equipped, then the script should check for the variable on the bullets. If it exists, add a temporary (one day of time) +1 attack bonus to the sling. OnUnequipItem should check what's being unequipped and if it's a sling or bullets, it should remove any temporary attack bonus property from the sling.

    You'll also need to modify the OnPlayerRest event so that after resting, it re-applies the attack bonus if a sling is still equipped at the same time as the appropriate bullets.
  • Awas73Awas73 Member Posts: 66
    Melkior wrote: »
    Bullets don't have an attack bonus property because that property belongs on the sling instead of on the bullet. This is hard-coded afaik but it might be possible to simulate what you want through the OnEquipItem/OnUnequipItem module events.
    Put a variable on the bullets in the blueprint for them so that they are always created with that variable attached.

    In OnEquipItem, check what was equipped. If it was either bullets with a sling already equipped or a sling with bullets already equipped, then the script should check for the variable on the bullets. If it exists, add a temporary (one day of time) +1 attack bonus to the sling. OnUnequipItem should check what's being unequipped and if it's a sling or bullets, it should remove any temporary attack bonus property from the sling.

    You'll also need to modify the OnPlayerRest event so that after resting, it re-applies the attack bonus if a sling is still equipped at the same time as the appropriate bullets.

    Thanks Melkior. It was a bit to think out and put into place but it worked. Had to pretty much compensate for all types of slings as well as any special or custom ones I created for the mod, but works great.
Sign In or Register to comment.