Jump to content

working on run speed mod for player and companions


osterac

Recommended Posts

Yeah, well, if I want to do any complicated conditionals I usually put them on a token item so I can script and force Order of Operations with parenteses. :)

Well, this was a relatively simple condition. :) But yeah, making complex conditions with it becomes extremely difficult when many AND/ORs are required. I therefore absolutely agree that when it's possible to substitute conditions with scripting, the later is always preferable. Unfortunately, it's not always possible (in message-boxes and terminals, for example). :wallbash:

Link to comment
Share on other sites

Yeah, well, if I want to do any complicated conditionals I usually put them on a token item so I can script and force Order of Operations with parenteses. :)

Well, this was a relatively simple condition. :) But yeah, making complex conditions with it becomes extremely difficult when many AND/ORs are required. I therefore absolutely agree that when it's possible to substitute conditions with scripting, the later is always preferable. Unfortunately, it's not always possible (in message-boxes and terminals, for example). :wallbash:

 

Mmm. Probably it could be with Game and MenuMode blocks and multiple tokens. You'd just have to delay the appearance of the terminal windows or message boxes until the tokens had finished processing... Hm, that could be a sticking point.

Link to comment
Share on other sites

The mod looks to be working now, thanks guys! Don't understand a word of the conversation you two are having though...

Only thing is, occasionally it will bug out a bit. Sometimes it won't go back to fast run speed until you go into sneak and then back out after combat, and sometimes it won't switch to normal speed in combat until you take a lot of damage. In any case, it will not switch until you take some damage. And in rare cases, it gets to this point (and this may happen without the mod too, I don't know) where you will be stuck walking slowly and if you jump you will walk at normal speed for a fraction of a second but then walk slowly again. Sometimes it seems the only way to get out of it is to reload a save, unless I'm mistaken.

 

I had another issue that sometimes happens too, occasionally when you get a new companion, they won't get the perk and you have to re-equip the run speed choker. I have a suspicion about this one though. I had in my scripts to assign the player perk on equip and the companion perk on un-equip. maybe I just forgot to unequip a few times. I'll fix that, but here's the code anyway from the 250% speed script (after fix):

 

scn runspeedperk250
Begin OnEquip
Player.RemovePerk Runspeed125
Player.RemovePerk Runspeed150
Player.RemovePerk Runspeed200
Player.RemovePerk Runspeed275	
Player.RemovePerk Runspeed300
Player.RemovePerk Runspeedbonkers
Player.RemovePerk Runspeed125 1
Player.RemovePerk Runspeed150 1
Player.RemovePerk Runspeed200 1
Player.RemovePerk Runspeed275 1
Player.RemovePerk Runspeed300 1
Player.RemovePerk Runspeedbonkers 1
Player.Addperk runspeed250
ShowMessage runspeedmsg
Player.Addperk runspeed250 1
End

EDIT:

Also, it seems like, sometimes, when I equip a choker, my companion won't get the perk. But if I equip it again, he/she will. Maybe this is why I was having that problem with new companions? They never had it in the first place and I didn't notice? Why would this occur?

EDIT 2:

Another weird thing:

I equipped on of the chokers, and my companion didn't get the perk, but then I un-equipped it and he did. And this was after I fixed the code. I used this code:

scn runspeedperk300
Begin OnEquip
Player.RemovePerk Runspeed125
Player.RemovePerk Runspeed150
Player.RemovePerk Runspeed200
Player.RemovePerk Runspeed250
Player.RemovePerk Runspeed275	
Player.RemovePerk Runspeedbonkers
Player.RemovePerk Runspeed125 1
Player.RemovePerk Runspeed150 1
Player.RemovePerk Runspeed200 1
Player.RemovePerk Runspeed250 1
Player.RemovePerk Runspeed275 1
Player.RemovePerk Runspeedbonkers 1
Player.Addperk runspeed300
Player.Addperk runspeed300 1
ShowMessage runspeedmsg
End

Why would that happen?

Edit 3:

It seems to happen ever other time I equip a choker.

Edited by osterac
Link to comment
Share on other sites

I'd like to propose a different approach. It relates to what Xaranth and I were discussing on our previous posts here. Counting on the perks to monitor the player's current state (i.e. sneaking/in combat) and adjust the running speed accordingly - this may not be the best idea, and could be the cause of the reliability issues you describe. It may work better if done by a dummy-quest running a script.

The quest (along with its attached script) will be activated/deactivated when the token item is equipped.

When activated, the script will continuously monitor the player's current state, adding/removing perks accordingly.

Each perk will only modify the running speed, with no conditions set. That means you would need two perks for every speed level - one for normal state, another for combat state.

 

Here's the skeleton of the quest script I have in mind:

(remember, when creating the quest, to set the script processing delay to 0.1)

scn RunSpeedPerkMonitorScript

short iState ; 2 - sneaking, 1 - in combat, 0 - default
short bReset
short iMultiplier ; this will be set by the token items scripts (see below).

begin GameMode

if bReset
; This block, when processed, will remove ALL the perks from the player and companions.
endif

if player.IsSneaking
	if iState != 2
		if bReset
			set bReset to 0
		else
			set bReset to 1
			Return
		endif
		set iState to 2
	endif
elseif player.IsInCombat
	if iState != 1
		if bReset
			set bReset to 0
		else
			set bReset to 1
			Return
		endif
		if iMultiplier == 125
			player.AddPerk Runspeed125c     ; x1.25 perk, combat version.
			player.AddPerk Runspeed125c 1
		elseif iMultiplier == 150
			; etc.
		elseif iMultiplier == 200
			; etc.
		endif
		set iState to 1
	endif
elseif iState
	if iState == 1
		if bReset
			set bReset to 0
		else
			set bReset to 1
			Return
		endif
	endif
	if iMultiplier == 125
		player.AddPerk Runspeed125     ; x1.25 perk, default version.
		player.AddPerk Runspeed125 1
	elseif iMultiplier == 150
		; etc.
	elseif iMultiplier == 200
		; etc.
	endif
	set iState to 0
endif

end

 

As for the token items' scripts, each should look something like this:

scn runspeedperk125

begin OnEquip

if GetQuestRunning RunSpeedPerkMonitor
	StopQuest RunSpeedPerkMonitor
	; Then remove ALL the perks
else
	StartQuest RunSpeedPerkMonitor
	set RunSpeedPerkMonitor.iMultiplier to 125 ; or 150/200/etc.
endif

player.UnequipItem [token item] 0 1

end

Link to comment
Share on other sites

I'll try that. Would the item have to stay equipped? That was one of the things I was trying to avoid in my mod. I didn't want it so the player had an armor slot used up by the mod.

 

Edit

Now I'm having a problem with GECK. When I go to create a new script, and put in all the code, and click save, it doesn't save. Then I click close, and it asks me if I want to save. If I click yes, the script window stays open and it doesn't save. If I click no, it doesn't save and the window closes?

Edited by osterac
Link to comment
Share on other sites

I think that's because, when you copied the code from here and pasted it in the GECK script editor, it replaced all the tab stops with spaces. The script editor was then unable to resolve all the spaces and refused to compile. You will need to erase all the spaces, preceding each code line, then manually restore all the tab stops (the later is not really necessary - removing the spaces should be enough to get the script to compile).
Link to comment
Share on other sites

  • Recently Browsing   0 members

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