Jump to content

Needing Help Adding Items and XP Via Dialogue.


Recommended Posts

Hello,

 

I'm trying to get an NPC to give the player items via a dialogue choice. I tired to get the NPC to give the player items via the DefaultTopicAddItem script however it only gives a random item from the LeveledItem form instead off all the items.

 

I also need to have the NPC give the player XP, which after trying a few things that I thought would I'm just stunted currently.

 

The biggest issue is that I'm a complete Papyrus noob, so its making this 20 times harder than it should be.

 

If anyone has any help/suggestions/advice it would be very, very, much appreciated.

Link to comment
Share on other sites

In the script "End" of the topic (the script box at the bottom of the 'topic info'), or in "Begin", depends if prefer it to happen before the NPC says the line or after.

You need to add a property for the item that you want to give to the player, and use this property as argument for the AddItem function, check out the following wiki page:

https://www.creationkit.com/fallout4/index.php?title=AddItem_-_ObjectReference

 

Then you can call RewardPlayerXP:

https://www.creationkit.com/fallout4/index.php?title=RewardPlayerXP_-_Game

 

In the property, you need to set a name, let say you want to give a pen, the pen is a misc object, so you name it pen and select misc object and press ok to add the property, then you need to fill the property so it points to the actual misc object for the pen.

The name you set for the property is the one you'll use when you call AddItem in the script.

Link to comment
Share on other sites

Thanks for your help DieFem.

I've been trying a few things now and I've ran into a new road block. I've managed to write a script that is supposed to add xp but for some strange reason it doesn't work (in the spoiler). The issue is that once the line has been and said and ended nothing happens.

 

Scriptname TopicAddCheatXP extends TopicInfo const
bool Property XPRewardOnBegin = false const auto
{Default: false; should we reward xp when the topic starts playing?}
bool Property XPRewardOnEnd = true const auto
{Default: true; Should we reward XP when the topic finishes playing?}

int property XPReward const auto
{How xp is given to the player?}

Event OnBegin(ObjectReference akSpeakerRef, bool abHasBeenSaid)
	if XPRewardOnBegin
		debug.trace(self + "OnBegin() will RewardPlayerXP" + XPReward)
		Game.RewardPlayerXP(XPReward)
	endif
endEvent

Event OnEnd (ObjectReference akSpeakerRef, bool abHasBeenSaid)
	if XPRewardOnEnd
		debug.trace(self + "OnBegin() will RewardPlayerXP" + XPReward)
		Game.RewardPlayerXP(XPReward)
	endif
endEvent
 

 

 

 

 

Link to comment
Share on other sites

You attached a custom script to the topic, I didn't tried to do it that way so I can't help if you do it like that. Use the begin and end fragment text boxes at the bottom of the topic, those will create a Fragment_Begin/Fragment_End function that works perfectly fine.

Edited by DieFeM
Link to comment
Share on other sites

  • Recently Browsing   0 members

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