Quick Questions, Quick Answers Thread #7

Post » Sun Nov 18, 2012 11:36 pm

I'd guess you'd need to use Game.GetPlayer().AddItem(Alias_Book.GetRef())...although if you're using "Create In" and Player, I'm not sure why it wouldn't be there already? (Granted I haven't used "Create In" much.)

Oh wow, thanks DK - that worked perfectly
User avatar
Chris Jones
 
Posts: 3435
Joined: Wed May 09, 2007 3:11 am

Post » Sun Nov 18, 2012 9:18 pm

The summoned end of the portal is made up of 3 parts (some FX art, Xmarkerheading, and an activator) These three parts are initially in a "holding cell". I made a new package and it is using the package template "Activate". Under public package data it wants a target so I use the specific reference option and select the portals' activator inside that holding cell. I have 2 conditions at the moment: GetStage to see if the player has talked to the actor about the spell, and a GetDistance referencing the FX art (I should be able to use either of the 3 parts of the portal) < 2000. As for the schedule...I put a duration of 1 hour with everything else being "Any", not really sure what to do with this tab.

Any insight would be appreciated, this is my first foray into packages and eventually scenes.

Don't bother putting a duration on the package, it does not need one. Leave the schedule as it is, the schedule is only needed for a package that contains regular tasks. If this package is a once off behavior just advance the quest stage when the package completes using OnPackageEnd or OnPackageChange on a script attached to the alias.

What does your actor do when he should activate the portal?
User avatar
Makenna Nomad
 
Posts: 3391
Joined: Tue Aug 29, 2006 10:05 pm

Post » Mon Nov 19, 2012 3:21 am

I'd guess you'd need to use Game.GetPlayer().AddItem(Alias_Book.GetRef())...although if you're using "Create In" and Player, I'm not sure why it wouldn't be there already? (Granted I haven't used "Create In" much.)
Just a note, I'd always recommend http://www.creationkit.com/GetReference_-_ReferenceAlias over http://www.creationkit.com/GetRef_-_ReferenceAlias. If you take a look inside ReferenceAlias.psc you'll see why:
Spoiler
; Get the object reference this alias refers toObjectReference Function GetReference() native; ...; Convenience functionObjectReference Function GetRef()	return GetReference()endFunction
Basically, both of these functions do exactly the same thing, but GetRef involves the extra unnecessary overhead of an extra function call.

Cipscis
User avatar
Chris Duncan
 
Posts: 3471
Joined: Sun Jun 24, 2007 2:31 am

Post » Mon Nov 19, 2012 5:32 am

With how poorly this new system runs for time sensitive scripting why would they even make such "extra steps"?

The vanilla shield charge is listed on various Skyrim sties as known to give DELAYED results (the actor gets knocked to the ground a little while after the collision) so it is not like they themselves were not effected by script lag. It seems to me they would not have wanted a "convenience" like theses to add the the problem.

Maybe they did just did not know how bad the lag would be in the beginning when this was programmed?


Just a note, I'd always recommend http://www.creationkit.com/GetReference_-_ReferenceAlias over http://www.creationkit.com/GetRef_-_ReferenceAlias. If you take a look inside ReferenceAlias.psc you'll see why:
Spoiler
; Get the object reference this alias refers toObjectReference Function GetReference() native; ...; Convenience functionObjectReference Function GetRef()	return GetReference()endFunction
Basically, both of these functions do exactly the same thing, but GetRef involves the extra unnecessary overhead of an extra function call.

Cipscis
User avatar
Theodore Walling
 
Posts: 3420
Joined: Sat Jun 02, 2007 12:48 pm

Post » Mon Nov 19, 2012 12:05 pm

http://www.creationkit.com/GetRef_-_ReferenceAlias is just the tip of the iceberg too. Many other convenience functions also add little to the script but add the extra overhead of an additional function call. They usually save a few keypresses, such as those involved in a longer function name or a cast. Some examples include http://www.creationkit.com/GetActorReference_-_ReferenceAlias, http://www.creationkit.com/GetActorRef_-_ReferenceAlias, http://www.creationkit.com/GetValueInt_-_GlobalVariable, and http://www.creationkit.com/GetActorBase_-_Actor.

GetRef alone is used 1596 times in 351 different vanilla scripts. All of these instances could be replaced with GetReference for no cost yet some gain.

Another problem is the difference between http://www.creationkit.com/GetPlayer_-_Game and either getting the value once and storing it or, even better, using an auto property pointing to the player. This function is used 4515 times in 2039 vanilla scripts. Despite the fact that this value never changes, one script (PlayerWerewolfChangeScript) calls this function 69 times!

Other functions, such as http://www.creationkit.com/GetBaseObject_-_ObjectReference, can also be called only once per script per object yet are often called multiple times per object in both vanilla and mod scripts.

