Jump to content

Script to give an Item to the player


danatoth666

Recommended Posts

Ah. I guess that would explain the problem. What you're looking at is one of those Radiant quests that (I think) uses keywords to supply references and such. Probably not what you wanted. I was working from DA02Script myself.

 

I wasn't trying to do a Radiant quest it was just the only reference to giving an item I could find. Now that I'm looking at DAO2 I'm noticing this line:

 

PlayerRef .AddItem(kmyquest.DA02Dagger)

 

What is the "kmyquest" exactly?

Link to comment
Share on other sites

For some reason, I find that the only way to get properties working correctly in the scripts, is to add them via CK, not directly into code. The CK adds the same line of code I would add, but I think it also associates the property with the correct object, which does not happen if you just type something like "GlobalVariable Property MyVariable Auto" in the script.

 

So if you have set up your object and want to declare a property for it in the script, try using the CK interface to do it, and make sure that you have picked your object for that property once it's created.

Link to comment
Share on other sites

  • 1 year later...

Lol, this thread is mad funny.

 

Forget about alias's and all that stuff. Just go onto the quest stages tab of your quest, click onto the stage you want to add the gold, and add a new property to the script fragment there, of the type "miscitem" and call it Gold001, and then use autofill, and it will fill it automatically.

 

Then back in the script just type this:

Game.GetPlayer().Additem(Gold001, 2000)
Edited by rjhelms84
Link to comment
Share on other sites

For some reason, I find that the only way to get properties working correctly in the scripts, is to add them via CK, not directly into code. The CK adds the same line of code I would add, but I think it also associates the property with the correct object, which does not happen if you just type something like "GlobalVariable Property MyVariable Auto" in the script.

 

So if you have set up your object and want to declare a property for it in the script, try using the CK interface to do it, and make sure that you have picked your object for that property once it's created.

 

 

You can write it yourself in the script, but you still need to set what the property points to in the properties window.

Link to comment
Share on other sites

  • 2 months later...

Basically the way you have to look at Papyrus is this: Papyrus knows NOTHING about what anything in the game is. You basically have to use variable properties to define everything, which in full form scripts means to define your items before the rest of your code ex: ObjectReference Propery BIGASSSWORD Auto

 

I like to make my properties all caps so they stand out to me in the code. Then you tell it what you want to do with BIGASSSWORD and save the script, then you have the "property" button where you actually get to tell papyrus WHAT that BIGASSSWORD refers to...

 

In quest and dialog it's trickier because you have to go through alias' for everything. You need an alias container OR NPC and you need an alias for the item you want to give. You then tell the item alias to generate a reference inside of the container or the NPC when the quest starts (i'ts fairly easy on the alias page to figure that out), then you slap the script fragment in that adds the item to the player (the standard Game.GetPlayer...etc etc Call) and the alias is where you want to take it from.

 

It's kinda confusing and a big pain in the butt to set up, especially for one off things, but the new system is vastly more versatile for handling things with generic functions instead of custom code for every task. I'm still learning it all myself, but I'm starting to get back to my old Oblivion proficiency :smile:

Edited by icecreamassassin
Link to comment
Share on other sites

  • Recently Browsing   0 members

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