csbx Posted September 10, 2016 Share Posted September 10, 2016 I'm fairly sure I've asked this, but it has come up again for a quest I'm working on and I'm basically stuck. I need to have an npc (that I've added) wield a lit torch. Apparently adding a torch01 to their inventory and placing them in a dark environment isn't enough. Is there some package that would accomplish this ? Is there some way I have to register my cell as 'dark' below some numeric threshold for this to work automatically ? Is there a way to force them to equip a lit torch ? Thanks for any suggestions. Link to comment Share on other sites More sharing options...
dalsio Posted September 10, 2016 Share Posted September 10, 2016 You can do it in a few ways. One of them is to mess with AI packages to get them to pull out a torch in certain circumstances but for your purposes, a much simpler script-based solution is probably better. Add the torch to their inventory in the editor, and then in a script tied to either the actor or the quest, whichever works best, use the EquipItem(item, true) function. This function causes the actor (npc) to search their inventory for a form "item" and equip it. The second parameter, set to true, prevents the actor from unequipping it themselves (IE outside of a script). Then, when you want them to put the torch away, use UnequipItem(item, false) which works the same way but in reverse. Note that this time the second parameter is false, as setting that to true would prevent the actor from equipping that item themselves. If you don't know scripting or how to do all that, I encourage you to try and learn and I'm more than willing to help you. Still, if you simply want some code with instructions on how to use it, let me know and I can whip something up for you. Link to comment Share on other sites More sharing options...
csbx Posted September 10, 2016 Author Share Posted September 10, 2016 Woh. Yeah, this helped a lot. I fumbled around with vanilla script (defaultequipitemonload), realized it wasn't supposed to be on a trigger box but rather on the npc himself--still didn't work even when they possessed a torch item. What did it was--as you said--the 'true' parameter, which in the properties field I assumed was true by default. I actually had to click the radio box rather than leave as default, something I haven't come across before while riding the coattails of vanilla scripts. The short of it: IT WORKS !! Thanks a lot for your generosity offering help in these threads. Almost done this quest ! You can do it in a few ways. One of them is to mess with AI packages to get them to pull out a torch in certain circumstances but for your purposes, a much simpler script-based solution is probably better. Add the torch to their inventory in the editor, and then in a script tied to either the actor or the quest, whichever works best, use the EquipItem(item, true) function. This function causes the actor (npc) to search their inventory for a form "item" and equip it. The second parameter, set to true, prevents the actor from unequipping it themselves (IE outside of a script). Then, when you want them to put the torch away, use UnequipItem(item, false) which works the same way but in reverse. Note that this time the second parameter is false, as setting that to true would prevent the actor from equipping that item themselves. If you don't know scripting or how to do all that, I encourage you to try and learn and I'm more than willing to help you. Still, if you simply want some code with instructions on how to use it, let me know and I can whip something up for you. Link to comment Share on other sites More sharing options...
dalsio Posted September 11, 2016 Share Posted September 11, 2016 (edited) Awesome! Yea, your npc was probably unequipping it because their AI package told them to. When dealing with vanilla functions, I recommend bookmarking this: http://www.creationkit.com/index.php?title=Category:Script_Objects This is a list of all the categories that functions are under, what parameters they take, and what each of them does. Under the Actor section, you'll find anything that has to do specifically with actors. Note that it's in a tree under ObjectReference, which is in a big list of things that are all under the Form section. That means that Actor extends the ObjectReference script which extends the Form script, so any functions available for the Form script are also available for the ObjectReference script and the functions of both of them are available to the Actor script. Near the top of the Actor section is EquipItem. Under the "syntax" section is it's code showing what parameters it can take. "akItem" isn't set, so it doesn't have a default value (and thus is required). "abPreventRemoval = false" lets you know that it defaults to false and you already know what it does. Lastly "abSilent" also defaults to false and it causes there to be no notification message when it is equipped (only matters for the PC, of course). Edited September 11, 2016 by dalsio Link to comment Share on other sites More sharing options...
Luciusfly Posted December 27, 2018 Share Posted December 27, 2018 Hello everyone, I red the topic and did not found the item i was looking for, however at the bottom of the page it dinged me:" Let's try ( ` console) + "help torch" = list appeared = some of the results were: LIGH: (0001d4ec) 'Torch'well okey, lets try selecting [ I was actually doing the High Hrotgar quest and the teachers were in the yeard it was midnight and i could not see a f***, so i wanted to give them torches, LEGIT?) select NPC + equipitem 0001d4ec 1 = GG WP HFThanks guys. Link to comment Share on other sites More sharing options...
Recommended Posts