On top of all of this, the output of the compiler can be further improved. I've taken to manipulating my scripts at the assembly level (scripts run through the compiler to convert Papyrus (*.psc files) to http://skyrim.nexusmods.com/mods/24009 (*.pas files), then through the assembler to produce compiled scripts (*.pex files)) at the moment, mainly to familiarise myself with the assembly language.

In a recent script, I was able to remove half of the "temp" local variables created by the compiler, and over a quarter of the instructions. I've also tested some of these optimisations with JustinOther's and my http://skyrim.nexusmods.com/mods/23782 and confirmed that this does make a measurable difference.

I hope to create utility to automate this process of optimising the assembly file so it can be done just as easily as compiling scripts normally. That would allow modders to produce slightly more efficient scripts at no cost to themselves after the initial setup and absolutely no cost to the end user.

Cipscis

EDIT:

It'd probably be best if we continue this discussion in the http://www.gamesas.com/topic/1409991-best-practices-papyrus/ thread I've started, so as not to derail this thread.

Cipscis
User avatar
ONLY ME!!!!
 
Posts: 3479
Joined: Tue Aug 28, 2007 12:16 pm

Post » Mon Nov 19, 2012 12:11 am

Don't bother putting a duration on the package, it does not need one. Leave the schedule as it is, the schedule is only needed for a package that contains regular tasks. If this package is a once off behavior just advance the quest stage when the package completes using OnPackageEnd or OnPackageChange on a script attached to the alias. What does your actor do when he should activate the portal?

Got rid of the duration and when the portal is summoned he just stands there doesn't move at all (there is navmesh, hes about a two second walk away from the Whiterun gate). I noticed an error when opening the esp today: Quest owned package 'rayPackageDariusUsePortal' is invalid for NPC_Form 'rayDariusReklin' After looking at that I figured the conditions could be causing some issues. The GetStage condition was running on the Subject and the GetDistance condition ran on the Target. I changed the GetStage to run on the Player and that seems to get rid of that error but I do not see a change in his behavior around the portal. I should note he does not have any other packages on him. Also does anyone know the equivalent of feet/meters in "units".
User avatar
zoe
 
Posts: 3298
Joined: Sun Nov 12, 2006 1:09 pm

Post » Sun Nov 18, 2012 9:34 pm

Got rid of the duration and when the portal is summoned he just stands there doesn't move at all (there is navmesh, hes about a two second walk away from the Whiterun gate). I noticed an error when opening the esp today: Quest owned package 'rayPackageDariusUsePortal' is invalid for NPC_Form 'rayDariusReklin' After looking at that I figured the conditions could be causing some issues. The GetStage condition was running on the Subject and the GetDistance condition ran on the Target. I changed the GetStage to run on the Player and that seems to get rid of that error but I do not see a change in his behavior around the portal. I should note he does not have any other packages on him. Also does anyone know the equivalent of feet/meters in "units".
Forget about feet/metres ... it makes no sense to think about it. A unit is a unit (and it is SMALL). That said, here's what you want: http://www.creationkit.com/Unit :wink:



So long as you know the portal WILL be close, while testing: REMOVE the distance condition altogether and see if your NPC wanders over to it then.
User avatar
Phoenix Draven
 
Posts: 3443
Joined: Thu Jun 29, 2006 3:50 am

Post » Mon Nov 19, 2012 5:40 am

I have a map resource that retextures the "civil war" skyrim parchment maps. If you don't know what I'm talking about they can be viewed in dragonsreach in the space above and behind the jarl's throne.

What I would like to do is use this resource in my mod without it retexturing every map in the game.

To accomplish this I have extracted the relevant meshes and now I'm having trouble editing the texture path so my mod-added meshes point to the new textures.

How do I get these meshes to point to specific textures? And how do I make sure that it will work regardless of where Skyrim may be installed?

Please assume I know nothing about NifSkope in any explanations.
User avatar
Ridhwan Hemsome
 
Posts: 3501
Joined: Sun May 06, 2007 2:13 pm

Post » Mon Nov 19, 2012 11:56 am

Directly editing the meshes to retexture objects is no longer necessary in Skyrim. All you need to do is add the textures to the game's data files in the form of a Texture Set, duplicate the Civil War Map object, open the Edit Model dialogue for the duplicated object, and assign your Texture Set as its alternate texture.
User avatar
Rebekah Rebekah Nicole
 
Posts: 3477
Joined: Fri Oct 13, 2006 8:47 pm

Post » Mon Nov 19, 2012 9:41 am

Items that can be sold have a "Value" field in their editing windows. You can just change the values there or, with Papyrus, you can use SKSE's http://www.creationkit.com/SetGoldValue_-_Form.

just to go above and beyond JustinOther's answer with a bit of visual help
the fifth field from above, counting from the ID is the value of the item.
http://www.creationkit.com/File:Tutorial-Customizing-2.jpg
the value is the base value, meaning that the value of enchants are added to that.

