Jump to content

Book Ownership


daisy8

Recommended Posts

Hi all

 

I have a book inside a chest that I need the player to take. The problem is that the chest is owned by an NPC and so when the player takes the book the NPCs of the cell come and take it back because it's been stolen.

 

I don't want to change the ownership of the chest or the cell, I just need a script to change the ownership of the book when the player picks itout of the chest.

 

scriptName ADZToddJournalToPlayer extends ObjectReference

Event OnContainerChanged(ObjectReference newContainer, ObjectReference oldContainer)
if (newContainer == Game.GetPlayer())

	Debug.Notification("Journal Picked Up")

	Self.SetActorOwner(None)
	
EndIf

EndEvent

 

This is the scriptI have on the book. What's wrong with it ??

 

Thanks

Daisy

Link to comment
Share on other sites

It seems ok, do you get compile errors?

 

Hi there

 

No, no errors. It just doesn't work at all. No notification no change of ownership. I can't even find an ownership dialogue box in the book's definition window. Is the only way to set ownership of a book to have it take the ownership from the cell it's in ?

 

It's an alias generated object in the chest so might be that.

 

Still no clue though ??

Link to comment
Share on other sites

I'll give no guarantee that it works, but it compiles:

 

Event OnContainerChanged(ObjectReference newContainer, ObjectReference oldContainer)
       if (newContainer == Game.GetPlayer())
       
               Debug.Notification("Journal Picked Up")
       
               Self.SetActorOwner(Game.GetPlayer().GetActorBase())               
       EndIf
EndEvent

Link to comment
Share on other sites

I'll give no guarantee that it works, but it compiles:

 

Event OnContainerChanged(ObjectReference newContainer, ObjectReference oldContainer)
       if (newContainer == Game.GetPlayer())
       
               Debug.Notification("Journal Picked Up")
       
               Self.SetActorOwner(Game.GetPlayer().GetActorBase())               
       EndIf
EndEvent

 

Hey

 

I have changed the book now to just an additional object in the chests inventory and both scripts (changing ownership to none and to the player) generate a debug notify but neither change the ownership. To none and the NPCs attack me, to the player and they just take the book off me again.

 

Might try OnLoad instead.

 

One problem is that the book is set as stolen because you 'steal from the chest'

 

Thanks

Daisy

Link to comment
Share on other sites

Hey for anyone interested I managed to get this to work.

 

scriptName ADZToddJournalToPlayer2 extends ObjectReference
;put on the chest


Book Property ToddJournal Auto

Event OnOpen(ObjectReference akActionRef)

if (akActionRef == Game.GetPlayer())
	Debug.Notification("Chest Openned")
	Self.SetActorOwner(Game.GetPlayer().GetActorBase())
	Debug.Notification("Owner to Me")
	
EndIf
EndEvent

Event OnItemRemoved(Form akBaseItem, int aiItemCount, ObjectReference akItemReference, ObjectReference akDestContainer)		

if akBaseItem == ToddJournal
	Debug.Notification("Got Journal")
	Self.SetActorOwner(none)
	Debug.Notification("Owner to Todd")

 endIf
endEvent

 

Apart from the fact that now the player can steal everything in the chest it works great. The 'steal from chest' text comes up at the start and end of looking in the chest but anything removed is not stolen.

 

Cheers

Link to comment
Share on other sites

  • Recently Browsing   0 members

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