Jump to content

Recommended Posts

Posted

Here is the script, I'll edit it later to make it easier to understand, I'm exhausted and hoping someone can tell me where I went wrong by the time I wake up.

Scriptname patTGRQuestScript extends Quest

GlobalVariable Property patTGTotalPoints Auto Conditional
GlobalVariable Property patLocksPickedGlobal Auto Conditional
GlobalVariable Property patItemsPickedGlobal Auto Conditional
GlobalVariable Property patItemsStolenGlobal Auto Conditional
GlobalVariable Property patRadiantJobsGlobal Auto Conditional
GlobalVariable Property TGRMasterTotal Auto Conditional
GlobalVariable Property TGStatusCount Auto Conditional
GlobalVariable Property patRewardGlobal00 Auto Conditional
GlobalVariable Property patRewardGlobal01 Auto Conditional
GlobalVariable Property patRewardGlobal02 Auto Conditional
GlobalVariable Property patRewardGlobal03 Auto Conditional
GlobalVariable Property patRewardGlobal04 Auto Conditional
GlobalVariable Property patRewardGlobal05 Auto Conditional
GlobalVariable Property patRewardGlobal06 Auto Conditional
GlobalVariable Property patRewardGlobal07 Auto Conditional
GlobalVariable Property patRewardGlobal08A Auto Conditional
GlobalVariable Property patRewardGlobal08B Auto Conditional
GlobalVariable Property patRewardGlobal09 Auto Conditional
Quest Property TG00 Auto Conditional
Quest Property TG01 Auto Conditional
Quest Property TG02 Auto Conditional
Quest Property TG03 Auto Conditional
Quest Property TG04 Auto Conditional
Quest Property TG05 Auto Conditional
Quest Property TG06 Auto Conditional
Quest Property TG07 Auto Conditional
Quest Property TG08A Auto Conditional
Quest Property TG08B Auto Conditional
Quest Property TG09 Auto Conditional
ObjectReference Property patStatusStage001  Auto  Conditional
ObjectReference Property patStatusStage002  Auto  Conditional
ObjectReference Property patStatusStage003  Auto  Conditional
ObjectReference Property patStatusStage004  Auto  Conditional
ObjectReference Property patStatusStage005  Auto  Conditional
ObjectReference Property patStatusStage006  Auto  Conditional
ObjectReference Property patStatusStage007  Auto  Conditional
ObjectReference Property patStatusStage008  Auto  Conditional
ObjectReference Property patStatusStage009  Auto  Conditional
ObjectReference Property patStatusStage010  Auto  Conditional
ObjectReference Property patStatusStageHoneyside  Auto  Conditional
Cell Property RiftenHoneyside Auto
Faction Property PlayerFaction Auto
Location Property RiftenRaggedFlagonLocation Auto
Location Property RiftenThievesGuildHeadquartersLocation Auto


Event OnPlayerLoadGame()
	RegisterForUpdateGameTime(1.0)
EndEvent
				
				
Event OnUpdateGameTime()
if (RiftenHoneyside.GetFactionOwner() == PlayerFaction) &&  (patTGTotalPoints.GetValueInt() >= 1500)
	patStatusStageHoneyside.Enable()
