Jump to content

[LE] Remote Container not opening through script when far from it.


Recommended Posts

I bumped into an odd issue about last month, but only now I decided to take a look further, after taking a break from the game.

 

It's a really odd issue.

If I trigger the dialogue on the companion to open the storage, it will not open the container, until I get close to where the container I'm trying to open is at.

That wasn't happening before the addition of the new script for selling loot in the chest, which actually works regardless of if I'm close or not to the chest, and also seems unrelated to the issue.

 

Ever since before I added the new function for selling, the script for opening the container didn't changed, and the container is still where it always has been, under the ground where the npc was stationary in the Markath entrance.

 

Anyone has any idea why the script decided to rebel all of sudden?

The code is bellow.

Scriptname MerchCompanionScript extends Quest  

MiscObject Property Gold  Auto  

Potion Property AppleCabbageStew  Auto  

ReferenceAlias Property Darmarash  Auto  

Quest Property ThisQuest  Auto  

Container Property LootChest  Auto  

Faction Property MerchantFaction  Auto  

ObjectReference Property MerchLootChest  Auto  

SPELL Property MerchBuffLv1  Auto  


Function SellAppleCabbageStew()
	Actor Player = Game.GetPlayer()
	Player.RemoveItem(AppleCabbageStew, 1)
	Player.AddItem(Gold, 10)
	Darmarash.GetActorRef().RemoveItem(Gold, 10)
	ThisQuest.SetStage(1)
endFunction

Function GiveAppleCabbageStew()
	Actor Player = Game.GetPlayer()
	Player.RemoveItem(AppleCabbageStew, 1)
	Darmarash.GetActorRef().SetRelationshipRank(Player, 1)
	ThisQuest.SetStage(1)
endFunction

Function PropposalAccepted()
	ThisQuest.SetStage(2)
endFunction

Function OnGiveGold()
	ThisQuest.SetStage(3)
	Actor Player = Game.GetPlayer()
	Player.RemoveItem(Gold, 50)
	Actor D = Darmarash.GetActorRef()
	D.SetFactionRank(MerchantFaction, 1)
	D.SetPlayerTeamMate()
	Game.GetPlayer().AddSpell(MerchBuffLv1, false)
endFunction

Function SetFollowPlayer()
	Darmarash.GetActorRef().SetAv("WaitingForPlayer", 0)
	Game.GetPlayer().AddSpell(MerchBuffLv1, false)
EndFunction

Function SetWaitPlayer()
	Darmarash.GetActorRef().SetAv("WaitingForPlayer", 100)
	Game.GetPlayer().RemoveSpell(MerchBuffLv1)
EndFunction

Function SetDismiss()
	Darmarash.GetActorRef().SetAv("WaitingForPlayer", 200)
	Game.GetPlayer().RemoveSpell(MerchBuffLv1)
EndFunction

Function OpenFollowerStorage()
	MerchLootChest.Activate(Game.GetPlayer(), true) ;This is where the issue is happening. Container activation misbehaves if I'm not close to Markath entrance.
EndFunction

Function OpenFollowerInventory()
	Actor D = Darmarash.GetActorRef()
	D.OpenInventory(true)
EndFunction

Function EmptyInventoryOnCaravan()
	int GoldAcquisition = 0
	int NumItems = MerchLootChest.GetNumItems()
	While NumItems > 0
		NumItems -= 1
		Form item = MerchLootChest.GetNthForm(NumItems)
		int ItemCount = MerchLootChest.GetItemCount(item)
		GoldAcquisition += item.GetGoldValue() * ItemCount
		MerchLootChest.RemoveItem(item, ItemCount, true)
	EndWhile
	Actor D = Darmarash.GetActorRef()
	int DarmarashSellRate = D.GetAv("Speechcraft") as Int
	GoldAcquisition = DarmarashSellRate * GoldAcquisition * 22 / 10000
	Game.GetPlayer().AddItem(Gold, GoldAcquisition, true)
	D.AddItem(Gold, GoldAcquisition / 10, true)
	if (GoldAcquisition > 0)
		Debug.Notification("Sold items for "+GoldAcquisition+" golds.")
	else
		Debug.Notification("There is nothing to sell.")
	EndIf
EndFunction
Link to comment
Share on other sites

I had to google what you meant, and yes, it is.

You can even see its reference on the script I posted.

The chest itself, in the world, is assigned to MerchLootChest.

 

Edit: Okay, I managed to get it fixed, and I think I have an idea why it was bugging out.

 

Since my character was "in the same map" as the chest, the game was trying to play the opening animation of the chest when the script activated it, and being unable to finish it.

Due to the fact that if I get close to where the chest is at, the container opens, I believe that might have been the case.

 

To fix this issue, I moved the container to Elsweyr, so probably it will no longer bug out, because no longer need to show the chest opening.

Edited by nakano15
Link to comment
Share on other sites

  • Recently Browsing   0 members

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