Help writing a script

Post » Tue May 17, 2011 1:30 am

Okay, this is what I'm trying to do: I've noticed that when attributes reach 255 or 256, they reset to 0. Once an attribute has reset to 0 once, it will repeatedly do it over and over, even if you use the console command to set it back several units. My problem is strength. It reached 255 or 256 and is always resetting to 0. I use the console to set it to 230, for example, and it will still reset to 0 when loading, opening containers, etc. So, I'm asking for help to write a script that checks the attributes current value, if it is 255 or 256 (what is the hardcoded value here - 255 or 256? Someone at the mods forums said it was 255), it will monitor that value and if it resets to zero, it will restore the value to 255 (256). I'm a total newb to scripting. I've written one script that worked and it was super simple. Other than that, all I've ever done is make simple adjustments to scripts. So iuf someone could just give me an example of how to do what I want, I'll finish the script. I think once I get started I'll be able to finish it. Thanks in advance if someone helps.
User avatar
Siidney
 
Posts: 3378
Joined: Fri Mar 23, 2007 11:54 pm

Post » Tue May 17, 2011 12:54 am

The max is hex FF which is dec 255.

begin GameMode   if player.GetAv Strength > 250      player.SetAv Strength 230   endifend

User avatar
Mizz.Jayy
 
Posts: 3483
Joined: Sat Mar 03, 2007 5:56 pm

Post » Tue May 17, 2011 11:59 am

Awesome. Thanks. Now, how can I add a check for attributes that are not already at 255, so the script doesn't effect them? I only want the script to effect attributes that are at 255 and prone to resetting to zero. Or does that do that already?
User avatar
ZANEY82
 
Posts: 3314
Joined: Mon Dec 18, 2006 3:10 am

Post » Tue May 17, 2011 1:24 pm

How do I add a check if the attribute drops to below, let's say 10, to set it back to 255?
User avatar
Charles Mckinna
 
Posts: 3511
Joined: Mon Nov 12, 2007 6:51 am

Post » Tue May 17, 2011 8:47 am

Basically, the script doesn't work. It still resets to 0 (or 5 actually - it used to be 0). So is there a function, OBSE or vanilla, that monitors if the value has dropped?
User avatar
Emily Rose
 
Posts: 3482
Joined: Sat Feb 17, 2007 5:56 pm

Post » Tue May 17, 2011 10:08 am

I got it working. Just had to read a little at the CS Wiki. Simple script. Thanks WillieSea.
User avatar
Alexxxxxx
 
Posts: 3417
Joined: Mon Jul 31, 2006 10:55 am

Post » Tue May 17, 2011 4:25 am

Okay. After playing a while, the script doesn't work all the time. A big problem is it doesn't work when the game is first loaded. It doesn't work after opening containers sometimes. And it doesn't work when restoring attributes via alters. Here's what I have:

scn AttributeStayScriptShort IsLoadedBegin GameModeSet GetGameLoaded to IsLoadedif IsLoaded == 1 && player.GetAV Strength < 10	player.SetAV Strength 255endifif player.GetAV Strength >= 255	player.SetAV Strength 255		if player.GetAV Strength < 10			player.SetAV Strength 255		endifendifendBegin MenuModeif player.GetAV Strength >= 255	player.SetAV Strength 255		if player.GetAV Strength < 10			player.SetAV Strength 255		endifendifend

User avatar
Siobhan Thompson
 
Posts: 3443
Joined: Sun Nov 12, 2006 10:40 am

Post » Tue May 17, 2011 3:37 am

Okay. After playing a while, the script doesn't work all the time. A big problem is it doesn't work when the game is first loaded. It doesn't work after opening containers sometimes. And it doesn't work when restoring attributes via alters. Here's what I have:

scn AttributeStayScriptShort IsLoadedBegin GameModeSet GetGameLoaded to IsLoadedif IsLoaded == 1 && player.GetAV Strength < 10	player.SetAV Strength 255endifif player.GetAV Strength >= 255	player.SetAV Strength 255		if player.GetAV Strength < 10			player.SetAV Strength 255		endifendifendBegin MenuModeif player.GetAV Strength >= 255	player.SetAV Strength 255		if player.GetAV Strength < 10			player.SetAV Strength 255		endifendifend


I think you need to drop to 245 or so. I'm guessing >= 255 doesn't work because the game sets it to 0 before your script can adjust it.
User avatar
Melis Hristina
 
Posts: 3509
Joined: Sat Jun 17, 2006 10:36 pm

Post » Tue May 17, 2011 11:23 am

You cannot have a value greater than 255 since 255 is the max. When the value is 'FF', it rolls to 00, 01, 02, etc. anytime you level it up or restore a value, or get a value 'enhanced'.

That means you need to check for much less than 'greater than 255' because it can easily spin past that amount.

Another thing, in your menumode part, you have the check for less than 10 'inside' the check for greater than 255. That will NEVER happen.

