ajs52698 Posted August 7, 2016 Share Posted August 7, 2016 Im having a hard time understanding how to use this in my script, need some help. Link to comment Share on other sites More sharing options...
Dielos Posted August 8, 2016 Share Posted August 8, 2016 (edited) You have to add an AddInventoryEventFilter for everything you want to catch. A small example for detecting when some armors are added through keywords: Event OnInit() AddInventoryEventFilter(pma_Railroad_ClothingArmor) AddInventoryEventFilter(pObjectTypeArmor) EndEvent Event OnItemAdded(Form akBaseItem, int aiItemCount, ObjectReference akItemReference, ObjectReference akSourceContainer) If (akBaseItem.HasKeyword(pma_Railroad_ClothingArmor) || akBaseItem.HasKeyword(pObjectTypeArmor)) DoSomethingFunction(akBaseItem) EndIf EndEvent Edited August 8, 2016 by Dielos Link to comment Share on other sites More sharing options...
ajs52698 Posted August 8, 2016 Author Share Posted August 8, 2016 (edited) Will This Work? Event OnItemAdded(Form akBaseItem, int aiItemCount, ObjectReference akItemReference, ObjectReference akSourceContainer) AddInventoryEventFilter(Caps001) if akBaseItem == caps001Search() Edited August 8, 2016 by ajs52698 Link to comment Share on other sites More sharing options...
Dielos Posted August 8, 2016 Share Posted August 8, 2016 (edited) No it wont. An event needs a defined start and end, just like my example above. Also, for the OnItemAdded event to fire, you need to have registered for the event before. For that I used in my example the OnInit event, as that one fires when the script is run the first time. On the CK wiki there are nice tutorials that can help you through the basics. You should understand those, and I'd recommend to start with the basic "Hello World" one, as that one already helps define events. It's amazing what you can do once you have some understanding of how scripts work, really tons of fun... If what you want to do is not too complex, explain it here and I can give you some code to start with. Edited August 8, 2016 by Dielos Link to comment Share on other sites More sharing options...
ajs52698 Posted August 8, 2016 Author Share Posted August 8, 2016 (edited) Im aware you have to end a event, but what Id like is for this event to go off as a papyrus fragment script checking if the npc has recieved gold. aka caps :tongue: Npc Receives Caps from player -> Npc Runs Script checking if received caps -> if received, do something! Edited August 8, 2016 by ajs52698 Link to comment Share on other sites More sharing options...
ajs52698 Posted August 8, 2016 Author Share Posted August 8, 2016 (edited) I also am in need of a way to enable packages and disable packages for certain conditions which go along with what im trying to do here aka npc receives caps-> packages is started,if not another package started /: Ive been stuck on this all day Edited August 8, 2016 by ajs52698 Link to comment Share on other sites More sharing options...
ajs52698 Posted August 8, 2016 Author Share Posted August 8, 2016 ah just found a solution now I just need help with packages Link to comment Share on other sites More sharing options...
ajs52698 Posted August 8, 2016 Author Share Posted August 8, 2016 (edited) Ok so let me try to explain what im having problems with now a little better. Player Enables ActivatorActivator Starts QuestActivator Calls/enables package that sends npc to playerQuest is finished when npc talks to player and enables Second PackageThen npc just returns to where he came from when the second package no longer finds its targets, npc returning would be a third package I guess.Quest would be repeatable Hopefully this explains what im trying to achieve a little better. Everything else this mod would need ive already done. I just need a way to tell the npc what to do other than using pathtoreference since I wasnt able to get that working Edited August 8, 2016 by ajs52698 Link to comment Share on other sites More sharing options...
Dielos Posted August 9, 2016 Share Posted August 9, 2016 (edited) Ok sorry, didn't get this was on fragments. Never used them before myself, so I have no idea. And I was sending you to tutorials... Really sorry! Actually, I'm trying to learn packages myself, so this could be really useful for me as well, although I need to control them through script ideally. In theory (didn't try), you should be able to put a condition in your package for when your quest changes stages. Or you could have the activator change a variable and this variable be the condition to start the package. My guess (really, just a guess, never did this before!) is that you could set up a global variable that starts at 0. Your activator or even quest start could change it to 1, and the first package kicks in. Change it then to 2 on another stage and the second package starts. pathtoreference didn't work for me either too well. So now the need for packages for me as well. :mad: Edited August 9, 2016 by Dielos Link to comment Share on other sites More sharing options...
ajs52698 Posted August 9, 2016 Author Share Posted August 9, 2016 (edited) haha well ill hit you up if I make any progress :D Edit : I also would like to control them through scripting :P Edited August 9, 2016 by ajs52698 Link to comment Share on other sites More sharing options...
Recommended Posts