Ok thanks guys.
User avatar
Haley Cooper
 
Posts: 3490
Joined: Wed Jun 14, 2006 11:30 am

Post » Mon Nov 19, 2012 3:21 am

Directly editing the meshes to retexture objects is no longer necessary in Skyrim. All you need to do is add the textures to the game's data files in the form of a Texture Set, duplicate the Civil War Map object, open the Edit Model dialogue for the duplicated object, and assign your Texture Set as its alternate texture.

Fantastic!

Brilliant!

Thank you!!
User avatar
Solina971
 
Posts: 3421
Joined: Thu Mar 29, 2007 6:40 am

Post » Mon Nov 19, 2012 7:04 am

For the Craft Item SM event, does cooking food count in that? I'd guess it would be, but does anyone know for sure? :)
User avatar
Assumptah George
 
Posts: 3373
Joined: Wed Sep 13, 2006 9:43 am

Post » Mon Nov 19, 2012 2:08 am

I'm trying to make a plot of land purchasable from the steward in Riften, i've added a fragment to the Housepurchase script and made its own script containing that fragment. The text option appears in the steward's dialogue but the gold amount displays as [...] and nothing happens when you choose the option to buy it.

Spoiler
;BEGIN FRAGMENT CODE - Do not edit anything between this and the end comment;NEXT FRAGMENT INDEX 14Scriptname QF_HousePurchase_000A7B33 Extends Quest Hidden;BEGIN ALIAS PROPERTY VMSMarker;ALIAS PROPERTY TYPE ReferenceAliasReferenceAlias Property Alias_VMSMarker Auto;END ALIAS PROPERTY[/b];BEGIN ALIAS PROPERTY WhiterunDoor;ALIAS PROPERTY TYPE ReferenceAliasReferenceAlias Property Alias_WhiterunDoor Auto;END ALIAS PROPERTY;BEGIN ALIAS PROPERTY MarkarthJarl;ALIAS PROPERTY TYPE ReferenceAliasReferenceAlias Property Alias_MarkarthJarl Auto;END ALIAS PROPERTY;BEGIN ALIAS PROPERTY SolitudeFrontDoor;ALIAS PROPERTY TYPE ReferenceAliasReferenceAlias Property Alias_SolitudeFrontDoor Auto;END ALIAS PROPERTY;BEGIN ALIAS PROPERTY WhiterunJarl;ALIAS PROPERTY TYPE ReferenceAliasReferenceAlias Property Alias_WhiterunJarl Auto;END ALIAS PROPERTY;BEGIN ALIAS PROPERTY VMSBench;ALIAS PROPERTY TYPE ReferenceAliasReferenceAlias Property Alias_VMSBench Auto;END ALIAS PROPERTY;BEGIN ALIAS PROPERTY WhiterunSonsJarl;ALIAS PROPERTY TYPE ReferenceAliasReferenceAlias Property Alias_WhiterunSonsJarl Auto;END ALIAS PROPERTY;BEGIN ALIAS PROPERTY RiftenJarl;ALIAS PROPERTY TYPE ReferenceAliasReferenceAlias Property Alias_RiftenJarl Auto;END ALIAS PROPERTY;BEGIN ALIAS PROPERTY MarkarthDoor;ALIAS PROPERTY TYPE ReferenceAliasReferenceAlias Property Alias_MarkarthDoor Auto;END ALIAS PROPERTY;BEGIN ALIAS PROPERTY WindhelmDoor;ALIAS PROPERTY TYPE ReferenceAliasReferenceAlias Property Alias_WindhelmDoor Auto;END ALIAS PROPERTY;BEGIN ALIAS PROPERTY RiftenTamrielDoor;ALIAS PROPERTY TYPE ReferenceAliasReferenceAlias Property Alias_RiftenTamrielDoor Auto;END ALIAS PROPERTY;BEGIN ALIAS PROPERTY WindhelmEmpireJarl;ALIAS PROPERTY TYPE ReferenceAliasReferenceAlias Property Alias_WindhelmEmpireJarl Auto;END ALIAS PROPERTY;BEGIN ALIAS PROPERTY RiftenCityDoor;ALIAS PROPERTY TYPE ReferenceAliasReferenceAlias Property Alias_RiftenCityDoor Auto;END ALIAS PROPERTY;BEGIN ALIAS PROPERTY SolitudeJarl;ALIAS PROPERTY TYPE ReferenceAliasReferenceAlias Property Alias_SolitudeJarl Auto;END ALIAS PROPERTY;BEGIN ALIAS PROPERTY SolitudeSideDoor;ALIAS PROPERTY TYPE ReferenceAliasReferenceAlias Property Alias_SolitudeSideDoor Auto;END ALIAS PROPERTY;BEGIN ALIAS PROPERTY WindhelmJarl;ALIAS PROPERTY TYPE ReferenceAliasReferenceAlias Property Alias_WindhelmJarl Auto;END ALIAS PROPERTY;BEGIN ALIAS PROPERTY RiftenEmpireJarl;ALIAS PROPERTY TYPE ReferenceAliasReferenceAlias Property Alias_RiftenEmpireJarl Auto;END ALIAS PROPERTY;BEGIN ALIAS PROPERTY MarkarthSonsJarl;ALIAS PROPERTY TYPE ReferenceAliasReferenceAlias Property Alias_MarkarthSonsJarl Auto;END ALIAS PROPERTY;BEGIN FRAGMENT Fragment_6Function Fragment_6();BEGIN AUTOCAST TYPE HousePurchaseScriptQuest __temp = self as QuestHousePurchaseScript kmyQuest = __temp as HousePurchaseScript;END AUTOCAST;BEGIN CODEkmyquest.Purchasehouse(markarthhouse, markarthhousekey, markarthguide, kmyquest.HPMarkarth)kmyquest.markarthhousevar=1SetObjectiveDisplayed(40,1)If Favor250.GetStageDone(10)  Favor250.SetStage(15)EndIf;END CODEEndFunction;END FRAGMENT;BEGIN FRAGMENT Fragment_7Function Fragment_7();BEGIN AUTOCAST TYPE HousePurchaseScriptQuest __temp = self as QuestHousePurchaseScript kmyQuest = __temp as HousePurchaseScript;END AUTOCAST;BEGIN CODEkmyquest.Purchasehouse(windhelmhouse, windhelmhousekey, windhelmguide, kmyquest.HPWindhelm)kmyquest.windhelmhousevar=1SetObjectiveDisplayed(50,1)If Favor254.GetStageDone(10)  Favor254.SetStage(15)EndIf;END CODEEndFunction;END FRAGMENT;BEGIN FRAGMENT Fragment_5Function Fragment_5();BEGIN AUTOCAST TYPE HousePurchaseScriptQuest __temp = self as QuestHousePurchaseScript kmyQuest = __temp as HousePurchaseScript;END AUTOCAST;BEGIN CODEkmyquest.Purchasehouse(riftenhouse, riftenhousekey, riftenguide, kmyquest.HPRiften)kmyquest.riftenhousevar=1SetObjectiveDisplayed(30,1)If Favor251.GetStageDone(10)  Favor251.SetStage(15)EndIf;END CODEEndFunction;END FRAGMENT;BEGIN FRAGMENT Fragment_0Function Fragment_0();BEGIN AUTOCAST TYPE HousePurchaseScriptQuest __temp = self as QuestHousePurchaseScript kmyQuest = __temp as HousePurchaseScript;END AUTOCAST;BEGIN CODEkmyquest.Purchasehouse(whiterunhouse, whiterunhousekey, whiterunguide, kmyquest.HPWhiterun)kmyquest.whiterunhousevar=1SetObjectiveDisplayed(10,1)If Favor253.GetStageDone(10)  Favor253.SetStage(15)EndIf;END CODEEndFunction;END FRAGMENT;BEGIN FRAGMENT Fragment_3Function Fragment_3();BEGIN AUTOCAST TYPE HousePurchaseScriptQuest __temp = self as QuestHousePurchaseScript kmyQuest = __temp as HousePurchaseScript;END AUTOCAST;BEGIN CODEkmyquest.Purchasehouse(solitudehouse, solitudehousekey, solitudeguide, kmyquest.HPSolitude)kmyquest.solitudehousevar=1SetObjectiveDisplayed(20,1)If Favor252.GetStageDone(10)  Favor252.SetStage(15)EndIf;END CODEEndFunction;END FRAGMENT;BEGIN FRAGMENT Fragment_13Function Fragment_13();BEGIN AUTOCAST TYPE ViimagstenscriptQuest __temp = self as QuestViimagstenscript kmyQuest = __temp as Viimagstenscript;END AUTOCAST;BEGIN CODEkmyquest.Purchasehouse(VMSMarker, ViimagstenDeed, ViimagstenPlotBuilding, kmyquest.PPViimagsten)kmyquest.ViimagstenPlotvar=1SetObjectiveDisplayed(60,1);END CODEEndFunction;END FRAGMENT;END FRAGMENT CODE - Do not edit anything between this and the begin commentcell Property WhiterunHouse  Auto  key Property WhiterunHouseKey  Auto  cell Property SolitudeHouse  Auto  key Property SolitudeHouseKey  Auto  cell Property RiftenHouse  Auto  key Property RiftenHouseKey  Auto  cell Property MarkarthHouse  Auto  key Property MarkarthHouseKey  Auto  cell Property WindhelmHouse  Auto  key Property WindhelmHouseKey  Auto  Quest Property Favor250  Auto  Quest Property Favor251  Auto  Quest Property Favor252  Auto  Quest Property Favor254  Auto  quest Property Favor253  AutoBook Property WhiterunGuide  Auto  Book Property SolitudeGuide  Auto  Book Property RiftenGuide  Auto  Book Property MarkarthGuide  Auto  Book Property WindhelmGuide  Auto[b]ObjectReference Property VMSMarker  Auto  Book Property ViimagstenPlotBuilding  Auto  Book Property ViimagstenDeed  Auto

