Jump to content
Heavy Traffic ×

Need help with mod - armor (not overall) rating detect


ThatUsernameIsAlreadyTak

Recommended Posts

I need to create condition (for perk effects/abilities) which will say whenever player has any armor that increases Damage Reducton.

Example of usage: two inddependent perks that will grant DR when armor with less than 10 AR is worn - stacking with eachother.

Like Toughness and Pitt Fighter but only for light armored characters.

Problem is that function GetArmorRating returns player DR, which can be modified by perks and thus not being actual armor rating.

On the other hand GetArmorRatingUpperBody (checking only upper body DR is a compromise I can agree at) does not return DR at all - it only returns 0 when no armor is worn or 1 otherwise.

MY FIRST QUESTION: Is it possible to write new function which can be used as condition?

(or enable FOSE's GetArmorAR to be chooseable as a condition)

 

I've searched a lot of forums and it seems it's impossible so I get another idea: script that will do following

  • when equipping armor (upper body item) it will check it's AR
  • if this AR is what I want (0), script will garant player a perk
  • when unequipping the perk will be taken
  • this perk could be used along with HasPerk function in my condition

AND THERE COMES SECOND QUESTION: Waht type of script should it be (effect/quest), what block should I use (GameMode etc.) and where would I attach it?

Note that attaching it to every armor in game is what I want to avoid since some armors, especiallly those from mods, can already have their own scripsts attached and it would be very time-consuming and mod-unfriendly.

 

THIRD QUESTION: Do You see any workaround to my problem? If so, please share Your' ideas.

Link to comment
Share on other sites

You could do a quest script set with a process delay of 1-5 seconds ... that looks like this ...

 

SCN MyDRBoostScript

 

Ref rChest

Ref rHead ; however many slots you want to check for

 

Int iChestAR

Int iHeadAR ; make as many Int as refs ... these store their AR value

 

Int iPeice01

Int iPeice02 ; these are on/off for needing multiple peices

 

Int DoOnce

 

Begin GameMode

 

If DoOnce == 0 && Player.HasPerk MylightArmorPerk

 

Set rChest to PlayerRef.GetEquippedObject 2

Set iChestAR to rChest.GetArmorAR ; I'm a little unsure if this is correct syntax

If iChestAR <= 10

Set iPeice01 to 1

 

Set rHead to PlayerRef.GetEquippedObject 0

Set iHeadAR to rHead.GetArmorAR ; I'm a little unsure if this is correct syntax

If iHeadAR <= 10

Set iPeice02 to 1

 

If iPeice01 + iPeice02 == 2

Player.ModAV DamageResist 5

Set DoOnce to 1

 

endif

endif

endif

endif

 

End

 

~~~~~~~~~~~~~~~~~~~~~~~~~~~

 

Of course it needs some fine tuneing to return things back if the peices are not worn. But something like that may work ... where the actual perk is merely a conditional check to execute the code in a quest script that runs every few seconds in GameMode.

 

And it should be noted that the condition of the peice will effect what it returns on AR.

Seems to indicate it can return as low as 2/3 its full value. Hence a peice of armour with a top DR of 15 can return a 10 if its condition is near broken.

Edited by Mktavish
Link to comment
Share on other sites

Thank You! I've achieved my goal.

Details needed bit of adjustment but the main idea was very helpful.

Just note that I resigned of using DoOnce which, I must admit, I dodn't understand why You suggested in first place.

I would be glad to learn how was that supposed to work and not create pernament DR boost.

You thought about second part of script removing DR boost also setting DoOnce back to 0 ?

Link to comment
Share on other sites

The DoOnce is there to keep it from continueing to modify the actor value of Damage Resist with a +5 every time the script runs and the conditional checks are true. And in fact ... since DoOnce is the first condition it checks ... I believe it won't even read the rest of the script if it is not == 0

Therefore freeing up CPU cycles by a small margin , since the script is firing at what ever process delay you set on the quest. If you put no delay there ... It would be firing as many times a second that your frame rate is.

But there is other ways to keep it from doing that. Glad you got it working.

 

What does your script look like if you don't mind me asking ?

Edited by Mktavish
Link to comment
Share on other sites

Of course I don't mind. Here is the part responsible for unarmored bonus:

 

 

Begin GameMode

Set rChest to PlayerRef.GetEquippedObject 2
Set iChestAR to GetArmorAR rChest
If iChestAR <= 0
Set iPiece01 to 1

elseif iChestAR > 0 && iChestAR <=10

Set iPiece01 to 3

(...)
else
Set iPiece01 to 0
endif

Set rHead to PlayerRef.GetEquippedObject 0
Set iHeadAR to GetArmorAR rHead
If iHeadAR <= 0
Set iPiece02 to 1

(...)
else
Set iPiece02 to 0
endif

If (iPiece01 + iPiece02)==2 && (Player.HasPerk PNoARPerk)==0
ShowMessage PNoArmorWorn
PlayerRef.AddPerk PNoARPerk
elseif (iPiece01 + iPiece02)<2 && (Player.HasPerk PNoARPerk)==1
ShowMessage PArmorEquipped
PlayerRef.RemovePerk PNoARPerk

(...)
endif
End

 

 

As You can see perks are results of this script rather than conditionals.

This allows me to use one (blank) perk as conditon in effect functions, making scipt more universal.

I think it's more versatile that multiple perks can use the same script:

One that makes You faster and more agile when 0 AR clothes are worn, one that simply increases Your DR in that situation, another one that turns You into chameleon at night. The same applies to light armor perk and so on.

 

I realise that You can achieve the same effect by using perks as conditionals and by moving this condition to section where IPiece's are summed, but I don't like leaving my mod values in scripts. Why? FO3Edit can not read scripts and it's way faster when balancing mod.

 

As for the DoOnce discussion - I've started with what You suggested, but after inserting some messages into the code I ralized that the script actually never repeats itslef. Maybe it's a difference in how we setup the quest...

Edited by ThatUsernameIsAlreadyTak
Link to comment
Share on other sites

Ahh ya thats a good solution ... although I'm still scratching my head as to why it doesn't appear to keep fireing the first half where you set the variables ... Maybe there is yet another sub routine in the engine that is aware of the variables not changing ... so no reason for it to commit a higher level of thought process to it , that would then execute showing a message.

But of course I'm just talking out of my butt on that.

 

Originally for some reason I didn't think DamageResist was available in the base effects ... and had to be done with an entry point or script command. But that works better with the effect , so you can just check the "recover" flag and not have to re-modify the player DR. I think even a perk entry point would only give you a one way ticket on that.

 

Well hey thanks ... you showed me something new too :thumbsup:

Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...