Question for script wise people

Post » Tue Jan 26, 2016 5:44 pm

I mentioned that in question on a thread titled "Question to Frans users" but I should ask perhaps people who knows a bit about scripts in Oblivion.



I wonder if this is well written script (will it work):



Spoiler

begin OnReset

set Done to 0

set Trapped to 0

set NeedsKey to 0

end


begin OnLoad


if Done == 0

set Done to 1

set LType to GetLockLevel

set Rand to GetRandomPercent

if Rand <= (5 + FranLoot.ChestKey)

set Difficulty to (25 + (GetRandomPercent * 0.75))

set NeedsKey to 1

set Trapped to Difficulty / 33

set ModStat to Difficulty/4

set Reward to Difficulty/15

set KeyKeeper to PlaceAtMe FranLL00NPCNecro, 1

KeyKeeper.AddItem FranKeyNecro, 1

KeyKeeper.AddScriptPackage aaaDefaultExploreCurrentLoc3000

KeyKeeper.ModAv Health Difficulty

KeyKeeper.ModAv Luck ModStat

KeyKeeper.ModAv Strength ModStat

KeyKeeper.ModAv Agility ModStat

KeyKeeper.ModAv Willpower ModStat

AddItem FranLLG0DungRandKeyMage, Reward

set Difficulty to (Difficulty - LType)

Lock Difficulty

elseif FranLoot.RandomizeLocks == 1

if GetLocked == 0 && Rand == 6 + FranLoot.ChestKey

Lock 75

elseif GetLocked == 0 && Rand < 9 + FranLoot.ChestKey

Lock 35

elseif GetLocked == 0 && Rand < 12 + FranLoot.ChestKey

Lock 18

elseif GetLocked == 0 && Rand < 16 + FranLoot.ChestKey

Lock 6

elseif GetLocked == 1 && Rand < 15 + FranLoot.ChestKey

Unlock

elseif GetLocked && GetLockLevel <= 80 && Rand > 75

set Rand to GetRandomPercent

set LockEasy to (18 - LType)

set LockAverage to (35 - LType)

set LockHard to (75 - LType)

set LockVeryHard to (95 - LType)

if LType <= 7 && Rand <= 75

Lock LockEasy

additem FranLLG2DungRandChestLev05, 1

additem FranLLG0DungRandTreasure, 1

elseif (LType <= 7 && Rand < 95) || (LType <= 20 && Rand <= 75)

Lock LockAverage

additem FranLLG2DungRandChestLev07, 1

additem FranLLG0DungRandTreasure, 1

elseif (LType <= 7) || (LType <= 20 && Rand < 95) || (LType <= 40 && Rand <= 75)

Lock LockHard

additem FranLLG2DungRandChestLev10, 1

additem FranLLG0DungRandTreasure, 1

elseif (LType <= 20) || (LType <= 40 && Rand > 75) || (LType > 40)

Lock LockVeryHard

additem FranLLG2DungRandChestLev15, 1

additem FranLLG0DungRandTreasure, 1

endif

endif

endif

if GetLocked && NeedsKey == 0 && GetRandomPercent <= (2 + FranLoot.ChestTrap)

set LType to GetLockLevel

set Trapped to LType / 33

endif


if FranLoot.ChestMArms == 1

additem FranSCL5LootArmorAll08, 1

additem FranSCL5LootWeaponAll08, 1

endif

if FranLoot.ChestMGems == 1

additem FranSCL0LootMoreGems15, 1

endif

if FranLoot.ChestMGold == 1 && GetRandomPercent >= 50

additem LL1LootGold100, 1

endif

endif

end


Begin OnActivate


set Actor To GetActionRef

if NeedsKey == 1 && Actor.GetItemCount FranKeyNecro >= 1

set NeedsKey to 0

set Trapped to 0

Actor.RemoveItem FranKeyNecro, 1

Unlock

Activate

elseif Trapped > 0

set LType to GetLockLevel

if Done == 1 && Actor == Player && Actor.GetAv Security > ((GetRandomPercent + LType) /2)

message "Something looks out of place in this chest.. it may be trapped!"

set Done to 2

elseif Done == 2 && Actor == Player && Actor.GetAv Security > ((GetRandomPercent + LType) /1.75)

message "You managed to disarm the trap, the chest can now be safely opened!"

set Done to 3

set Trapped to 0

else

set Rand to GetRandomPercent

if Trapped <= 1 && Rand < 50

cast StandardFrostDamageTarget3Journeyman Actor

cast StandardDrainFatigue3Journeyman Actor

elseif Trapped <= 1

cast StandardFireDamageTarget3Journeyman Actor

cast StandardDrainFatigue3Journeyman Actor

elseif Trapped <= 2 && Rand < 50

cast StandardShockDamageTarget4Expert Actor

cast FranDungTrapDFatigue4 Actor

elseif Trapped <= 2

cast StandardFrostDamageTarget4Expert Actor

cast FranDungTrapDFatigue4 Actor

elseif Trapped <= 3 && Rand < 50

cast StandardShockDamageTarget5Master Actor

cast FranDungTrapDFatigue5 Actor

elseif Trapped <= 3

cast StandardFireDamageTarget5Master Actor

cast FranDungTrapDFatigue5 Actor

endif

set Trapped to 0

if Done == 2 && Actor == Player

message "You failed to disarm the trap!"

elseif Actor == Player

message "The chest was trapped!"

elseif Actor != Player

Unlock

Activate

RemoveAllItems Actor

endif

endif

elseif Actor != Player

Unlock

Activate

RemoveAllItems Actor

else

Activate

endif

end





Because in my game, I don't remember any chests locked that would require a key (that key should be held by a key guardian NPC nearby). Francesco 5.0 comes with an ini file where a value is stored: FranLoot.ChestKey


I set that value quite high and still hasn't notice any key-locked chest.

User avatar
kelly thomson
 
Posts: 3380
Joined: Thu Jun 22, 2006 12:18 pm

Post » Tue Jan 26, 2016 3:44 pm

Without looking too hard at the script (sorry, my brain hurts today, normally I would), have you loaded Frans up in the CS and checked for use of that variable? I suppose that Francesco's Leveled Creatures-Items Mod.esm would be it. Or the .esp, which I don't have loaded, because of FCOM. Alternately, TES4Edit should tell you.

User avatar
Shiarra Curtis
 
Posts: 3393
Joined: Thu Jan 04, 2007 3:22 pm

Post » Tue Jan 26, 2016 5:02 pm

Do you mean usage od this script? It is called by FranLootSettingsScript.

User avatar
Chase McAbee
 
Posts: 3315
Joined: Sat Sep 08, 2007 5:59 am

Post » Tue Jan 26, 2016 9:35 am

I can't comment on whether the scripting is good or not, but it does work. I've received locked chests and found the key on a bandit nearby on a few occasions.

User avatar
Tikarma Vodicka-McPherson
 
Posts: 3426
Joined: Fri Feb 02, 2007 9:15 am

Post » Tue Jan 26, 2016 2:44 pm

That's good to hear! You are using version 5.0 updated by SomeWelshGuy with an ini file, right?

User avatar
Sara Lee
 
Posts: 3448
Joined: Mon Sep 25, 2006 1:40 pm

Post » Tue Jan 26, 2016 5:44 pm

Yes

User avatar
Veronica Martinez
 
Posts: 3498
Joined: Tue Jun 20, 2006 9:43 am


Return to IV - Oblivion