Jump to content

Creating an Aid Item That Rewards XP


Recommended Posts

I don't have enough left in me to test this, as helping out around here has been feeling like some stupid competition, I don't even know if it'll compile.

 

 

Scriptname RewardExperiencePointsScript extends ReferenceAlias

ActorValue property Experience auto
{ The total amount of experience gained since level 1. }

Potion property aidItem auto
{ The potion to listen for. }

Float property expToReward auto
{ Change this to amount of experience you want to reward. }
; NOTE: The exp bar widget can't be stopped, so large values will take awhile for the bar to "finish".

Event OnItemEquipped(Form akBaseObject, ObjectReference akReference)
    ; Set the player's experience
    akBaseObject = akBaseObject as Potion
    
    if akBaseObject == TRUE && akBaseObject == aiItem
        (GetReference() as Actor).ModValue(Experience, expToReward)
    endIf
endEvent

 

Place on a player alias in quest. I guess there might be an easier, no scripted way to do it, or whatever, I don't know. Hope that works for you(or somebody out there). Good day and good luck.

Link to comment
Share on other sites

I don't have enough left in me to test this, as helping out around here has been feeling like some stupid competition, I don't even know if it'll compile.

Scriptname RewardExperiencePointsScript extends ReferenceAlias

ActorValue property Experience auto
{ The total amount of experience gained since level 1. }

Potion property aidItem auto
{ The potion to listen for. }

Float property expToReward auto
{ Change this to amount of experience you want to reward. }
; NOTE: The exp bar widget can't be stopped, so large values will take awhile for the bar to "finish".

Event OnItemEquipped(Form akBaseObject, ObjectReference akReference)
    ; Set the player's experience
    akBaseObject = akBaseObject as Potion
    
    if akBaseObject == TRUE && akBaseObject == aiItem
        (GetReference() as Actor).ModValue(Experience, expToReward)
    endIf
endEvent

Place on a player alias in quest. I guess there might be an easier, no scripted way to do it, or whatever, I don't know. Hope that works for you(or somebody out there). Good day and good luck.

Thank you, I'll try it. Sorry to hear you're feeling a bit worn out. :c

Link to comment
Share on other sites

I'd recommend using using this function instead:

Game.RewardPlayerXP(expToReward.GetValueInt()) 

This is how it's done in the base game scripts I've looked at.

I'll try it. Feeling a bit rusty with the Creation Kit right now, so I feel like I'm sort've stumbling around trying to figure out how to do everything again.

Link to comment
Share on other sites

I'd recommend using using this function instead:

Game.RewardPlayerXP(expToReward.GetValueInt()) 

This is how it's done in the base game scripts I've looked at.

So I tried to figure out what to do, and I'm sorry, I'm at a complete loss despite having handled dialogue and certain smaller scripts before. I don't suppose you could help give me step-by-step instructions to do what I want this to do?

Link to comment
Share on other sites

So you've got your new Potion item. You'll want to make a new Magic Effect and change the Effect Archetype to Script, you'll need to click OK to create the new Magic Effect before adding a script. So open up your effect and in the bottom right click Add, then New Script. Once you've got your script on the effect you'll want to open in and add this:

Float Property expToGive Auto Const

Event OnEffectStart(Actor akTarget, Actor akCaster)
	Game.RewardPlayerXP(expToGive.GetValueInt()) 
EndEvent

Now compile it, go into Properties and set expToGive to your desired value. Now add your Magic Effect to your Potion and you should be good to go.

Edited by Pokepunch
Link to comment
Share on other sites

So you've got your new Potion item. You'll want to make a new Magic Effect and change the Effect Archetype to Script, you'll need to click OK to create the new Magic Effect before adding a script. So open up your effect and in the bottom right click Add, then New Script. Once you've got your script on the effect you'll want to open in and add this:

Float Property expToGive Auto Const

Event OnEffectStart(Actor akTarget, Actor akCaster)
	Game.RewardPlayerXP(expToGive.GetValueInt()) 
EndEvent

Now compile it, go into Properties and set expToGive to your desired value. Now add your Magic Effect to your Potion and you should be good to go.

Okay, so I ran into some trouble with compiling. Here's what I did:

 

Creating The Potion

- Duplicated Med-X

- Changed it's BaseID to XPBoost

- Changed it's Name to XP Boost

- Changed It's Desc to +200 XP

- Deleted the old three Effects

- Clicked OK

 

Creating the Magic Effect

- Created a new Magic Effect

- Set it's ID to XPBoostEffect

- Set It's name to BoostXP

- Clicked OK

 

Creating the Script

- Re-opened the Magic Effect

- Clicked Add in the Papyrus Scripts section

- Selected New Script and clicked OK

- Named it "XPBoostScript"

- Clicked OK

- Closed the Properties window that came up

- Right-clicked my script in the XPBoostEffect window

- Selected "Open in External Editor" (in this case, a standard notepad)

- Copy and pasted the script you gave me into it so that it looked like this:

Scriptname XPBoostScript extends activemagiceffect

Float Property expToGive Auto Const

Event OnEffectStart(Actor akTarget, Actor akCaster)
	Game.RewardPlayerXP(expToGive.GetValueInt()) 
EndEvent

- Saved and closed it

- Pressed OK to close the XPBoostEffect window

- Navigated to Gameplay>Compile Papyrus Scripts in the top bar

- Selected XPBoostScript and clicked Compile

 

It came back with this:

Papyrus Compiler Version 2.8.0.4 for Fallout 4
Copyright (C) ZeniMax Media. All rights reserved.
Starting 1 compile threads for 1 files...
Compiling "XPBoostScript.psc"...
C:\Program Files (x86)\Steam\steamapps\common\Fallout 4\Data\Scripts\Source\User\XPBoostScript.psc(6,31): float is not a known user-defined script type
C:\Program Files (x86)\Steam\steamapps\common\Fallout 4\Data\Scripts\Source\User\XPBoostScript.psc(6,31): type mismatch on parameter 1 - cannot pass a void to a int
No output generated for XPBoostScript.psc, compilation failed.

Batch compile of 1 files finished. 0 succeeded, 1 failed.
Failed on XPBoostScript.psc
Link to comment
Share on other sites

That w

 

Try changing expToGive from float to int and then remove ".GetValueInt()"

That got it working, thank you so much.

That's, luckily, one technical part out of the way out of two - once both of those are done, the rest of what I'm working on, I'll be able to do myself. Thanks for the help.

Link to comment
Share on other sites

  • Recently Browsing   0 members

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