Adding spouse to new player home

Post » Tue Jun 19, 2012 4:08 am

Thanks again for the huge effort you guys are putting into this. Unfortunate that a developer does not chime in with a bit of advice as well.

And I'm also curious as to who the beta testers were, or if they brought some of these questions up while messing with the CK for the few weeks they had it?
User avatar
Nichola Haynes
 
Posts: 3457
Joined: Tue Aug 01, 2006 4:54 pm

Post » Tue Jun 19, 2012 4:43 am

Adding new quests is easy but updating ones with variable extras that can account for every house mod by supplying simple steps is a bit more advanced then what I'm sure it was designed for.

However since we have source scripts, editing a vanilla script to account for extra spouse houses could work as long as once we've edited it, noone else does. I.e modify the vanilla script to import files with a certain alias located in a constant directory as to add methoda. This could be the solution
User avatar
josh evans
 
Posts: 3471
Joined: Mon Jun 04, 2007 1:37 am

Post » Mon Jun 18, 2012 10:26 pm

Call me stupid when it comes to scripting, but what about SKSE?
User avatar
Angelina Mayo
 
Posts: 3427
Joined: Wed Jan 24, 2007 4:58 am

Post » Mon Jun 18, 2012 10:54 pm

I wasnt aware of SKSE (new to modding Skyrim but not new to programming :P) however I have found a solution, however it involves finding the "substring" method and parsing a list of all aliases in an array.

Any help on these methods would be appreciated, I am having no luck in the API, if someone comes back to tell me its C based(which it should be) then I can use C's substring command, only thing left would be find the ducmented list of aliases for quests linked to relationships.
User avatar
Cesar Gomez
 
Posts: 3344
Joined: Thu Aug 02, 2007 11:06 am

Post » Tue Jun 19, 2012 11:40 am

We have a solution for all and any custom house mods, but we need ideas on implementation of the green code, and I would like someone to check my syntax of the yellow as it has been a while since I have had to check a substring in an array

The solution:
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
Scriptname MasterSpouse extends Quest

Pass all Custom Quest House aliaes linked with "RelationshipQuest" into an Array
for each Alias in Array


if (Array[i] == Alias_Name.subString("*SpouseHouse")) //All house aliases end in "SpouseHouse"
{
Housearray[i] = Alias_Name
i++
}


Function MoveSpouse(Actor spouse, ReferenceAlias newHouse)
for (int i ==0; i < HouseArray.length;i++)
{
HouseArray[i].Clear() //Clears the specific reference to each House Alias
}
newHouse.ForeceRefTo(Spouse) // adds the actor reference to the newly selected house
endfunction

then service faction stuff
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

Green is what needs to be coded aka the pseudocode
Yellow is need to double check Papyrus syntax
I know it should be in code tags but the colours wont show else
User avatar
Juan Suarez
 
Posts: 3395
Joined: Sun Nov 25, 2007 4:09 am

Post » Tue Jun 19, 2012 12:21 am

OK, I've been trying to think through the other problem, which is how to get multiple dialogue nodes working from the vanilla moving question. There are actually two moving dialogues, the regular one and the forcegreet dialogue immediately after the wedding. The regular one can be set at top-level to avoid conflicts, even though it's ugly (still working on that one). But I thought the forecegreet version would just be impossible. BUT, then I noticed that the forcegreet node fires stage 5 of the wedding relationship quest, which runs the following script:

;spouse has forcegreetedAlias_LoveInterest.GetActorRef().EvaluatePackage()

Now, we may have stumbled upon the solution to both of the problems (the scripting and the dialogue) at once. Dialogue wise, for the post-wedding version we can create a top level line of dialogue, BUT one that has a condition set for checking that the quest stage for the wedding quest is 5. Note that the responses to that first moving question set the stage to 10, so the only time the condition could be filled is between the new spouse asking "Where should we move?" and the player's response. So it will look like your custom response is just part of that option list (if I'm right, I still need to test - but I think my reasoning is sound).

I'm just an amateur scripter myself, so I'm just going to lay out some logic and hope that what I suggest actually works. :P Perhaps this EvaluatePackage function could help with the scripting problem theconqueror148 mentioned above. The wiki is a little unclear about what exactly EvaluatePackage does: it doesn't have a return value, but it still might do something we can use.

