Editing CompanionsRadiantQuest script

Post » Wed Jun 20, 2012 5:23 am

So, I'm trying to edit the CompanionsRadiantQuest script to give higher quest rewards for Companions Radiant Quests, but unfortunately, the CRQ script is one of the scripts that the CK requires I open in an external editor, meaning it won't automatically compile as a .pex file, which I need to run this mod.

How can I compile my edited .psc file with the script I want into a .pex file, so this mod will work? Are there any external tools I need to download?
User avatar
Eliza Potter
 
Posts: 3481
Joined: Mon Mar 05, 2007 3:20 am

Post » Wed Jun 20, 2012 4:09 am

There's help for choosing and setting up an external editor on the main http://www.creationkit.com/Category:Papyrus wiki page. Look at the r.h.s.
Notepad++ seems to be the most popular.
User avatar
Stephy Beck
 
Posts: 3492
Joined: Mon Apr 16, 2007 12:33 pm

Post » Tue Jun 19, 2012 3:59 pm

In the Papyrus Scripts window, you can right click on any script and compile.
No external tools are needed.

Though Notepad++ is GREAT for the actual editing.
This page:
http://www.creationkit.com/Notepad%2B%2B_Setup
Contains files to add syntax highlighting and autocomplete.
It also contains instructions for compiling in Notepad++, if you wish to do so.
User avatar
jess hughes
 
Posts: 3382
Joined: Tue Oct 24, 2006 8:10 pm

Post » Tue Jun 19, 2012 4:33 pm

Alright, that was very helpful - I compiled my modified CompanionsRadiantQuest script into a .pex, but it seems that Skyrim refuses to run it. I always get 100 gold for radiant quests, when my script should reward 300-500 gold depending on level.

Here is the original - compare all references to the property "RewardAmount":
Spoiler
Scriptname CompanionsRadiantQuest extends Quest Conditional
Quest Property ParentQuest auto
ReferenceAlias Property Questgiver auto
ReferenceAlias Property MapMarker auto
bool Property IsRegistered = false auto
bool Property QuestgiverComesAlong = false auto conditional
bool Property IsActive = false auto conditional
bool Property IsAccepted = false auto conditional
bool Property WasRejected = false auto conditional
int Property RewardAmount = 100 auto
bool Property Succeeded = false auto
bool Property Premature = false auto

; called when quest is first setup, but before player has accepted it
Function Setup()
; default properties are supposed to handle most of these, but just in case....
; IsRegistered = false
; QuestgiverComesAlong = false
; IsActive = false
; IsAccepted = false
; WasRejected = false
; Succeeded = false
; Premature = false
int level = Game.GetPlayer().GetLevel()
if (level < 10)
RewardAmount = 100
elseif (level < 20)
RewardAmount = 150
elseif (level < 20)
RewardAmount = 200
elseif (level < 20)
RewardAmount = 250
else
RewardAmount = 300
endif
(ParentQuest as CompanionsHousekeepingScript).RegisterRadiantQuest(self)
SetStage(1)
EndFunction
; called when player accepts quest
Function Accepted()
; Debug.Trace("CRQ: Accepting " + self + ".")
(ParentQuest as CompanionsHousekeepingScript).AcceptRadiantQuest(Questgiver.GetActorReference(), QuestgiverComesAlong)
if ( (MapMarker != None) && (MapMarker.GetReference() != None) )
MapMarker.GetReference().AddToMap()
endif
IsAccepted = True
SetStage(10)
EndFunction
; when player turns down the quest
Function Rejected()
; Debug.Trace("CRQ: Rejecting " + self + ".")
WasRejected = True
EndFunction
; when player has finished quest, but not yet collected reward
Function Finished(bool _succeeded = true, bool _finished = true)
; Debug.Trace("CRQ: Finishing " + self + "; succeeded? " + _succeeded)
Succeeded = _succeeded
(ParentQuest as CompanionsHousekeepingScript).RadiantQuestFinished = _finished
EndFunction
; when the quest is shutting down
Function Cleanup()
if (!Premature)
(ParentQuest as CompanionsHousekeepingScript).CompleteRadiantQuest(self)
endif
EndFunction
; for when the player kills someone before they accepted the quest, etc
Function PrematureShutdown()
; Debug.Trace("CRQ: Shutting down " + self + "prematurely...")
IsAccepted = false
Premature = true
(ParentQuest as CompanionsHousekeepingScript).CycleRadiantQuests()
Cleanup()
EndFunction

Here is my modified quest script:

Spoiler
Scriptname CompanionsRadiantQuest extends Quest Conditional
Quest Property ParentQuest auto
ReferenceAlias Property Questgiver auto
ReferenceAlias Property MapMarker auto
bool Property IsRegistered = false auto
bool Property QuestgiverComesAlong = false auto conditional
bool Property IsActive = false auto conditional
bool Property IsAccepted = false auto conditional
bool Property WasRejected = false auto conditional
int Property RewardAmount = 300 auto
bool Property Succeeded = false auto
bool Property Premature = false auto

; called when quest is first setup, but before player has accepted it
Function Setup()
; default properties are supposed to handle most of these, but just in case....
; IsRegistered = false
; QuestgiverComesAlong = false
; IsActive = false
; IsAccepted = false
; WasRejected = false
; Succeeded = false
; Premature = false
int level = Game.GetPlayer().GetLevel()
if (level < 10)
RewardAmount = 300
elseif (level < 20)
RewardAmount = 350
elseif (level < 30)
RewardAmount = 400
elseif (level < 40)
RewardAmount = 450
else
RewardAmount = 500
endif
(ParentQuest as CompanionsHousekeepingScript).RegisterRadiantQuest(self)
SetStage(1)
EndFunction
; called when player accepts quest
Function Accepted()
; Debug.Trace("CRQ: Accepting " + self + ".")
(ParentQuest as CompanionsHousekeepingScript).AcceptRadiantQuest(Questgiver.GetActorReference(), QuestgiverComesAlong)
if ( (MapMarker != None) && (MapMarker.GetReference() != None) )
MapMarker.GetReference().AddToMap()
endif
IsAccepted = True
SetStage(10)
EndFunction
; when player turns down the quest
Function Rejected()
; Debug.Trace("CRQ: Rejecting " + self + ".")
WasRejected = True
EndFunction
; when player has finished quest, but not yet collected reward
Function Finished(bool _succeeded = true, bool _finished = true)
; Debug.Trace("CRQ: Finishing " + self + "; succeeded? " + _succeeded)
Succeeded = _succeeded
(ParentQuest as CompanionsHousekeepingScript).RadiantQuestFinished = _finished
EndFunction
; when the quest is shutting down
Function Cleanup()
if (!Premature)
(ParentQuest as CompanionsHousekeepingScript).CompleteRadiantQuest(self)
endif
EndFunction
; for when the player kills someone before they accepted the quest, etc
Function PrematureShutdown()
; Debug.Trace("CRQ: Shutting down " + self + "prematurely...")
IsAccepted = false
Premature = true
(ParentQuest as CompanionsHousekeepingScript).CycleRadiantQuests()
Cleanup()
EndFunction

I've tried loading games well before I've even met the companions outside of Whiterun, but to no avail. If I can get the script to run, I think I'll be good to go - it may seem like a simple mod, but the second part to this mod will be to add Leveled item rewards to Companion quests, and I have that script already written from another mod.

I really appreciate the help - those who will help me figure this out will be included in the credits for this mod for scripting assistance when it's released.
User avatar
IsAiah AkA figgy
 
Posts: 3398
Joined: Tue Oct 09, 2007 7:43 am

Post » Tue Jun 19, 2012 11:03 pm

Hmm, I'll need to have a look at the quests myself to see how they are organised ...
Meanwhile, just in-case, try from a completely new game (use console commands to advance quickly through the questline).

Edit: Had a look. I'd say definitely try starting a new game.
User avatar
YO MAma
 
Posts: 3321
Joined: Thu Dec 21, 2006 8:24 am

Post » Wed Jun 20, 2012 2:45 am

That definitely worked - is there any way to force the script to load for an already started game? I would like to use this mod for personal use, as well as release it, and having to start a new game just to increase quest rewards is a major downside.

Thanks for helping :).
User avatar
Ross Thomas
 
Posts: 3371
Joined: Sat Jul 21, 2007 12:06 am

Post » Tue Jun 19, 2012 6:57 pm

Well, the problem I think is that the Setup() function (where the rewards are set) is only run once, when the quest is first initialized, not each time the player starts it?
The script itself loads, I would think, it's just that the function is not called again.

So if you put the functionality somewhere else ... perhaps ... is there a function that is run every time the quest starts? I again do not have the script in front of me, but there should be something, because isn't there a "cleanup" function?

I can have a look at it later today, see if I find something. Or you might be able to in the meantime.
User avatar
le GraiN
 
Posts: 3436
Joined: Thu Mar 22, 2007 6:48 pm


Return to V - Skyrim