Creation an Alias halfway through a quest?

Post » Sun Nov 18, 2012 10:10 pm

I have a quest where the player has an NPC craft a necklace for them. The player then has to deliver this necklace to the questgiver. I don't want the player losing the necklace, so I'd like for it to be an Alias of the quest so I can mark it as a quest item. Can I somehow create an alias halfway through the quest to achieve this? Can I create it in a nearby (hidden) container, then move it to the player's inventory with a script command? (None SKSE) Is there some other way to do this?

Thanks for any help,
AJV
User avatar
Jeremy Kenney
 
Posts: 3293
Joined: Sun Aug 05, 2007 5:36 pm

Post » Mon Nov 19, 2012 11:28 am

Yep.

Create the alias, and have it created IN a container (also an alias). Then in the script box for the stage you want, or in a script somewhere, simply use the Player.AddItem() script :)

Your item alias needs to be below your container alias in the alias list.

I have this in a couple of my hunting quests for some stuff.
User avatar
elliot mudd
 
Posts: 3426
Joined: Wed May 09, 2007 8:56 am

Post » Mon Nov 19, 2012 12:07 pm

You can't create an alias half way through a quest, but you can fill one with ForceRefTo(), for example after creating an object with PlaceAtMe() .

Another way is to start a new quest with an alias and then assign the object in that alias to an alias in another quest. That's particularly useful if you want to use the Find matching reference fill method, because Papyrus's Find functions are more limited.
User avatar
Natasha Callaghan
 
Posts: 3523
Joined: Sat Dec 09, 2006 7:44 pm

Post » Mon Nov 19, 2012 10:58 am

A craft item event that forces the crafted object into an empty-by-default optional alias tagged with "quest item" in the parent quest?
User avatar
Claudz
 
Posts: 3484
Joined: Thu Sep 07, 2006 5:33 am

Post » Mon Nov 19, 2012 5:10 am

Yep.

Create the alias, and have it created IN a container (also an alias). Then in the script box for the stage you want, or in a script somewhere, simply use the Player.AddItem() script :smile:

Your item alias needs to be below your container alias in the alias list.

I have this in a couple of my hunting quests for some stuff.
Wait, how does it know what ref the alias is then? That doesn't make sense to me. I say 'Create a banana in this chest', then give the player a banana and it is the alias?


You can't create an alias half way through a quest, but you can fill one with ForceRefTo(), for example after creating an object with PlaceAtMe() .

Another way is to start a new quest with an alias and then assign the object in that alias to an alias in another quest. That's particularly useful if you want to use the Find matching reference fill method, because Papyrus's Find functions are more limited.
But if I use PlaceAtMe (Or another quest) how would I get the reference into the player's inventory? That's the issue. Creating the alias isn't a perticular problem, it's getting it added to the players inventory after it's created. Without the player having to do anything, as to immitate the NPC giving you the object.
User avatar
Louise Dennis
 
Posts: 3489
Joined: Fri Mar 02, 2007 9:23 pm

Post » Mon Nov 19, 2012 11:53 am

But if I use PlaceAtMe (Or another quest) how would I get the reference into the player's inventory?

Player.Additem(TheAlias).

Additem creates base references, but moves aliases.
User avatar
N Only WhiTe girl
 
Posts: 3353
Joined: Mon Oct 30, 2006 2:30 pm

Post » Mon Nov 19, 2012 7:10 am

Player.Additem(TheAlias).

Additem creates base references, but moves aliases.
Ah, sweet! Forget my further noobishness, but how exactly should I reference the alias when using that command? It will be in dialogue in the same quest, so is it already a 'property'? For example, if I create my alias inside a nearby underground chest, and I call the alias 'CoolNecklace' what would I type?

Player.AddItem(CoolNecklace, 1) ? I've never dealt with reference aliases before. :P
User avatar
Rozlyn Robinson
 
Posts: 3528
Joined: Wed Jun 21, 2006 1:25 am

Post » Mon Nov 19, 2012 12:36 pm

The trick they are talking about does work ... if you've setup for it in advance

So:

1. Create an Alias for your necklace, in the normal way. Make it Optional.
2. After the necklace is crafted, ForceToRef to get it into the (empty) Alias created
3. Then run the line of script as Ingenue suggests
Player.AddItem(MyAlias)
and all will be well

:smile:


And, if you are doing it this way, no need to worry about Big's ordering ... that is only applicable if you are using the create-in, as he suggests ...