endif



	Float LocksPicked = (Game.QueryStat("Locks Picked"))
		if LocksPicked > (patLocksPickedGlobal.GetValueInt())

			int LocksPickedGlobal = (patLocksPickedGlobal.GetValueInt())	;assign the new value for the global
			patLocksPickedGlobal.SetValueInt(LocksPickedGlobal + 1) 			;apply the new global value
				if TG08B.IsCompleted()
					int patTGCurrent = (patTGTotalPoints.GetValueInt())	
					patTGTotalPoints.SetValueInt(patTGCurrent + 6)	
				else
					int patTGCurrent = (patTGTotalPoints.GetValueInt())
					patTGTotalPoints.SetValueInt(patTGCurrent + 3)	
				endif
		endif
	Float ItemsPicked = (Game.QueryStat("Items Pickpocketed"))
		if ItemsPicked > (patItemsPickedGlobal.GetValueInt())
			int ItemsPickedGlobal = (patItemsPickedGlobal.GetValueInt())	;assign the new value for the global
			patItemsPickedGlobal.SetValueInt(ItemsPickedGlobal + 1) 			;apply the new global value
			if TG08B.IsCompleted()
					int patTGCurrent = (patTGTotalPoints.GetValueInt())	
					patTGTotalPoints.SetValueInt(patTGCurrent + 12)	
				else
					int patTGCurrent = (patTGTotalPoints.GetValueInt())
					patTGTotalPoints.SetValueInt(patTGCurrent + 6)	
				endif
		endif
	Float ItemsStolen = (Game.QueryStat("Items Stolen"))
		if ItemsStolen > (patItemsStolenGlobal.GetValueInt())
			int ItemsStolenGlobal = (patItemsStolenGlobal.GetValueInt())	;assign the new value for the global
			patItemsStolenGlobal.SetValueInt(ItemsStolenGlobal + 1) 			;apply the new global value
			if TG08B.IsCompleted()
					int patTGCurrent = (patTGTotalPoints.GetValueInt())	
					patTGTotalPoints.SetValueInt(patTGCurrent + 2)	
				else
					int patTGCurrent = (patTGTotalPoints.GetValueInt())
					patTGTotalPoints.SetValueInt(patTGCurrent + 1)	
				endif
		endif
	float RadiantJobs = TGRMasterTotal.GetValue()
		if RadiantJobs > (patRadiantJobsGlobal.GetValueInt())
			int RadiantJobsGlobal = (patRadiantJobsGlobal.GetValueInt())	;assign the new value for the global
			patRadiantJobsGlobal.SetValueInt(RadiantJobsGlobal + 1) 			;apply the new global value
			if TG08B.IsCompleted()
					int patTGCurrent = (patTGTotalPoints.GetValueInt())	
					patTGTotalPoints.SetValueInt(patTGCurrent + 24)	
				else
					int patTGCurrent = (patTGTotalPoints.GetValueInt())
					patTGTotalPoints.SetValueInt(patTGCurrent + 12)	
				endif
		endif
		
		
	if (TG00.IsCompleted()) && (patRewardGlobal00.GetValueInt() == 0)
			int patTGCurrent = (patTGTotalPoints.GetValueInt())
			patTGTotalPoints.SetValueInt(patTGCurrent + 65)
			patRewardGlobal00.SetValueInt(1)				
	endIf
	if (TG01.IsCompleted()) && (patRewardGlobal01.GetValueInt() == 0)
			int patTGCurrent = (patTGTotalPoints.GetValueInt())
			patTGTotalPoints.SetValueInt(patTGCurrent + 65)
			patRewardGlobal01.SetValueInt(1)				
	endIf
	if (TG02.IsCompleted()) && (patRewardGlobal02.GetValueInt() == 0)
			int patTGCurrent = (patTGTotalPoints.GetValueInt())
			patTGTotalPoints.SetValueInt(patTGCurrent + 65)
			patRewardGlobal02.SetValueInt(1)				
	endIf
	if (TG03.IsCompleted()) && (patRewardGlobal03.GetValueInt() == 0)
			int patTGCurrent = (patTGTotalPoints.GetValueInt())
			patTGTotalPoints.SetValueInt(patTGCurrent + 65)
			patRewardGlobal03.SetValueInt(1)				
	endIf
	if (TG04.IsCompleted()) && (patRewardGlobal04.GetValueInt() == 0)
			int patTGCurrent = (patTGTotalPoints.GetValueInt())
			patTGTotalPoints.SetValueInt(patTGCurrent + 65)
			patRewardGlobal04.SetValueInt(1)				
	endIf
	if (TG05.IsCompleted()) && (patRewardGlobal05.GetValueInt() == 0)
			int patTGCurrent = (patTGTotalPoints.GetValueInt())
			patTGTotalPoints.SetValueInt(patTGCurrent + 65)
			patRewardGlobal05.SetValueInt(1)				
	endIf
	if (TG06.IsCompleted()) && (patRewardGlobal06.GetValueInt() == 0)
			int patTGCurrent = (patTGTotalPoints.GetValueInt())
			patTGTotalPoints.SetValueInt(patTGCurrent + 65)
			patRewardGlobal06.SetValueInt(1)				
	endIf
	if (TG07.IsCompleted()) && (patRewardGlobal07.GetValueInt() == 0)
			int patTGCurrent = (patTGTotalPoints.GetValueInt())
			patTGTotalPoints.SetValueInt(patTGCurrent + 65)
			patRewardGlobal07.SetValueInt(1)				
	endIf
	if (TG08A.IsCompleted()) && (patRewardGlobal08A.GetValueInt() == 0)
			int patTGCurrent = (patTGTotalPoints.GetValueInt())
			patTGTotalPoints.SetValueInt(patTGCurrent + 65)
			patRewardGlobal08A.SetValueInt(1)				
	endIf
	if (TG08B.IsCompleted()) && (patRewardGlobal08B.GetValueInt() == 0)
			int patTGCurrent = (patTGTotalPoints.GetValueInt())
			patTGTotalPoints.SetValueInt(patTGCurrent + 130)
			patRewardGlobal08B.SetValueInt(1)				
	endIf
	if (TG09.IsCompleted()) && (patRewardGlobal09.GetValueInt() == 0)
			int patTGCurrent = (patTGTotalPoints.GetValueInt())
			patTGTotalPoints.SetValueInt(patTGCurrent + 130)
			patRewardGlobal09.SetValueInt(1)				
	endIf
