Jump to content

Changing "A Bloody Mess" to give bonuses instead of penalties


Recommended Posts

So I got an idea for a race that I've been trying to make, but I ran into several scripting issues. The end result I want is for the player to gradually get bonuses each time they are damaged, i.e. the basic stats increase, maybe skill increases as well.

 

The problem is that I can't figure out how to have an ability trait on a race that activates it's bonus when the player is damaged. So I was trying to change the "A Bloody Mess" mod to give bonuses to stats instead of penalties, as the tiered blood stage system was very close to what I wanted for this race (of course, the issue is that it only activates when the player damages others, which isn't exactly what I wanted but was the closest I could get).

 

I've tried editing the script to include a strength bonus but it just doesn't activate. I also tried calling for the RBloodyMessStage variable in other scripts (for instance, a specific ability script that looked only at the stage level to determine bonuses) and it again, didn't work at all.

 

Here's the script I've tried so far. All of the Strength stuff is what I've added. I'm guessing there's some discrepancy in the if loops for the bonuses to work.

 

ScriptName RBloodyMessScript

Float FQuestDelayTime
Short Counter

Short PCStrength
Short PCStrRedAmount
Short RecoverStr

Short PCPersonality
Short PCSpeechcraft
Short PCMercantile
Short PCPerRedAmount
Short PCSpeRedAmount
Short PCMerRedAmount
Short RecoverPer
Short RecoverSpe
Short RecoverMer
Short LastBloodStage
Ref LastCell
Short LastPenalization
Short RagNumber

Begin GameMode
If (FQuestDelayTime != 1)
Set FQuestDelayTime to 1;Runs every second
EndIf

Set PCStrength to Player.GetAV Strength

Set PCPersonality to Player.GetAV Personality

;If swimming the player is cleaned of their blood
If (Player.IsSwimming == 1)
Set RBloodyMessStage to 0
If (Player.GetItemCount RBloodyMessRagBloodied > 0)
	Set RagNumber to (Player.GetItemCount RBloodyMessRagBloodied)
	Player.RemoveItem RBloodyMessRagBloodied RagNumber
	Player.AddItem RBloodyMessRag RagNumber
EndIf
EndIf

;If it's raining, the player is cleaned of a level of blood every 10 seconds
If (IsRaining == 1)
If (Player.IsInInterior == 0)
	If (RBloodyMessStage > 1);Rain can't wash ALL the blood off
		If (Counter < 10)
			set Counter to (Counter + 1)
		Else;should run every 10 seconds with an fQuestDelayTime of 1
		Set RBloodyMessStage to (RBloodyMessStage - 1)
		set Counter to 0
		EndIf
	EndIf
EndIf
EndIf

;Max Check
If (RBloodyMessStage > 10)
Set RBloodyMessStage to 10
EndIf

;If bloody, subtract the player's appropriate stats (Resets player's stats each time - makes a clean slate in case there are any changes in the stat levels - and then penalizes their stats again)
If (BloodPenalizeStats == 0);Repairs stat damage done after turning stat penalizations off in case you were bloody at the time
If (LastPenalization == 1)
	Player.ModAV Personality RecoverPer
	Player.ModAV Speechcraft RecoverSpe
	Player.ModAV Mercantile RecoverMer
	Player.ModAV Strength RecoverStr
EndIf
EndIf
If (BloodPenalizeStats == 1);Player has chosen to allow stat penalization
If (LastBloodStage != RBloodyMessStage)||(LastPenalization == 0);Blood stage has changed, or stat penalization has just been re-enabled
	If (LastPenalization != 0);Prevents permanent boost to penalized stats after reactivating it
		Player.ModAV Personality RecoverPer
	EndIf
	If (Player.GetAV Personality >= 4)
		Set PCPerRedAmount to (RBloodyMessStage * 4)
		If (PCPerRedAmount > Player.GetAV Personality)
			Set PCPerRedAmount to Player.GetAV Personality
		EndIf
		Set RecoverPer to PCPerRedAmount
		Set PCPerRedAmount to (-PCPerRedAmount)
		Player.ModAV Personality PCPerRedAmount
	EndIf
	
	If (LastPenalization !=0);
		Player.ModAV Strength RecoverStr
	EndIf
	If (Player.GetAV Strength >=5)
		Set PCStrRedAmount to RBloodyMessStage * 5)
		If (PCStrRedAmount > Player.GetAV Strength)
			Player.ModAV Strength PCStrRedAmount
		EndIf
		Set RecoverStr to PCStrRedAmount
		Set PCStrRedAmount to (+PCStrRedAmount)
		Player.ModAV Strength PCSpeRedAmount
	EndIf

	If (LastPenalization != 0);Prevents permanent boost to penalized stats after reactivating it
		Player.ModAV Speechcraft RecoverSpe
	EndIf
	If (Player.GetAV Speechcraft >= 2)
		Set PCSpeRedAmount to (RBloodyMessStage * 2)
		If (PCSpeRedAmount > Player.GetAV Speechcraft)
			Set PCSpeRedAmount to Player.GetAV Speechcraft
		EndIf
		Set RecoverSpe to PCSpeRedAmount
		Set PCSpeRedAmount to (-PCSpeRedAmount)
		Player.ModAV Speechcraft PCSpeRedAmount
	EndIf

	If (LastPenalization != 0);Prevents permanent boost to penalized stats after reactivating it
		Player.ModAV Mercantile RecoverMer
	EndIf
	If (Player.GetAV Mercantile >= 2)
		Set PCMerRedAmount to (RBloodyMessStage * 2)
		If (PCMerRedAmount > Player.GetAV Mercantile)
			Set PCMerRedAmount to Player.GetAV Mercantile
		EndIf
		Set RecoverMer to PCMerRedAmount
		Set PCMerRedAmount to (-PCMerRedAmount)
		Player.ModAV Mercantile PCMerRedAmount
	EndIf
