• Please note: In an effort to ensure that all of our users feel welcome on our forums, we’ve updated our forum rules. You can review the updated rules here: http://forums.wolflair.com/showthread.php?t=5528.

    If a fellow Community member is not following the forum rules, please report the post by clicking the Report button (the red yield sign on the left) located on every post. This will notify the moderators directly. If you have any questions about these new rules, please contact support@wolflair.com.

    - The Lone Wolf Development Team

help with changing wClass in script

Fuzzy

Well-known member
So, in an effort to make an Orc Double Axe that can be properly enchanted individually, I tried making a 'Orc Double Axe (half)' weapon. This idea was that in doing so, it could be simply equipped in each hand and made to behave in pretty much every way as the original double weapon, but allow each end to be enchanted individually.

The first issue, is that the double weapon is treated as light in the off hand. This can sort of be solved by creating two different half-weapons. One for the main hand that is OneHanded, and one for the off hand that is Light. However, this then has the problem of being two different things, and therefore, things that affect a specific weapon type (like weapon focus and specialization), will not recognize the off hand weapon.
So I then created a script on the weapon that checks for the Hero.OffHand tag, and changes that particular weapon to light:
Code:
if (tagis[Hero.OffHand] = 1) then
    perform tagreplace[wClass.OneHanded,wClass.Light]
endif
This works part way. The weapon is tagged as Light when wielded in the off hand, as shown by the proper wClass tag on the weapon. The issue is, however, that the core mechanics are not detecting that it is light, and is still penalizing. I have tried a few different timings, but have been unable to get it to make the tag change AND apply the proper two weapon penalties. As far as I can tell, the two weapon penalties are done in the core game system logic, and I don't have the ability to view that code itself. Is there any what timing this is done at and how to get it to recognize the 'soft changed' wClass tag?
 
On a related note, any word on if double weapon enchantment is going to be handled natively? There is a 4 year old thread requesting this capability, but nothing yet.
 
Last edited:
One for the main hand that is OneHanded, and one for the off hand that is Light. However, this then has the problem of being two different things, and therefore, things that affect a specific weapon type (like weapon focus and specialization), will not recognize the off hand weapon.
This could be solved by using the 'Count As Weapon' feature. I am not near HL but pretty sure that is the wording. Its a tag that is applied that for purposes of WF or WS this weapon counts as the other weapon. It is what is used on a Composite Longbow to be treated the same as a Longbow. So you take Weapon Focus (Longbow) and that works with both the Longbow and the Composite Longbow.

So I then created a script on the weapon that checks for the Hero.OffHand tag, and changes that particular weapon to light:
Code:
if (tagis[Hero.OffHand] = 1) then
    perform tagreplace[wClass.OneHanded,wClass.Light]
endif
This works part way. The weapon is tagged as Light when wielded in the off hand, as shown by the proper wClass tag on the weapon. The issue is, however, that the core mechanics are not detecting that it is light, and is still penalizing. I have tried a few different timings, but have been unable to get it to make the tag change AND apply the proper two weapon penalties. As far as I can tell, the two weapon penalties are done in the core game system logic, and I don't have the ability to view that code itself. Is there any what timing this is done at and how to get it to recognize the 'soft changed' wClass tag?
I don't know the "exact" timing here but I would assume making the change at about First/1000 would be plenty early enough. What timings have you tried?

There is a dwarven feat "Dorn Dergar Master" changes a two-handed weapon to one handed. Maybe check the script on that feat to see valid timing.
 
This could be solved by using the 'Count As Weapon' feature. I am not near HL but pretty sure that is the wording. Its a tag that is applied that for purposes of WF or WS this weapon counts as the other weapon. It is what is used on a Composite Longbow to be treated the same as a Longbow. So you take Weapon Focus (Longbow) and that works with both the Longbow and the Composite Longbow.


I don't know the "exact" timing here but I would assume making the change at about First/1000 would be plenty early enough. What timings have you tried?

There is a dwarven feat "Dorn Dergar Master" changes a two-handed weapon to one handed. Maybe check the script on that feat to see valid timing.

I swear I looked for that, and didn't see a Counts as Weapon... sure enough, now that I look again, there it is. What I get for trying to do this stuff late at night. So that should handle the feat issue, which is good. However, in my test, it doesn't seem to work for the exotic proficiency that the Orc Weapon familiarity racial trait uses. It specifically calls out the Orc Double Axe thing in it's script. Not that I'm against creating a replaces thing for the racial trait. Actually adding Exotic Weapon Familiarity (Orc double axe) seems to work fine with the Counts as, so its only the racial I need to work around.

I'll try some more timing tests, but I thought I had tried some real early stuff.
 
Last edited:
Going too early seems to not work either.

First/1000 - Does not stay set as wClass.Light
Pre-Attr/1000 - stays wClass.Light, but doesn't get the proper modifiers.

so its hopefully somewhere in between there. I'll have to juggle back and forth to find the sweet spot.. that's what I was trying to avoid, but it won't take me too long to narrow it down, hopefully.
 
Well, the timing hunt didn't go well. At pre-levels/10000, something is setting the wClass back to OneHanded, but the bonuses seem to be handled prior to that, or something. All i know is that if I run my above script at pre-levels/10000, the weapon at render is wClass.OneHanded, if I run it at pre-levels/10001, the weapon at render is wClass.Light, but penalties are always as OneHanded in both hands.

Perhaps the best course would be to make two new weapons, one for the main hand, and one for the off hand. Counts as should make that easier, and I'll just have to work around the racial trait for both (which I'll have to do for at least one anyway).
 
Looks like that's going to work for now. Added the appropriate EasyWeapon tags to the racial special, so not proficiency is handled properly, and made two weapons (OneHanded for the Main Hand, Light for the Off Hand). Seems to be working at this point, and this avoids timing issues. I could go further and turn the normal Orc Double Axe into a kit that auto-adds the two halfs, but I don't think that will work with the custom weapon gizmo, so its of no use, since that gizmo's inadequacies is really the reason for doing this.
 
The only 'downside' I suppose to this is that with the separate weapons, they are stuck as one end always being 'main', and the other always being 'off'. the weapon can't be flipped around simply by swapping the checkmarks, since the 'off' is always the light weapon. Not an issue with the current character, who has Two-Weapon Fighting and Improved Two-Weapon Fighting, so main and off hand are the same modifier, but without those feats, you may want to be able to switch the more appropriately enchanted weapon head into the more accurate and more plentiful main hand swings.
 
Is there any reason I can't make it a single weapon and just make it Light? I'm trying to think of what effect a weapon being Light have. Don't want to do that and end up with extra benefit or hindrance that shouldn't be there.
 
nevermind, this would prohibit being able to wield one end 'two handed'. No perfect solution here it seems.
 
Code:
if (tagis[Hero.OffHand] = 1) then
    perform tagreplace[wClass.OneHanded,wClass.Light]
endif
I know why this is not working. Its because your using the "tag" Hero.OffHand instead of using the "field". The tag is updated late but the field is updated right away.

use this:
Code:
~ If equipped in off-hand then change class to Light
if (field[wIs2nd].value <> 0) then
    perform tagreplace[wClass.OneHanded,wClass.Light]
endif

Then try this at First/10000 and it will work. So the reason it was staying "one-handed" is because the the test for Hero.OffHand was returning 0 "false".
 
Ah.. okay, I'll try that out. I always go to tags first, as they are smoother and faster. Didnt' even think about them getting set later.
 
Back
Top