Jump to content

Need help with quest and scripting to spawn item in inventory.


Recommended Posts

Before I pour out my eyes I will give a little background on me. I'm an experienced modder, however, the CK for Fallout 4 has me tearing out my hair. I thought since I've modding Fallout New Vegas and Skyrim it would be easy but that isn't the case. Here's some of my work for Skyrim, http://steamcommunity.com/profiles/76561197977765379/myworkshopfiles/?appid=72850. Here's some of my work for Fallout New Vegas, http://www.thepcmasterrace.com/red-hood-fallout-new-vegas-mod/.

 

Now that is out the way I need help making an item spawn in your inventory upon the game start up. I've done this in New Vegas and Skyrim but it's not so easy with Fallout 4, in my case. I've tried making a quest but the quest never starts when I load up the mod nor does the script work either. I've tried going off other people code but nothing works. If anyone with experience in either making quest or scripting could help I will credit you on my first mod. All I'm trying to accomplish is make a simple quest that starts as soon as you load the game then it completes and give you an item.

Link to comment

Create a quest

Add a reference alias to it

Set the ref alias to be specific to the player

Add a script to the reference alias

Use the event OnPlayerLoadGame

 

Something like:

 

Event OnPlayerLoadGame()

  PlayerRef.AddItem(theItemIWantToAdd, 1)

EndEvent

 

Link to comment

Create a quest

Add a reference alias to it

Set the ref alias to be specific to the player

Add a script to the reference alias

Use the event OnPlayerLoadGame

 

Something like:

 

Event OnPlayerLoadGame()

  PlayerRef.AddItem(theItemIWantToAdd, 1)

EndEvent

 

Would you mine adding me on Steam by any chance? If you help me with this first mod I will add you as contributor. Here's how the quest is set up.

 

Quest Data

  • ID = Somename
  • Quest Name = Somename
  • Priority = 10
  • Start Game Enabled
  • Run Once

Quest Stage

  • 10
  • 20
  • 30 = Complete Quest

Not my script I tried to use it but it doesn't work.

 

Scriptname aaaGiveArmorQuestScript extends Quest
 
; -----------------------------------------------------------------------------   
; PROPERTIES  
; -----------------------------------------------------------------------------  
Armor Property MonsterArmor auto
 
; -----------------------------------------------------------------------------  
; EVENTS  
; -----------------------------------------------------------------------------  
 
Event OnPlayerLoadGame(Actor Target, Actor Caster)
 
Game.GetPlayer().AddItem(MonsterArmor)
 
Game.GetPlayer().EquipItem(MonsterArmor)
 
EndEvent
____________________________
 
Error Script throws out.

 

______________________

 

Papyrus Compiler Version 2.8.0.4 for Fallout 4
Copyright © ZeniMax Media. All rights reserved.
Starting 1 compile threads for 1 files...
Compiling "aaaGiveArmorQuestScript"...
C:\Users\Admin\AppData\Local\Temp\PapyrusTemp\aaaGiveArmorQuestScript.psc(12,0): new event onplayerloadgame cannot be defined because the script is not flagged as native
No output generated for aaaGiveArmorQuestScript, compilation failed.
 
Batch compile of 1 files finished. 0 succeeded, 1 failed.
Failed on aaaGiveArmorQuestScript
 
Link to comment

CPU Lives!!!!!!!!!!

9090414_orig.jpg

 

(Actually knew that already.... but....)

 

ps

 

What they said is correct. (but, What do I know?). Anyhow... what is your final aim for your mod?, (i.e. lots of api's from other mods which can be accosted in Skyrim which can achieve things which you might want do when used in combination. However, admittedly, you do need them to be a base mod to get access to their api).

Link to comment

CPU Lives!!!!!!!!!!

9090414_orig.jpg

 

(Actually knew that already.... but....)

 

ps

 

What they said is correct. (but, What do I know?). Anyhow... what is your final aim for your mod?, (i.e. lots of api's from other mods which can be accosted in Skyrim which can achieve things which you might want do when used in combination. However, admittedly, you do need them to be a base mod to get access to their api).

 

Well basically I'm trying to make the armor spawn as soon as you start game. Here's an example of what I'm referring to in a previous mod I made on New Vegas and Skyrim.

 

New Vegas

 

 

Skyrim

 

Link to comment

 

CPU Lives!!!!!!!!!!

9090414_orig.jpg

 

(Actually knew that already.... but....)

 

ps

 

What they said is correct. (but, What do I know?). Anyhow... what is your final aim for your mod?, (i.e. lots of api's from other mods which can be accosted in Skyrim which can achieve things which you might want do when used in combination. However, admittedly, you do need them to be a base mod to get access to their api).

 

Well basically I'm trying to make the armor spawn as soon as you start game. Here's an example of what I'm referring to in a previous mod I made on New Vegas and Skyrim.

 

New Vegas

 

 

Skyrim

 

 

 

Sorry I'm old and take every post to be Skyrim related rather than there is a 'new' thing. If Skyrim, I'd of done something additem'thingy under 'Event OnInit()" if for only once or If everyload "Event OnPlayerLoadGame()", with a call to 'OnPlayerLoadGame()' from OnInit not to duplicate code. However this question isn't for Skyrim. Ho hum, new world order, bla bla bla. :) Sorry! - ignore. (well everything apart from CPU's stuff).

 

Have a picture of a black pudding.

 

black-pudding-nutrition-2.jpg

 

 

 

Link to comment

You have a script for a Quest. You should use a script for a Reference Alias.

 

Create a Quest.

Inside the Quest create a Reference Alias and set it to the Player

Attach a script to the ReferenceAlias with this code:

 

 

Scriptname abcdAutoEquipArmorOnLoad extends ReferenceAlias
 
Actor Property PlayerRef Auto
Armor Property MonsterArmor Auto
 
Event OnInit()
  if PlayerRef.getItemCount(MonsterArmor)==0
    PlayerRef.addItem(MonsterArmor, 1)
  endIf
  PlayerRef.equipItem(MonsterArmor, False, False)
EndEvent
 
Event OnPlayerLoadGame()
  if PlayerRef.getItemCount(MonsterArmor)==0
    PlayerRef.addItem(MonsterArmor, 1)
  endIf
  PlayerRef.equipItem(MonsterArmor, False, False)
EndEvent

 

Link to comment

 

You have a script for a Quest. You should use a script for a Reference Alias.

 

Create a Quest.

Inside the Quest create a Reference Alias and set it to the Player

Attach a script to the ReferenceAlias with this code:

Scriptname abcdAutoEquipArmorOnLoad extends ReferenceAlias
 
Actor Property PlayerRef Auto
Armor Property MonsterArmor Auto
 
Event OnInit()
  if PlayerRef.getItemCount(MonsterArmor)==0
    PlayerRef.addItem(MonsterArmor, 1)
  endIf
  PlayerRef.equipItem(MonsterArmor, False, False)
EndEvent
 
Event OnPlayerLoadGame()
  if PlayerRef.getItemCount(MonsterArmor)==0
    PlayerRef.addItem(MonsterArmor, 1)
  endIf
  PlayerRef.equipItem(MonsterArmor, False, False)
EndEvent

Thanks will give this a try and if all is well I will add you as contributor to my first mod.

 

EDITED: THANKS IT WORKED YOU'RE THE BEST!  :D

Link to comment

Archived

This topic is now archived and is closed to further replies.

  • Recently Browsing   0 members

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

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. For more information, see our Privacy Policy & Terms of Use