Scripting Conflict with Slower Backpedaling and Triage

Post » Sun Dec 19, 2010 6:44 am

I have detected a conflict with the Slower Backpedaling mod and the Triage mod. Slower Backpedaling, as the name implies, slows down your character when moving backwards but does so by damaging your left leg and then restoring the damage done (presumably to overcome engine or scripting limitations). The issue is that if your left leg is crippled, it will damage it (which does nothing in that case) and then restore the damage done which effectively grants your left leg a sliver of health and thereby removes the crippled status. This is very annoying! Here is the script from Slower Backpedaling that is responsible for this (backPedalAgility is a global to determine whether agility should affect your backpedaling speed):

Scriptname BackPedalScriptshort healOnceshort backSpeedshort isBackingBegin GameModeif(isBacking == 0)	if(backPedalAgility == 1)		set backSpeed to -80 + player.getav agility * 10		if (backSpeed > 0)			set backSpeed to 0		endif	else		set backSpeed to -100 + BackPedalSpeed	endifendif;Repairs the damage we did to the player's legif(healOnce == 1)	player.Restoreav LeftMobilityCondition 1	set healOnce to 0endifif(player.IsMoving == 2 && isBacking == 0 && player.isRunning == 1)	set isBacking to 1	player.modav SpeedMult backSpeed	player.Damageav LeftMobilityCondition 1 ;Damages the player's leg in order to force the game to reevaluate the player's speed	set healOnce to 1endifif(isBacking == 1 && (player.IsMoving != 2 || player.isRunning == 0))	set isBacking to 0	set backSpeed to backSpeed  * -1	player.modav SpeedMult backSpeed	player.Damageav LeftMobilityCondition 1	set healOnce to 1endifEnd


Now, I know very little about scripting and I don't know how to fix this issue. My thoughts are that the script should check to see if the leg is already crippled and if so, prevent the script from adding health back to the crippled leg. I don't know if such a fix would cause other problems, though. Does anyone with some scripting experience know how to go about resolving this issue?
User avatar
Sanctum
 
Posts: 3524
Joined: Sun Aug 20, 2006 8:29 am

Post » Sun Dec 19, 2010 5:16 am

I would think using SpeedMult on the player would work without crippling the leg.

It looks to me like the 'backSpeed' is getting set to high (or low). A '50' would be 50% of your normal speed.
User avatar
Jenna Fields
 
Posts: 3396
Joined: Mon Dec 11, 2006 11:36 am

Post » Sun Dec 19, 2010 2:47 am

I would think using SpeedMult on the player would work without crippling the leg.

It looks to me like the 'backSpeed' is getting set to high (or low). A '50' would be 50% of your normal speed.


If it's not too much trouble, could you repost the code above with the necessary portions removed that you think would resolve the issue?
User avatar
Kelly Tomlinson
 
Posts: 3503
Joined: Sat Jul 08, 2006 11:57 pm

Post » Sun Dec 19, 2010 7:05 am

I've been having similar problems with my mod. (Changing your speed when a 2handed weapon is drawn.) Luckily, I've stumbled upon a solution, aided by looking over how the FWE team altered the original back pedal script, although I've had to go a bit further.

You need to do two things.

1) Add a check for the actorvalue IgnoreCrippledLimbs. If it's there you need to remove it and then restore it after the limb is damaged and then healed.

2) Add an if before damaging the limb. If it's already crippled you need to heal it instead.

The script would look something like this (sorry, I don't know how to highlight or any of that fancy stuff):
Scriptname BackPedalScriptshort healOnceshort backSpeedshort isBackingshort isCrippledBegin GameModeif(isBacking == 0)        if(backPedalAgility == 1)                set backSpeed to -80 + player.getav agility * 10                if (backSpeed > 0)                        set backSpeed to 0                endif        else                set backSpeed to -100 + BackPedalSpeed        endifendif;Repairs the damage we did to the players legif(healOnce == 1)        player.Restoreav LeftMobilityCondition 1        set healOnce to 0elseif (healOnce == 2)	player.damageav LeftMobilityCondition	set healOnce to 0endif;Restore any morphine effects.;You can probably use forceAV for this, but better safe than sorry.if (isCrippled != 0)	set isCrippled to isCrippled * -1	player.modAV IgnoreCrippledLimbs isCrippled	set isCrippled to 0endifif(player.IsMoving == 2 && isBacking == 0 && player.isRunning == 1)        set isBacking to 1        player.modav SpeedMult backSpeed        ;Checking for and removing IgnoreCrippleLimbs effect	if (player.getAV IgnoreCrippledLimbs != 0)		set isCrippled to player.getAV IgnoreCrippledLimbs		;PrintC "Morphine detected. AV is %.0f" isCrippled		set isCrippled to isCrippled * -1		player.modAV IgnoreCrippledLimbs isCrippled	endif	;Damages the players leg in order to force the game to reevaluate the players speed	if (Player.GetAV LeftMobilityCondition > 0)		player.Damageav LeftMobilityCondition 1		set healOnce to 1	elseif (player.getAV LeftMobilityCondition <= 0)		player.restoreAV LeftMobilityCondition 1		set healOnce to 2	endifendifif(isBacking == 1 && (player.IsMoving != 2 || player.isRunning == 0))        set isBacking to 0        set backSpeed to backSpeed  * -1        player.modav SpeedMult backSpeed        ;Checking for and removing IgnoreCrippleLimbs effect	if (player.getAV IgnoreCrippledLimbs != 0)		set isCrippled to player.getAV IgnoreCrippledLimbs		;PrintC "Morphine detected. AV is %.0f" isCrippled		set isCrippled to isCrippled * -1		player.modAV IgnoreCrippledLimbs isCrippled	endif	;Damages the players leg in order to force the game to reevaluate the players speed	if (Player.GetAV LeftMobilityCondition > 0)		player.Damageav LeftMobilityCondition 1		set healOnce to 1	elseif (player.getAV LeftMobilityCondition <= 0)		player.restoreAV LeftMobilityCondition 1		set healOnce to 2	endifendifEnd


Hope that makes sense.

Cheers.

Edit:

The above only kind of works, and is very clunky. (I've tested it now.) If you're still interested, check out the way back pedal is implemented in http://www.gamesas.com/index.php?/topic/1169090-relz-project-nevada-2/. Their (excellent) method will fix the conflict with triage, although it still won't function properly when you've got an ignorecrippled effect on you. :)

To do that you need to...:
';Checking for and removing IgnoreCrippleLimbs effect'if (player.getAV IgnoreCrippledLimbs != 0)	set isCrippled to player.getAV IgnoreCrippledLimbs	player.setAV IgnoreCrippledLimbs 0endif'PN method of applying limb damage to force speed update goes here'';Restoring morphine effect'if isCrippled != 0	player.setAV IgnoreCrippledLimbs isCrippled	set isCrippled to 0endif


Hope that helps.

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


Return to Fallout 3