... and you could do it that way. Have the Player as an Alias (don't shoot me, Justin!) and then use a Create-In on the player to put the necklace in the game-world ... If you did that the necklace alias would need to come after the player-alias in the Quest-Alias Tab
User avatar
sw1ss
 
Posts: 3461
Joined: Wed Nov 28, 2007 8:02 pm

Post » Mon Nov 19, 2012 3:43 am

Yea I should have said you don't need a container to be the middle man. You can create an alias to an object, make it optional, then add the item to the player at a later stage, calling the alias name inside the () :)
User avatar
Rach B
 
Posts: 3419
Joined: Thu Mar 08, 2007 11:30 am

Post » Mon Nov 19, 2012 10:25 am


Player.AddItem(CoolNecklace, 1) ? I've never dealt with reference aliases before. :tongue:
Yep.
  • If you pass the AddItem function an Alias it does a MOVE (not a create) ... because the Alias must be filled and so is already in the game-world (somewhere).
  • If you pass it a base form then it does a create.
User avatar
BethanyRhain
 
Posts: 3434
Joined: Wed Oct 11, 2006 9:50 am

Post » Mon Nov 19, 2012 10:33 am

Okay, the whole 'fill the optional alias' thing just has me confused, so I'll just stick it in a chest somewhere hidden from the player, then I'll move it when the time comes for the player to have it.

Thanks guys! I didn't expect so much help! :tongue:
User avatar
Strawberry
 
Posts: 3446
Joined: Thu Jul 05, 2007 11:08 am

Post » Mon Nov 19, 2012 4:15 am

how exactly should I reference the alias when using that command? It will be in dialogue in the same quest, so is it already a 'property'?

You would add a property of type ReferenceAlias to the dialogue script. You can fill such a property with the alias of any quest.
User avatar
Stacey Mason
 
Posts: 3350
Joined: Wed Nov 08, 2006 6:18 am

Post » Mon Nov 19, 2012 10:45 am

Okay, the whole 'fill the optional alias' thing just has me confused, so I'll just stick it in a chest somewhere hidden from the player, then I'll move it when the time comes for the player to have it.

Thanks guys! I didn't expect so much help! :tongue:
Assuming a "jeweller" is passing this necklace to the player, for them to deliver, then you might find B1g's original suggestion easiest, AV?

Just do a create-in, on the Player (as a container) ... You'd need a sub-quest though ... So may not the best idea, afterall ...

So yeah, just shove the thing in a chest and move it as needed ... You're right AV. ;)
User avatar
Sista Sila
 
Posts: 3381
Joined: Fri Mar 30, 2007 12:25 pm

Post » Sun Nov 18, 2012 10:00 pm

Well, I get the impression the player is supposed to make the necklace, so if you don't want to deal with setting up a Craft Item event node to handle that, then what could happen is at the appropriate time, just start checking for if the player has crafted the necklace in a script and swap it out for the one in the alias once the player gets a copy.
User avatar
Brandon Wilson
 
Posts: 3487
Joined: Sat Oct 13, 2007 1:31 am

Post » Mon Nov 19, 2012 6:41 am

The player is not crafting it, the NPC is. The issue was simply how to create it when he handed them the necklace, or move the already created alias into the players inventory, which I now know AddItem will do. :)
User avatar
josh evans
 
Posts: 3471
Joined: Mon Jun 04, 2007 1:37 am

Post » Mon Nov 19, 2012 12:03 pm

If it helps the WICourier quest does this with the courier's note. It creates a new note to fill the alias, sticks it in the courier's container and moves it to the player when the note is delivered. Useful if you need an example.
User avatar
Nick Pryce
 
Posts: 3386
Joined: Sat Jul 14, 2007 8:36 pm

Post » Mon Nov 19, 2012 12:49 pm

Not sure if I'm missing something, but I did 'Game.GetPlayer().AddItem(Necklace) and I get this error:

type mismatch on parameter 1 (did you forget a cast?)

Necklace is a 'ReferenceAlias' property I made on the script and directed towards my quests alias. Do I need to cast as something? I tried ObjectReference, and Armor, and it said both were incompatable. :/
User avatar
Jay Baby
 
Posts: 3369
Joined: Sat Sep 15, 2007 12:43 pm

Post » Mon Nov 19, 2012 11:36 am

http://www.creationkit.com/AddItem_-_ObjectReference expects a parameter of type http://www.creationkit.com/Form_Script. In order to get this from a http://www.creationkit.com/ReferenceAlias_Script you'll want to call http://www.creationkit.com/GetReference_-_ReferenceAlias on it and then http://www.creationkit.com/GetBaseObject_-_ObjectReference on the result of that.

