Using Luck to reduce loot

Post » Mon Mar 14, 2011 9:13 pm

Hi guys, I'm afraid I need help again.

What I'm trying to do is use the player's Luck to alter the amount of found loot (such as the amount of ammo found in an ammo box).
In my Less-Is-More module (part of my Realism Tweaks) I used my own global modifiers to reduce the amount of loot, and it works really well. Now I'm trying to factor in the player's Luck to alter the average amount of loot that they find.

I wrote a simple quest script and created a quest (which uses my script), checked "Start Game Enabled."

Here is my script:
scn ArwenLuckQuestScript ; by Arwen v.4.4short LuckMultshort Reduce20short Reduce30short Reduce40short Reduce50short Reduce60short Reduce70begin GameMode	Set LuckMult to ((10 - player.GetActorValue Luck) * 4) 		Set Reduce20 to LuckMult ; 1 Luck = 36, 5 Luck = 20, 10 Luck = 0	Set Reduce30 to (LuckMult +10) ; 1 Luck = 46, 5 Luck = 30, 10 Luck = 10	Set Reduce40 to (LuckMult +20) ; 1 Luck = 56, 5 Luck = 40, 10 Luck = 20	Set Reduce50 to (LuckMult +30) ; 1 Luck = 66, 5 Luck = 50, 10 Luck = 30	Set Reduce60 to (LuckMult +40) ; 1 Luck = 76, 5 Luck = 60, 10 Luck = 40	Set Reduce70 to (LuckMult +50) ; 1 Luck = 86, 5 Luck = 70, 10 Luck = 50		SetNumericGameSetting ArwenReduce20 Reduce20 	SetNumericGameSetting ArwenReduce30 Reduce30 	SetNumericGameSetting ArwenReduce40 Reduce40 	SetNumericGameSetting ArwenReduce50 Reduce50 	SetNumericGameSetting ArwenReduce60 Reduce60 	SetNumericGameSetting ArwenReduce70 Reduce70 end


For some reason, my global modifier values are not changing when my Luck changes, but are remaining at their default amounts.
My guess is that globals need to handled differently than this.

Any help will be GREATLY appreciated, as I've spent hours trying to figure out why this will not work.
User avatar
Maria Leon
 
Posts: 3413
Joined: Tue Aug 14, 2007 12:39 am

Post » Mon Mar 14, 2011 10:12 pm

Hmm... How are those ArwenReduceXX game settings being used?
User avatar
Charity Hughes
 
Posts: 3408
Joined: Sat Mar 17, 2007 3:22 pm

Post » Mon Mar 14, 2011 6:44 pm

Hmm... How are those ArwenReduceXX game settings being used?

Thanks for replying! Sorry for not explaining this very well; I'll try to clarify this better:

The ArwenReduceXX are global modifiers that are used on Leveled Items, such as "Ammo32Caliber75," which has a default "Chance None" of 25 [75% chance that the assigned rounds will spawn . . . for 100 rounds, and average of 75 will spawn].
If the above case, I used my ArwenReduce60 Global, which has a default value of 60 [Chance None], so only an average of 40 rounds will spawn. This is how my mod reduces ammo (and other things), and it works just fine.

The problem is that now I'm trying to use the script that I posted, to alter the ArwenReduceXX values, based on the player's Luck, and it is not working.

My intent is to have 5 Luck give you the default ArwenReduceXX values (ArwenReduce60 would remain at 60, when you had 5 Luck . . . so for 100 rounds, an average of 40 would still spawn).
And the number of items would decrease when your luck was less than 5 (for example my ArwenReduce60 would have a value of 76, when you had 1 Luck . . . so for 100 rounds, an average of only 24 would now spawn).
And the number of items would increase when your luck was higher than 5 (for example my ArwenReduce60 would have a value of 40, when you had 10 Luck . . . so for 100 rounds, an average of only 60 would now spawn).