EndIf
EndIf

If (LastBloodStage != RBloodyMessStage)||(LastCell != Player.GetParentCell); Blood stage has changed or player has entered a new area
	Player.StopMagicShaderVisuals RBloodyMess1
	Player.StopMagicShaderVisuals RBloodyMess2
	Player.StopMagicShaderVisuals RBloodyMess3
	Player.StopMagicShaderVisuals RBloodyMess4
	Player.StopMagicShaderVisuals RBloodyMess5
	Player.StopMagicShaderVisuals RBloodyMess6
	Player.StopMagicShaderVisuals RBloodyMess7
	Player.StopMagicShaderVisuals RBloodyMess8
	Player.StopMagicShaderVisuals RBloodyMess9
	Player.StopMagicShaderVisuals RBloodyMess10

;Add the visual for the appropriate level of blood
If (RBloodyMessStage == 1)
	Player.PlayMagicShaderVisuals RBloodyMess1
ElseIf (RBloodyMessStage == 2)
	Player.PlayMagicShaderVisuals RBloodyMess2
ElseIf (RBloodyMessStage == 3)
	Player.PlayMagicShaderVisuals RBloodyMess3
ElseIf (RBloodyMessStage == 4)
	Player.PlayMagicShaderVisuals RBloodyMess4
ElseIf (RBloodyMessStage == 5)
	Player.PlayMagicShaderVisuals RBloodyMess5
ElseIf (RBloodyMessStage == 6)
	Player.PlayMagicShaderVisuals RBloodyMess6
ElseIf (RBloodyMessStage == 7)
	Player.PlayMagicShaderVisuals RBloodyMess7
ElseIf (RBloodyMessStage == 8)
	Player.PlayMagicShaderVisuals RBloodyMess8
ElseIf (RBloodyMessStage == 9)
	Player.PlayMagicShaderVisuals RBloodyMess9
ElseIf (RBloodyMessStage == 10)
	Player.PlayMagicShaderVisuals RBloodyMess10
EndIf
EndIf

Set LastBloodStage to RBloodyMessStage
Set LastCell to Player.GetParentCell
Set LastPenalization to BloodPenalizeStats

End

 

Does anyone have any ideas on how to fix this? Or perhaps a better way to do this mod in general?

Link to comment
Share on other sites

I do not have the original mod, but after looking through the script and the mod description, I have a rough idea of how it works. As for why your modified script is not working, you should note that the variable "BloodPenalizeStats" is originally set to 0. I imagine that there's a readme that comes with the mod telling you to set this variable to 1 if you want stat changes to occur along with the blood splatters. So the reason your mod didn't work is because you didn't set this variable to 1.

 

That said, the modified parts you put in aren't that good either. If the script did work, then you would get ridiculous boosts in strength whenever you get splattered with blood. Not only that, but unlike with the original stat decreases, the strength doesn't go back to normal later either... In fact, instead of decreasing strength back to normal, you actually increase it even more. You're better off creating a whole new mod rather than trying to mess with this one.

 

EDIT: Also, there might be another reason why it wasn't working. From reading the mod description, there are esm and esp files. The esm file is the one that has the script that you posted. The bloody fights esp file is the one that controls the "RBloodyMessStage" variable. So you need to have that one activated before you see any effects.

Edited by fg109
Link to comment
Share on other sites

I should have mentioned that the other stat penalties worked fine, but the strength one did not. I wasn't concerned with it getting massive boosts, since I mostly wanted to see it actually working.

 

What would you suggest would be a good method? I'm not entirely sure how to check for damage inside of a spell script and make it apply bonuses in relation to how much damage you're taking. The second part seems pretty straightforward, but how do I figure out when the player gets hit, and how much damage they take?

Link to comment
Share on other sites

You could have a quest script that checks the player's health every time that it runs. If the player's health is lower than it was the last time the script ran, then obviously the player has taken some damage.
Link to comment
Share on other sites

You could have a quest script that checks the player's health every time that it runs. If the player's health is lower than it was the last time the script ran, then obviously the player has taken some damage.

 

Ah, that's a great idea. Thanks, I'll try that!

Link to comment
Share on other sites

  • Recently Browsing   0 members

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