Spoiler
Scriptname Viimagstenscript extends Quest  Conditional;Propertiesmiscobject Property Gold  Auto  faction Property PlayerFaction  Auto  int Property ViimagstenPlotVar  Auto  conditionalGlobalVariable Property PPViimagsten  Auto  ObjectReference property PlayerRef Autofunction PurchaseHouse(objectreference VMSMarker, book ViimagstenDeed, book ViimagstenPlotBuilding, globalvariable GoldAmount)	game.getplayer().RemoveItem(Gold, GoldAmount.getvalueint())	game.getplayer().AddItem(ViimagstenDeed)	game.getplayer().AddItem(ViimagstenPlotBuilding)	game.IncrementStat( "Houses Owned" )endfunction
I thought I was getting the hang of scripting but obviously not. I'm pretty sure I have all the text options linked up correctly and the aliases defined. Does it matter the code says DO NOT EDIT? :D
User avatar
Mark Churchman
 
Posts: 3363
Joined: Sun Aug 05, 2007 5:58 am

Post » Mon Nov 19, 2012 1:13 pm

I'm trying to make a plot of land purchasable from the steward in Riften, i've added a fragment to the Housepurchase script and made its own script containing that fragment. The text option appears in the steward's dialogue but the gold amount displays as [...] and nothing happens when you choose the option to buy it.

