What happens when you die?

Post » Fri May 13, 2011 2:00 pm

Philosophical and religious issues aside, I am puzzled over why a quest script that functions flawlessly when loaded or reload, completely fails to execute if the player is killed and restored.

The code below is designated as a quest script and attached to a start game enabled quest. The function is to classify weapons, assign and execute appropriate kickback and muzzle rise when fired.

After a death and reset, the quest variable remain frozen at their last values and the effect loop is not executed.

What am I missing?

SCN xCalKickScriptshort ammocountshort xCalKickLoopshort KickLoopCountershort Kickskillshort IsSmallGunfloat fRisefloat fAnglefloat Kickback float Kickfloat RiseAmtref rAmmoType ref rCurrentGunBEGIN Gamemode;############################################################# KickBack Assignment IF (IsSmallGun==41) || (rCurrentGun==0)	IF ( rCurrentGun != player.getequippedobject 5 ) 		set rCurrentGun to player.getequippedobject 5		set rAmmoType to getweaponammo rCurrentGun		set IsSmallGun to Player.getweaponskill rCurrentGun			IF player.isweaponinlist xCalKickAutoL				set Kickback to 1.25				Set xCalKickLoop to 2			ElseIF player.isweaponinlist xCalKickAutoH				set Kickback to 2				Set xCalKickLoop to 2			ElseIF player.isweaponinlist xCalKickAutoSMG				set Kickback to .75				Set xCalKickLoop to 2			ElseIF player.isweaponinlist xCalKickSemiS				set Kickback to 2				Set xCalKickLoop to 4			ElseIF player.isweaponinlist xCalKickSemiM				set Kickback to 3				Set xCalKickLoop to 4			ElseIF player.isweaponinlist xCalKickSemiL				set Kickback to 4				Set xCalKickLoop to 4			ElseIF player.isweaponinlist xCalKickCannon				set Kickback to 5				Set xCalKickLoop to 4			ElseIF (getisautomatic rCurrentGun)										;Automatic designation				IF (GetWeaponType ==3) || (GetWeaponType == 4)					listaddform xCalKickAutoSMG rCurrentGun					set Kickback to .75					Set xCalKickLoop to 2				ElseIF (rAmmoType == CALIBRxAmmoRifle762x51)					listaddform xCalKickAutoH rCurrentGun					set Kickback to 2					Set xCalKickLoop to 2				ElseIF (rAmmoType != CALIBRxAmmoRifle762x51)						listaddform xCalKickAutoL rCurrentGun					set Kickback to 1.25					Set xCalKickLoop to 2				EndIF			ElseIF getdamage rCurrentGun < 30									;Semi designation				listaddform xCalKickSemiS rCurrentGun				set Kickback to 2				Set xCalKickLoop to 4			ElseIF getdamage rCurrentGun < 60				listaddform xCalKickSemiM rCurrentGun				set Kickback to 3				Set xCalKickLoop to 4			ElseIF getdamage rCurrentGun < 90				listaddform xCalKickSemiL rCurrentGun				set Kickback to 4				Set xCalKickLoop to 4			ElseIF getdamage rCurrentGun > 89				listaddform xCalKickCannon rCurrentGun				set Kickback to 5				Set xCalKickLoop to 4			EndIF			Set Kickskill to player.GetAV SmallGuns			Set Kick to (Kickback*(100/(kickskill+100)))								; full skill reduces kick 50%	EndIF 																					; New Weapon Equiped loop;############################################################# KickBack Effect Loop	IF ( AmmoCount > player.getitemcount rAmmoType )	;  weapon has been fired		Set KickLoopCounter to 1		Label 1		IF KickLoopCounter <= xCalKickLoop			set fAngle to player.getangle x - (Kick/ xCalKickLoop)			IF ( fAngle>=-89 && fAngle<=89 )				player.setangle x fAngle			EndIF			IF iscontrolpressed 6 == 0				Set RiseAmt to ((Kick/xCalKickLoop)/2)			Else				Set RiseAmt to (Kick/xCalKickLoop)			EndIF			set fRise to ((getrandompercent - 50)/100)*RiseAmt 			set fAngle to player.getangle z - fRise			player.setangle z fAngle			set KickloopCounter to (KickloopCounter + 1)			GoTo 1		EndIF	EndIF	set AmmoCount to player.getitemcount rAmmoTypeEndIFEND

User avatar
Damned_Queen
 
Posts: 3425
Joined: Fri Apr 20, 2007 5:18 pm

Post » Fri May 13, 2011 6:05 am

Probably just a quirk in the loading/unloading code in the engine. It's utterly unreliable.
User avatar
Lauren Graves
 
Posts: 3343
Joined: Fri Aug 04, 2006 6:03 pm

Post » Fri May 13, 2011 3:42 pm

Something different, definitely. I've got a quest script (gamemode block) running to help me debug a mod. It checks to see if the player's inventory count of a given item changes, and if it does, posts a message to the screen showing the new item count. Upon first starting the game, the item count quest variable is uninitialized and therefor zero, so you'll get messaged if you have more than zero of the item in your inventory to start with. If you save, then manually load that save, the message doesn't pop up, since both the quest variable value and item count are loaded from the last save, where they were equal.

The weirdness is that when I first start fallout, the message pops up upon loading a save. Also, if I die, the message pops up as soon as I'm dead, but not when the save is autoloaded. It's like the quest script gets reset as soon as I die, but keeps running until the save is loaded.
User avatar
Sxc-Mary
 
Posts: 3536
Joined: Wed Aug 23, 2006 12:53 pm

Post » Fri May 13, 2011 3:16 pm

After a death and reset, the quest variable remain frozen at their last values and the effect loop is not executed.

What am I missing?

Long shot, but perhaps the quest is still trying to check equipped and ammo counts during the microseconds (during respawn/reload) that he doesn't actually exist or have any equipment, causing the script break. Maybe surrounding the whole of what you have in a 'if player.GetDead !=1', and add a 'if GetDead is true' section where you set all your variables to null 0. Then add in another part to manually recheck player counts (1st time only) after respawning/reloading is complete and re-enable the main detections.
User avatar
Nathan Risch
 
Posts: 3313
Joined: Sun Aug 05, 2007 10:15 pm

Post » Fri May 13, 2011 6:50 pm

I don't see anything that sets rCurrentGun back to zero when something other than a small gun is equipped, so you'd stop entering the loop permanently as soon as you equipped a laser or big gun or whatever.
User avatar
Heather M
 
Posts: 3487
Joined: Mon Aug 27, 2007 5:40 am

Post » Fri May 13, 2011 3:29 pm

The rCurrentGun == 0 condition is only required first time the script is run to get you into the loop, but I think you might be right about the smallgun skill check. The code was pretty fluid before I ran out of ideas and posted here.

With regret, I decided to abandon this approach and go with a more traditional equipment token to control the process.

Some mysteries were just meant to be mysteries I guess.
User avatar
Annick Charron
 
Posts: 3367
Joined: Fri Dec 29, 2006 3:03 pm


Return to Fallout 3

cron