Jump to content

Simple add item script


Guest deleted849934

Recommended Posts

Guest deleted849934

I'm trying to make a simple script that will add an item on use. Can't find one single clear answer on this and tired of reading through 50 pages of stuff that doesn't answer it, so any help is appreciated.

 

I'm tired of micromanaging plain so just to clean my character so want to create a self replicating item to make it essentially unlimited use.

 

1. I clone the SBBathPlainSoap item from Keep It Clean mod. The consumable is a potion.

2. I made it SBBathBrush so that it retains the effects of what using plain soap does for the mod.

3. I made a SBBathBrush magiceffect which will house the script needed to generate the item (SBBathBrush)

 

Now this is where I need retard mode instructions as a person who has never done scripting before.

 

1. In the magic effect in 'Papyrus Scripts' I click add

2. Add New Script menu pops up asking for:

  1. Name
  2. Extends
  3. Document String

 

Now the ONLY example I found of script adding an item was:

 

Scriptname bread extends activemagiceffect

{Event OnEffectStart(Actor akTarget, Actor akCaster)
Game.GetPlayer().AddItem(bread) ;get player reference and give him the object
EndEvent}

 

Don't even know if that script is correct.

 

But from what I gather, on the add the name spot takes care of the 'Scriptname SBBathBrushAdd' portion. I would write in activemagiceffect (this or maybe object reference dunno). Then for 'Document String' I put in the event line.

 

From there, I gather from reading that I'm supposed to then select that script and click 'Properties' to define what (BathBrush) refers to. Assuming all to this point is correct, I get lost here on how to point back to the original potion item SBBathBrush.

 

The 'Add Script Property' asks for:

  1. Type - Which I'm going to assume would be potion, since that's what I'm trying to add.
  2. Name - I don't know if I'm supposed to add the name SBBathBrush that's already created or what.
  3. Initial Value - Don't know what this means. If it's supposed to be how many items or something else or just blank.
  4. Document String - At this point it looks like I'm creating another script which kind of defeats the purpose.

Any help would be appreciated. Basically this creates a new potion item Bath Brush, to replace plain soap. When you use it to bathe, it will generate a new one in your inventory so that the item is a persistent item.

 

My reasoning is that I should be able to bath in water and scrub myself with the brush to remove the Keep it Clean negative effects as much as I want, and I should only need to worry about buying or crafting soaps if I want the buffs.

Link to comment
Share on other sites

Add item to player via magic effect when the magic effect starts:

 

 

Scriptname myScript extends activemagiceffect  

Potion Property myPotion Auto

Event OnEffectStart(Actor akTarget, Actor akCaster)
  Game.GetPlayer().AddItem(myPotion,1)
EndEvent

 

 

 

Add item to player via magic effect when the magic effect ends:

 

 

Scriptname myScript extends activemagiceffect  

Potion Property myPotion Auto

Event OnEffectFinish(Actor akTarget, Actor akCaster)
  Game.GetPlayer().AddItem(myPotion,1)
EndEvent

 

 

Obviously if your item is not a potion, then change the property type as necessary. Replace myScript with whatever name you want for the script. Replace myPotion with whatever name you want to reference the object to add to the player within the script, if you use the Editor ID name you can auto-fill the property via the auto-fill button.

 

That said, if there is already a script on the magic effect that script could be edited instead of adding another script. These are merely examples.

Link to comment
Share on other sites

Guest deleted849934

Thanks for your response.

 

So I had to look up the proper way of adding script. I was thinking the document string is where script went, but learned it's just the modder's notes. So added the item and opened it up in editor to add the script. This is what I have. You can see the SBBathBrush potion name in editor ID, and the new magiceffect I'm trying to make. When I click compile it says it compiles fine. If I hit save it says that there's an error so I want to save.

 

unknown.png

Link to comment
Share on other sites

Guest deleted849934

Nevermind. I figured it out.

 

So when adding this script via Creation Kit. I'm not replacing myPotion with the name of the potion I want. I have to compile the script and THEN click properties and see there is a property attached to SBBathBrush. From there I edit that myPotion property and click the drop down menu you and select SBBathBrush to reference it.

 

It's little steps like that, noobs like me don't know and probably so second nature to modders they don't think about it. So thank you. Now I think I am getting a handle on simple scripting.

 

Again, thanks for pointing me in right direction on building the script. I have background in coding in other platforms, so it's much easier for me to see a script and see what it does, than to see how to put it together from scratch.

Link to comment
Share on other sites

  • Recently Browsing   0 members

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