Jump to content
ℹ️ Intermittent Download History issues ×

Need help with scripts for adding items to inventory after using consumable?


Recommended Posts

So I'm working on a Packed Lunch mod and I need to know what to type into my script in order to add a plastic knife, plastic fork and Vault-tec lunchbox into the players inventory once the packed lunch is consumed. This is my first time ever making a script and any help would be greatly appreciated. I'm using the CK.

Link to comment
Share on other sites

Create a new magic effect of archetype Script, casting type: Fire and forget and delivery: self. Check no magnitude, no area and no duration checkboxes. Then attach new script on it and paste following code inside:

MiscItem property PlascticFork Auto
MiscItem property PlascticKnife Auto
MiscItem property VTecLunchbox Auto
Bool property isSilent Auto

Event OnEffectStart(Actor akTarget, Actor akCaster)
	Game.GetPlayer().AddItem(PlascticFork, 1, isSilent)
	Game.GetPlayer().AddItem(PlascticKnife, 1, isSilent)
	Game.GetPlayer().AddItem(VTecLunchbox, 1, isSilent)
endEvent

Then go to properties and fill each of them. if you check isSilent property, then these items will be added without showing notification in upper left part of screen.

After that, open your PackedLuch potion item and add your created magic effect on it.

That's all.

Link to comment
Share on other sites

 

 

Create a new magic effect of archetype Script, casting type: Fire and forget and delivery: self. Check no magnitude, no area and no duration checkboxes. Then attach new script on it and paste following code inside:

MiscItem property PlascticFork Auto
MiscItem property PlascticKnife Auto
MiscItem property VTecLunchbox Auto
Bool property isSilent Auto

Event OnEffectStart(Actor akTarget, Actor akCaster)
	Game.GetPlayer().AddItem(PlascticFork, 1, isSilent)
	Game.GetPlayer().AddItem(PlascticKnife, 1, isSilent)
	Game.GetPlayer().AddItem(VTecLunchbox, 1, isSilent)
endEvent

Then go to properties and fill each of them. if you check isSilent property, then these items will be added without showing notification in upper left part of screen.

After that, open your PackedLuch potion item and add your created magic effect on it.

That's all.

 

It's not compiling, I'm getting some no output generated error and nothing's showing up under properties... I don't know, maybe modding just isn't for me. Like seriously, how f*#@ing far will I even get if I can't even make a simple script? I appreciate the help anyway though so thanks for that, but I think I'm in over my head...

Link to comment
Share on other sites

 

Create a new magic effect of archetype Script, casting type: Fire and forget and delivery: self. Check no magnitude, no area and no duration checkboxes. Then attach new script on it and paste following code inside:

MiscItem property PlascticFork Auto
MiscItem property PlascticKnife Auto
MiscItem property VTecLunchbox Auto
Bool property isSilent Auto

Event OnEffectStart(Actor akTarget, Actor akCaster)
	Game.GetPlayer().AddItem(PlascticFork, 1, isSilent)
	Game.GetPlayer().AddItem(PlascticKnife, 1, isSilent)
	Game.GetPlayer().AddItem(VTecLunchbox, 1, isSilent)
endEvent

Then go to properties and fill each of them. if you check isSilent property, then these items will be added without showing notification in upper left part of screen.

After that, open your PackedLuch potion item and add your created magic effect on it.

That's all.

 

It's not compiling, I'm getting some no output generated error and nothing's showing up under properties... I don't know, maybe modding just isn't for me. Like seriously, how f***ing far will I even get if I can't even make a simple script? I appreciate the help anyway though so thanks for that, but I think I'm in over my head...

 

It's my fault. The form is called MiscObject not MiscItem. Try this:

MiscObject property PlascticFork Auto
MiscObject property PlascticKnife Auto
MiscObject property VTecLunchbox Auto
Bool property isSilent Auto

Event OnEffectStart(Actor akTarget, Actor akCaster)
	Game.GetPlayer().AddItem(PlascticFork, 1, isSilent)
	Game.GetPlayer().AddItem(PlascticKnife, 1, isSilent)
	Game.GetPlayer().AddItem(VTecLunchbox, 1, isSilent)
endEvent
Link to comment
Share on other sites

 

 

Create a new magic effect of archetype Script, casting type: Fire and forget and delivery: self. Check no magnitude, no area and no duration checkboxes. Then attach new script on it and paste following code inside:

MiscItem property PlascticFork Auto
MiscItem property PlascticKnife Auto
MiscItem property VTecLunchbox Auto
Bool property isSilent Auto

Event OnEffectStart(Actor akTarget, Actor akCaster)
	Game.GetPlayer().AddItem(PlascticFork, 1, isSilent)
	Game.GetPlayer().AddItem(PlascticKnife, 1, isSilent)
	Game.GetPlayer().AddItem(VTecLunchbox, 1, isSilent)
endEvent

Then go to properties and fill each of them. if you check isSilent property, then these items will be added without showing notification in upper left part of screen.

After that, open your PackedLuch potion item and add your created magic effect on it.

That's all.

 

It's not compiling, I'm getting some no output generated error and nothing's showing up under properties... I don't know, maybe modding just isn't for me. Like seriously, how f***ing far will I even get if I can't even make a simple script? I appreciate the help anyway though so thanks for that, but I think I'm in over my head...

 

It's my fault. The form is called MiscObject not MiscItem. Try this:

MiscObject property PlascticFork Auto
MiscObject property PlascticKnife Auto
MiscObject property VTecLunchbox Auto
Bool property isSilent Auto

Event OnEffectStart(Actor akTarget, Actor akCaster)
	Game.GetPlayer().AddItem(PlascticFork, 1, isSilent)
	Game.GetPlayer().AddItem(PlascticKnife, 1, isSilent)
	Game.GetPlayer().AddItem(VTecLunchbox, 1, isSilent)
endEvent

Thank you so much for your help, I got it working and I'm fine tuning it and packaging it now. Would you be okay with me crediting you for your help on my mod page?

Link to comment
Share on other sites

It never hurts to acknowledge help received when help is given.

I heartily agree, however as a sign of respect I like to ask for permission first. He may not want the publicity for all I know, but I'd very much like to credit him if he's okay with it.

Link to comment
Share on other sites

 

It never hurts to acknowledge help received when help is given.

I heartily agree, however as a sign of respect I like to ask for permission first. He may not want the publicity for all I know, but I'd very much like to credit him if he's okay with it.

 

I'm going to upload now and credit you anyway Shav. If you wish for me to remove your credit at a later date just ask and I'll do so.

Link to comment
Share on other sites

One thing I notice with that script is that even if an NPC consumes the packed lunch, it will add the Misc items to the player inventory. You may want to add to the script so that it checks to see if the player is the one that consumed it.
Link to comment
Share on other sites

  • Recently Browsing   0 members

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