Spoiler
;BEGIN FRAGMENT CODE - Do not edit anything between this and the end comment;NEXT FRAGMENT INDEX 14Scriptname QF_HousePurchase_000A7B33 Extends Quest Hidden;BEGIN ALIAS PROPERTY VMSMarker;ALIAS PROPERTY TYPE ReferenceAliasReferenceAlias Property Alias_VMSMarker Auto;END ALIAS PROPERTY[/b];BEGIN ALIAS PROPERTY WhiterunDoor;ALIAS PROPERTY TYPE ReferenceAliasReferenceAlias Property Alias_WhiterunDoor Auto;END ALIAS PROPERTY;BEGIN ALIAS PROPERTY MarkarthJarl;ALIAS PROPERTY TYPE ReferenceAliasReferenceAlias Property Alias_MarkarthJarl Auto;END ALIAS PROPERTY;BEGIN ALIAS PROPERTY SolitudeFrontDoor;ALIAS PROPERTY TYPE ReferenceAliasReferenceAlias Property Alias_SolitudeFrontDoor Auto;END ALIAS PROPERTY;BEGIN ALIAS PROPERTY WhiterunJarl;ALIAS PROPERTY TYPE ReferenceAliasReferenceAlias Property Alias_WhiterunJarl Auto;END ALIAS PROPERTY;BEGIN ALIAS PROPERTY VMSBench;ALIAS PROPERTY TYPE ReferenceAliasReferenceAlias Property Alias_VMSBench Auto;END ALIAS PROPERTY;BEGIN ALIAS PROPERTY WhiterunSonsJarl;ALIAS PROPERTY TYPE ReferenceAliasReferenceAlias Property Alias_WhiterunSonsJarl Auto;END ALIAS PROPERTY;BEGIN ALIAS PROPERTY RiftenJarl;ALIAS PROPERTY TYPE ReferenceAliasReferenceAlias Property Alias_RiftenJarl Auto;END ALIAS PROPERTY;BEGIN ALIAS PROPERTY MarkarthDoor;ALIAS PROPERTY TYPE ReferenceAliasReferenceAlias Property Alias_MarkarthDoor Auto;END ALIAS PROPERTY;BEGIN ALIAS PROPERTY WindhelmDoor;ALIAS PROPERTY TYPE ReferenceAliasReferenceAlias Property Alias_WindhelmDoor Auto;END ALIAS PROPERTY;BEGIN ALIAS PROPERTY RiftenTamrielDoor;ALIAS PROPERTY TYPE ReferenceAliasReferenceAlias Property Alias_RiftenTamrielDoor Auto;END ALIAS PROPERTY;BEGIN ALIAS PROPERTY WindhelmEmpireJarl;ALIAS PROPERTY TYPE ReferenceAliasReferenceAlias Property Alias_WindhelmEmpireJarl Auto;END ALIAS PROPERTY;BEGIN ALIAS PROPERTY RiftenCityDoor;ALIAS PROPERTY TYPE ReferenceAliasReferenceAlias Property Alias_RiftenCityDoor Auto;END ALIAS PROPERTY;BEGIN ALIAS PROPERTY SolitudeJarl;ALIAS PROPERTY TYPE ReferenceAliasReferenceAlias Property Alias_SolitudeJarl Auto;END ALIAS PROPERTY;BEGIN ALIAS PROPERTY SolitudeSideDoor;ALIAS PROPERTY TYPE ReferenceAliasReferenceAlias Property Alias_SolitudeSideDoor Auto;END ALIAS PROPERTY;BEGIN ALIAS PROPERTY WindhelmJarl;ALIAS PROPERTY TYPE ReferenceAliasReferenceAlias Property Alias_WindhelmJarl Auto;END ALIAS PROPERTY;BEGIN ALIAS PROPERTY RiftenEmpireJarl;ALIAS PROPERTY TYPE ReferenceAliasReferenceAlias Property Alias_RiftenEmpireJarl Auto;END ALIAS PROPERTY;BEGIN ALIAS PROPERTY MarkarthSonsJarl;ALIAS PROPERTY TYPE ReferenceAliasReferenceAlias Property Alias_MarkarthSonsJarl Auto;END ALIAS PROPERTY;BEGIN FRAGMENT Fragment_6Function Fragment_6();BEGIN AUTOCAST TYPE HousePurchaseScriptQuest __temp = self as QuestHousePurchaseScript kmyQuest = __temp as HousePurchaseScript;END AUTOCAST;BEGIN CODEkmyquest.Purchasehouse(markarthhouse, markarthhousekey, markarthguide, kmyquest.HPMarkarth)kmyquest.markarthhousevar=1SetObjectiveDisplayed(40,1)If Favor250.GetStageDone(10)  Favor250.SetStage(15)EndIf;END CODEEndFunction;END FRAGMENT;BEGIN FRAGMENT Fragment_7Function Fragment_7();BEGIN AUTOCAST TYPE HousePurchaseScriptQuest __temp = self as QuestHousePurchaseScript kmyQuest = __temp as HousePurchaseScript;END AUTOCAST;BEGIN CODEkmyquest.Purchasehouse(windhelmhouse, windhelmhousekey, windhelmguide, kmyquest.HPWindhelm)kmyquest.windhelmhousevar=1SetObjectiveDisplayed(50,1)If Favor254.GetStageDone(10)  Favor254.SetStage(15)EndIf;END CODEEndFunction;END FRAGMENT;BEGIN FRAGMENT Fragment_5Function Fragment_5();BEGIN AUTOCAST TYPE HousePurchaseScriptQuest __temp = self as QuestHousePurchaseScript kmyQuest = __temp as HousePurchaseScript;END AUTOCAST;BEGIN CODEkmyquest.Purchasehouse(riftenhouse, riftenhousekey, riftenguide, kmyquest.HPRiften)kmyquest.riftenhousevar=1SetObjectiveDisplayed(30,1)If Favor251.GetStageDone(10)  Favor251.SetStage(15)EndIf;END CODEEndFunction;END FRAGMENT;BEGIN FRAGMENT Fragment_0Function Fragment_0();BEGIN AUTOCAST TYPE HousePurchaseScriptQuest __temp = self as QuestHousePurchaseScript kmyQuest = __temp as HousePurchaseScript;END AUTOCAST;BEGIN CODEkmyquest.Purchasehouse(whiterunhouse, whiterunhousekey, whiterunguide, kmyquest.HPWhiterun)kmyquest.whiterunhousevar=1SetObjectiveDisplayed(10,1)If Favor253.GetStageDone(10)  Favor253.SetStage(15)EndIf;END CODEEndFunction;END FRAGMENT;BEGIN FRAGMENT Fragment_3Function Fragment_3();BEGIN AUTOCAST TYPE HousePurchaseScriptQuest __temp = self as QuestHousePurchaseScript kmyQuest = __temp as HousePurchaseScript;END AUTOCAST;BEGIN CODEkmyquest.Purchasehouse(solitudehouse, solitudehousekey, solitudeguide, kmyquest.HPSolitude)kmyquest.solitudehousevar=1SetObjectiveDisplayed(20,1)If Favor252.GetStageDone(10)  Favor252.SetStage(15)EndIf;END CODEEndFunction;END FRAGMENT;BEGIN FRAGMENT Fragment_13Function Fragment_13();BEGIN AUTOCAST TYPE ViimagstenscriptQuest __temp = self as QuestViimagstenscript kmyQuest = __temp as Viimagstenscript;END AUTOCAST;BEGIN CODEkmyquest.Purchasehouse(VMSMarker, ViimagstenDeed, ViimagstenPlotBuilding, kmyquest.PPViimagsten)kmyquest.ViimagstenPlotvar=1SetObjectiveDisplayed(60,1);END CODEEndFunction;END FRAGMENT;END FRAGMENT CODE - Do not edit anything between this and the begin commentcell Property WhiterunHouse  Auto  key Property WhiterunHouseKey  Auto  cell Property SolitudeHouse  Auto  key Property SolitudeHouseKey  Auto  cell Property RiftenHouse  Auto  key Property RiftenHouseKey  Auto  cell Property MarkarthHouse  Auto  key Property MarkarthHouseKey  Auto  cell Property WindhelmHouse  Auto  key Property WindhelmHouseKey  Auto  Quest Property Favor250  Auto  Quest Property Favor251  Auto  Quest Property Favor252  Auto  Quest Property Favor254  Auto  quest Property Favor253  AutoBook Property WhiterunGuide  Auto  Book Property SolitudeGuide  Auto  Book Property RiftenGuide  Auto  Book Property MarkarthGuide  Auto  Book Property WindhelmGuide  Auto[b]ObjectReference Property VMSMarker  Auto  Book Property ViimagstenPlotBuilding  Auto  Book Property ViimagstenDeed  Auto