I hope that all makes sense. I'm really hoping that someone will be able to help me with my script, as I've been trying to find a way to make Luck a greater factor in how your game plays . . . and I finally figured out a good way, but cannot get my script to work (even though it seems to compile just fine).
User avatar
Bambi
 
Posts: 3380
Joined: Tue Jan 30, 2007 1:20 pm

Post » Mon Mar 14, 2011 2:27 pm

Thanks for replying! Sorry for not explaining this very well; I'll try to clarify this better:

The ArwenReduceXX are global modifiers that are used on Leveled Items, such as "Ammo32Caliber75," which has a default "Chance None" of 25 [75% chance that the assigned rounds will spawn . . . for 100 rounds, and average of 75 will spawn].
If the above case, I used my ArwenReduce60 Global, which has a default value of 60 [Chance None], so only an average of 40 rounds will spawn. This is how my mod reduces ammo (and other things), and it works just fine.

The problem is that now I'm trying to use the script that I posted, to alter the ArwenReduceXX values, based on the player's Luck, and it is not working.

My intent is to have 5 Luck give you the default ArwenReduceXX values (ArwenReduce60 would remain at 60, when you had 5 Luck . . . so for 100 rounds, an average of 40 would still spawn).
And the number of items would decrease when your luck was less than 5 (for example my ArwenReduce60 would have a value of 76, when you had 1 Luck . . . so for 100 rounds, an average of only 24 would now spawn).
And the number of items would increase when your luck was higher than 5 (for example my ArwenReduce60 would have a value of 40, when you had 10 Luck . . . so for 100 rounds, an average of only 60 would now spawn).

I hope that all makes sense. I'm really hoping that someone will be able to help me with my script, as I've been trying to find a way to make Luck a greater factor in how your game plays . . . and I finally figured out a good way, but cannot get my script to work (even though it seems to compile just fine).


I think that it's not actually possible to change Game Settings on the fly without either saving and loading after the setting is changed or without using FOSE, as I had the same problem you did in my mod. Try running the game, changing your luck, and quicksaving then quckloading and then check the setting to see if it's different. If it is changing after saving/loading, you'd have to use FOSE's con_SetGameSetting function, which unfortunately doesn't take variables as arguements, which would make your script a lot more difficult. If that's the case, then you'd have to piece it up into many, many if statements. Hopefully that won't matter though, and I could be completely confused.
User avatar
JeSsy ArEllano
 
Posts: 3369
Joined: Fri Oct 20, 2006 10:51 am

Post » Mon Mar 14, 2011 9:20 pm

I think that it's not actually possible to change Game Settings on the fly without either saving and loading after the setting is changed or without using FOSE, as I had the same problem you did in my mod. Try running the game, changing your luck, and quicksaving then quckloading and then check the setting to see if it's different. If it is changing after saving/loading, you'd have to use FOSE's con_SetGameSetting function, which unfortunately doesn't take variables as arguements, which would make your script a lot more difficult. If that's the case, then you'd have to piece it up into many, many if statements. Hopefully that won't matter though, and I could be completely confused.

I was finally able to fix my script by getting rid of the SetNumericGameSetting lines at the bottom (which apparantly don't work for globals :facepalm: )
Then I just set my ArwenReduceXXs directly (instead of using the ReduceXXs).

I knew that this should be possible with a very simple script, an then I went and made it way more complex than it had to be.
User avatar
jodie
 
Posts: 3494
Joined: Wed Jun 14, 2006 8:42 pm

Post » Tue Mar 15, 2011 2:22 am

Well it sounds like you've got your issue solved but; I've been playing around with making a mod do the exact same thing, I just set the Chance None to Use Global Value and created a quest script that does:

set ContainerAmmoGlobal 100 - Player.getav Luck * 5

I'm thinking of having it fire only on level up.
User avatar
flora
 
Posts: 3479
Joined: Fri Jun 23, 2006 1:48 am


Return to Fallout 3