scn AttributeStayScriptShort IsLoadedBegin GameMode	Set GetGameLoaded to IsLoaded	if IsLoaded == 1		if player.GetAV Strength < 10			player.SetAV Strength 230		endif		if player.GetAV Strength >= 240			player.SetAV Strength 230	endifendBegin MenuMode	if player.GetAV Strength >= 240		player.SetAV Strength 230	endif	if player.GetAV Strength < 10		player.SetAV Strength 230	endifend

User avatar
Nathan Barker
 
Posts: 3554
Joined: Sun Jun 10, 2007 5:55 am

Post » Tue May 17, 2011 6:21 am

Cool. Thanks for the tips. I'll see if your adjustments makes a difference.
User avatar
Laura Cartwright
 
Posts: 3483
Joined: Mon Sep 25, 2006 6:12 pm

Post » Tue May 17, 2011 8:50 am

Nope. It doesn't work. It may be an engine limitation. Strange that the console can correct it. I made a few changes. This is what I have now:

scn AttributeStayScriptShort IsLoadedfloat fQuestDelayTime Begin GameMode	Set fQuestDelayTime to 1	Set GetGameLoaded to IsLoaded	if IsLoaded == 1		if player.GetBaseAV Strength < 10			player.SetAV Strength 252				if player.GetAV Strength < 10					player.SetAV Strength 252				endif		endif	endif		if player.GetAV Strength >= 252			player.SetAV Strength 252		endifendBegin MenuMode	if player.GetAV Strength >= 252		player.SetAV Strength 252	endif	if player.GetBaseAV Strength < 10		player.SetAV Strength 252	endif	if player.GetAV Strength < 10		player.SetAV Strength 252	endifend


It's a quest script, attached to a quest with a priority of 100. I may be out of luck here. Maybe I should contact the author of Realistic leveling and tell him to make it so the attributes cannot level over 254 or something. Someone in the mods forums suggested that.
User avatar
Flesh Tunnel
 
Posts: 3409
Joined: Mon Sep 18, 2006 7:43 pm

Post » Tue May 17, 2011 2:10 pm

Nope. It doesn't work. It may be an engine limitation. Strange that the console can correct it. I made a few changes. This is what I have now:

...

It's a quest script, attached to a quest with a priority of 100. I may be out of luck here. Maybe I should contact the author of Realistic leveling and tell him to make it so the attributes cannot level over 254 or something. Someone in the mods forums suggested that.

Wait, are you saying that you're using Realistic Leveling? That would be why you're getting the weird behaviour with the attributes resetting: Realistic Leveling is setting them to 256, which wraps around to 0. Realistic leveling ideally would have a maximum anyway, but I assume you're doing weird things with the settings to get attributes that high. Maybe use more sensible values for the attribute stuff?
User avatar
Ridhwan Hemsome
 
Posts: 3501
Joined: Sun May 06, 2007 2:13 pm

Post » Tue May 17, 2011 9:17 am

Wait, are you saying that you're using Realistic Leveling? That would be why you're getting the weird behaviour with the attributes resetting: Realistic Leveling is setting them to 256, which wraps around to 0. Realistic leveling ideally would have a maximum anyway, but I assume you're doing weird things with the settings to get attributes that high. Maybe use more sensible values for the attribute stuff?


Yeah. The plugin I wrote with much help from people here is working now. Thanks though.
User avatar
El Khatiri
 
Posts: 3568
Joined: Sat Sep 01, 2007 2:43 am

Post » Tue May 17, 2011 6:13 am

Wait, are you saying that you're using Realistic Leveling? That would be why you're getting the weird behaviour with the attributes resetting: Realistic Leveling is setting them to 256, which wraps around to 0. Realistic leveling ideally would have a maximum anyway, but I assume you're doing weird things with the settings to get attributes that high. Maybe use more sensible values for the attribute stuff?

RealisticLeveling calculates and sets attributes based on your skills, and it will do this at regular intervals, so it will undo any setting of attributes done at the console or by other mods. For it to calculate attributes as high as 255 you must either be running with strange settings in RealisticLeveling.ini, or have skills that are nearly 255. RL was not written with skills that high in mind... it does work fine with skill uncappers right up until your skills are so high they cause your attributes to wrap.

There is an "attrMax" setting in RealisticLeveling.ini that you can edit to change how high your attributes go. This setting is how high your attributes will reach, not including racial bonuses, when all your skills have reached 100. Attributes will still go above attrMax when skills go above 100. I suggest lowering this setting so that your attributes don't wrap.
User avatar
GPMG
 
Posts: 3507
Joined: Sat Sep 15, 2007 10:55 am

Post » Tue May 17, 2011 8:34 am

Thanks, ABO. I'll have a look at the ini.
User avatar
lydia nekongo
 
Posts: 3403
Joined: Wed Jul 19, 2006 1:04 pm


Return to IV - Oblivion