The Nexus Forums: dbattackScript assistance - The Nexus Forums

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

dbattackScript assistance One more playerLevel clause breaks it!

#1 User is offline   bobtb 

  • Stranger
  • Pip
  • Group: Members
  • Posts: 1
  • Joined: 10-August 08

Posted 29 August 2008 - 09:26 PM

I'm a new scripter learning some basics by merging a couple mods I have. Both of them edit the dark brotherhood attack script.

I've taken the script to pieces and tested it as I added things back. All is well until I add the code block I've commented out below, which makes the script not respond ingame -- none of the messageboxes show up, nor any assassins when conditions say they should. ScriptRunning tells me the script is active.

I'm well within lines-of-code, number-of-character and If-Else total/nesting limitations, according to the Scripting for Dummies guide.

Could someone with more experience let me know what I'm doing wrong here?

Begin dbattackScript

Float dbChance
Short journalOnce
Short attackOnce
Short playerLevel
Short attackmod
Short othermod
Short dbnumber
Short temp
Short sleepOnce
Short playerNoticed

If ( GetJournalIndex TR_dbAttack >= 50 ) ;kill script based on storyline
	StopScript dbattackScript
	Return
EndIf

If ( GetPCSleep == 1 ) ;only check for assasins when sleeping

	If ( sleepOnce == 1 ) ;only check once per sleep-cycle
		Return
	EndIf

	Set sleepOnce To 1

	MessageBox "Debug: In Sleeping Script"

	If ( GetPCCell "Seyda Neen, Census and Excise Office" == 1 );
		Return
	EndIf

	Set playerNoticed To 0

;player comes to the attention of the DB based on progress in these quests
	If ( GetJournalIndex B1_UnifyUrshilaku >= 50 )
		Set playerNoticed To 1
	ElseIf ( GetJournalIndex B2_AhemmusaSafe >= 50 )
		Set playerNoticed To 1
	ElseIf ( GetJournalIndex B3_ZainabBride >= 50 )
		Set playerNoticed To 1
	ElseIf ( GetJournalIndex B4_KillWarLovers >= 50 )
		Set playerNoticed To 1
	ElseIf ( GetJournalIndex B5_RedoranHort >= 50 )
		Set playerNoticed To 1
	ElseIf ( GetJournalIndex B6_HlaaluHort >= 50 )
		Set playerNoticed To 1
	ElseIf ( GetJournalIndex B7_TelvanniHort >= 50 )
		Set playerNoticed To 1
	ElseIf ( GetJournalIndex HH_WinCamonna >= 100 )
		Set playerNoticed To 1
	ElseIf ( GetJournalIndex HR_Archmaster >= 100 )
		Set playerNoticed To 1
	ElseIf ( GetJournalIndex HT_Archmagister >= 100 )
		Set playerNoticed To 1
	ElseIf ( GetJournalIndex C3_DestroyDagoth >= 50 )
		Set playerNoticed To 1
	ElseIf ( GetJournalIndex TG_KillHardHeart >= 100 )
		Set playerNoticed To 1
	ElseIf ( GetJournalIndex FG_KillHardHeart >= 100 )
		Set playerNoticed To 1
	ElseIf ( GetJournalIndex MG_Guildmaster >= 100 )
		Set playerNoticed To 1
	EndIf

	If ( playerNoticed == 1 )

		MessageBox "Debug: playerNoticed is %G", playerNoticed

		If ( player->GetLevel >= 30 ) ;determines strength of attacking assassins
			Set playerLevel To 5
		ElseIf ( player->GetLevel >= 20 )
			Set playerLevel To 4
		ElseIf ( player->GetLevel >= 10 )
			Set playerLevel To 3
		ElseIf ( player->GetLevel >= 4 )
			Set playerLevel To 2
		Else
			Set playerLevel To 1
		EndIf

		MessageBox "Debug: playerLevel is %G", playerLevel
	
		If ( journalOnce == 1 )
			;Journal TR_DBAttack 10
			Set journalOnce To -1
		EndIf
	
		Set dbChance To Random 100
		Set attackmod To ( attackonce * 10 )

		MessageBox  "Debug: dbChance = %G", dbChance


;		If ( playerLevel >= 5 )
;			Set othermod To ( 90 - attackmod ) ;90% chance of attack
;	
;			If ( dbChance <= othermod )
;				WakeUpPC
;				MessageBox "A sudden premonition jars you from your slumber."
;				Set dbnumber To ( dbnumber + 1 )
;
;				If ( dbnumber > 2 )
;					Set dbnumber To 2
;				EndIf
;
;				Set temp To dbnumber
;
;				While ( temp > 0 )
;					PlaceAtPC "db_assassin4" 1 128 1
;					Set temp To ( temp - 1 )
;				EndWhile
;
;				Set attackonce To ( attackonce + 1 )
;
;				If ( journalOnce == -1 )
;					Return
;				EndIf
;
;				Set journalOnce To 1
;				Set DBAttack To 1
;			EndIf
;	Else

		If ( playerLevel >= 4 )
			Set othermod To ( 70 - attackmod )

			If ( dbChance <= othermod )
				WakeUpPC
				MessageBox "A sudden premonition jars you from your slumber."
				Set dbnumber To ( dbnumber + 1 )

				If ( dbnumber > 2 )
					Set dbnumber To 2
				EndIf

				Set temp To dbnumber

				While ( temp > 0 )
					PlaceAtPC "db_assassin3" 1 128 1
					Set temp To ( temp - 1 )
				EndWhile

				Set attackonce To ( attackonce + 1 )

				If ( journalOnce == -1 )
					Return
				EndIf

				Set journalOnce To 1
				Set DBAttack To 1
			EndIf

		ElseIf ( playerLevel >= 3 )
			Set othermod To ( 50 - attackmod )

			If ( dbChance <= othermod )
				WakeUpPC
				MessageBox "A sudden premonition jars you from your slumber."
				PlaceAtPC "db_assassin2" 1 128 1
				Set attackonce To ( attackonce + 1 )

				If ( journalOnce == -1 )
					Return
				EndIf

				Set journalOnce To 1
				Set DBAttack To 1
			EndIf

		ElseIf ( playerLevel >= 2 )
			Set othermod To ( 40 - attackmod )

			If ( dbChance <= othermod )
				WakeUpPC
				MessageBox "A sudden premonition jars you from your slumber."
				PlaceAtPC "db_assassin1" 1 128 1
				Set attackonce To ( attackonce + 1 )

				If ( journalOnce == -1 )
					Return
				EndIf

				Set journalOnce To 1
				Set DBAttack To 1
			EndIf

		Else ;playerLevel is 1
			Set othermod To ( 20 - attackmod )

			If ( dbChance <= othermod )
				WakeUpPC
				MessageBox "A sudden premonition jars you from your slumber."
				PlaceAtPC "db_assassin1b" 1 128 1
				Set attackonce To ( attackonce + 1 )

				If ( journalOnce == -1 )
					Return
				EndIf

				Set journalOnce To 1
				Set DBAttack To 1
			EndIf

		EndIf

	Else
		MessageBox "Debug: playerNoticed is %G", playerNoticed

	EndIf

Else
	Set sleepOnce To 0
EndIf

End

0

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users


Skin by Skinbox
Quality & cheap IPB skins, premade vBulletin styles, cheap Web templates and more! - Skinbox