Jump to content

how do we dismiss a summoned npc after dialogue is over?


tonycubed2

Recommended Posts

This forum rocks. I could not have done my mod without you guys.

 

I have a ring in the mod that when equipped summons the "Sandman" which is really meant to be a ingame menu system to tweak the mod. Took me days to get the ingamemenu working. Summoning is easy, I just use the "onequipped" event. But how do I dismiss him? I can attach a unequipped to the ring but it would be much better if when the dialogue stops the dude poofs out. I could not find any event for "ondialogueend". I cant even get teh following to compile, says no such function:

 

ActorBase Property sanddude Auto

Event OnUnequipped(Actor akActor)

sanddude.Kill()

EndEvent

 

 

My summon script is below.

 

Scriptname summonsandman extends ObjectReference  

ActorBase Property sanddude Auto


Event OnEquipped(Actor akActor) 
ObjectReference PlayerRef = Game.GetPlayer()
PlayerRef.PlaceActorAtMe(sanddude,1)

endEvent



Link to comment
Share on other sites

Yup. That is how I get him to spawn when the ring is worn. It seems the kill function only works with certain evetns and conditions, and on eventunequipped is not one of them. So I need some other way to make him go away...
Link to comment
Share on other sites

Yup. That is how I get him to spawn when the ring is worn. It seems the kill function only works with certain evetns and conditions, and on eventunequipped is not one of them. So I need some other way to make him go away...
Link to comment
Share on other sites

Try this...

 

Scriptname summonsandman extends ObjectReference

ActorBase Property sanddude Auto
Actor dudeInstance

Event OnEquipped(Actor akActor) 
 dudeInstance = Game.GetPlayer().PlaceActorAtMe(sanddude,1)
endEvent

Event OnUnequipped(Actor akActor)
 dudeInstance.Kill()
EndEvent

 

Edit: silly typo sandInstance -> dudeInstance

Edited by tunaisafish
Link to comment
Share on other sites

Man, it was funny! I had him set as "essential" so he writhed and groaned in pain for a minute while getting over it and not dying! Very cool and usable somewhere. So I took off the essential part and yes, he died. But he stayed right there, dead! Searchable and all. I need him to go away... is there a command for get rid of dead body?
Link to comment
Share on other sites

OK, Tuna is a fish , the answer was to use dudeinstance.disable instead of kill. he was gone in a flash. Would not have worked though without your code, since I had tried already so all credit is yours. I also gave you public recognition in two places on my humble mod page. thanks again!
Link to comment
Share on other sites

lol @ essential.

 

Glad it worked out :) Where did you release it?

 

Just one more thing, when you spawn things, you're also responsible for the cleanup.

So while disable() hides it from view, it will still take space in savefiles.

Follow the disable() up with a delete() and all's good.

 

Oh, and you've not finished with it even then.

Next comes the requests of "This is cool, but..."

Link to comment
Share on other sites

  • Recently Browsing   0 members

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