[Questions] Weapon stat: Reach

Discussions and questions about the CS and mods for Oblivion
Locked
Oblis
Initiate
Initiate
Posts: 38
Joined: Fri May 18, 2007 2:07 pm
ES Games: Daggerfall, Morrowind, Oblivion
Platform: PC
Location: Greece

[Questions] Weapon stat: Reach

Post by Oblis »

Hello!
I m working on a script to make weapon limitations (as Daggerfall did) on classes.
After a short research, I decided that the best way to achieve this, is only the weapon stat: Reach
For this reason I worked with GetWeaponReach function.

I managed to get the weapon reach, for every weapon an actor is using on a message.
But...
When I m trying to use it, in a IF statement, I dont get any results.
I really dont know what may be the problem for that.

I m thinking the possible way, that the reach stat may change on every actor, as encumbrance does.
And I m looking for a way to get the base reach....

An example of the script:
(The 0.8000 value is from OOO)

ref NPC
ref Weapon
short WeaponType
float WeaponSkill

Begin GameMode

set NPC to GetSelf
set Weapon to NPC.GetEquippedObject 16
set Weapontype to GetWeaponType Weapon
set WeaponSkill to GetWeaponReach Weapon

MessageEX "%1.5f and %.0f" WeaponSkill WeaponType

If ( WeaponType == 2 ) && ( WeaponSkill == 0.8000 ) <-- NOT WORKING
PrintToConsole "%n holds a Mace" NPC
endif

END

I d appreciate any help.
Thanks and Happy new year.
BFG
Champion
Champion
Posts: 902
Joined: Sat Oct 18, 2008 3:00 am
ES Games: Morrowind, Oblivion
Platform: PC/Windows 7 x64, PS3
Status: Exhilarated
Location: Rebuilding the lost city of Sutch

Re: [Questions] Weapon stat: Reach

Post by BFG »

I'm guessing, from the fact you're looking for a Reach of 0.8 on Maces, that you're using MOBS, OOO, or FCOM. (In Vanilla Oblivion, Maces have a reach of 1.)

Assuming that's the case, I think the answer is very simple: most Reach values in MOBS/OOO/FCOM are not exact numbers. For example, the Reach might be stored as 0.7999985 or 0.800000012, not exactly 0.8. (This is despite the fact it displays in the CS as 0.8. You'd have to use another utility such as TES4Edit to see the true value.) As such your IF statement is failing.

To test this, I'd suggest this statement instead:
If ( WeaponType == 2 ) && ( WeaponSkill >= 0.795 ) && ( WeaponSkill <= 0.805 )
Image
Oblis
Initiate
Initiate
Posts: 38
Joined: Fri May 18, 2007 2:07 pm
ES Games: Daggerfall, Morrowind, Oblivion
Platform: PC
Location: Greece

Re: [Questions] Weapon stat: Reach

Post by Oblis »

Hmm... I didnt knew that possible.
But... if the following line work as it should be,

MessageEX "%1.5f and %.0f" WeaponSkill WeaponType

shouldnt it appear me the actual value (as you metioned above) and not the CS value?
Because when it runs, it gives me results as 0.5000 or 0.8000.

Thanks for answer. ;)
BFG
Champion
Champion
Posts: 902
Joined: Sat Oct 18, 2008 3:00 am
ES Games: Morrowind, Oblivion
Platform: PC/Windows 7 x64, PS3
Status: Exhilarated
Location: Rebuilding the lost city of Sutch

Re: [Questions] Weapon stat: Reach

Post by BFG »

You may not be displaying enough digits. Try
MessageEX "%1.15f and %.0f" WeaponSkill WeaponType

In other words let it display as many digits as possible for WeaponSkill and see if it still shows 0.8 etc. Or, you could just try my suggested command and see if that works :)
Image
Oblis
Initiate
Initiate
Posts: 38
Joined: Fri May 18, 2007 2:07 pm
ES Games: Daggerfall, Morrowind, Oblivion
Platform: PC
Location: Greece

Re: [Questions] Weapon stat: Reach

Post by Oblis »

You are right. I used the tip you said and worked.
Thanks you very much.
Locked