Spoiler
Scriptname Viimagstenscript extends Quest  Conditional;Propertiesmiscobject Property Gold  Auto  faction Property PlayerFaction  Auto  int Property ViimagstenPlotVar  Auto  conditionalGlobalVariable Property PPViimagsten  Auto  ObjectReference property PlayerRef Autofunction PurchaseHouse(objectreference VMSMarker, book ViimagstenDeed, book ViimagstenPlotBuilding, globalvariable GoldAmount)	game.getplayer().RemoveItem(Gold, GoldAmount.getvalueint())	game.getplayer().AddItem(ViimagstenDeed)	game.getplayer().AddItem(ViimagstenPlotBuilding)	game.IncrementStat( "Houses Owned" )endfunction
I thought I was getting the hang of scripting but obviously not. I'm pretty sure I have all the text options linked up correctly and the aliases defined. Does it matter the code says DO NOT EDIT? :biggrin:

Any reason why you're using an alias for gold? Just use a property :smile: Have the text say how much gold, like 10000 Gold. Then make gold a property of your "take the money" script, and do game.getplayer().RemoveItem(Gold, 10000)

If you really want to use an alias you'll have to set a global variable as it's value, or set it's value in a script.
User avatar
Chloe :)
 
Posts: 3386
Joined: Tue Jun 13, 2006 10:00 am

