Jump to content

What's wrong with my script?


antstubell

Recommended Posts

So the event is player takes coin purse and a Werewofl appears. This is what I scripted and it compiles. WW01 is EncWerewolf and summoned3 is SummonFXlight.

 

ActorBase property WW01 auto

Light property summoned3 auto

 

Event OnContainerChanged(ObjectReference newContainer, ObjectReference oldContainer)

if (newContainer == Game.GetPlayer())

self.PlaceAtMe(summoned3,1)

self.PlaceAtMe(WW01,1)

 

endif

 

EndEvent

 

Something is wrong because Werewolf doesn't appear.

Link to comment
Share on other sites

You are trying to place a werewolf at the coin purse ..... which is now in the **player's inventory** :)

Yeah. I just had a nap and thought about thwat the script is doing or trying to do. It's not even a container change as the coin purse isn't in a conatainer. What's the command I'm looking for?

Link to comment
Share on other sites

OnContainerChanged should be fine, I think. Try this. If you get a debug message on the screen, then you will know the script is firing.

You should place the werewolf at the player, not at the purse (self = the script on the purse) :)

 

ActorBase property WW01 auto
Light property summoned3 auto

Event OnContainerChanged(ObjectReference newContainer, ObjectReference oldContainer)
Debug.Notification("OnContainerChanged just fired.")
if (newContainer == Game.GetPlayer())
	newContainer.PlaceAtMe(summoned3,1)
	newContainer.PlaceAtMe(WW01,1) 
endif

EndEvent

Edited by steve40
Link to comment
Share on other sites

OnContainerChanged should be fine, I think. Try this. If you get a debug message on the screen, then you will know the script is firing.

You should place the werewolf at the player, not at the purse (self = the script on the purse) :)

 

ActorBase property WW01 auto
Light property summoned3 auto

Event OnContainerChanged(ObjectReference newContainer, ObjectReference oldContainer)
Debug.Notification("OnContainerChanged just fired.")
if (newContainer == Game.GetPlayer())
	newContainer.PlaceAtMe(summoned3,1)
	newContainer.PlaceAtMe(WW01,1) 
endif

EndEvent

 

 

Nope, script is not firing, no debug message and no Werewolf.

Link to comment
Share on other sites

OnContainerChanged WILL fire when the coin purse is placed into a container, such as the player's inventory. If it doesn't, then something is wrong. Please post the full script including the script header. I want to see which script you are extending. You are putting the script on the coin purse objectreference in the Render Window, not on a quest alias, right? Edited by steve40
Link to comment
Share on other sites

OnContainerChanged WILL fire when the coin purse is placed into a container, such as the player's inventory. If it doesn't, then something is wrong. Please post the full script including the script header. I want to see which script you are extending. You are putting the script on the coin purse objectreference in the Render Window, not on a quest alias, right?

I put the script on a copy of a coin purse renamed "CoinPurseScripted" in the Object Window. Here is the script.

 

Scriptname SummonWWScript extends ObjectReference

 

ActorBase property WW01 auto

Light property summoned3 auto

 

Event OnContainerChanged(ObjectReference newContainer, ObjectReference oldContainer)

Debug.Notification("OnContainerChanged just fired.")

if (newContainer == Game.GetPlayer())

newContainer.PlaceAtMe(summoned3,1)

newContainer.PlaceAtMe(WW01,1)

endif

 

EndEvent

 

I've attached 2 screenshots of the Object and Properties.

Link to comment
Share on other sites

Excuse my intrusion, but mightn't antstubell have been on the right track with "the coinpurse isn't in a container" up there? The coinpurse isn't added to the player's inventory, X amount of gold is, so the purse itself isn't really changing containers, is it? Edited by AnkhAscendant
Link to comment
Share on other sites

Excuse my intrusion, but mightn't antstubell have been on the right track with "the coinpurse isn't in a container" up there? The coinpurse isn't added to the player's inventory, X amount of gold is, so the purse itself isn't really changing containers, is it?

 

That's what I thought. I am a novice scripter basically copying and mashing together scripts from other scripts. I am fluent in old BASIC programming and logic told me that the line "OnContainerChange..." didn't make sense in the context of what's happening. I thank Steve40 for taking the time to reply and I bow to anybody's knowledge tat is greater than mine. Is there an "OnItemAdded" comand or am I just making it up? I really don't know how to script this.

Link to comment
Share on other sites

  • Recently Browsing   0 members

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