viesty Posted March 17, 2009 Author Share Posted March 17, 2009 Okay, this is my problem-when i try to add this basic script:```Sub ScriptedNPC(index, Script)Select Case Script Case 0 If CheckInventoryForItem(index, 2) = true Then Call TakeItem(index, 2, 0) Call GiveItem(index, 3, 0) Call PlayerMsg(index, "Congrats quest complete.", 4) Else Call PlayerMsg(index, "You don't have item 2", 4) End IfEnd SelectEnd Sub```And I put npc on script 0, and attack it, it brings me a message- NPCz work.What the hell is wrong?It looks like this-![](http://img8.imageshack.us/img8/3112/shithaaben.png) Link to comment Share on other sites More sharing options...
Lanphrost Posted March 17, 2009 Share Posted March 17, 2009 You have two case 0I'm assuming that because the first case 0 has call playermsg(index, "NPCz work", 15) that it's sending that message and ignoring the second case 0Try replacing the old case 0(If that works… that would make my first actual scripting advice... scary...) Link to comment Share on other sites More sharing options...
Saida Posted March 17, 2009 Share Posted March 17, 2009 I really need to learn sad script because I get what it means but that's about it. Link to comment Share on other sites More sharing options...
viesty Posted March 17, 2009 Author Share Posted March 17, 2009 Lanphrost, thanks, but doesn't work anyways :SNow it doesn't show anything. Link to comment Share on other sites More sharing options...
Lanphrost Posted March 17, 2009 Share Posted March 17, 2009 Ah, well… :( I'm still an unprogrammer then X3 Link to comment Share on other sites More sharing options...
Admiral Refuge Posted March 17, 2009 Share Posted March 17, 2009 Which version of the main.txt are you using? Because that doesn't look like EE's main.txtAnyway, you forgot to have "Case Else" in the Case statement (not sure if it it's needed or not), and you forgot to add the Exit Sub command.Here's a screenshot of my main.txt, with that part:![](http://i43.tinypic.com/ilk7s9.png) Link to comment Share on other sites More sharing options...
viesty Posted March 18, 2009 Author Share Posted March 18, 2009 I am using Fulou's main.txt Link to comment Share on other sites More sharing options...
Chakkra Posted March 18, 2009 Share Posted March 18, 2009 replace EVERYTHING in the scripted NPC section with this```'**************************************************************' Executes whenever a scripted NPC does an action.Sub ScriptedNPC(Index, Script)'************************************************************** Select Case Script Case 0 If CheckInventoryForItem(index, 2) = true Then Call TakeItem(index, 2, 0) Call GiveItem(index, 3, 0) Call PlayerMsg(index, "Congrats quest complete.", 4) Else Call PlayerMsg(index, "You don't have item 2", 4) End IfExit sub Case Else Call PlayerMsg(Index, "No NPC script found. Please contact an admin to solve this problem.", WHITE) Exit Sub End SelectEnd Sub```Works like a charm.And if it doesn't work for you, don't blame me because you don't know how to follow simple instructions. It's not my fault if you don't know what i'm talking about. Link to comment Share on other sites More sharing options...
Squiddle Posted March 18, 2009 Share Posted March 18, 2009 Also, make sure you HAVE the sub "CheckforinventoryItem" put into your main, as I don't think it comes with the original? Link to comment 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