Python and Responders: Please Read!
If you are using Python files to make things happen in your Age (and you more than likely will if you want puzzles, and neat actions to happen), then it is very IMPORTANT that you remember to have your responders that you have Python run to notify Python that they are done.
Basically what is happening is your python file will have something in it that has a responder run, say like this clip here:
def OnNotify(self, state, id, events): global avatarEntering if (id == triggerRgn1.id): if (PtFindAvatar(events) != PtGetLocalAvatar()): return print ' must have ki' kiLevel = PtGetLocalKILevel() if (kiLevel < 2): return for event in events: if ((event == 1) and (event == 1)): avatarEntering = PtFindAvatar(events) print "entered the region, disable this one and the other door's triggers" triggerRgn1.disable() triggerRgn2.disable() if (avatarEntering == PtGetLocalAvatar()): print 'stop this avatar' PtDisableMovementKeys() print 'take away first person' cam = ptCamera() cam.disableFirstPersonOverride() cam.undoFirstPerson() PtSendKIMessage(kDisableEntireYeeshaBook, 0) print 'open the door' door1OpenResponder.run(self.key, avatar=avatarEntering) return if (id == door1OpenResponder.id): if (avatarEntering != PtGetLocalAvatar()): return print ' door is open, walk in' avatarEntering.avatar.runBehaviorSetNotify(behaviorWalkIn.value, self.key, behaviorWalkIn.netForce) return
In this clip, the Avatar is going to be stopped, and commands to it disabled. My door responder is going to be told by python to run.
This python file is the "trigger" for that door responder. If it does NOT tell the Python file that it's done, you will end up with nothing else happening (I know, I went down this road, wondering why after the door opened nothing else was happening!).
All you need to do is add this to the end of your responders that are being controlled by Python:
You may want to make sure you tell it to wait until the previous command is finished too.
This is the responder saying "Hey Python File! I'm done! You can go do your next thing!"
Return To: 3DS Max Plugin Tutorials