Talk:OnAdd

From the Fallout3 GECK Wiki
Revision as of 19:10, 19 January 2009 by imported>SnakeChomp (Gamemode freeze)
Jump to navigation Jump to search

On the notes, were the actors in the same cell as the player?
--Haama 20:07, 19 January 2009 (UTC)

No, I added the test actors to a random house interior I had never been to and traveled there with coc. OnAdd blocks simply won't execute for items placed into NPC inventories when they initially spawn (or their inventory is regenerated via SetLevel or ResetInventory), or added as death items. It is most unfortunate behavior indeed. =(
I am going to play around more when I am home to see if I can use a gamemode script with a timer to add an item shortly after the actor spawns using AddItem (which will trigger the OnAdd block). My previous experiments with this showed that a gamemode block on an item script calling additem on its container would freeze the game, but it may be because the item I was adding also called RemoveMe in its OnAdd block. I hope to find a workaround for this.
--SnakeChomp 21:06, 19 January 2009 (UTC)
The GameMode script shouldn't freeze the game - try something simpler? I asked because in Oblivion (yeah, yeah - new computer should be up tomorrow so I can finally test these things myself) when you added an item to a remote container it would fire the script, so a GameMode block would run. However, the onAdd block wouldn't fire until the player entered the cell.
--Haama 21:38, 19 January 2009 (UTC)
I figured out why the game would freeze when I used a gamemode block. I added information about it to the RemoveMe page. There is a similar bug in Oblivion too.
--SnakeChomp 00:10, 20 January 2009 (UTC)
For the note that I added, about the Death Items, they were. I tried it with and without the player killing them, and it seems to be true for regular Death Items and for those added via perks like Contract Killer.
It's not all bad, you can use it to tell when the item is first removed from its container.
-- Cipscis 21:08, 19 January 2009 (UTC)
Sounds good, then. Confirmation is always a good thing :)
--Haama 21:38, 19 January 2009 (UTC)