Ultimately, the spouse move is accomplished by assigning a house sandbox package and a set of service packages (if the spouse has a profession) to the spouse - usually about six packages altogether. Those packages are bundled together into a reference alias and then forced onto the spouse in the vanilla dialogue (or perhaps the spouse is forced onto the alias). When you move, you need to clear all those packages to allow a new set of packages to be assigned by the new house's alias. (NOW: I *think* you don't need to worry about the clear function in the post-wedding version because you don't yet HAVE a set of house packages assigned: so the clear command in that vanilla script seems superfluous or is just present because the same script is used in the regular move: would like confirmation that I'm right, though it might not matter if we solve this scripting problem anyway). Our problem has been that the custom script we have can clear the vanilla house aliases and clear our one custom house, but we haven't figured out a way to be able to clear the data from any potential other custom house (we're assuming we might be able to encourage the community to adopt naming conventions to help).

theconqueror148 has suggested a clear mechanism that summons the entire set of aliases that assigned the old house packages in their respective quests - this is what the vanilla script does. What I'd like to know is if the EvaluatePackage function in essence summons an array of the packages, rather than the aliases that assigned them. Is it possible - and if so, is it easier - to clear packages that begin in MarriageSpouse* and ServicesSpouse*. Why I think this might be easier, is that to gather an array of all the aliases the script has to gather the data from any quests that have house package aliases. However, if it's possible *just* to gather the relevant packages that are on the spouse and clear them, it accomplishes the same thing - clearing the way for the new house alias to apply the new set of packages. And is the EvaluatePackage function the way to summon the array of packages?

Now, you may say, but Clear only works with Reference Aliases. This is true. So is there a way to construct a Reference Alias that gets defined by adding the relevant packages to the definition? You can attach scripts to definitions of Reference Aliases, so can those scripts be used to populate the alias with those packages? And then you clear that constructed alias. And is EvaluatePackage going to help find them? I think looking into how the Radiant Quest constructs aliases on the fly might give us some clues.

I'll continue poking through this, but it would be great if some more experienced scripters could verify my logic.
User avatar
Jordan Fletcher
 
Posts: 3355
Joined: Tue Oct 16, 2007 5:27 am

Post » Tue Jun 19, 2012 6:12 am

OK, follow-up question to make sure I understand how Reference Aliases work. My understanding is that they are stand-ins without any independent existence. So, for example, I'm looking at Bounty Quest BQ03. It has the Quest Alias Bounty, which chooses the "boss" at that location and then puts a death script on the boss that will advance the quest when that boss is killed. Am I right that once the alias has done that job, it no longer has any independent existence? You don't really need to clear that alias when the quest is rebooted, since the reboot is done by other means (stage 200 resets the stage to 0).

So if I'm right, we don't necessarily need to summon the House Aliases (although that might be one means to gather the data) to clear them. We can instead construct a new alias that we can clear, removing its attached packages. So the issue is just how do we populate the alias with the relevant packages?

