I'm trying to convert my Merchant Contract mod from Oldrim to SE but it's not working. The contract shows up where it should, but when the script runs, Int Gold = Game.GetPlayer().GetItemCount(Gold001) always equals 0 (I have gold). When I skip the gold check out and try to summon the NPC, it doesn't work either. It calls the Summon function, but no summon happens. I used coc to go to TestTony (where the NPC starts) and she's there hanging out so it seems to be a script problem entirely. Any ideas? Full code:
Scriptname SummonedBuyerContract extends ObjectReference
Actor Property SummonedBuyerActor Auto
Message Property SummonedBuyerMSG Auto
Book Property SummonBuyerContractBook Auto
MiscObject Property Gold001 Auto
Event OnEquipped(Actor player)
Int Response = -1
Bool ExitMenu = False
Int Gold = Game.GetPlayer().GetItemCount(Gold001)
While !ExitMenu
Response = SummonedBuyerMSG.Show()
If Response == 0
If Gold < 1000
Debug.MessageBox("You don't have enough gold.")
ExitMenu=True
Else
Game.DisablePlayerControls(false, false, false, false, false, true, false)
utility.wait(0.1)
Game.EnablePlayerControls(false, false, false, false, false, true, false)
Summon(Game.GetPlayer(),SummonedBuyerActor)
Game.GetPlayer().RemoveItem(Gold001,1000)
ExitMenu = True
EndIf
Else
ExitMenu = True
EndIf
EndWhile
;SummonedBuyerActor.MoveTo(Game.GetPlayer(),120 * Math.Sin(Game.GetPlayer().GetAngleZ()), 120 * Math.Cos(Game.GetPlayer().GetAngleZ()),0, false)
EndEvent
Function Summon(ObjectReference akSummoner = None, ObjectReference akSummon = None, Float afDistance = 150.0, Float afZOffset = 0.0, ObjectReference arPortal = None, Int aiStage = 0)
While aiStage < 6
aiStage += 1
If aiStage == 1 ; Shroud summon with portal
arPortal = akSummon.PlaceAtMe(Game.GetForm(0x0007CD55)) ; SummonTargetFXActivator disables and deletes itself
ElseIf aiStage == 2 ; Disable Summon
akSummon.Disable()
ElseIf aiStage == 3 ; Move portal in front of summoner
arPortal.MoveTo(akSummoner, Math.Sin(akSummoner.GetAngleZ()) * afDistance, Math.Cos(akSummoner.GetAngleZ()) * afDistance, afZOffset)
ElseIf aiStage == 4 ; Move summon to portal
akSummon.MoveTo(arPortal)
akSummon.SetAngle(0.0,0.0,akSummoner.GetAngleZ()+180.0)
ElseIf aiStage == 5 ; Enable summon as the portal dissipates
akSummon.Enable()
EndIf
Utility.Wait(0.6)
EndWhile
EndFunction