Hangman4358 Posted March 20, 2013 Share Posted March 20, 2013 as to the states, you don't really need the notools state. Instead of going to the notools state when the player does not have them just remove the entire state since as long as the player has no tools it will always pop up with the message about not having tools. I would simplify the entire thing to this: Event onActivate(objectReference akActivator) if (akActivator as Actor) == game.getPlayer() if akActivator.GetItemCount(SEEFORMLISTGravetools) < 1 SEEMESSAGEGraverobfailure.Show() else BlockActivation(false) GotoState("Access") endIf endIf endEvent STATE access Event OnBeginState() self.activate(ObjectReference akActivator) BlockActivation(true) GotoState("") Endevent EndState can't test if it will compile because i am not home but it should, there might be some spelling mistakes. This should check the player inventory, and if the player has the tools it will activate the object again. and at the end of everything go back to the empty state to start from the beginning again Link to comment Share on other sites More sharing options...
Job4aCowboy Posted March 20, 2013 Author Share Posted March 20, 2013 Thanks for your help, I'll test it tonight when I finish work. Spent most of the night researching states, events and functions. Didn't make any breakthroughs. When I think of it logically I need my first state and "event on activate" this sends it to state 2 where it checks the player inventory. Then sends it to state 3 if they do, which activates the chest.If they don't it sends it back to the first state.Does this sound right to you? Link to comment Share on other sites More sharing options...
Job4aCowboy Posted March 20, 2013 Author Share Posted March 20, 2013 (edited) Just tried it, it won't compile, these are the errors i get... C:\Program Files (x86)\Notepad++>"D:\Steam\SteamApps\Common\Skyrim\Papyrus Compi ler\PapyrusCompiler.exe" "J4ACGraveRobbersScript2.psc" -f="TESV_Papyrus_Flags.fl g" -i="D:\Steam\SteamApps\Common\Skyrim\Data\Scripts\Source" -o="D:\Steam\SteamA pps\Common\Skyrim\Data\Scripts" Starting 1 compile threads for 1 files... Compiling "J4ACGraveRobbersScript2"... D:\Steam\SteamApps\Common\Skyrim\Data\Scripts\Source\J4ACGraveRobbersScript2.psc (41,22): no viable alternative at input 'ObjectReference' D:\Steam\SteamApps\Common\Skyrim\Data\Scripts\Source\J4ACGraveRobbersScript2.psc (41,49): required (...)+ loop did not match anything at input ')' No output generated for J4ACGraveRobbersScript2.psc, compilation failed. Batch compile of 1 files finished. 0 succeeded, 1 failed. Failed on J4ACGraveRobbersScript2.psc C:\Program Files (x86)\Notepad++>Pause Press any key to continue . . . Both errors point to this line: self.activate(ObjectReference akActivator)According to the CK website, these are what the errors mean, still makes no sense to me though..."No viable alternative at input 'X'The compiler didn't expect X, and so cannot compile the element. Usually the result of a malformed line or missing parts."Required (...)+ loop did not match anything at input 'X'"The compiler expected a list of things, but got confused when it encountered X. You may be missing a comma somewhere, misspelled something, or have excess text at the end of a line. Edited March 20, 2013 by Job4aCowboy Link to comment Share on other sites More sharing options...
Hangman4358 Posted March 20, 2013 Share Posted March 20, 2013 doh, totally didn't proofread when I posted. for the .activate() you need to pass who will do the activating. So you need to pass game.getplayer() Link to comment Share on other sites More sharing options...
Job4aCowboy Posted March 20, 2013 Author Share Posted March 20, 2013 How and we're would I right that out? Sorry, like I said I'm new to this and still learning. Link to comment Share on other sites More sharing options...
Job4aCowboy Posted March 21, 2013 Author Share Posted March 21, 2013 Bump Link to comment Share on other sites More sharing options...
Hangman4358 Posted March 21, 2013 Share Posted March 21, 2013 into the self.activate() I just copied and pasted the CK wiki line and forgot to change it before I posted Link to comment Share on other sites More sharing options...
Job4aCowboy Posted March 21, 2013 Author Share Posted March 21, 2013 into the self.activate() I just copied and pasted the CK wiki line and forgot to change it before I posted so self.activate(game.getplayer())? Link to comment Share on other sites More sharing options...
Job4aCowboy Posted March 22, 2013 Author Share Posted March 22, 2013 Bump Link to comment Share on other sites More sharing options...
IsharaMeradin Posted March 22, 2013 Share Posted March 22, 2013 (edited) I'm taking your last script and am going to tweak it. Then try it and see how it works. Scriptname J4ACGraveRobbersScript2 extends ObjectReference {Script attached to GraveActivator, checks to see if player has required items...} formlist property SEEFORMLISTGravetools auto {Player must have at least one item from this formlist to interact} Message Property SEEMESSAGEGraverobfailure Auto {Message to say why you cannot use this without RequiredWeapon} Actor Player = Game.GetPlayer() ;assign the player to the variable Player so that it can be used throughout the script Event OnLoad() Utility.wait(0.50) BlockActivation(true) EndEvent Event onActivate(objectReference akActivator) if (akActivator as Actor) == Player if akActivator.GetItemCount(SEEFORMLISTGravetools) < 1 SEEMESSAGEGraverobfailure.Show() else gotostate("Access") endIf endIf endEvent STATE access Event OnBeginState() BlockActivation(false) Self.Activate(Player) Utility.Wait(1.0) ;lets just wait a second before moving on BlockActivation(true) Endevent EndState I removed a couple states. Saw no need to keep passing between them. I defined a variable specifically for the player so that it could be used throughout the entire script. Edit -- removed the apostrophe from one of them comment strings... it annoys me when the highlighting colors get thrown off :P Edited March 22, 2013 by IsharaMeradin Link to comment Share on other sites More sharing options...
Recommended Posts