(I'm sorry, I'm a letters rather than a math person, so I tend to lay out my logic in human language. I'm sure it can be translated into scripting speak) :tongue:

And on the dialogue front, I'm wondering if AddTopic can be utilized to somehow stick the moving dialogue somewhere other than top-level.

EDIT: OK, I think I understand EvaluatePackage. In the case of the wedding quest, the LoveInterest alias adds a short term package that triggers the forcegreet first move dialogue. So the EvaluatePackage is a failsafe to make sure that package rises to the top. It would only be of use to us if we can somehow force our new house packages to have a higher priority than the old house packages (which unfortunately won't actually clear them).

EDIT2: It all takes us back to the ability to check for substrings. GetCurrentAIPackage unfortunately gets the top one, which will work fine IF the spouse happens to be running the sandbox package at the time you begin dialogue, but if your spouse is also a fighting companion or has a profession package running at the time, GetCurrentAIPackage won't be of much use. What we would need is to be able to GetPackage with substring MarriageSpouse*, but I don't see a way to do that.)
Sorry for all the thinking out loud.
User avatar
Daddy Cool!
 
Posts: 3381
Joined: Tue Aug 21, 2007 5:34 pm

Post » Tue Jun 19, 2012 1:06 am

First it is great your still thinking and I love the letters, it could be possible to manually script an alias, however that would not solve the clear question.

Assuming the list of packages can be put into an array, we loop round with a != operation, to check for a package not equal to *spouseHOuse say. Once it finds it it can then clear that package. The this is viable as whoever the spouse is , is referred to as akspeaker(inherited from Quest class).

In theory:


Array of packages that are attached to akspeaker

Loop till we find one

At that point .clear that package and force reference the new one.

This solves the getting a list of all aliases, however getting packages into an array could be viable. That way we solve our problem. Qutayba your a genius.
User avatar
Sara Lee
 
Posts: 3448
Joined: Mon Sep 25, 2006 1:40 pm

Post » Tue Jun 19, 2012 1:50 pm

My understanding of the way aliases work is that the alias doesn't really exist, for all intents and purposes, once it has assigned its packages. So the vanilla script is summoning the appropriate house aliases back into existence, so the engine knows which packages to clear. Which is what we would be doing, too, but we would summon an alias into existence filled with house packages we check for rather than the pre-defined list of the vanilla aliases. Does that make sense?

P.S. Did you find out anything about substrings? Everything still hinges on that. I've been trying to fiddle with other alias conditionals, but each creates new problems, Being able to test for substrings would solve everything.
User avatar
Ana
 
Posts: 3445
Joined: Sat Jul 01, 2006 4:29 am

Post » Tue Jun 19, 2012 11:59 am

No luck on substrings, what I was thinking was evaluating the akspeaker packages, since that where they are stored
User avatar
Bedford White
 
Posts: 3307
Joined: Tue Jun 12, 2007 2:09 am

Post » Mon Jun 18, 2012 9:58 pm

Guess what? The service portions of the house alias are factions (not packages), and in the vanilla houses, they are all exactly alike, despite different names. They are all vendor capacities that reference spouse containers by profession that only exist in the void space of Vlindrel Hall. This means that clearing these factions isn't really a priority, because they don't really change or need to change. This means we really only have to worry about package.

One way is to GetCurrentAIPackage, but the problem is, we only want to clear the sandbox package, which may or may not be the current one (if the NPC is a follower, the current package might be combat companion, or something else). I think our problem is simpler now, but it's not solved yet.

EDIT: EUREKA! There is a a GetTemplate function. Ignore the silly syntax.

Speaker.EvaluatePackageOR?  Speaker.GetCurrentAIPackageif SpeakerPackage.GetTemplate() == Sandbox   Clear the svckerendIf

Are we close? I was thinking of adding a daytime sandbox package for getting the spouse to farm outside. Is there a way to get it to clear ALL Sandbox packages, or are we getting greedy?

So, in short and in conclusion: We need to GetAlias of the Speaker's Sandbox packages and clear them. Lol, we're almost back to where we were yesterday, but maybe there's some progress here, right?
User avatar
Jonathan Montero
 
Posts: 3487
Joined: Tue Aug 14, 2007 3:22 am

Post » Tue Jun 19, 2012 9:06 am

The http://www.creationkit.com/Package_Script that this one is templated on. If this package isn't templated on another package, it will return None.

What this does is test to see if a package is based on a template,and return what template the package is based upon, we would need the exact name of the template first of all, which varies from house to house. Each alias assigns a package by assigning an actor to the alias, therefore clearing the alias would not work, and although we could update the reference the correct package would need to be reattached.




So the stacking order of the various package lists that will ultimately live on an actor reference is as follows (see images to right):
  • Packages in currently running http://www.creationkit.com/Scenes_Tab#Package_Action.
  • Quest Alias Package List (if multiple aliases, use quest priority to sort)
  • Actor Form AI Package Tab main list
  • Packages in the Form List selected in the AI Package Tab's "Default Package List" drop down
  • Packages in the Form List set to be the Default Object "Default Pack List"

Now if we make all quest alias priority 70 say, The packages assigned will have priority 70, meaning only major quests will superseed our packages.

This means, when we initially add a house, whichever quest alias it may be, we forcetoref the first house selected, and then since it will have priority 70, it will sit on top of the packages, this is why spouses never leave the house lol.

This means that unless a quest running which will affect the NPC anyway sets a package above 70, the currentPackage will always be the houseSpouse package. Meaning we can get the current package, clear(), forcetoref() and then evaluate() the stack again to order properly. This means we can do it.

Anyway the .clear() function clears the reference to the alias, not clears the alias, that means each alias has it's own assigned packages, factions etc... all the script does is clear the reference, and attach a new reference to the correct alias. Find a clear method for packages and we can do it. Further the forcetoref assigns trhe actor refrence to an alias, problem with that is even if we changed the package the old alias will still be referred to, and therefore we would have multiple aliases attached to one person.


What you are suggesting is creating one permanent quest alias for the relationship quest, and adjust the packages accordingly which in theory would work, however that means people would only upload a package, not a quest.

Finally there is no way of directly attaching a package through script,-well none that the api show.
User avatar
The Time Car
 
Posts: 3435
Joined: Sat Oct 27, 2007 7:13 pm

Post » Tue Jun 19, 2012 12:06 am

I've been wondering how to do this myself being still a bit of a newb to modding Skyrim. I was wondering if it would be possible to "fake" the ability to add a marriage partner to you own created home. I have a wife who is also a follower and one of the dialog commands is "wait here". Could another command similar to that one be added but modified to where the AI would wait permanently and engage in sandbox mode until otherwise commanded?

Maybe a "Stay here" or "Live here" command and give it roughly the same duties.

In that way there wouldn't be any conflicts with any other mods or if you already own a default skyrim home.
User avatar
pinar
 
Posts: 3453
Joined: Thu Apr 19, 2007 1:35 pm

Post » Tue Jun 19, 2012 1:02 pm

What this does is test to see if a package is based on a template,and return what template the package is based upon, we would need the exact name of the template first of all, which varies from house to house. Each alias assigns a package by assigning an actor to the alias, therefore clearing the alias would not work, and although we could update the reference the correct package would need to be reattached.

Now if we make all quest alias priority 70 say, The packages assigned will have priority 70, meaning only major quests will superseed our packages.

This means, when we initially add a house, whichever quest alias it may be, we forcetoref the first house selected, and then since it will have priority 70, it will sit on top of the packages, this is why spouses never leave the house lol.

This means that unless a quest running which will affect the NPC anyway sets a package above 70, the currentPackage will always be the houseSpouse package. Meaning we can get the current package, clear(), forcetoref() and then evaluate() the stack again to order properly. This means we can do it.

Anyway the .clear() function clears the reference to the alias, not clears the alias, that means each alias has it's own assigned packages, factions etc... all the script does is clear the reference, and attach a new reference to the correct alias. Find a clear method for packages and we can do it. Further the forcetoref assigns trhe actor refrence to an alias, problem with that is even if we changed the package the old alias will still be referred to, and therefore we would have multiple aliases attached to one person.


I'll look at this in more detail tomorrow, but I thought of a couple things off the bat. All the house packages (including most custom ones) are based on the "Sandbox" template. In principle, you can define new templates, but sandbox templates cover most of what you'd want a spouse to do at home. Now one problem is that spouses would have more than one package based on the sandbox template, since they would have whatever pre-marriage sandbox template falls lower in the stack.

As for priority: it will be important to have the packages at the same priority as the vanilla houses, if the quest priority is any indication. I discovered that the reason our earlier model was working in the test houses and not my existing mod was that in my mod I had incorporated the move dialogues and scripts into its main quest which had a priority of 60, which is the standard for side quests. As soon as I changed the priority down to 45 like the vanilla relationship quest, I could get spouses to ping-pong from my house to vanilla houses and back with no problem.

Unfortunately, I understand what we're trying to do, but my scripting knowledge limitations are preventing me from actually figuring out how to actually implement it. I fiddled around with some things this afternoon, but I was trying to stick apples, oranges, and chinchillas together, and it wasn't pretty, although it was somewhat amusing :tongue: I do feel we're close, but probably either way we will have to appeal to the house building community to comply with some conventions for this to work,

@ Woodman: The problem we're running up against isn't so much assigning a new ai package for the spouse, but clearing the predominant spouse house package that the spouse might already be following at the time. We know what the vanilla ones are called, so we can clear those before putting on a new one, but we want to be able to find a way to clear other custom packages from mods that we won't know the names of to be able to clear. So, we have achieved compatibility with the vanilla game, but we want to make it possible for several custom houses to exist together peacefully for one player (I suppose one could always uninstall the ones you don't like - but I like having a few extra buildings around even if I don't live in them. Many of them do and will have cool quests attached to them, too).
User avatar
Justin Bywater
 
Posts: 3264
Joined: Tue Sep 11, 2007 10:44 pm

Post » Tue Jun 19, 2012 11:45 am

Like I said, I am at a conference dor a few days, however
User avatar
Unstoppable Judge
 
Posts: 3337
Joined: Sat Jul 29, 2006 11:22 pm

Post » Tue Jun 19, 2012 10:50 am

Silly phone LOL, like i started to say, even if we got the current housepackage we still don't have a delete/clear function, also look into getAliasOD as we can concatenate the alias id.
If we got the current package(easy enough) and then found the alias is relating to that package(since it is unique) we can then clear the ref. So if you could into the getAliasID for me, it would be grand

If not look into getAliasID for actor.

Speak Tuesday

Theconquerer
User avatar
James Baldwin
 
Posts: 3366
Joined: Tue Jun 05, 2007 11:11 am

Post » Tue Jun 19, 2012 7:38 am

Emma and I have released an alternate solution to this problem with a different approach: http://skyrim.nexusmods.com/downloads/file.php?id=11370
User avatar
Emmi Coolahan
 
Posts: 3335
Joined: Wed Jan 24, 2007 9:14 pm

Post » Tue Jun 19, 2012 12:01 pm

The Wiki suggests (and I realize it is incomplete) that you can only use getAlias from within a quest. If I'm right about aliases, we have a bit of a problem. I think aliases don't even have ID's because they're not "objects" that live anywhere except in the quest.

How I think the vanilla script works is this: the house alias has a set of packages and factions that then get added to the factions and packages that reside (or are associated with) on the NPC. There is no tag or flag on the NPC or the packages that they are associated with an alias, because you could, in principle, manually apply those same features without the alias, which is just a convenient mechanism for applying several features at once. When the script clears the alias, it is once more through the quest, and the list defined on the alias is the list of packages and factions that it finds on its list to remove. The alias is not greater than the sum of its parts, in other words, it simply IS the sum of its parts. Another example I looked at was the kill giant radiant quest. The alias is used to add a script to the giant that advances the quest when the giant is killed. There is no persistent connection between the giant object and the alias once this happens.

If I'm right, that means there's no real way to find an alias through the npc and package - and there's also no intrinsic need to remove the alias because the alias isn't actually on them. The packages are BUT there appears to be no way to remove packages other than by specifying them through an alias (I still think it would work if we could construct a new alias that consisted of checked-for current packages). But since you can clear packages through the alias system, that means that somehow you can clear packages. But I just can't find such a function on the list on the Wiki. I could be wrong about this, of course.

In the meantime, I just saw a new post by amgepo pop in while I was typing. I'll go take a look at that.
User avatar
Chrissie Pillinger
 
Posts: 3464
Joined: Fri Jun 16, 2006 3:26 am

Post » Tue Jun 19, 2012 1:32 pm

Wow, Amgepo! That is a brilliant solution. Amgepo & Emma's mod basically creates an X-marker that can be moved by a spell (Mark House). So when the old house packages are cleared, there's a new house package that will seek out the current location of the X marker. So you can move your spouse anywhere, and they'll adopt an appropriate sandbox ai.

I do have a couple of technical comments for you, Amgepo, based on the various tests of our method this week. Your mod does something similar to the current version of my house mod quest-wise, which only works for moving the spouse between my house and the vanilla houses (I'm changing this for my next version). You make changes to both the vanilla RelationshipMarriageSpouseHouseScript and the vanilla marriage dialogue. So, for example, if the current versions of both our mods were loaded, they'd conflict with unpredictable results. If you make your script an extension of the RelationshipMarriageSpouseHouseScript, you can fix that problem easily (check out theconqueror148's script earlier in the thread) and then you can remove the changed vanilla script from the assets you send with your mod. You might also think about making your dialogue a top-level topic. Unfortunately, creating a link to the vanilla marriage dialogue constitutes a change to that dialogue, and the game will only recognize one change per asset. It maybe looks a little less pretty, but since your mod is universally compatible otherwise, you might not have a lot of other people putting dialogue in that same spot. These are just suggestions.

You stole our destiny, Amgepo & Emma! But you did it with style and creativity, so I think I can live with that :)

I'd still be interested in figuring out the remaining puzzles in our method, but I think that those problems might be more theoretical at this point, now that there's a working practical solution our there.
User avatar
Eduardo Rosas
 
Posts: 3381
Joined: Thu Oct 18, 2007 3:15 pm

Post » Tue Jun 19, 2012 8:14 am

I guess the simplest solution is the best a simple change location spell does the trick, ah well at,least I can do any type of quest lol. Looking into it, it is a lot simpler than playing with quests and I have to say Congrats. If people still want us to continue than we will however this solution would suffice
User avatar
Judy Lynch
 
Posts: 3504
Joined: Fri Oct 20, 2006 8:31 am

Post » Tue Jun 19, 2012 4:50 am

Wow, Amgepo! That is a brilliant solution. Amgepo & Emma's mod basically creates an X-marker that can be moved by a spell (Mark House). So when the old house packages are cleared, there's a new house package that will seek out the current location of the X marker. So you can move your spouse anywhere, and they'll adopt an appropriate sandbox ai.

I do have a couple of technical comments for you, Amgepo, based on the various tests of our method this week. Your mod does something similar to the current version of my house mod quest-wise, which only works for moving the spouse between my house and the vanilla houses (I'm changing this for my next version). You make changes to both the vanilla RelationshipMarriageSpouseHouseScript and the vanilla marriage dialogue. So, for example, if the current versions of both our mods were loaded, they'd conflict with unpredictable results. If you make your script an extension of the RelationshipMarriageSpouseHouseScript, you can fix that problem easily (check out theconqueror148's script earlier in the thread) and then you can remove the changed vanilla script from the assets you send with your mod. You might also think about making your dialogue a top-level topic. Unfortunately, creating a link to the vanilla marriage dialogue constitutes a change to that dialogue, and the game will only recognize one change per asset. It maybe looks a little less pretty, but since your mod is universally compatible otherwise, you might not have a lot of other people putting dialogue in that same spot. These are just suggestions.

You stole our destiny, Amgepo & Emma! But you did it with style and creativity, so I think I can live with that :smile:

I'd still be interested in figuring out the remaining puzzles in our method, but I think that those problems might be more theoretical at this point, now that there's a working practical solution our there.
I'll check that script :)
User avatar
Kat Ives
 
Posts: 3408
Joined: Tue Aug 28, 2007 2:11 pm

Post » Tue Jun 19, 2012 2:59 am

Actually what they're doing in their scripts, conqueror, isn't too different from what we were trying, in some respects. But instead of clearing the vanilla packages and adding one for a specific custom house (and so we were running into the problem of how to clear packages that were not vanilla and not from our one custom house), they're clearing the vanilla package and replacing it with a package that looks for the location of a marker instead. Their spell moves the marker. So they found a solution in defining their package rather than in the scripting.

If someone were to make a mod (like the current version of my mod, will be updating) that also clears the vanilla houses to add a custom house, their mod would still run into the problem of not being able to clear our custom package. So the short term solution for my mod is to simply make sure you move your spouse back to a vanilla house before installing their mod :P
User avatar
Chavala
 
Posts: 3355
Joined: Sun Jun 25, 2006 5:28 am

Post » Tue Jun 19, 2012 12:58 pm

So would you say we are still needed? And custom house packages might be a problem lol
User avatar
herrade
 
Posts: 3469
Joined: Thu Apr 05, 2007 1:09 pm

Post » Tue Jun 19, 2012 10:12 am

Wow, so my old script is still useful, brilliant lol
User avatar
carrie roche
 
Posts: 3527
Joined: Mon Jul 17, 2006 7:18 pm

Previous

Return to V - Skyrim