Post » Mon Nov 19, 2012 1:06 pm

I was just sort of copy/pasting the original code, I have a global variable set for the gold amount to buy the plot, but it doesn't appear in the text dialogue.

This is what I have:

"I'd like to buy a plot of land within the Rift ( gold)" Which should appear as 4000 gold.

But it appears as:

"I'd like to buy a plot of land within the Rift [...] gold)" in game.
User avatar
Code Affinity
 
Posts: 3325
Joined: Wed Jun 13, 2007 11:11 am

Post » Mon Nov 19, 2012 2:10 am

I was just sort of copy/pasting the original code, I have a global variable set for the gold amount to buy the plot, but it doesn't appear in the text dialogue.

This is what I have:

"I'd like to buy a plot of land within the Rift ( gold)" Which should appear as 4000 gold.

But it appears as:

"I'd like to buy a plot of land within the Rift [...] gold)" in game.

In the first Quest Data tab for your quest, there is a section in the bottom right called Text Display Globals. You need to put your variables in there. Then, when you use in your text, it'll display properly.

To take the correct amount of gold from the player, you use Game.GetPlayer().RemoveItem(Gold, (YourGlobalName.GetValueInt()))
If that's in a dialogue fragment box, you need to make your global a property of your dialogue script, as well as a Gold property.
User avatar
stevie trent
 
Posts: 3460
Joined: Thu Oct 11, 2007 3:33 pm

Post » Mon Nov 19, 2012 3:34 am

In the first Quest Data tab for your quest, there is a section in the bottom right called Text Display Globals. You need to put your variables in there. Then, when you use in your text, it'll display properly.

To take the correct amount of gold from the player, you use Game.GetPlayer().RemoveItem(Gold, (YourGlobalName.GetValueInt()))
If that's in a dialogue fragment box, you need to make your global a property of your dialogue script, as well as a Gold property.
This all seems to be in order in the quest, but it's still the same. I am trying to narrow down where the error could be but since most of the scripts are copypasta from vanilla scripts I don't see how there could be mistakes in that.
User avatar
Oceavision
 
Posts: 3414
Joined: Thu May 03, 2007 10:52 am

Post » Sun Nov 18, 2012 9:11 pm

This all seems to be in order in the quest, but it's still the same. I am trying to narrow down where the error could be but since most of the scripts are copypasta from vanilla scripts I don't see how there could be mistakes in that.

I would not trust vanilla scripts... Make sure you go through all that delicious copypasta and make sure there are no mistakes.
User avatar
Add Me
 
Posts: 3486
Joined: Thu Jul 05, 2007 8:21 am

