Jump to content

Item Display Scripting Question


xJACKTHERIPPERx

Recommended Posts

I may just have to try this for Waterstone Manor myself as this is the biggest bug (IMHO at least, though nobody has complained about it yet.)

 

So I assume you have to give the container a unique ID? I also assume you can't put more than one in the world or it will cause skyrim to get confused.

 

Unfortunately I think this will cause issues with an established mod since you are changing the way an object is handling an item. When people go to update Skyrim will get confused and use it's JuuJuu magic to try to solve the problem, which never ends well.

 

Will need to test this on a clean save then.

Link to comment
Share on other sites

I had just kinda figured out that first part, but I don't quite get what you mean with the

Actor Someone = akActivator

NewContainer.removeItem(Wabba, 1,False,Someone)

part

I have the new ObjectReference Property linked to a chest called DAHolder.

This is what it looks like now.

EDIT: also, when I place the weapon it doesn't seem to show up in the referenced chest that I added.

Scriptname WabbaRack2 extends ObjectReference  

WEAPON Property Wabba  Auto  
Bool Property isPlaced = false Auto Hidden
ObjectReference Property DAHolder  Auto  
Message Property defaultLackTheItemMSG  Auto

EVENT OnActivate(objectReference akActivator)
	if(isPlaced == FALSE)
		if akActivator.getItemCount(Wabba) >= 1
			isPlaced = TRUE
			self.getLinkedRef().enable()
			(akActivator as actor).removeItem(Wabba, 1,False,DAHolder)
		else
			defaultLackTheItemMSG.show()
		endif
	else
		isPlaced = FALSE
		self.getLinkedRef().disable()
		Actor Someone = akActivator
		DAHolder.removeItem(Wabba, 1,False,Someone)
	endif
endEvent
Edited by xJACKTHERIPPERx
Link to comment
Share on other sites

Might work on an existing save. You can at least try it. The changes I suggested are not major changes. I don't see why they would not work with an existing game.

 

You can have as many containers as you want. It is all in how you assign them to the script property. I'm guessing that you are reusing the script for each rack and just changing the value of the property variables. This too would work with multiple containers. Tho it will also work with just one container.

 

EDIT:

What I meant with regards to the (akActivator as actor) vs Actor Someone = akActivator

 

Sometimes (akActivator as actor) does not like being used at least in my experience. More often it was when inside of a function call i.e.

 

DAHolder.removeItem(Wabba, 1,False,(akActivator as actor))

 

To bypass any such problems, I assign the akActivator, which is an actor anyway even tho it is defined as an object reference, to a variable (in this case Someone)

 

Further Edit:

You can go even further and cut down on casting and processing by changing the script as below

 

 

Scriptname WabbaRack2 extends ObjectReference  

WEAPON Property Wabba  Auto  
Bool Property isPlaced = false Auto Hidden
ObjectReference Property DAHolder  Auto  
Message Property defaultLackTheItemMSG  Auto
Actor Property PlayerRef Auto

EVENT OnActivate(objectReference akActivator)
  If akActivator == PlayerRef 
	if(isPlaced == FALSE)
		if PlayerRef.getItemCount(Wabba) >= 1
			isPlaced = TRUE
			self.getLinkedRef().enable()
			PlayerRef.removeItem(Wabba, 1,False,DAHolder)
		else
			defaultLackTheItemMSG.show()
		endif
	else
		isPlaced = FALSE
		self.getLinkedRef().disable()
		DAHolder.removeItem(Wabba, 1,False,PlayerRef)
	endif
  EndIf
endEvent 

 

You will note that this is different. What is done is a new property for the player reference (which will auto fill) is added. The akActivator is then compared to the PlayerRef to ensure that the script only works when it is the player that is interacting with the object. We then use PlayerRef instead of (akActivator as actor).

Edited by IsharaMeradin
Link to comment
Share on other sites

Well I just tried it using

 

DAHolder.removeItem(Wabba, 1,False,akActivator)
and it seemed to work fine. And ya, I was just using the same script on each rack, and was going to just put all the items into one chest.
I'm just really new to scripting and don't really know how to assign something to a variable. I just pasted what you wrote into the script. Should that have worked? Or was there something else I was supposed to have changed?
EDIT: oh wow, that makes a lot more sense. I like that. Do you mind if I use it in my mod?
Edited by xJACKTHERIPPERx
Link to comment
Share on other sites

  • Recently Browsing   0 members

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