IsharaMeradin Posted November 16, 2012 Share Posted November 16, 2012 Personally I feel that it could be done a bit better. Instead of going on about someone's method being complicated or done with unnecessary steps, just show the alternative and explain how it works. The original poster can decide what method they want to use. I dislike trying to help people only to come back and find someone making an issue out of what I've posted. I learn much better with an example and an explanation that isn't prefaced with something that boils down to "Why the heck you do it like that?" It puts me on the defensive instead of allowing me to learn. Link to comment Share on other sites More sharing options...
Ez0n3 Posted November 16, 2012 Share Posted November 16, 2012 (edited) I'm always a little intimidated when someone asks how to do something in papyrus and I have a suggestion which I'd like to share (helping people is cool) but I suspect it'll be an awkward way of doing things and I just know someone like Steve or Ez0n3 will come along sooner or later and bust out an awesome way of doing it and make me feel like a total hack - but at the same time that's how both I and the asker learn something new. So I just suck it up and post anyway.I still feel like I'm usually more wrong than right :P I'm still fuzzy on the whole states thing (gotostate does not mean leave the current state immediately? WTF) and the CK wiki isn't the most helpful on the subject of states (which is why I initially avoided them), but these examples have helped a lot.States_(Papyrus) It will finishing running the code under GoToState. States are mainly for events, but functions work also. Auto State Waiting Event OnTriggerEnter(ObjectReference akActionRef) GoToState("Done") int iCount = 0 While (iCount < 100000000) Debug.Trace("Counter:" + iCount) iCount += 1 EndWhile EndEvent EndState State Done EndStateThe first trigger will change the state and then run the loop. If this object gets triggered again while the loop is still running, it will do nothing because it's in the "Done" state which does nothing. It can get triggered again and again and it will do nothing while the loop finishes. Once the loop finishes, this script would do nothing. Auto State Waiting Event OnTriggerEnter(ObjectReference akActionRef) GoToState("Busy") int iCount = 0 While (iCount < 100000000) Debug.Trace("Counter:" + iCount) iCount += 1 EndWhile GoToState("Waiting") EndEvent EndState State Busy Event OnTriggerEnter(ObjectReference akActionRef) Debug.Notification("This Script is Busy") EndEvent EndStateBascially the same thing but after the loop runs, it will re-enable itself by setting the state back once it completes. That way, it will trigger, change the state, run the loop and then change the state back.If this object gets triggered while it's in the "Busy" state, you'll just get a notification saying "This Script is Busy" untill it finishes the loop and re-sets the state allowing the object to be triggered again. Edited November 17, 2012 by Ez0n3 Link to comment Share on other sites More sharing options...
Recommended Posts