How to launch a script when an object is added to the world?

Post » Tue Jun 19, 2012 6:28 pm

I am making a script which should be launched when the item is added to the game (such as with Player.Additem() AND when it's loaded), but somehow OnInit event doesn't seem to launch when I run my Player.Additem console command. :(

Anyone knows a better way of doing this? :|

Thanks,
Jashkar
User avatar
bonita mathews
 
Posts: 3405
Joined: Sun Aug 06, 2006 5:04 am

Post » Tue Jun 19, 2012 8:40 am

Make lauch through condition
User avatar
Symone Velez
 
Posts: 3434
Joined: Thu Sep 07, 2006 12:39 am

Post » Tue Jun 19, 2012 12:50 pm

Try something like this maybe:

Event OnContainerChanged(ObjectReference akNewContainer, ObjectReference akOldContainer)  if akNewContainer == Game.GetPlayer()    ;put whateveryouwant  endIfendEvent 

I use this to trigger a new stage of my quest when the player get the item in the inventory.
User avatar
Catherine N
 
Posts: 3407
Joined: Sat Jan 27, 2007 9:58 pm

Post » Tue Jun 19, 2012 10:32 am

Make lauch through condition

^^^

Assuming you are doing it as part of a Quest, you can do it by adding the Item as an Alias and making that Alias a CREATE-IN (easy - Player) ....

... you might need to add Player as a Quest Alias too (I can't remember and the CK is now shut ... and I don't need another drink & smoke :wink:)
User avatar
Trent Theriot
 
Posts: 3395
Joined: Sat Oct 13, 2007 3:37 am

Post » Tue Jun 19, 2012 11:59 am

Ah yeah forgot to say, I use that script on the alias of the item as part of the quest (can confirm no Player alias needed). But give it a try.
User avatar
~Sylvia~
 
Posts: 3474
Joined: Thu Dec 28, 2006 5:19 am

Post » Tue Jun 19, 2012 8:42 pm

Try something like this maybe:

Event OnContainerChanged(ObjectReference akNewContainer, ObjectReference akOldContainer)  if akNewContainer == Game.GetPlayer()	;put whateveryouwant  endIfendEvent 

Thanks. :)

I use this to trigger a new stage of my quest when the player get the item in the inventory.
^^^

Assuming you are doing it as part of a Quest, you can do it by adding the Item as an Alias and making that Alias a CREATE-IN (easy - Player) ....

... you might need to add Player as a Quest Alias too (I can't remember and the CK is now shut ... and I don't need another drink & smoke :wink:)

No. My understanding of the quest thing is still too hazy... I am not mixing it with a quest. :P

Thank you guys,
Jashkar
User avatar
Eire Charlotta
 
Posts: 3394
Joined: Thu Nov 09, 2006 6:00 pm


Return to V - Skyrim