Post » Mon Nov 19, 2012 2:05 am

Ok i've got the script working partially. It now removes the gold, activates the marker and gives the player the plot deed and book. Now I just have to get the dialogue to say (4000 gold) and not ([...] gold).
User avatar
Rachell Katherine
 
Posts: 3380
Joined: Wed Oct 11, 2006 5:21 pm

Post » Mon Nov 19, 2012 2:17 am

Can someone please tell me what I am doing wrong here. This script is attached to a quest and is not doing anything.

Spoiler
Scriptname CSStopCrimeOverhaulJail extends QuestActor Property PlayerRef  AutoQuest Property CQCrimeOverhaul  AutoEvent OnLocationChange(Location akOldLoc, Location akNewLoc)    If PlayerRef.GetCurrentLocation()==akNewLoc		 Debug.Notification("Location changed.")			  If PlayerRef.IsArrested()				   CQCrimeOverhaul.Stop()				   Debug.Notification("Crimeoverhaul stopped.")			  EndIf	 EndIfEndEvent
User avatar
xxLindsAffec
 
Posts: 3604
Joined: Sun Jan 14, 2007 10:39 pm

Post » Mon Nov 19, 2012 11:41 am

Do I have to worry about the reliability of waitgametime or regsiterforupdategametime?
Hypothetical example: Imagine that I had a gate that I wanted to always be open in the day and closed at night. Could I just register it for a 12 hour game time update twice every day and switch it's position?
User avatar
Daddy Cool!
 
Posts: 3381
Joined: Tue Aug 21, 2007 5:34 pm

Post » Sun Nov 18, 2012 11:07 pm

The http://www.creationkit.com/OnLocationChange_-_Actor event is not called on http://www.creationkit.com/Quest_Script, it is called on http://www.creationkit.com/Actor_Script. You probably want to create a new http://www.creationkit.com/ReferenceAlias_Script for your quest that points to the actor in question and receives this event, although depending on how your mod works a script extending Actor may work just as well.

Cipscis

EDIT:

@seventyfour:
I'd recommend http://www.creationkit.com/RegisterForUpdateGameTime_-_Form over http://www.creationkit.com/WaitGameTime_-_Utility. All objects are forced to be http://www.creationkit.com/Persistence_(Papyrus) while they are registered for events, so that approach should work well.

Cipscis
User avatar
Siobhan Thompson
 
Posts: 3443
Joined: Sun Nov 12, 2006 10:40 am

Post » Mon Nov 19, 2012 12:08 pm

Your right thanks, I had attached the script to the quest instead of the reference alias pointing to the player because my reference alias script was not firing for some reason. I just swapped the script...bad idea.
User avatar
Ice Fire
 
Posts: 3394
Joined: Fri Nov 16, 2007 3:27 am

Post » Mon Nov 19, 2012 12:16 pm

So long as you know the portal WILL be close, while testing: REMOVE the distance condition altogether and see if your NPC wanders over to it then.

Got rid of the distance condition and he walked over to the portal. However, it did not activate (he stayed in the center of the portal). Taking a look at my script I think I see why:
Scriptname rayPortalGoHome extends ObjectReference {Sends the player to the castle.}ObjectReference Property PortalDoor AutoEvent OnActivate(ObjectReference akActionRef)If akActionRef == Game.GetPlayer()  PortalDoor.Activate(Game.GetPlayer())EndIfEndEvent

I'm guessing I'll need to remove that getplayer bit and maybe the whole If statement as well. I don't see why the distance condition would cause a problem though, how often would an actor re-evaluate packages when the player is near?
User avatar
Jimmie Allen
 
Posts: 3358
Joined: Sun Oct 14, 2007 6:39 am

Post » Mon Nov 19, 2012 7:00 am

Got rid of the distance condition and he walked over to the portal. However, it did not activate (he stayed in the center of the portal). Taking a look at my script I think I see why:
Scriptname rayPortalGoHome extends ObjectReference{Sends the player to the castle.}ObjectReference Property PortalDoor AutoEvent OnActivate(ObjectReference akActionRef)If akActionRef == Game.GetPlayer()  PortalDoor.Activate(Game.GetPlayer())EndIfEndEvent

I'm guessing I'll need to remove that getplayer bit and maybe the whole If statement as well. I don't see why the distance condition would cause a problem though, how often would an actor re-evaluate packages when the player is near?
Yes, remove it I think. It's not the player doing the Activating (is it?), it's the NPC.

As to the Distance Condition ... well if your-guy walks over to the portal without it being present, but does not walk when it is present; at the very least something is wrng with it (as you currently have it written). Maybe you are just checking for too small a distance? (or something like that). Note: I have not used Distance in a Criteria, only in scripts.
User avatar
Vicki Gunn
 
Posts: 3397
Joined: Thu Nov 23, 2006 9:59 am

PreviousNext

Return to V - Skyrim