Jump to content

[LE] Script connects but won't add item


Recommended Posts

Problem: I am trying to make a script that adds one Gold Ingot upon casting a spell. The script connects and claims the ingot has been added, but no ingot is added.

 

 

Code:

Scriptname goldspell extends activemagiceffect 

MiscObject property Sum Auto

Event OnEffectFinish(Actor akTarget, Actor akCaster)
	Debug.Notification("connect with script")
	akCaster == Game.GetPlayer()
	Game.GetPlayer().AddItem(Sum, 1, true)
	Debug.Notification("added an ingot")
endEvent 

I have gone over and changed much of the code in a few hours and every time, the outcome is the same. The messages play, but no item is added. I've used the properties to add the value as "IngotGold". Any ideas on how to get it to actually add an ingot to the player's inventory?

 

I am new to scripting in papyrus and using Creation Kit (yes, I have gone through some tutorials).

 

Fixed it. Error was due to another mod

Edited by IAmOliverQueen
Link to comment
Share on other sites

maybe you should thinking about your script code

 

iaoqIngotMGEFScript

 

Scriptname iaoqIngotMGEFScript extends ActiveMagicEffect 
; https://forums.nexusmods.com/index.php?/topic/7643778-script-connects-but-wont-add-item/

  MiscObject PROPERTY Sum auto     ; the object you want to add


; -- EVENT --

EVENT OnEffectStart(Actor akTarget, Actor akCaster)
IF (akCaster == Game.GetPlayer())
;;; Utility.Wait(1.5)                            ; if you need you can wait here for a while
    akCaster.AddItem(Sum, 1, TRUE)
    Debug.Notification("added an ingot")
ENDIF
ENDEVENT

 

 

Link to comment
Share on other sites

maybe you should thinking about your script code

 

iaoqIngotMGEFScript

 

Scriptname iaoqIngotMGEFScript extends ActiveMagicEffect 
; https://forums.nexusmods.com/index.php?/topic/7643778-script-connects-but-wont-add-item/

  MiscObject PROPERTY Sum auto     ; the object you want to add


; -- EVENT --

EVENT OnEffectStart(Actor akTarget, Actor akCaster)
IF (akCaster == Game.GetPlayer())
;;; Utility.Wait(1.5)                            ; if you need you can wait here for a while
    akCaster.AddItem(Sum, 1, TRUE)
    Debug.Notification("added an ingot")
ENDIF
ENDEVENT

 

 

Thanks for this. May have to try this on a heavy modded save.

Link to comment
Share on other sites

  • Recently Browsing   0 members

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