mich125 8 Posted February 8, 2017 Share Posted February 8, 2017 So i have a quest where i need to useitem on npc to spawn some small npcs that i have to kill for quest objective to complete. I use this code: Thread t = new Thread(() => { uint itemId = 24501; int questId = 9849; while (robotManager.Products.Products.IsStarted) { if (Conditions.InGameAndConnectedAndAliveAndProductStartedNotInPause) { if (!Quest.HasQuest(questId)) break; if (ObjectManager.Target.IsValid && ObjectManager.Target.IsAlive) { ItemsManager.UseItem(itemId); } } Thread.Sleep(500); } }); t.Start(); But before he turns this quest, he has to do 3 more other quests nearby, and he keeps casting this item on other mobs from those 2 other quests, even tho this quest is already completed. Is it possible to add break if quest is completed but not turned yet? Or add only specific npcid to use this itemid on only? Link to comment https://wrobot.eu/forums/topic/5032-useitem-script-on-specific-npc-only/ Share on other sites More sharing options...
eeny 523 Posted February 8, 2017 Share Posted February 8, 2017 yeah... if you look at the code: if (!Quest.HasQuest(questId)) break; if (ObjectManager.Target.IsValid && ObjectManager.Target.IsAlive) { ItemsManager.UseItem(itemId); That means between the time that code is run, and you hand in the quest... it will attempt to use the item. This looks suspect. In this scenario all you can really do is do your other 2 quests first, then run the code and to the 'item quest' and hand in. Alternatively, run code, pulse quest, hand in, pulse other 2 quests hand in. in the end if your running that kind of code, you want to pulse the quest then turn in asap. Link to comment https://wrobot.eu/forums/topic/5032-useitem-script-on-specific-npc-only/#findComment-23340 Share on other sites More sharing options...
Droidz 2738 Posted February 8, 2017 Share Posted February 8, 2017 To check if it is good npc type: if (ObjectManager.Target.Entry == 17157) // http://www.wowhead.com/npc=17157/shattered-rumbler Link to comment https://wrobot.eu/forums/topic/5032-useitem-script-on-specific-npc-only/#findComment-23346 Share on other sites More sharing options...
mich125 8 Posted February 8, 2017 Author Share Posted February 8, 2017 So i can do it like this? Thread t = new Thread(() => { uint itemId = 24501; int questId = 9849; while (robotManager.Products.Products.IsStarted) { if (Conditions.InGameAndConnectedAndAliveAndProductStartedNotInPause) { if (!Quest.HasQuest(questId)) break; if (ObjectManager.Target.IsValid && ObjectManager.Target.IsAlive && ObjectManager.Target.Entry == 17157) { ItemsManager.UseItem(itemId); } } Thread.Sleep(500); } }); t.Start(); Seems to work, thanks! Link to comment https://wrobot.eu/forums/topic/5032-useitem-script-on-specific-npc-only/#findComment-23347 Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now