if Game.Getplayer().IsInLocation(RiftenRaggedFlagonLocation) != 1 && Game.Getplayer().IsInLocation(RiftenThievesGuildHeadquartersLocation) != 1 
IF patTGTotalPoints.GetValueInt() >= 300
	patStatusStage001.Enable()
Endif
IF patTGTotalPoints.GetValueInt() >= 600
	patStatusStage002.Enable()
Endif
IF patTGTotalPoints.GetValueInt() >= 900
	patStatusStage003.Enable()
Endif
IF patTGTotalPoints.GetValueInt() >= 1200
	patStatusStage004.Enable()
Endif
IF patTGTotalPoints.GetValueInt() >= 1500
	patStatusStage005.Enable()
Endif
IF patTGTotalPoints.GetValueInt() >= 1800
	patStatusStage006.Enable()
Endif
IF patTGTotalPoints.GetValueInt() >= 2100
	patStatusStage007.Enable()
Endif
IF patTGTotalPoints.GetValueInt() >= 2400
	patStatusStage008.Enable()
Endif
IF patTGTotalPoints.GetValueInt() >= 2700
	patStatusStage009.Enable()
Endif
IF patTGTotalPoints.GetValueInt() >= 3000
	patStatusStage010.Enable()
Endif
endif
endEvent
Posted (edited)

OnPlayerLoadGame() only fires on scripts attached to the player (which should be done through a player alias). This script is listed as extends Quest. It will compile because Papyrus reads your addition of OnPlayerLoadGame() as a declaration of a new function (with the same name as the one you're trying to use, but because they're in separate scopes it doesn't matter), but because nothing calls that function, the first update is never registered for, and so the whole script chokes.

 

The simplest fix is to add the player to an alias in this quest and add a very short script to it:

Scriptname patTGRPlayerAliasScript extends ReferenceAlias

Event OnPlayerLoadGame()
    (GetOwningQuest() as patTGRQuestScript).OnPlayerLoadGame()
EndEvent

This will pass along the load-game trigger from the thing that receives it to the quest that's trying to listen for it.

 

Note: This will not fire the first time a game is loaded with the mod, because, at that time, the quest (and alias) didn't exist and so can't receive the event. To catch the very first load after installation, you want to use OnInit().

Edited by foamyesque
Posted

As foamyesque already wrote, OnInit() is the clue.

By using arrays the script will be more comfortable.

 

patTGRQuestScript

  Reveal hidden contents

 

  • Recently Browsing   0 members

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