Cipscis
User avatar
Avril Churchill
 
Posts: 3455
Joined: Wed Aug 09, 2006 10:00 am

Post » Mon Nov 19, 2012 3:45 am

But that would circumvent the entire point of this. To add an alias to the players inventory partially through the quest. If I add the base object (And I know exactly what it is, and it's always the same), wouldn't it just add one of those objects, and not the one marked as my alias?
User avatar
Dawn Porter
 
Posts: 3449
Joined: Sun Jun 18, 2006 11:17 am

Post » Mon Nov 19, 2012 8:32 am

But that would circumvent the entire point of this. To add an alias to the players inventory partially through the quest. If I add the base object (And I know exactly what it is, and it's always the same), wouldn't it just add one of those objects, and not the one marked as my alias?
I still think best way is to start a new quest and use the Create-In Option.

Yeah, it may well mean making a couple of logic changes to the quest structure, but should not be much ... You could even split the quest just before the necklace is created. So Part1 runs to the step before creation and then Part Two starts and Creates the necklace alias (in the player container) as one of its startup steps.

Easy to do and works like a charm ----> Last dialogue event in Part One is "here is the necklace, can you take it to Mr Smith for me?" (script to start Part2) and then - in Part Two - necklace is "created in player container" Alias and Objective set to Mr Smith (script on Necklace, OnChangedContainer ... check it is Mr Smith ... complete Quest)


No need for all the mither :wink:
User avatar
Steve Bates
 
Posts: 3447
Joined: Sun Aug 26, 2007 2:51 pm

Post » Mon Nov 19, 2012 3:57 am

When you're adding an item to the player, the script needs to know which one. In this situation you have 2 options.

1. Make a property of the object, and add that item.
2. Add the item as its alias, rather than its property.

So you could use

Game.GetPlayer().AddItem(Alias.GetReference().Aliasnamehere, 1)

Which would make the quest look for that alias item and add it.
User avatar
Latino HeaT
 
Posts: 3402
Joined: Thu Nov 08, 2007 6:21 pm

Post » Mon Nov 19, 2012 9:34 am

http://www.creationkit.com/AddItem_-_ObjectReference expects a parameter of type http://www.creationkit.com/Form_Script. In order to get this from a http://www.creationkit.com/ReferenceAlias_Script you'll want to call http://www.creationkit.com/GetReference_-_ReferenceAlias on it and then http://www.creationkit.com/GetBaseObject_-_ObjectReference on the result of that.

Cipscis

Going all the way back to the Form level is unnecessary for AddItem. The function permits References to be used, as well (Beth's own setup of the function is a bit misleading in that regard). So just do an AddItem (MyObjectAlias.GetReference()) and it will move the Refernce that is currently filling the Alias into the Player's inventory.
User avatar
Pumpkin
 
Posts: 3440
Joined: Sun Jun 25, 2006 10:23 am

Post » Mon Nov 19, 2012 2:19 am

When you're adding an item to the player, the script needs to know which one. In this situation you have 2 options.

1. Make a property of the object, and add that item.
2. Add the item as its alias, rather than its property.

So you could use

Game.GetPlayer().AddItem(Alias.GetReference().Aliasnamehere, 1)

Which would make the quest look for that alias item and add it.
Okay this appears to be what I was missing, but I'm lost on the syntax. It's telling me that GetReference() isn't a function.

So I have the alias in my quest, that's a 'Create In' on a nearby underground chest. I created a property on the script fragment that's a ReferenceAlias directed to my quest's alias. And I called it Necklace. Based on that info, is this the incorrect way of typing the line?:

Game.GetPlayer().AddItem((Alias.GetReference()).Necklace)
User avatar
Naomi Ward
 
Posts: 3450
Joined: Fri Jul 14, 2006 8:37 pm

Post » Mon Nov 19, 2012 1:20 am

It depends which script your AddItem is in. If its in the quest script, you call Alias. For example in a quest stage.

If its in a seperate script, you word it differently.

Let me switch my PC on and get you my script :) I only ever use aliases where I can, so I have it all down.
User avatar
helliehexx
 
Posts: 3477
Joined: Fri Jun 30, 2006 7:45 pm

Post » Mon Nov 19, 2012 12:27 pm

Okay. It's currently in a dialogue response end fragment.
User avatar
CSar L
 
Posts: 3404
Joined: Fri Nov 09, 2007 9:36 pm

Next

Return to V - Skyrim